Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
A Tutorial
Modelling Operational Amplifiers
Mike Brinson
Copyright
c 2006, 2007 Mike Brinson <mbrin72043@yahoo.co.uk>
Permission is granted to copy, distribute and/or modify this document under the terms of
the GNU Free Documentation License, Version 1.1 or any later version published by the
Free Software Foundation. A copy of the license is included in the section entitled ”GNU
Free Documentation License”.
Introduction
Operation amplifiers (OP AMP) are a fundamental building block of linear electronics.
They have been widely employed in linear circuit design since they were first introduced
over thirty years ago. The use of operational amplifier models for circuit simulation using
SPICE and other popular circuit simulators is widespread, and many manufacturers provide
models for their devices. In most cases, these models do not attempt to simulate the
internal circuitry at device level, but use macromodelling to represent amplifier behaviour
as observed at the terminals of a device. The purpose of this tutorial note is to explain
how macromodels can be used to simulate a range of the operational amplifier properties
and to show how macromodel parameters can be obtained from manufacturers data sheets.
This tutorial concentrates on models that can be simulated using Qucs release 0.0.9.
1
Equation
R3 Eqn1
R=47 k d1=dB(Vout.v)
OP1 d2=phase(Vout.v)
G=1e6
Vin
Vout
V1
U=1 V R4
R=4.7 k
dc simulation ac simulation
DC1 AC1
Type=log
Start=1 Hz
Stop=100 MHz
Points=801
Figure 1: Qucs schematic for a basic OP AMP inverting amplifier:Qucs OP AMP has
G=1e6 and Umax=15V.
if a model is only required for small signal AC transfer function simulation then including
the output voltage limiting section of an OP AMP model is not necessary or indeed may
be considered inappropriate. In the following sections of this tutorial article macromodels
for a number of the OP AMP parameters listed above are developed and in each case
the necessary techniques are outlined showing how to derive macromodel parameters from
manufacturers data sheets.
2
0
Vout.v
-10
-20
1 10 100 1e3 1e4 1e5 1e6 1e7 1e8
Frequency Hz
40
dB(Vout.v)
20
0
1 10 100 1e3 1e4 1e5 1e6 1e7 1e8
Frequency Hz
400
phase(Vout.v) Degrees
200
0
1 10 100 1e3 1e4 1e5 1e6 1e7 1e8
Frequency Hz
Figure 2: Gain and phase curves for a basic OP AMP inverting amplifier.
3
T6 T7 T14 T15
P_VCC T24
T27
R10
R=50
R5
R=39k T18
T3 T4 VIN_N
R11
C1 R=25
VIN_P T21 VOUT
C=30pF
T26
T2 T5 R9
R=40k
T17 T23
T13
T8 T10 T19
T11 T12
T16
R1
R=3k R8
R6 R7 R=50k T20
R4 R3 R2 R=50k R=50
R=1k R=50k R=1k
P_VEE
4
10
Vout.v
20
dB(Vout.v)
-20
100
0
1 10 100 1e3 1e4 1e5 1e6 1e7
Frequency Hz
Figure 4: Gain and phase curves for a times 10 inverting amplifier with the OP AMP
represented by a transistor level UA741 model.
R2
R=47k Ohm
Vin
Vout
V1 R1 C1
U=1 V R3 R=200k Ohm C=159.15nF
R=4.7k Ohm
SRC1 OP1
G=1 S G=1
T=0
Equation
dc simulation ac simulation
Eqn1
DC1 AC1 d2=phase(Vout.v)
Type=lin d1=dB(Vout.v)
Start=1 Hz
Stop=10 MHz
Points=1800
Figure 5: Modified Qucs OP AMP model to include single pole frequency response.
5
10
Vout.v
20
dB(Vout.v)
-20
150
100
Figure 6: Gain and phase curves for the circuit shown in Fig. 5.
6
Adding features to the Qucs OP AMP model
In the previous section it was shown that the Qucs OP AMP model had a frequency
response that is independent of frequency. By adding external components to the Qucs
OP AMP model the functionality of the model can be improved. The UA741 differential
open loop gain has a pole at roughly 5Hz and a frequency response that decreases at 20 dB
per frequency decade from the first pole frequency up to a second pole frequency at roughly
3 MHz. The circuit shown in Fig. 5 models the differential frequency characteristics of a
UA741 from DC to around 1 MHz. Figure 6 illustrates the closed loop frequency response
for the modified Qucs OP AMP model.
7
device characteristics only those amplifier characteristics which are needed are included
in a given macromodel. This approach leads to a genuinely structured macromodel. The
following sections present the detail and derivation of the electrical networks forming the
blocks drawn in Fig. 7. To illustrate the operation of the modular OP AMP macromodel
the values of the block parameters are calculated for the UA741 OP AMP and used in a
series of example simulations. Towards the end of this tutorial note data are presented for
a number of other popular general purpose operational amplifiers.
1. RD = 2 MΩ and R1 = R2 = 1MΩ
8
In+ In-
Signal
adder
Slew rate
limiting stage
Voltage gain
stage 1
Overdrive limiting
Vcc stage
In+
Out Voltage gain
stage 2
In-
Vee
Output stage
RPD
Vee Vcc
Current limiting
Vcc Vee stage
Voltage limiting
stage
9
The differential output signal (VD) is given by V D− P 1 − V D− N 1 and the common mode
output signal (VCM ) by (V D− P 1 + V D− N 1)/2.
Voff1
U=0.35mV
Input
Ib1 R1 stage
IN_N1 VD_N1
I=80nA R=1M Ohm In- Vd-
Cin1
Ioff1 VCM1
C=1.4 pF
I=10nA Vcm
Ib2 R2
Voff2 In+ Vd+
I=80nA R=1M Ohm
U=0.35mV
SUB1
IN_P1 VD_P1
File=input_stage.sch
10
Voltage gain stage 1.
The circuit for voltage gain stage 1 is shown in Fig. 9, where
1. RD1 = 100 MΩ = A dummy input resistor - added to ensure nodes IN− P 1 and
IN− N 1 are connected by a DC path.
2. GMP1 = 1 S = Unity gain voltage controlled current generator.
3. RADO = The DC open loop differential gain ( AOL(DC) ) of the OP AMP.
4. CP1 = 1/(2*π*GBP), where GBP = the OP AMP gain bandwidth product.
Typical values for the UA741 OP AMP are:
1. RADO = 200kΩ. (AOL(DC) = 106 dB)
2. CP1 = 159.15 nF (The typical value for UA741 GBP is 1 MHz).
POLE1
IN+
RD1 RADC1 CP1 OUT
IN_P1
R=100M R=200k Ohm C=159.15 nF
POLE_1_OUT1 IN-
GMP1
IN_N1 SUB1
G=1 S
T=0 File=pole1.sch
11
Aol
Aol(DC)
fp1 GBP f Hz
Figure 10: OP AMP open loop differential voltage gain as a function of frequency.
12
OUTSTG_OUT1
Output
stage
RD1 In+
IN_P1 ROS1
R=100M
R=75 Ohm Out
EOS1 In-
IN_N1
G=1
T=0
SUB1
File=out_stage.sch
Output stage.
The electrical network representing a basic output stage is given in Fig. 11, where
1. RD1 = 100 MΩ = A dummy input resistor - added to ensure nodes IN− P 1 and
IN− N 1 are connected by a DC path.
A typical value for the UA741 OP AMP output resistance is ROS1 = 75Ω.
13
SUB2
File=input_stage.sch
14
dc simulation ac simulation Equation
Eqn1
DC1 AC1 yp=phase(vout.v)
Type=lin yp3=phase(vout3.v)
number vout.V vout3.V Start=1 Hz ydb=dB(vout.v)
1 0.0068 0.0069 Stop=10 MHz ydb3=dB(vout3.v)
Points=1801
R1
R=10k Ohm
vin
In-
V1 R2 vout
U=1 V R=1k Ohm OP AMP
IP1O
SUB5
In+
R3
R=10k Ohm
SUB6
- V2
R8 vout3 U=15 V
VEE
R=1k Ohm
UA741_tran
VCC
+ V3
U=15 V
Figure 13: Test circuit for an inverting amplifier. Output signals: (1) vout for AC macro-
model, (2) vout3 for UA741 transistor model.
15
200
20
phase(vout.v) in degrees
dB(vout.v)
150
0
100
-20
1 10 100 1e3 1e4 1e5 1e6 1e7 1 10 100 1e3 1e4 1e5 1e6 1e7
Frequency Hz Frequency Hz
200
20
phase(vout3.v) in degrees
db(vout3.v)
0
100
-20
0
1 10 100 1e3 1e4 1e5 1e6 1e7 1 10 100 1e3 1e4 1e5 1e6 1e7
Frequency Hz Frequency Hz
Figure 14: Simulation test results for the circuit shown in Fig. 13.
16
A more accurate OP AMP AC macromodel
Most general purpose OP AMPs have a high frequency pole in their differential open loop
gain characteristics. By adding a second gain stage to the simple AC macromodel the
discrepancy in the high frequency response can be corrected. The model for the second
gain stage is shown in Fig. 15. This additional gain stage has a structure similar to the
first gain stage, where
1. RD2 = 100 MΩ = A dummy input resistor - added to ensure nodes IN_P2 and IN_N2
are connected by a DC path.
3. RP2 = 1Ω.
A typical value for the UA741 OP AMP high frequency pole is fp2 = 3M Hz
V (IN− P 2) − V (IN− N 2)
vout(P OLE− 2− OU T 1) = (5)
1 + j(ω ∗ CP 2)
and
1
CP 2 = (6)
2π ∗ f p2
POLE2
IN+
RD2 RP2 CP2
IN_P2 OUT
R=100M R=1 Ohm C=53.05nF
POLE_2_OUT1 IN-
GMP2
IN_N2 SUB1
G=1 S
T=0 File=pole2.sch
17
ac simulation
AC1
R1 Type=log
R=10M Ohm Start=1 Hz
Stop=100MHz
In- Points=241
C1 vout
C=100mF OP AMP Equation
IP1P2O Eqn1
vin
In+
y4=rad2deg(unwrap(angle(vout3.v)))
y=dB(vout.v)
V1 y3=dB(vout3.v)
U=1 V SUB1
File=op_amp_ac_IP1P2O.sch y2=phase(vout.v)
dc simulation
R2
R=10M Ohm DC1
SUB2
V2
U=15 V
C2
-
vout3
C=100 mF VEE
UA741_tran
VCC
V3
+ U=15 V
Figure 16: Test circuit for simulating OP AMP open loop differential gain.
Aol(f )
vout(f ) = vin(f ) (7)
Aol(f )
1+
1 + jω ∗ R ∗ C
vout(f )
where vout(f ) = (V + − V − ) ∗ Aol(f ), V + = vin(f ), and V − =
1 + jω ∗ R ∗ C
Aol(f )
Provided << 1, equation (7) becomes vout(f ) ⇒ Aol(f ) ∗ vin(f ). Hence, for
ω∗R∗C
those frequencies where this condition applies vout(f ) = Aol(f ) when vin(f ) = 1 V. Figure
17 shows plots of the open loop simulation data. Clearly with the test circuit time constant
set at 1e6 seconds the data is accurate for frequencies down to 1 Hz.
18
1e5
1e5
1e4 1e4
1e3
1e3
100
vout3.v
vout.v
10 100
1
10
0.1
0.01 1
1e-3 0.1
1e-4 0.03
1 10 100 1e3 1e4 1e5 1e6 1e7 1e8 1 10 100 1e3 1e4 1e5 1e6 1e7 1e8
Frequency Hz Frequency Hz
100 100
dB(vout3.v)
dB(vout.v)
0
0
-100
1 10 100 1e3 1e4 1e5 1e6 1e7 1e8 1 10 100 1e3 1e4 1e5 1e6 1e7 1e8
Frequency Hz Frequency Hz
0
phase(vout3.v) degrees
phase(vout.v) degrees
-100
-200
-200
1 10 100 1e3 1e4 1e5 1e6 1e7 1e8 1 10 100 1e3 1e4 1e5 1e6 1e7 1e8
Frequency Hz Frequency Hz
Figure 17: Simulation test results for the circuit shown in Fig. 16.
19
Adding common mode effects to the OP AMP AC
macromodel
The open-loop differential gain AD (f ) for most general purpose operational amplifiers can
be approximated by
1
AD (f ) = AD(0) (8)
f
1+j
fP D
Similarly, the common-mode gain ACM (f ) can be represented by the same single-pole
response and a single zero response given by
f
1+j
fCM Z
ACM (f ) = ACM (0) (9)
f
1+j
fP D
AD (f )
CM RR(f ) = (10)
ACM (f )
gives
1
CM RR(f ) = CM RR(0) (11)
f
1+j
fCM Z
where
AD (0)
CM RR(0) = (12)
ACM (0)
Common-mode effects can be added to OP AMP macromodels by including a stage in the
modular macromodel that introduces a zero in the amplifier frequency response. Output
VCM from the macromodel input stage senses an amplifier common mode signal. This
signal, when passed through a CR network generates the required common mode zero.
Figure 18 gives the model of the zero generating network, where.
2. RCM1 = 1 MΩ
RCM 1
3. ECM1 G = 31.623 = RCM 2 . (NOTE: RCM1/RCM2 is a scaling factor.)
CM RR(0)
1
4. CCM1 = 795.8 pF = .
2π ∗ RCM 1 ∗ fCM Z
20
RCM1 CMV_OUT1
R=1M
RDCMZ RCM2
IN_P1 CMZERO
R=650M R=1
IN+
CCM1 OUT
ECM1
IN_N1 C=795.8 pF
G=31.623
T=0 IN-
SUB1
File=cmzero.sch
5. RCM2 = 1 Ω
2. CMRR(0) = 90 dB
The AC voltage transfer function for the common-mode zero transfer function is
RCM 2 1 + jω ∗ RCM 1 ∗ CCM 1
V out(CMV_OUT1) = G(ECM 1) [V (IN_P1) − V (IN_N1)]
RCM 1 1 + jω ∗ RCM 2 ∗ CCM 1
(13)
RCM 2
As << 1, the pole introduced by the common-mode RC network is at a very high
RCM 1
frequency and can be neglected. Combining the common-mode zero with the previously
defined stage models yields the macromodel shown in Fig. 19. In this model the differential
and common-mode signals are combined using a simple analogue adder based on voltage
conrolled current generators.
21
SUB6
VSUM
In+ Vd+ IN1+
IN_N1
IN1- POLE1
Vcm OUT IN+ POLE2
IN2+
OUT IN+ Output
In- Vd- stage
Input IN2- IN- OUT In+
IN_P1 OUT1
stage
SUB5 IN- Out
SUB4
CMZERO
IN+ SUB3 In-
OUT
In- SUB2
IN- OP_AMP
ICMZP1P2O
SUB1
File=cmzero.sch In+
SUB7
File=op_amp_ac_ICMZP1P2O.sch
WHERE IN1_P1
RSUM1
R=1
SUM_OUT1
VSUM
IN1+
GMSUM1
IN1_N1
IN1- G=1 S
T=0
OUT
IN2+
IN2- IN2_P1
SUB8
File=VSUM.sch GMSUM2
IN2_N1
G=1 S
T=0
22
R1
R=10k
dc simulation
vin In-
DC1
R2 vout
OP_AMP
V1 R=10k ICMZP1P2O
ac simulation U=1 V
In+
AC1 R3
Type=log R=10k SUB1
Start=1 Hz
Stop=10 kHz R4File=op_amp_ac_ICMZP1P2O.sch
Points=401 R=10k
R6
R=10k
SUB2
File=ua742_tran.sch
- V2
vout3 U=15 V
R5 VEE
R=10k UA741_tran
VCC
V3
+ U=15 V
R7
R=10k R8
R=10k
the macromodel and the UA741 transistor model are very similar. In the case of the
macromodel typical device parameters were used to calculate the macromodel component
values. However, in the transistor level model the exact values of the component parameters
are unknown.6
6
The UA741 transistor level model is based on an estimate of the process parameters that determine
the UA741 transistor characteristics. Hence, the device level model is unlikely to be absolutely identical
to the model derived from typical parameters values found on OP AMP data sheets. From the simulation
results the CMRR(0) values are approximately (1) macromodel 90 dB, (2) UA741 transistor model 101
dB. Similarly, the common-mode zero frequencies are approximately (1) macromodel 200 Hz, (2) UA741
transistor model 500 Hz.
23
1e-3
vout.v
1e-4
3e-5
1 10 100 1e3 1e4
Frequency Hz
1e-4
vout3.v
1e-5
3e-6
1 10 100 1e3 1e4
Frequency Hz
Figure 21: Simulation test results for the circuit shown in Fig. 20.
24
Large signal transient domain OP AMP macromodels
The modular macromodel introduced in the previous sections concentrated on modelling
OP AMP performance in the small signal AC domain. Large signal models need to take
into account the passage of signals through an OP AMP in the time domain and limit the
excursion of voltage and current swings to the practical values found in actual amplifiers.
Starting with the AC domain macromodel introduced in the previous sections, adding a
slew rate limiting stage and a overdrive stage will more correctly model OP AMP high
speed large signal limitations. Furthermore, by adding output voltage and current limiting
stages the OP AMP macromodel will correctly model large signal effects when signal levels
approach circuit power supply voltages or the OP AMP output current limits.
V (P OLE− 1− OU T 1) dV (P OLE− 1− OU T 1)
GM P 1 (V (IN− P 1) − V (IN− N 1)) = +CP 1∗
RADO dt
(14)
Hence, provided RADO is large7
dV (P OLE− 1− OU T 1)
GM P 1 (V (IN− P 1) − V (IN− N 1)) ' CP 1 ∗ (15)
dt
1
But CP 1 =
2π ∗ GBP
Yielding
1 dV (P OLE− 1− OU T 1)
GM P 1 (V (IN− P 1) − V (IN− N 1)) ' ∗ (16)
2π ∗ GBP dt
dV (P OLE− 1− OU T 1)
Moreover, if is set equal to the OP-AMP slew rate then the current
dt
charging CP1 will be limited to the maximum allowed. In Fig. 9 GM P 1 is 1 S.
1 dV (P OLE− 1− OU T 1)
must be set to ∗ .
2π ∗ GBP dt
This is done by the network SLEWRT shown in Fig. 22, where
7
This condition is normally true because RADO is set to the DC open loop differential gain in macro-
module POLE1.
25
D1 GMSRT1
G=0.01 S
T=0 SLEWRT
IN+
RSCALE1 VSR1 RSRT1
IN_P1 SLEWRT_OUT1
R=100 Ohm U=7.26 V R=1 OUT
IN-
SRC1
IN_N1
G=1 S SUB1
T=0 File=slewrt.sch
The circuit in Fig. 23 demonstrates the effect of slew rate limiting on OP AMP transient
performance. Three identical OP AMP inverter circuits are driven from a common input
10 kHz AC signal source. Voltage controlled voltage sources are used to amplify the input
signal to the second and third circuits. The three input signals are (1) 5 V peak, (2) 10 V
peak and (3) 15 V peak respectively. The input and output waveforms for this circuit are
illustrated in Fig. 24. The effect of slew rate limiting on large signal transient performance
is clearly demonstrated by these curves. In the case of the 15 V peak input signal the
output signal (vout3.Vt) has a slope that is roughly 0.5 V per µS.
26
transient
simulation
In- TR1
OP_AMP vout1 Type=lin
ICMZ Start=0
vin SLEWRT Stop=200us
P1P2O
In+
V1
U=5 V
SUB1
File=op_amp_ac_ICMZP1P2O.sch
In-
OP_AMP vout2
ICMZ
SLEWRT
P1P2O
In+
SUB2
File=op_amp_ac_ICMZP1P2O.sch
SRC1
G=2
T=0
In-
OP_AMP vout3
ICMZ
SLEWRT
P1P2O
In+
SUB3
File=op_amp_ac_ICMZP1P2O.sch
SRC2
G=3
T=0
27
5
vin.Vt
-5
0 2e-5 4e-5 6e-5 8e-5 1e-4 1.2e-4 1.4e-4 1.6e-4 1.8e-4 2e-4
time
5
vout1.Vt
-5
0 2e-5 4e-5 6e-5 8e-5 1e-4 1.2e-4 1.4e-4 1.6e-4 1.8e-4 2e-4
time
10
vout2.Vt
-10
0 2e-5 4e-5 6e-5 8e-5 1e-4 1.2e-4 1.4e-4 1.6e-4 1.8e-4 2e-4
time
20
10
vout3.Vt
-10
0 2e-5 4e-5 6e-5 8e-5 1e-4 1.2e-4 1.4e-4 1.6e-4 1.8e-4 2e-4
time
Figure 24: OP AMP slew rate simulation waveforms for the circuit shown in Fig. 23.
28
P_VCC1
P_VCC2
VOVDRV1
U=2.5 V VLIM1
U=2 V
DOVRV1
Is=8e-16 A VCC
DVL1
OVDRV SUB1 Is=8e-16 A
File=OVDRV.sch VCC
IN SUB2
IN VLIMIT File=vlimit.sch
DVL2
P_IN1 DOVDRV1 VEE P_IN2
Is=8e-16 A
Is=8e-16 A VEE
VOVDRV2 VLIM2
U=2.5 V U=2 V
P_VEE2
P_VEE1
The effect of overdrive signals can be modelled by a voltage clamping circuit which takes
account of OP AMP recovery time from voltage overdrive. This extra element clamps the
output of the POLE1 module at a level above the OP AMP DC supply voltages. The
overall effect of the overdrive circuit is to delay the restoration of linear circuit behaviour
when an overload signal is removed. In contrast to the overdrive module the output voltage
limiting module clamps the output voltage to a voltage close to the power rail voltages,
clipping any output voltage excursions above the power rail voltage levels. Figure 25
illustrates the macromodels for the overdrive and output voltage limiting models, where
29
4. VLIM2 = 2.0 V = (- supply voltage) - (Maximum negative output voltage) + 1 V.
5. The diode parameters are Is = 8e-16 A, others default.
Typical values for the UA741 OP AMP are:
1. Amplifier recovery time 5 µS.
2. + supply voltage = 15 V.
3. - supply voltage = -15 V.
4. Maximum positive output voltage = 14 V.
5. Maximum negative output voltage = -14 V.
The test circuit given in Fig. 26 illustrates the effects of signal overdrive and output voltage
clamping on a unity gain buffer circuit. The test input signal is a 1 kHz signal with the
following drive voltages (1) vin1 = 10 V peak, (2) vin2 = 18 V peak, and (3) vin3 = 22
V peak. The corresponding output waveforms are shown in Fig. 27. These indicate that
increasing overdrive signals results in longer OP AMP recovery times before the amplifier
returns to linear behaviour.
Figures 29 and 30 show a simple current limiter test circuit and the resulting test waveforms.
In this test circuit time controlled switches decrease the load resistors at 1 mS intervals.
When the load current reaches roughly 34 mA the output voltage is clamped preventing
further increases in load current.
30
V2
U=15 V
In-
VCC
OP_AMP vout1
ICMZ
vin1 SLEWRT OVDRV
P1P2O
V1 In+ VEE
U=10 V
SUB1 V3
U=15 V
transient
simulation
TR1
Type=lin
Start=0
Stop=1.20 ms
In-
VCC
vout2 dc simulation
OP_AMP
vin2 ICMZ
DC1
SLEWRT OVDRV
P1P2O
In+ VEE
SUB2
SRC1
G=1.8
T=0
In-
VCC
OP_AMP vout3
vin3 ICMZ
SLEWRT OVDRV
P1P2O
In+ VEE
SUB3
SRC2
G=2.2
T=0
Figure 26: OP AMP overdrive and output voltage limiting test circuit.
31
10
vout1.Vt
vin1.Vt
-10
0 1e-4 2e-4 3e-4 4e-4 5e-4 6e-4 7e-4 8e-4 9e-4 1e-3 0.0011 0.0012
Time
20
vout2.Vt
vin2.Vt
-20
0 1e-4 2e-4 3e-4 4e-4 5e-4 6e-4 7e-4 8e-4 9e-4 1e-3 0.0011 0.0012
Time
20
vout3.Vt
vin3.Vt
-20
0 1e-4 2e-4 3e-4 4e-4 5e-4 6e-4 7e-4 8e-4 9e-4 1e-3 0.0011 0.0012
Time
Figure 27: OP AMP overdrive and output voltage limiting waveforms for the circuit shown
in Fig. 26.
D2 D1
Is=1e-15 A Is=1e-15 A
P_OUT1 CLIMIT
IN OUT
P_IN1
RDCL1 HCL1
R=100M G=36 SUB1
T=0 File=CLIMIT.sch
ECL1
G=1
T=0
32
V2
U=15 V
In-
VCC
OP_AMP vout
ICMZ
vin SLEWRT OVDRV
P1P2O CLIMIT
In+ VEE
V1 SUB1
U=10 V
S1 S2 S3 S4 S5
V3
U=15 V
R1 R2 R3 R4 R5 R6
R=1k R=1k R=2k R=2k R=2k R=2k
dc simulation transient
simulation
DC1
TR1
Type=lin
Start=0
Stop=8 ms
10
vin.Vt
-10
0 5e-4 1e-3 0.0015 0.002 0.0025 0.003 0.0035 0.004 0.0045 0.005 0.0055 0.006 0.0065 0.007 0.0075 0.008
Time
10
vout.Vt
-10
0 5e-4 1e-3 0.0015 0.002 0.0025 0.003 0.0035 0.004 0.0045 0.005 0.0055 0.006 0.0065 0.007 0.0075 0.008
Time
Figure 30: Simulation waveforms for current limiter test circuit shown in Fig. 29.
33
Parameter UA741 OP27 OP42 OPA134 AD746 AD826
Offset voltage (V) 7e-4 30e-6 4e-4 5e-4 3e-4 5e-4
Bias current (A) 80e-9 15e-9 130e-12 5e-12 110e-12 3-3e-6
Offset current (A) 20e-9 12e-9 6e-12 2e-12 45e-12 25e-9
Differential input res. (ohm) 2e6 4e6 1e12 1e13 2e11 300e3
Differential input cap. (F) 1.4e-12 6e-12 2e-12 5.5e-12 1.5e-12
Avd(0) dB 106 125 120 120 109 75
fp1 (Hz) 5 6 20 5 0.25 10e3
fp2 (Hz) 3e6 17e6 20e6 10e6 35e6 100e6
CMRR(0) dB 90 125 96 100 85 100
fcm (Hz) 200 2e3 100e3 500 3e3 2e3
GBP (Hz) 1e6 8e6 10e6 8e6 13e6 35e6
Rout (ohm) 75 70 50 10 10 8
Slew rate (V per micro sec.) 0.5 2.8 50 20 75 300
Overdrive recovery time (S) 5e-6 700e-9 0.5e-6
DC supply current (A) 1.4e-3 2.5e-3 5.1e-3 4e-3 7e-3 6.6e-3
Short circuit output current(A) 34e-3 32e-3 30e-3 40e-3 25e-3 90e-3
Common-mode input res. (ohm) 1.3e8 2e9 1e13 2.5e11
Common-mode input cap. (F) 5e-12 5.5e-12
Table 1: Typical OP AMP parameters taken from device data sheets.
34
Example 1: State variable filter design and simulation
The circuit given in Fig. 31 is a state variable filter which simultaneously generates band-
pass, high-pass and low-pass responses. The circuit consists of an OP AMP adder and two
integrator circuits and requires three OP AMPS, two capacitors and a number of resistors.
The selection of the type of OP AMP for successful operation of this filter is critical because
devices with high offset voltage will cause the integrators to saturate and the circuit will
not function correctly. For operation below 20 kHz the OP27 is a good choice of OP
AMP because of it’s low offset voltage in the µV region. In this simulation both the DC
characteristics and small signal AC transfer characteristics are needed to check the filter
design, hence the AC macromodel with the DC parameters embedded in the input stage
should allow accurate modelling of the filter performance.9 The insert in Fig. 31 list the
DC output voltages for each of the OP AMP stages indicating that the integrators are not
saturated. The design of the state variable filter uses the following equations:
When R1 = R6 = R7
3R4
vhp = −vin − vlp + vbp (18)
R4 + R5
2. Also
1
vbp = − vhp (19)
j ff0
where
1 1
f0 = = (20)
2πR2 C1 2πR3 C2
3. Similarly
1 1
vlp = − vbp = − vhp (21)
j ff0 ( ff0 )2
4. Hence
vhp ( ff0 )2
= (22)
vin 1 − ( ff0 )2 + ( Qj )( ff0 )
Where
1 R5
Q = (1 + ) (23)
3 R4
9
The magnitude of the output signals from the filter should also be checked to ensure that these signals
do not exceed the power supply voltages.
35
R7 number V1.I vbp.V vhp.V vlp.V
R=47k
1 8.56 e-11 -0.00149 -0.00149 0.000514
vin
R6 R1 R2 C1 R3 C2
R=47k R=47k R=72.33k C=2.2n R=72.33k C=2.2n
V1
U=0.1
In-
In- In- OP27 vlp
OP27 vhp OP27 vbp ICMZ
ICMZ ICMZ P1P2O
P1P2O P1P2O
In+
In+ In+
SUB3
SUB1 SUB2
R4 R5
R=1k R=294 k
5. Also
f
vbp j f0
= (24)
vin 1 − ( ff0 )2 + ( Qj )( ff0 )
6. Also
vlp −1
= (25)
vin 1 − ( f0 )2 + ( Qj )( ff0 )
f
Assuming f0 = 1 kHz and the required bandwidth of the band pass filter is 10 Hz, on setting
R1 = R6 = R7 = 47kΩ and C1 = C2 = 2.2nF , calculation yields R2 = R3 = 72.33kΩ10 In
this design Q = 1k/10 = 100. Hence setting R4 = 1kΩ yields R5 = 294kΩ (1 % tolerance).
The simulation waveforms for the band pass output are given in Fig. 32 11 . When the
circuit Q factor is reduced to lower values the other filter outputs act as traditional high
and low pass filters. The simulation results for Q factor one are shown in Fig. 33.
10
The values of R2 and R3 need to be trimmed if the filter center frequency and bandwidth are required
to high accuracy.
11
Note that the input signal vin has been set at 0.1 V peak. The circuit has a Q factor of 100 which
means that the band pass output voltage is 10 V peak. Input signals of amplitude much greater than 0.1
V are likely to drive the output signal into saturation when the power supply voltages are ±15V .
36
40
20
Av_BP in dB
-20
100
50
AV_phase in degrees
-50
-100
200 400 600 800 1e3 1.2e3 1.4e3 1.6e3 1.8e3
Frequency Hz
Figure 32: Simulation waveforms for current state variable filter circuit shown in Fig. 31.
37
0.1
vhp.v
0.05
0.1
vlp.v
0.05
Figure 33: State variable low pass and high pass response for Q = 1, R5 = 2kΩ.
38
Moreover, at f = f0 ,
R3
1 + R4
bAv = (29)
3
Setting R3/R4 slightly greater than two causes oscillations to start and increase in
amplitude during each oscillatory cycle. Furthermore, if R3/R4 is less than two
oscillations will never start or decrease to zero.
Figure 35 shows a set of Wien bridge oscillator waveforms. In this example the OP AMP is
modelled using the OP27 AC macromodel. This has been done deliberately to demonstrate
what happens with a poor choice of OP AMP model. The oscillator frequency is 10 kHz
with both feedback capacitors and resistors having equal values. Notice that the oscillatory
output voltage continues to grow with increasing time until it’s value far exceeds the
limit set by a practical OP AMP power supply voltages. The lower of the two curves in
Fig. 35 illustrates the frequency spectrum of the oscillator output signal. The data for
this curve has been generated using the Time2Freq function. Adding slew rate and voltage
limiting to the OP27 macromodel will limit the oscillator output voltage excursions to the
OP AMP power supply values. The waveforms for this simulation are shown in Fig. 36.
When analysing transient response data using function Time2Freq it is advisable to restrict
the analysis to regions of the response where the output waveform has reached a steady
state otherwise the frequency spectrum will include effects due to growing, or decreasing,
transients. The voltage limiting network clips the oscillator output voltage restricting its
excursions to below the OP AMP power supply voltages. The clipping is very visible in
Fig. 36. Notice also that the output waveform is distorted and is no longer a pure sinusoidal
waveform of 10 kHz frequency. Odd harmonics are clearly visible and the fundamental
frequency has also decreased due to the signal saturation distortion. In a practical Wien
bridge oscillator the output waveform should be a pure sinusoid with zero or little harmonic
distortion. One way to achieve this is to change the amplitude of the OP AMP gain with
changing signal level: as the output signal increases so Av is decreased or as the output
signal level decreases Av is increased. At all times the circuit parameters are changed
to achieve the condition bAv = 1. The circuit shown in Fig. 37 uses two diodes and a
resistor to automatically change the OP AMP closed loop gain with changing signal level.
Fig. 38 shows the corresponding waveforms for the Wien bridge circuit with automatic
gain control. Changing the value of resistor R5 causes the amplitude of the oscillator
output voltage to stabilise at a different value; decreasing R5 also decreases vout. The
automatic gain control version of the Wien bridge oscillator also reduces the amount of
harmonic distortion generated by the oscillator. This can be clearly observed in Fig. 38.
Changing the oscillator frequency can be accomplished by either changing the capacitor
or resistor values in the feedback network b. To demonstrate how this can be done using
Qucs, consider the circuit shown in Fig. 39. In this circuit time controlled switches change
the value of both capacitors as the simulation progresses. The recorded output waveform
for this circuit is shown in Fig. 40.
39
C2 R2
C=1 nF R=15.8k C1 R1
C=1nF R=15.8k
SUB2
File=OP27_ICMZP1P2O.sch
In+
vout
OP27
dc simulation ICMZ
P1P2O
DC1 In-
transient
simulation
R4 R3
TR1 R=10k R=21k
Type=lin
Start=0
Stop=10 ms
Equation
Eqn1
y=1
fscan=Time2Freq(vout.Vt,time[700:1000])
1e11
vout.Vt
-1e11
0 1e-3 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
time
Frequency Spectrum
1e9
0
0 5e3 1e4 1.5e4 2e4 2.5e4 3e4 3.5e4 4e4 4.5e4 5e4
Frequency Hz
Figure 35: Simulation waveforms for the circuit shown in Fig. 34: OP27 AC macromodel.
40
10
vout.Vt
-10
0 1e-3 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
time
6
Freq-Specrum
0 3e3 6e3 9e3 1.2e4 1.5e4 1.8e4 2.1e4 2.4e4 2.7e4 3e4 3.3e4 3.6e4 3.9e4 4.2e4 4.5e4 4.8e4
Frequency
Figure 36: Simulation waveforms for the circuit shown in Fig. 34: OP27 AC + slew rate
+ vlimit macromodel.
C2 R2
C=1 nF R=15.8k C1 R1
C=1nF R=15.8k
SUB1
V1
In+ VEE
U=15 V
OP27 vout
ICMZ SLWRT
dc simulation P1P2 VLIM V2
O U=15 V
In- VCC
DC1
transient
simulation
R4 R3
TR1 R=10k R=21k
Type=lin
Start=0
Stop=10 ms
IntegrationMethod=Trapezoidal
R5 D1
R=50k
Equation
Eqn1 D2
fscan=Time2Freq(vout.Vt,time[700:1000])
41
1
vout.Vt
-1
0 1e-3 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
time
0.4
Freq-Spectrum
0.2
0 3e3 6e3 9e3 1.2e4 1.5e4 1.8e4 2.1e4 2.4e4 2.7e4 3e4 3.3e4 3.6e4 3.9e4 4.2e4 4.5e4 4.8e4
Frequency Hz
Figure 38: Simulation waveforms for the circuit shown in Fig. 37: OP27 AC + slew rate
+ vlimit macromodel.
42
dc simulation S6
C8
C=0.0625nF
DC1
C7 S5
transient C=0.125nF
simulation
C6 S4
TR1
Type=lin C=0.25nF
Start=0 R1
Stop=10 ms R=15.8k
IntegrationMethod=Trapezoidal C1
C=0.5nF
SUB1
S3 S1 S2
time=8 ms time=7 ms time=6 ms V1
In+ VEE
U=15 V
OP27 vout
C5 C3 C4 C2 R2 ICMZ SLWRT
C=0.0625nF C=0.125nF C=0.25nF C=0.5 nF R=15.8k P1P2 VLIM V2
O U=15 V
In- VCC
R4 R3
R=10k R=21k
R5 D1
R=50k
D2
Figure 39: Wien bridge oscillator with switched capacitor frequency control.
43
1
vout.Vt
-1
0 1e-3 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
time
1
vout.Vt
-1
0.005 0.0051 0.0052 0.0053 0.0054 0.0055 0.0056 0.0057 0.0058 0.0059
time
1
vout.Vt
-1
0.006 0.0061 0.0062 0.0063 0.0064 0.0065 0.0066 0.0067 0.0068 0.0069
time
1
vout.Vt
-1
0.007 0.0071 0.0072 0.0073 0.0074 0.0075 0.0076 0.0077 0.0078 0.0079
time
1
vout.Vt
-1
0.008 0.0081 0.0082 0.0083 0.0084 0.0085 0.0086 0.0087 0.0088 0.0089
time
Figure 40: Simulation waveforms for the circuit shown in Fig. 39: OP27 AC + slew rate
+ vlimit macromodel.
44
Update number one: March 2007
In this first update to the operational amplifier tutorial readers will be introduced to Qucs
macromodel model building using schematics and SPICE to Qucs conversion techniques,
secondly to procedures for constructing Qucs operational amplifier libraries, and finally to
two different approaches which allow existing OP AMP models to be extended to include
new amplifier performance parameters, for example power supply rejection. This update is
very much a report on the OP AMP modelling work that has been done by the Qucs devel-
opment team since version 0.0.10 of the package was released in September 2006. Future
Qucs releases will offer many significant improvements in OP AMP modelling particularly
via SPICE to Qucs netlist conversion, subcircuit passing and equation embedding in Qucs
schematics and library development. Following the release of Qucs 0.0.11, and a suitable
period of time for new feature debugging, many of the ideas introduced in this update
will be developed to include OP AMP model building using embedded equations in Qucs
schematics.
45
Voff1
U=0.35m V
Ib1 R1 RSUM1
P_INN I=80nA R=1M R=1
Ioff1
I=10nA Cin1
C=1.4 pF SRC1
G=1 S
Ib2
I=80nA R2
Voff2 R=1M
U=0.35m V
P_INP
RCM1 SRC2
RDCMZ R=1M RCM2 G=1 S
R=650M R=1
CCM1
ECM1 C=795.8 pF
G=31.623
GMSRT1
G=0.01 S
SRC3 GMP1
G=1 S D1 G=1 S
Is=1e-12 A
Bv=14.5
Ibv=20 mA
RP2 CP2
R=1 C=53.05nF ROS1
R=75
P_VCC
D2 D3 DVL1
Is=1e-15 A Is=1e-15 A Is=8e-16 A
HCL1 P_OUT
G=35 DVLM2
RDCCL1 Is=8e-16 A
R=100M
ECL
G=1 VLIM2
U=2 V
P_VEE
Figure 41: Modular OP AMP macromodel in schematic form - this model does not include
signal overloading.
46
With this approach users are only required to enter the device data; as a simple list derived
from manufacturers data sheets. One way to do this is to write a SPICE preprocessor
template14 and let a SPICE preprocessor generate the model for a specific OP AMP. The
PS2SP template file for an OP27 OP AMP modular macromodel is given in Fig. 42. The
resulting SPICE file is shown in Fig. 43. After construction of the SPICE OP27 netlist the
Qucs OP27 model is generated via the schematic capture SPICE netlist facility.15
47
B1 + 1 B2 + 1
6. IEE = + IC1
B1 B2
1
7. RC1 =
2πGBP C2
8. RC2 = RC1
B1 + B2 1 IC1
9. RE1 = RC1 − , where gm1 = , and RE2 = RE1
2 + B1 + B2 gm1 Vt
C2 π
10. CEE = · tan 4φ , where 4φ = 90o − Φm and Φm is the phase margin.
2 180
1
11. GCM =
CM M RRC1
1
12. GA =
RC1
AvOLRC1
13. GB =
R2RO2
14. ISD1 = IX · exp (T M P 1)+1e-32, where IX = 2 · IC1 · R2 · GB − IS1 ,
−1
and T M P 1 =
IS1
RO1
Vt
Vt IX
15. RC = ln (T EM P 2), where T EM P 2 =
100 · IX ISD1
ISCP
16. V C = abs (V CC) − V OU TP + V t · ln
IS1
ISCN
17. V E = abs (V EE) + V OU TN + V T · ln
IS1
(V CC − V EE) (V CC − V EE)
18. RP =
PD
Rather than calculate the Boyle macromodel component values by hand using a calculator
it is better to use a PS2SP preprocessor template that does these calculations and also
generates the Boyle SPICE netlist. A template for this task is given in Fig. 45. The
parameters at the beginning of the listing are for the UA741 OP AMP. In Fig. 45 the
macromodel internal nodes are indicated by numbers and external nodes by descriptive
names. This makes it easier to attach the macromodel interface nodes to a Qucs schematic
symbol. The SPICE netlist shown in Fig. 46 was generated by SP2SP.
48
∗ s u b c i r c u i t p o r t s : in+ in− p out p v c c p v e e
. s u b c k t opamp ac in p in n p out p v c c p v e e
∗ OP27 OP AMP p a r a m e t e r s
. param v o f f = 30 . 0u i b = 15n i o f f = 12n
. param rd = 4meg cd = 1 . 4p cmrrdc = 1 . 778 e6
. param fcmz = 2000 . 0 a o l d c = 1 . 778 e6 gbp = 8meg
. param f p 2 = 17meg p s l e w r=2 . 8 e6 n s l e w r=2 . 8 e6
. param vccm=15 vpoutm=14 veem=−15
. param vnoutm=−14 idcoutm=32m r o=70 . 0
. param p1={ ( 1 0 0 ∗ p s l e w r ) / ( 2 ∗ 3 . 1412∗ gbp ) −0 . 7}
. param p2={ ( 1 0 0 ∗ n s l e w r ) / ( 2 ∗ 3 . 1412∗ gbp ) −0 . 7}
∗ input stage
v o f f 1 in n 6 { v o f f /2 }
v o f f 2 7 in p { v o f f /2 }
ib1 0 6 {ib}
ib2 7 0 {ib}
i o f f 1 7 6 { i o f f /2 }
r1 6 8 { rd /2 }
r2 7 8 { rd /2 }
c i n 1 6 7 { cd }
∗ common−mode z e r o s t a g e
ecm1 12 0 8 0 {1 e6 / cmrrdc }
rcm1 12 13 1meg
ccm1 12 13 { 1 / ( 2 ∗ 3 . 1412∗1 e6 ∗ fcmz ) }
rcm2 13 0 1
∗ d i f f e r e n t i a l and common−mode s i g n a l summing s t a g e
gmsum1 0 14 7 6 1
gmsum2 0 14 13 0 1
rsum1 14 0 1
∗ slew rate stage
g s r c 1 0 15 13 0 1
r s c a l e 1 15 0 100
d s l 15 16 { d s l e w r a t e }
. model d s l e w r a t e d ( i s=1 e −12 bv= { p1+p2 } )
v s r 1 16 0 {p1}
gmsrt1 0 17 15 0 0 . 01
r s r t 1 17 0 1
∗ voltage gain stage 1
gmp1 0 9 17 0 1
rado 9 0 { a o l d c }
cp1 9 0 { 1 / ( 2 ∗ 3 . 1412∗ gbp ) }
∗ voltage gain stage 2
gmp2 0 11 9 0 1
rp2 11 0 1
cp2 11 0 { 1 / ( 2 ∗ 3 . 1412∗ f p 2 ) }
∗ ou tp ut s t a g e
e o s 1 10 0 11 0 1
r o s 1 10 50 { r o }
∗ ou tp ut c u r r e n t l i m i t e r s t a g e
r d c l 1 50 0 100meg
d c l 1 21 50 d c l i m
d c l 2 50 21 d c l i m
. model d c l i m d ( i s=1 e −15 c j 0=0 . 0 )
v c l 1 50 p out 0v
h c l 1 0 22 v c l 1 {0 . 9/ idcoutm }
e c l 1 21 22 50 0 1
∗ voltage limiting stage
d v l 1 p out 30 d v l i m i t
. model d v l i m i t d ( i s=8 e −16)
d v l 2 40 p out d v l i m i t
v l i m 1 p v c c 30 { vcc−vccm+1}
v l i m 2 40 p v e e {−v e e +veem+1}
. ends
. end
50
P_VCC
VC
RC1 RC2 RP
D3
C1
D1 D2
C2 RO1 P_OUT
D4
GCM
T1 T2 RO2 GC
R2 RC
P_INN VE
RE1 RE2
GA GB
P_VEE
P_INP
Model accuracy
The modular and Boyle OP AMP macromodels are examples of typical device models
in common use with todays popular circuit simulators. A question which often crops
up is which model is best to use when simulating a particular circuit? This is a complex
question which requires careful consideration. One rule of thumb worth following is always
validate a SPICE/Qucs model before use. Users can then check that a specific model
does simulate the circuit parameters that control the function and accuracy of the circuit
being designed18 . One way to check the performance of a given model is to simulate a
specific device parameter. The simulation results can then be compared to manufacturers
published figures and the accuracy of a model easily determined. By way of an example
consider the simulation circuit shown in Fig. 47. In this circuit the capacitors and inductors
ensure that the devices under test are in ac open loop mode with stable dc conditions.
Figure 48 illustrates the observed simulation gain and phase results for four different OP
AMP models. Except at very high frequencies, which are outside device normal operating
range, good agreement is found between manufacturers data and that recorded by the open
loop voltage gain test for both the modular and Boyle macromodels.
18
An interesting series of articles by Ron Mancini, on verification and use of SPICE models in circuit
design can be found in the following editions of EDN magazine:Validate SPICE models before use, EDN
March 31, 2005 p.22; Understanding SPICE models, EDN April 14, p 32; Verify your ac SPICE model,
EDN May 26, 2005; Beyond the SPICE model’s dc and ac performance, EDN June 23 2005, and Compare
SPICE-model performance, EDN August 18, 2005.
51
∗ Boyle macromodel t e m p l a t e f o r Qucs .
∗ D e s i g n p a r a m e t e r s ( For UA741 )
. param vt=26 e−3 $ Thermal v o l t a g e a t room temp .
. param c2=30 e −12 $ Compensation c a p a c i t a n c e
. param p o s i t i v e s l e w r a t e=0 . 625 e6 n e g a t i v e s l e w r a t e=0 . 50 e6 $ Slew r a t e s
. param i s 1=8 . 0 e −16 $ T1 l e a k a g e c u r r e n t
. param v o s=0 . 7 e−3 i b=80n i o s=20n $ I n p u t v o l t a g e and c u r r e n t p a r a m e t e r s
. param va=200 $ Nominal e a r l y v o l t a g e
. param gbp=1 . 0 e6 $ Gain bandwidth p r o d u c t
. param pm=70 $ E x c e s s phase a t u n i t y g a i n .
. param cmrr=31622 . 8 $ Common−mode r e j e c t i o n r a t i o ( 9 0 dB)
. param a v o l=200 k $ DC open l o o p d i f f e r e n t i a l g a i n
. param r o 2=489 . 2 $ DC ou tp ut r e s i s t a n c e
. param r o 1=76 . 8 $ High f r e q u e n c y AC ou tp ut r e s i s t a n c e
. param r 2=100 k
. param vout p=14 . 2 $ P o s i t i v e s a t u r a t i o n v o l t a g e − f o r VCC=15 v
. param vout n=−13 . 5 $ N e g a t i v e s a t u r a t i o n v o l t a g e − f o r VCC=−15v
. param v c c=15 $ P o s i t i v e power s u p p l y v o l t a g e
. param v e e=−15 $ N e g a t i v e power s u p p l y v o l t a g e
. param i s c p=25m $ S h o r t c i r c u i t ou tp ut c u r r e n t
. param i s c n=25m $ S h o r t c i r c u i t ou tp ut c u r r e n t
. param pd=59 . 4m $ T y p i c a l power d i s s i p a t i o n
∗ Design e q u a t i o n s
. param i s 2={ i s 1 ∗(1+ vo s / vt ) }
. param i c 1={0 . 5∗ c2 ∗ p o s i t i v e s l e w r a t e } i c 2={ i c 1 }
. param i b 1={ ib −0 . 5∗ i o s } i b 2={ i b +0 . 5∗ i o s }
. param b1={ i c 1 / i b 1 } b2={ i c 2 / i b 2 }
. param i e e={ ( ( b1 +1)/ b1+(b2 +1)/ b2 ) ∗ i c 1 }
. param gm1={ i c 1 / vt } r c 1={ 1 / ( 2 ∗ 3 . 1412∗ gbp ∗ c2 ) } r c 2=r c 1
. param r e 1={ ( ( b1+b2 )/(2+ b1+b2 ) ) ∗ ( rc1 −1/gm1 ) } r e 2=r e 1
. param r e e={va / i e e } c e e={ ( 2 ∗ i c 1 / n e g a t i v e s l e w r a t e )−c2 }
. param dphi={90−pm} c1={ ( c2 / 2 ) ∗ tan ( dphi ∗3 . 1 4 1 2 / 1 8 0 ) }
. param gcm={ 1 / ( cmrr ∗ r c 1 ) } ga={ 1/ r c 1 } gb={ ( a v o l ∗ r c 1 ) / ( r 2 ∗ r o 2 ) }
. param i x={ 2∗ i c 1 ∗ r 2 ∗gb−i s 1 } tmp1={−1 . 0 / ( r o 1 ∗ i s 1 / vt ) } i s d 1={ i x ∗ exp ( tmp1)+1e −32}
. param tmp2={ i x / i s d 1 } r c={ vt / ( 1 0 0 ∗ i x ) ∗ l n ( tmp2 ) }
. param gc={ 1/ r c }
. param vc={ abs ( v c c )− vout p+v t ∗ l n ( i s c p/ i s 1 ) } ve={ abs ( v e e )+ vout n+v t ∗ l n ( i s c n/ i s 1 ) }
. param rp={ ( vcc−v e e ) ∗ ( vcc−v e e ) / pd}
∗ Nodes : I n p u t n i n p n i n n n v c c n v e e Output n out
Q1 8 n i n n 10 qmod1
Q2 9 n i n p 11 qmod2
RC1 n v c c 8 { r c 1 }
RC2 n v c c 9 { r c 2 }
RE1 1 10 { r e 1 }
RE2 1 11 { r e 2 }
RE 1 0 { r e e }
CE 1 0 { c e e }
IEE 1 n v e e { i e e }
C1 8 9 { c1 }
RP n v c c n v e e { rp }
GCM 0 12 1 0 {gcm}
GA 12 0 8 9 { ga }
R2 12 0 { r 2 }
C2 12 13 30p
GB 13 0 12 0 {gb}
RO2 13 0 { r o 2 }
RO1 13 n out { r o 1 }
D1 13 14 dmod1
D2 14 13 dmod1
GC 0 14 n out 0 { gc }
RC 14 0 { r c }
D3 n out 15 DMOD3
D4 16 n out DMOD3
VC n v c c 15 { vc }
VE 16 n v e e { ve }
. model dmod1 d ( i s={ i s d 1 } r s=1 )
. model dmod3 d ( i s=8 e −16 r s=1 ) 52
. model qmod1 npn ( i s={ i s 1 } BF={b1} )
. model qmod2 npn ( i s={ i s 2 } BF={b2} )
. end
Figure 45: PS2SP template for the Boyle macromodel with UA741 parameters listed.
∗ b o y l e macromodel t e m p l a t e f o r q u c s .
∗ i n f i l e=ua741 b o y l e . p s 2 s p d a t e=Tue Feb 6 20 : 58 : 12 2007 Converted with p s 2 s p . p l V4 . 11
∗ o p t i o n s : −sp3=0 − l t s p i c e=0 −fromsub=0 −f r o m l i b=0 −c h e c k=0 ( t i n y l i n e s=1 )
∗ c o p y r i g h t 2007 by F r i e d r i c h Schmidt − terms of Gnu L i c e n c e
q1 8 n i n n 10 qmod1
q2 9 n i n p 11 qmod2
r c 1 n v c c 8 5305 . 82792138885
r c 2 n v c c 9 5305 . 82792138885
r e 1 1 10 1820 . 05072213971
r e 2 1 11 1820 . 05072213971
r e 1 0 13192612 . 1372032
c e 1 0 7 . 5 e −12
i e e 1 n v e e 1 . 516 e −05
c1 8 9 5 . 4588124089082 e −12
rp n v c c n v e e 15151 . 5151515152
gcm 0 12 1 0 5 . 96000 35417483 6 e −09
ga 12 0 8 9 0 . 000188472
r 2 12 0 100000
c2 12 13 30p
gb 13 0 12 0 21 . 6918557701915
r o 2 13 0 489 . 2
r o 1 13 n out 76 . 8
d1 13 14 dmod1
d2 14 13 dmod1
gc 0 14 n out 0 1621 . 78603105575
r c 14 0 0 . 0 0 0 6 1 6 6 0 4 1 5 1 7 5 0 5 3 9
d3 n out 15 dmod3
d4 16 n out dmod3
vc n v c c 15 1 . 60789 90527948 9
ve 16 n v e e 2 . 30789 90527948 8
. model dmod1 d ( i s=1 e −32 r s=1 )
. model dmod3 d ( i s=8 e −16 r s=1 )
. model qmod1 npn ( i s=8 e −16 b f=107 . 1 4 2 8 5 7 1 4 2 8 5 7 )
. model qmod2 npn ( i s=8 . 21538 46153846 1 e −16 b f=83 . 3 3 3 3 3 3 3 3 3 3 3 3 3 )
. end
53
vout_mod
L1 RL
R1
L=1000H R=2k
R=0.00001
C1
- VCC
V2
U=15 V
C=1000F UA741
(MOD)
+ VEE
V3
V1 U=15 V
U=1 V
SUB1
vout_boyle Equation
Eqn1
gain_mod_27_dB=dB(vout_mod_27.v)
C2 L2 R2 gain_mod_dB=dB(vout_mod.v)
C=1000F L=1000H R=0.00001 gain_boyle_dB=dB(vout_boyle.v)
gain_boyle_27_dB=dB(vout_boyle_27.v)
phase_boyle_deg=rad2deg(unwrap(angle(vout_boyle.v)))
phase_boyle_27_deg=rad2deg(unwrap(angle(vout_boyle_27.v)))
- VCC
phase_mod_deg=rad2deg(unwrap(angle(vout_mod.v)))
phase_mod_27_deg=rad2deg(unwrap(angle(vout_mod_27.v)))
UA741(Boyle)
VEE
+
SUB2
vout_mod_27
L3 RL1
R3 R=2k
L=1000H R=0.00001
C3
- VCC
dc simulation
C=1000F OP27 DC1
vin (MOD)
VEE ac simulation
+
AC1
SUB5 Type=log
Start=1Hz
Stop=100MHz
Points=200
vout_boyle_27
C4 L4 RL2
R4
C=1000F L=1000H R=2k
R=0.00001
- VCC
OP27
(Boyle)
+ VEE
SUB6
Figure 47: Test circuit for simulating OP AMP model open loop voltage gain.
54
100 0
phase_mod_deg
gain_mod_dB
-50
0
-100
-150
1 10 100 1e3 1e4 1e5 1e6 1e7 1e8 1 10 100 1e3 1e4 1e5 1e6 1e7 1e8
acfrequency acfrequency
0
100
phase_boyle_deg
gain_boyle_dB
0 -100
-100 -200
1 10 100 1e3 1e4 1e5 1e6 1e7 1e8 1 10 100 1e3 1e4 1e5 1e6 1e7 1e8
acfrequency acfrequency
0
100
phase_mod_27_deg
gain_mod_27_dB
-100
-200
1 10 100 1e3 1e4 1e5 1e6 1e7 1e8 1 10 100 1e3 1e4 1e5 1e6 1e7 1e8
acfrequency acfrequency
0
100
phase_boyle_27_deg
gain_boyle_27_dB
-100
-200
1 10 100 1e3 1e4 1e5 1e6 1e7 1e8 1 10 100 1e3 1e4 1e5 1e6 1e7 1e8
acfrequency acfrequency
Figure 48: Open loop voltage gain simulation waveforms for the modular and Boyle UA741
and OP27 macromodels.
55
The PSpice modified Boyle model
One of the most widely used OP AMP simulation models is a modified version of the Boyle
macromodel. This was originally developed for use with the PSpice circuit simulator. Many
semiconductor manufacturers provide models for their devices based on the modified Boyle
macromodel19 . A typical modified Boyle macromodel SPICE netlist is shown in Fig. 49.
The circuit structure and performance are very similar, but significantly different to the
original Boyle model. Some of the common OP AMP parameters NOT modeled are (1)
input offset voltage, (2) temperature coefficient of input offset voltage, (3) input offset
current, (4) equivalent input voltage and noise currents, (5) common-mode input voltage
range, and (6) temperature effect on component stability. Items (2), (4), (5) and (6) are also
not modeled by the standard Boyle macromodel. Although the modified Boyle macromodel
is similar to the original Boyle model it is not possible to use this model as it is defined with
Qucs; due to the fact that SPICE 2G nonlinear controlled sources, egnd and fb, are included
in the SPICE netlist. Controlled source egnd is employed to model the OP AMP reference
voltage as the average of the VCC and VEE power rail voltages rather than the ground
voltage assumed in the original Boyle macromodel20 . Current conrolled current source fb
is used to model OP AMP output current limiting. The nonlinear polynomial21 form of
controlled sources were included in the 2G series of SPICE simulators to allow behavioural
models of summers, multipliers, buffers and other important functional components to be
easily constructed. Single and multidimensional polynomial forms of controlled sources are
defined by SPICE 2G. Taking (1) the voltage controlled voltage source and (2) the current
controlled current sources as examples the syntax is as follows:
Ename N(+) N(-) POLY(n) NC1(+) NC1(-) NC2(+) NC2(-)..... P0 P1 P2......,
where n indicates the order of the polynomial with coefficients P0 .....Pn, and NCn(+),
NCn(-) etc are the control node pairs.
This becomes:
• For POLY(1) 22 : Ename N(+) N(-) P0 P1 P2.........
• For POLY(2): Ename N(+) N(-) POLY(2) NC1(+) NC1(-) NC2(+) NC(-) P0 P1 P2......
• For POLY(3): Ename N(+) N(-) POLY(3) NC1(+) NC1(-) NC2(+) NC2(-) NC3(+) NC3(-) P0 P1 P2....
and so on.
19
See for example the OP AMP section of the Texas Instruments (TI) Web site and the TI Operational
Amplifier Circuits, Linear Circuits, Data Manual, 1990.
20
Taking the OP AMP reference voltage to be the average of VCC and VEE allows devices with non-
symmetrical power supply voltages to be simulated.
21
The definition of these polynomial functions was changed in the SPICE 3 series simulators to a more
conventional algebraic form when specifying the B type source components. This often gives compatibility
problems when attempting to simulate SPICE 2 models with circuit simulators developed from SPICE 3f4
or earlier simulators. Most popular SPICE based circuit simulators now accept both types of nonlinear
syntax.
22
If only one P coefficient is given in the single dimension polynomial case, then SPICE assumes that
this is P1 and that P0 equals zero. Similarly if the POLY keyword is not explicitly stated in a controlled
source definition then it is assumed by SPICE to be POLY(1).
56
Similarly: Fname N(+) N(-) POLY(n) V1 V2 V3 ...... P0 P1 P2 ....., where V1, V2 .... are independent
voltage sources whose current controls the output. This becomes:
The meaning of the coefficients in the nonlinear controlled source definitions depends on
the dimension of the polynomial. The following examples indicate how SPICE calculates
current or voltage values.
57
SPICE sources engd and fb can therefore be replaced in the modified Boyle model by the
following SPICE code23 :
Modified Boyle macromodels are often generated using the PSpice Parts24 program. Such
models have similar structured SPICE netlists with different component values. However,
changes in technology do result in changes in the input stage that reflect the use of npn,
pnp and JFET input transistors in real OP AMPs. Hence to use manufacturers published
modified Boyle models with Qucs all that is required is the replacement of the SPICE
polynomial controlled sources with linear sources and the correct component values. Again
this is best done using a SPICE preprocessor template. The templates for OP AMPS with
npn and PJF input transistors are shown in Figures 50 and 51. The SPICE netlists
shown in Figs. 52 and 53 were generated by the PS2SP preprocessor. For OP AMPS with
pnp input transistors simply change the BJT model reference from npn to pnp and use the
same template.
23
It is worth noting that the code for the polynomial form of controlled sources can only be replaced by
a series connection of linear controlled voltage sources or a parallel connection of linear controlled current
sources provided no higher order polynomial coefficients are present in the original SPICE code. Some
SPICE models use these higher order coefficients to generate multiply functions. Such cases cannot be
converted to code which will simulate using Qucs 0.0.10. Sometime in the future this restriction will be
removed when nonlinear voltage and current sources are added to Qucs.
24
The Parts modelling program is an integral component in the PSpice circuit simulation software
originally developed by the MicroSim Corporation, 1993, The Design Centre:Parts (Irvine, Calif.). It now
forms part of Cadence Design Systems OrCad suite of CAD software.
58
∗ connections : non−i n v e r t i n g i n p u t
∗ | i n v e r t i n g input
∗ | | p o s i t i v e power s u p p l y
∗ | | | n e g a t i v e power s u p p l y
∗ | | | | ou tp ut
∗ | | | | |
. s u b c k t uA741 1 2 3 4 5
∗
c1 11 12 8 . 661E−12
c2 6 7 30 . 00E−12
dc 5 53 dx
de 54 5 dx
d l p 90 91 dx
d l n 92 90 dx
dp 4 3 dx
egnd 99 0 p o l y ( 2 ) ( 3 , 0 ) ( 4 , 0 ) 0 . 5 . 5
fb 7 99 p o l y ( 5 ) vb vc ve v l p v l n 0 10 . 61E6 −10E6 10E6 10E6 −10E6
ga 6 0 11 12 188 . 5E−6
gcm 0 6 10 99 5 . 961E−9
iee 10 4 dc 15 . 16E−6
hlim 90 0 v l i m 1K
q1 11 2 13 qx
q2 12 1 14 qx
r2 6 9 100 . 0E3
rc1 3 11 5 . 305E3
rc2 3 12 5 . 305E3
r e 1 13 10 1 . 836E3
r e 2 14 10 1 . 836E3
r e e 10 99 13 . 19E6
ro1 8 5 50
ro2 7 99 100
rp 3 4 18 . 16E3
vb 9 0 dc 0
vc 3 53 dc 1
ve 54 4 dc 1
v l i m 7 8 dc 0
v l p 91 0 dc 40
vln 0 92 dc 40
. model dx D( I s=800 . 0E−18 Rs=1 )
. model qx NPN( I s=800 . 0E−18 Bf=93 . 7 5 )
. ends
Figure 49: PSpice modified Boyle macromodel for the UA741 OP AMP.
59
∗ M o d i f i e d Boyle OP AMP model t e m p l a t e
∗ npn BJT i n p u t d e v i c e s .
∗
∗UA741C OP AMP p a r a m e t e r s , m a n u f a c t u r e r Texas I n s t r u m e n t s
. param c1=4 . 664 p c2=20 . 0p
. param ep1=0 . 5 ep2=0 . 5
. param f p 1=10 . 61 e6 f p 2=−10e6 f p 3=10 e6 f p 4=10 e6 f p 5=−10e6
. param vc=2 . 6 ve=2 . 6 v l p=25 v l n=25
. param ga=137 . 7 e−6 gcm=2 . 57 e−9
. param i e e=10 . 16 e−6 hlim=1k
. param r 2=100 k
. param r c 1=7 . 957 k r c 2=7 . 957 k
. param r e 1=2 . 74 k r e 2=2 . 74 k
. param r e e=19 . 69 e6 r o 1=150 r o 2=150
. param rp=18 . 11 k
∗
. s u b c k t ua741 TI P INP P INN P VCC P VEE P OUT
c1 11 12 { c1 }
c2 6 7 { c2 }
dc P OUT 53 dx
de 54 P OUT dx
d l p 90 91 dx
d l n 92 90 dx
∗ egnd 99 0 p o l y ( 2 ) ( 3 , 0 ) ( 4 , 0 ) 0 0 . 5 0 . 5
∗ Qucs m o d i f i c a t i o n , Mike Brinson , Feb 2007
egnd1 999 0 P VCC 0 { ep1 }
egnd2 99 999 P VEE 0 { ep2 }
∗ f b 7 99 p o l y ( 5 ) vb vc ve v l p v l n 0 10 . 61 e6 −10e6 10 e6 10 e6 −10e6
∗ Forms c u r r e n t s o u r c e with ou tp ut
∗ I=10 . 61 e6 ∗ i ( vb)−10 e6 ∗ i ( vc )+10 e6 ∗ i ( ve )+10 e6 ∗ i ( v l p )−10 e6 ∗ i ( v l n )
∗ Qucs m o d i f i c a t i o n , Mike Brinson , Feb 2007 .
∗Sum 5 c u r r e n t s o u r c e s t o g i v e f b .
f b 1 7 99 vb { f p 1 }
f b 2 7 99 vc { f p 2 }
f b 3 7 99 ve { f p 3 }
f b 4 7 99 v l p { f p 4 }
f b 5 7 99 v l n { f p 5 }
∗
ga 6 0 11 12 { ga }
gcm 0 6 10 99 {gcm}
i e e 10 P VEE { i e e }
hlim 90 0 v l i m { hlim }
q1 11 P INN 13 qx
q2 12 P INP 14 qx
r 2 6 9 100 k
r c 1 P VCC 11 { r c 1 }
r c 2 P VCC 12 { r c 2 }
r e 1 13 10 { r e 1 }
r e 2 14 10 { r e 2 }
r e e 10 99 { r e e }
r o 1 8 P OUT { r o 1 }
r o 2 7 99 { r o 2 }
rp P VCC P VEE { rp }
vb 9 0 dc 0
vc P VCC 53 dc { vc }
ve 54 P VEE dc { ve }
v l i m 7 8 dc 0
v l p 91 0 dc { v l p }
v l n 0 92 dc { v l p }
. model dx d ( i s=800 . 0 e −18)
. model qx npn ( i s=800 . 0 e −18 b f=62 . 5 )
. ends
. end
Figure 50: Modified Boyle PS2SP netlist for the UA741 OP AMP.
60
∗ M o d i f i e d Boyle OP AMP model t e m p l a t e
∗ JFET i n p u t d e v i c e s .
∗
∗TL081 OP AMP p a r a m e t e r s , m a n u f a c t u r e r Texas I n s t r u m e n t s
. param c1=3 . 498 p c2=15 . 0p
. param ep1=0 . 5 ep2=0 . 5
. param f p 1=4 . 715 e6 f p 2=−5e6 f p 3=5 e6 f p 4=5 e6 f p 5=−5e6
. param vc=2 . 2 ve=2 . 2 v l p=25 v l n=25
. param ga=282 . 8 e−6 gcm=8 . 942 e−9
. param i s s=195 . 0 e−6 hlim=1k
. param r 2=100 k
. param rd1=3 . 536 k rd2=3 . 536 k
. param r s s=1 . 026 e6 r o 1=150 r o 2=150
. param rp=2 . 14 k
∗
. s u b c k t ua741 TI P INP P INN P VCC P VEE P OUT
c1 11 12 { c1 }
c2 6 7 { c2 }
dc P OUT 53 dx
de 54 P OUT dx
d l p 90 91 dx
d l n 92 90 dx
∗ egnd 99 0 p o l y ( 2 ) ( 3 , 0 ) ( 4 , 0 ) 0 0 . 5 0 . 5
∗ Qucs m o d i f i c a t i o n , Mike Brinson , Feb 2007
egnd1 999 0 P VCC 0 { ep1 }
egnd2 99 999 P VEE 0 { ep2 }
∗ f b 7 99 p o l y ( 5 ) vb vc ve v l p v l n 0 10 . 61 e6 −10e6 10 e6 10 e6 −10e6
∗ Forms c u r r e n t s o u r c e with ou tp ut
∗ I=10 . 61 e6 ∗ i ( vb)−10 e6 ∗ i ( vc )+10 e6 ∗ i ( ve )+10 e6 ∗ i ( v l p )−10 e6 ∗ i ( v l n )
∗ Qucs m o d i f i c a t i o n , Mike Brinson , Feb 2007 .
∗Sum 5 c u r r e n t s o u r c e s t o g i v e f b .
f b 1 7 99 vb { f p 1 }
f b 2 7 99 vc { f p 2 }
f b 3 7 99 ve { f p 3 }
f b 4 7 99 v l p { f p 4 }
f b 5 7 99 v l n { f p 5 }
∗
ga 6 0 11 12 { ga }
gcm 0 6 10 99 {gcm}
i s s P VCC 10 { i s s }
hlim 90 0 v l i m { hlim }
j 1 11 P INN 10 j x
j 2 12 P INP 10 j x
r 2 6 9 100 k
rd1 P VEE 11 { rd1 }
rd2 P VEE 12 { rd2 }
r o 1 8 P OUT { r o 1 }
r o 2 7 99 { r o 2 }
rp P VCC P VEE { rp }
r s s 10 99 { r s s }
vb 9 0 dc 0
vc P VCC 53 dc { vc }
ve 54 P VEE dc { ve }
v l i m 7 8 dc 0
v l p 91 0 dc { v l p }
v l n 0 92 dc { v l p }
. model dx d ( i s=800 . 0 e −18)
. model j x p j f ( i s=15 . 0 e −12 b e t a=270 . 1 e−6 v t o=−1)
. ends
. end
Figure 51: Modified Boyle PS2SP netlist for the TL081 OP AMP.
61
∗ m o d i f i e d b o y l e op amp model t e m p l a t e
∗ i n f i l e=Mod b o y l e t e m p l a t e npn . pp d a t e=Thu Feb 8 23 : 54 : 59 2007 Converted with p s 2 s p . p l V4 . 11
∗ o p t i o n s : −sp3=1 − l t s p i c e=0 −fromsub=0 −f r o m l i b=0 −c h e c k=0 ( t i n y l i n e s=1 )
∗ c o p y r i g h t 2007 by F r i e d r i c h Schmidt − terms of Gnu L i c e n c e
. s u b c k t ua741 t i p i n p p i n n p v c c p v e e p out
c1 11 12 4 . 664 e −12
c2 6 7 2 e −11
dc p out 53 dx
de 54 p out dx
d l p 90 91 dx
d l n 92 90 dx
egnd1 999 0 p v c c 0 0 . 5
egnd2 99 999 p v e e 0 0 . 5
f b 1 7 99 vb 9 . 42507 06880301 6 e −08
f b 2 7 99 vc −1e −07
f b 3 7 99 ve 1 e −07
f b 4 7 99 v l p 1 e −07
f b 5 7 99 v l n −1e −07
ga 6 0 11 12 0 . 0001377
gcm 0 6 10 99 2 . 57 e −09
i e e 10 p v e e 1 . 016 e −05
hlim 90 0 v l i m 0 . 001
q1 11 p i n n 13 qx
q2 12 p i n p 14 qx
r 2 6 9 100 k
r c 1 p v c c 11 7957
r c 2 p v c c 12 7957
r e 1 13 10 2740
r e 2 14 10 2740
r e e 10 99 19690000
r o 1 8 p out 150
r o 2 7 99 150
rp p v c c p v e e 18110
vb 9 0 0
vc p v c c 53 2 . 6
ve 54 p v e e 2 . 6
vlim 7 8 0
v l p 91 0 25
v l n 0 92 25
. model dx d ( i s=800 . 0 e −18)
. model qx npn ( i s=800 . 0 e −18 b f=62 . 5 )
. ends
. end
Figure 52: Modified Boyle SPICE netlist for the TI UA741 OP AMP.
62
∗ m o d i f i e d b o y l e op amp model t e m p l a t e
∗ i n f i l e=TL081 TI . pp d a t e=Sun Feb 11 16 : 04 : 22 2007 Converted with p s 2 s p . p l V4 . 11
∗ o p t i o n s : −sp3=0 − l t s p i c e=0 −fromsub=0 −f r o m l i b=0 −c h e c k=0 ( t i n y l i n e s=1 )
∗ c o p y r i g h t 2007 by F r i e d r i c h Schmidt − terms of Gnu L i c e n c e
. s u b c k t ua741 t i p i n p p i n n p v c c p v e e p out t i m e s
c1 11 12 3 . 498 e −12
c2 6 7 1 . 5 e −11
dc p out 53 dx
de 54 p out dx
d l p 90 91 dx
d l n 92 90 dx
egnd1 999 0 p v c c 0 0 . 5
egnd2 99 999 p v e e 0 0 . 5
f b 1 7 99 vb 4715000
f b 2 7 99 vc −5000000
f b 3 7 99 ve 5000000
f b 4 7 99 v l p 5000000
f b 5 7 99 v l n −5000000
ga 6 0 11 12 0 . 0002828
gcm 0 6 10 99 8 . 942 e −09
i s s p v c c 10 0 . 000195
hlim 90 0 v l i m 1000
j 1 11 p i n n 10 j x
j 2 12 p i n p 10 j x
r 2 6 9 100 k
rd1 p v e e 11 3536
rd2 p v e e 12 3536
r o 1 8 p out 150
r o 2 7 99 150
rp p v c c p v e e 2140
r s s 10 99 1026000
vb 9 0 dc 0
vc p v c c 53 dc 2 . 2
ve 54 p v e e dc 2 . 2
v l i m 7 8 dc 0
v l p 91 0 dc 25
v l n 0 92 dc 25
. model dx d ( i s=800 . 0 e −18)
. model j x p j f ( i s=15 . 0 e −12 b e t a=270 . 1 e−6 v t o=−1)
. ends
. end
Figure 53: Modified Boyle SPICE netlist for the TI TL081 OP AMP.
63
Constructing Qucs OPAMP libraries
Qucs release 0.0.10 includes a facility which allows users to build their own component
libraries. This facility can be used to construct any library which contains device models
formed using the standard schematic entry route provided the individual components that
make up a model do not contain components that require file netlists. Qucs, for example,
converts SPICE netlists to Qucs formated netlists when a simulation is performed but does
not retain the converted netlists. Hence, to add OP AMP macromodels that are based on
SPICE netlist to a Qucs library a slightly modified procedure is required that involves users
copying the converted SPICE netlist into a Qucs library. One way for generating SPICE
netlist based OP AMP models is as follows25 :
1. Construct a Qucs OP AMP model using the procedure described on page 3 of the
Qucs Simulation of SPICE Netlists tutorial.
2. Add this model to a user defined library using the Qucs Create Library facility (short
cut Ctrl+Shift+L).
3. Place a copy of the OP AMP model on a drawing sheet and undertake a DC analysis.
NOTE: drag and drop the model symbol of the device you are simulating from your
current work project and NOT from the newly created Qucs library.
4. Copy the section of the Qucs netlist that has been converted from the model’s SPICE
netlist and paste this into the newly created library model. The converted SPICE
netlist can be displayed by pressing key F6. User generated library files are held in
directory user_lib.26
To demonstrate the procedure consider the following example based on the UA741 Boyle
model:
Steps 1 and 2 result in the following entry in a user created library:
25
The procedure presented here must be considered a work around and may change as Qucs develops.
26
The location of the user created libraries will differ from system to system depending where .qucs is
installed.
64
<L i n e 80 0 15 0 #00007 f 2 1>
<. PortSym −35 −35 1 0>
<. PortSym −35 40 2 0>
<. PortSym 95 0 3 180>
<L i n e 60 50 0 −40 #00007 f 2 1>
<L i n e 60 −15 0 −40 #00007 f 2 1>
<Text −15 −55 30 #000000 0 ”−”>
<Text −15 30 20 #000000 0 ”+”>
<Text −15 −5 12 #000000 0 ”UA741 ( Boyle ) ”>
<. PortSym 60 −55 4 180>
<. PortSym 60 50 5 180>
<Text 65 −30 12 #000000 0 ”VCC”>
<Text 65 20 12 #000000 0 ”VEE”>
</Symbol>
</Component>
Note that the model requires a subcircuit of type ua741_boyle_cir which is not included
when the library is created by Qucs. After completing the cut and paste operation described
in steps 3 and 4 above the resulting library entry becomes the Qucs netlist shown next.
<Component ua741 ( b o y l e )>
<D e s c r i p t i o n >
UA741 Boyle macromodel
</ D e s c r i p t i o n >
<Model>
. Def : Lib OPAMP ua741 b o y l e net0 net1 net2 net3 net4
Sub : X1 n e t 0 n e t 1 n e t 2 n e t 3 n e t 4 gnd Type=”ua741 b o y l e c i r ”
. Def : End
. Def : ua741 b o y l e c i r netN INN netN INP netN OUT netN VCC netN VEE r e f
Vdc :VE n e t 1 6 netN VEE U=”2 . 3079 ”
Vdc :VC netN VCC n e t 1 5 U=”1 . 6079 ”
Diode : D4 netN OUT n e t 1 6 I s=”8 e −16 ” Rs=”1 ” N=”1 ” M=”0 . 5 ” Cj0=”1 e −14 ” Vj=”0 . 7 ”
Diode : D3 n e t 1 5 netN OUT I s=”8 e −16 ” Rs=”1 ” N=”1 ” M=”0 . 5 ” Cj0=”1 e −14 ” Vj=”0 . 7 ”
R:RC n e t 1 4 r e f R=”0 . 000616604 ”
VCCS:GC netN OUT r e f net14 r e f G=”1621 . 79 ”
Diode : D2 n e t 1 3 n e t 1 4 I s=”1 e −32 ” Rs=”1 ” N=”1 ” M=”0 . 5 ” Cj0=”1 e −14 ” Vj=”0 . 7 ”
Diode : D1 n e t 1 4 n e t 1 3 I s=”1 e −32 ” Rs=”1 ” N=”1 ” M=”0 . 5 ” Cj0=”1 e −14 ” Vj=”0 . 7 ”
R:RO1 n e t 1 3 netN OUT R=”76 . 8 ”
R:RO2 n e t 1 3 r e f R=”489 . 2 ”
VCCS:GB n e t 1 2 n e t 1 3 ref r e f G=”21 . 6919 ”
C: C2 n e t 1 2 n e t 1 3 C=”30p ”
R: R2 n e t 1 2 r e f R=”100000 ”
VCCS:GA n e t 8 n e t 1 2 ref n e t 9 G=”0 . 000188472 ”
VCCS:GCM n e t 1 ref net12 r e f G=”5 . 96 e −09 ”
R:RP netN VCC netN VEE R=”15151 . 5 ”
C: C1 n e t 8 n e t 9 C=”5 . 45881 e −12 ”
I d c : IEE netN VEE n e t 1 I=”1 . 516 e −05 ”
C:CE n e t 1 r e f C=”0 ”
R:RE n e t 1 r e f R=”1 . 31926 e+07 ”
R: RE2 n e t 1 n e t 1 1 R=”1820 . 05 ”
R: RE1 n e t 1 n e t 1 0 R=”1820 . 05 ”
R: RC2 netN VCC n e t 9 R=”5305 . 83 ”
R: RC1 netN VCC n e t 8 R=”5305 . 83 ”
BJT : Q2 netN INP n e t 9 n e t 1 1 r e f Type=”npn ” I s=”8 . 21538 e −16 ” Bf=”83 . 3333 ” Nf=”1 ” Nr=”1 ” I k f=”0 ”
I k r=”0 ” Vaf=”0 ” Var=”0 ” I s e=”0 ” Ne=”1 . 5 ” I s c=”0 ” Nc=”2 ” Br=”1 ” Rbm=”0 ” I r b=”0 ” Cje=”0 ” Vje=”0 . 75 ”
Mje=”0 . 33 ” Cjc=”0 ” Vjc=”0 . 75 ” Mjc=”0 . 33 ” Xcjc=”1 ” C js=”0 ” Vjs=”0 . 75 ” Mjs=”0 ” Fc=”0 . 5 ” Vtf=”0 ”
Tf=”0 ” Xtf=”0 ” I t f=”0 ” Tr=”0 ”
BJT : Q1 netN INN n e t 8 n e t 1 0 r e f Type=”npn ” I s=”8 e −16 ” Bf=”107 . 143 ” Nf=”1 ”
Nr=”1 ” I k f=”0 ” I k r=”0 ” Vaf=”0 ” Var=”0 ” I s e=”0 ” Ne=”1 . 5 ” I s c=”0 ” Nc=”2 ” Br=”1 ”
Rbm=”0 ” I r b=”0 ” Cje=”0 ” Vje=”0 . 75 ” Mje=”0 . 33 ” Cjc=”0 ” Vjc=”0 . 75 ” Mjc=”0 . 33 ”
Xcjc=”1 ” C js=”0 ” Vjs=”0 . 75 ” Mjs=”0 ” Fc=”0 . 5 ” Vtf=”0 ” Tf=”0 ” Xtf=”0 ” I t f=”0 ” Tr=”0 ”
. Def : End
</Model>
<Symbol>
65
<. ID −20 74 SUB>
<L i n e −20 60 0 −125 #00007 f 2 1>
<L i n e −20 −65 100 65 #00007 f 2 1>
<L i n e −20 60 100 −60 #00007 f 2 1>
<L i n e −35 −35 15 0 #00007 f 2 1>
<L i n e −35 40 15 0 #00007 f 2 1>
<L i n e 80 0 15 0 #00007 f 2 1>
<. PortSym −35 −35 1 0>
<. PortSym −35 40 2 0>
<. PortSym 95 0 3 180>
<L i n e 60 50 0 −40 #00007 f 2 1>
<L i n e 60 −15 0 −40 #00007 f 2 1>
<Text −15 −55 30 #000000 0 ”−”>
<Text −15 30 20 #000000 0 ”+”>
<Text −15 −5 12 #000000 0 ”UA741 ( Boyle ) ”>
<. PortSym 60 −55 4 180>
<. PortSym 60 50 5 180>
<Text 65 −30 12 #000000 0 ”VCC”>
<Text 65 20 12 #000000 0 ”VEE”>
</Symbol>
</Component>
66
CEE RE3 RE5
C=7.5p R=106.1M R=15.06M
GCM
G=6.32e-2
RE4
R=10
1
the response and attenuating the signal. The frequency of the zero is set by 2∗π∗CEE∗RE3 .
29
The new value of CEE must have the same value as the original CEE value if the same
slew-rate is to be maintained, so for a 200 Hz cut-off this gives RE3=106.1M. RE4 is ar-
bitrarily fixed at 10 Ω, which introduces another pole at about 2 GHz, well outside the
frequency of interest. The value of REE is increased to RE5 (15.06meg), so that RE5 in
parallel with RE3 equals the original value of REE. GCM is also increased by the fac-
tor RE3
RE4
maintaining the correct low frequency common-mode gain. Differential frequency
response and slew rate are unchanged by these modifications. The simulation results for
the common-mode test circuit shown in Fig. 20 are given in Fig. 55. These indicate close
agreement between the modular and ac Boyle macromodels.
Modifying the circuit of an existing OP AMP macromodel is at best a complex process or at
worst impossible because the model details are either not known or well understood. One
way to add features to an existing model is to add an external circuit to a model’s terminals.
This circuit acts as a signal processing element adding additional capabilities to the original
macromodel. One circuit feature not modelled by any of the macromodels introduced in
earlier sections is power supply rejection. By adding a simple passive electrical network to
the terminals of a macromodel it is possible to model OP AMP power supply rejection.
Power supply rejection(PSRR) is a measure of the ability of an OP AMP to reject unwanted
signals that enter at the power terminals. It is defined as the ratio of differential-mode gain
to power supply injected signal gain. The simulation of OP AMP power supply rejection30
29
In the Boyle macromodel the value of CEE is set by the OP AMP slew rate. Adjusting both the
positive and negative slew rates changes the value of CEE. For the UA741 these have been set at 0.625e6
and 0.500e6 respectively. This gives CEE=7.5pF which is commonly quoted for the UA741 value of CEE,
see Andrei Vladimirescu, The SPICE Book,1994, John Wiley and Sons, Inc., ISBN 0-471-60926-9, pp 228-
239. Also note care must be taken when choosing values for the two slew rates because negative values of
CEE can occur which are physically not realisable.
30
M. E. Brinson and D. J. Faulkner, Measurement and modelling of operational amplifier power supply
67
2e-4
1.5e-4
vout_boyle_orig.v
1e-4
5e-5
0
1 10 100 1e3
acfrequency
2e-4
1.5e-4
vout_boyle_ac.v
1e-4
5e-5
0
1 10 100 1e3
acfrequency
2e-4
1.5e-4
vout_mod.v
1e-4
5e-5
0
1 10 100 1e3
acfrequency
Figure 55: AC common-mode simulation results for (1) Boyle macromodel, (2) ac Boyle
macromodel and (3) the modular macromodel
68
V3
U=1 V
R1
R=100k
- VCC vout
V1
U=15 V
R2
R=10 UA741(Boyle)
V2
VEE U=15 V
+
R3
R=10
SUB1
R4
R=100k
dc simulation ac simulation
DC1 AC1
Type=log
Start=1 Hz
Stop=10 MHz
Points=500
Figure 56: Test circuit for the simulation of PSRR(f) voltage transfer function characteristic
69
not symmetric when viewed from the power supply signal injection terminals. By adding
external components to an OP AMP macromodel power supply rejection effects can be
easily simulated. The schematic shown in Fig. 57 shows the TI UA741 model with RC
networks connected between the power supply terminals and earth. The voltage controlled
voltage sources probe the voltages at the center nodes of the additional RC networks.
These networks generate the power supply injected signals at dc. They also generate the
dominant zero in the power supply rejection characteristic.
Which gives, for the example UA741 device data, RA = 9Ω, CA = 232pF , RB = 5.9Ω
and CB = 25.7pF . Simulation waveforms for the small signal frequency response of the
test circuit are shown in Fig. 58. In the case of the modular UA741 model the simulation
signal plot clearly demonstrates the fact that the model does not correctly represent the
effects due to power supply injected signals.
70
Vout_mod
dc simulation R1
VS
R=100k
U=1 V
DC1
V1
R2 - VCC U=15 V
R=10 UA741
(MOD)
V2
U=15 V
+ VEE
R3
R=10 R4
R=100k SUB5
ac simulation
AC1 R11
Type=log R=100k
Start=1 Hz
Stop=10 kHz
Points=400
CA
C=232p
RA
R=9
R5
EP2 EN2 R=1M
R9 G=0.5 G=0.5
R=10
- vout_TI
VCC
UA741(TI)
VEE
+
SUB4
EP1 EN1
G=0.5 G=0.5
R10 R6
R=10 R=1M
RB
R=5.9
R12
R=100k CB
Equation C=25.7nF
Eqn1
PSRR_P=dB(p1/(vout_TI.v*p2*alpha))
fpz1=685
alpha=1e-4
gbp=1e-6
p1=mag(1+j*acfrequency/fpz1)
p2=mag(1+j*acfrequency/alpha*gbp)
Figure 57: Test circuit showing OP AMP with external power supply rejection modelling
network
71
0.03
0.025
vout_TI.v
0.02
0.015
0.01
1 10 100 1e3 1e4
acfrequency
110
PSRR_P
105
100
1 10 100 1e3 1e4
acfrequency
3e-21
2e-21
Vout_mod.v
1e-21
0
1 10 100 1e3 1e4
acfrequency
72
End note
While writing this tutorial I have tried to demonstrate how practical models of operational
amplifiers can be constructed using basic electronic concepts and the range of Qucs built-in
components. The modular OP AMP macromodel was deliberately chosen as the foundation
for the tutorial for two reasons; firstly Qucs is mature enough to easily simulate such
models, and secondly the parameters which determine the operation of the macromodel
can be be calculated directly from information provided on device data sheets. Recent
modelling development by the Qucs team has concentrated on improving the SPICE to
Qucs conversion facilities. This work has had a direct impact on Qucs ability to import
and simulate manufacturers OP AMP models. The tutorial upgrade explains how SPICE
Boyle type OP AMP macromodels can be converted to work with Qucs. The Qucs OP
AMP library (OpAmps) has been extended to include models for a range of popular 8 pin
DIL devices. If you require a model with a specific specification that is not modelled by
an available macromodel then adding extra functionality may be the only way forward.
Two procedures for extending models are outlined in the tutorial upgrade. Much work still
remains to be done before Qucs can simulate a wide range of the macromodels published
by device manufacturers. With the recent addition of subcircuit/component equations to
Qucs it is now possible to write generalised macromodel macros for OP AMPs. However,
before this can be done time is required to fully test the features that Stefan and Michael
have recently added to Qucs release 0.0.11. This topic and the modelling of other OP AMP
properties such as noise will be the subject of a further OP AMP tutorial update sometime
in the future. My thanks to David Faulkner for all his help and support during the period
we were working on a number of the concepts that form part of the basis of this tutorial.
Once again a special thanks to Michael Margraf and Stefan Jahn for all their help and
encouragement over the period that I have been writing this tutorial and testing the many
examples it includes.
73