* SPICE netlist
R1 N003 Vin 10k
R2 0 N003 10k
R3 Vref N004 2k
R4 Vo1 N004 10k
V1 Vin 0 PWL(0 0 1m 10 2m 0 3m 10)
V3 Vcc 0 10
XU1 N004 N003 Vcc Vss Vo1 LM324 ;pnba In+)In-)V+)V-)OUT
V2 Vref 0 2
V4 0 Vss 0
R5 N001 Vin 10k
R6 0 N001 10k
R7 Vref N002 2k
R8 voIdeal N002 10k
XU2 N002 N001 Vcc Vss voIdeal level5 Avol=1Meg GBW=10Meg Phimargin=45 SlewPos=10Meg SlewNeg=10Meg En=0 Enk=0 In=0 Ink=0 Rcm=500Meg Ccm=1p Rdiff=500k Cdiff=2p Ro=1k Vos=0 Ibp=2n Ibn=1n Iq=1m Rail=0 Ilimit=25m ;pnba In+)In-)V+)V-)OUT
.SUBCKT LM324 1 2 3 4 5
C1 11 12 5.544E-12
C2 6 7 20.00E-12
DC 5 53 DX
DE 54 5 DX
DLP 90 91 DX
DLN 92 90 DX
DP 4 3 DX
EGND 99 0 POLY(2) (3,0) (4,0) 0 .5 .5
FB 7 99 POLY(5) VB VC VE VLP VLN 0 15.91E6 -20E6 20E6 20E6 -20E6
GA 6 0 11 12 125.7E-6
GCM 0 6 10 99 7.067E-9
IEE 3 10 DC 10.04E-6
HLIM 90 0 VLIM 1K
Q1 11 2 13 QX
Q2 12 1 14 QX
R2 6 9 100.0E3
RC1 4 11 7.957E3
RC2 4 12 7.957E3
RE1 13 10 2.773E3
RE2 14 10 2.773E3
REE 10 99 19.92E6
RO1 8 5 50
RO2 7 99 50
RP 3 4 30.31E3
VB 9 0 DC 0
VC 3 53 DC 2.100
VE 54 4 DC .6
VLIM 7 8 DC 0
VLP 91 0 DC 40
VLN 0 92 DC 40
.tran 0 3m 0 0.1m

* LTspice schematic (.asc)
Version 4.1
SHEET 1 720 848
WIRE -40 -424 -72 -424
WIRE -40 -392 -40 -424
WIRE 72 -312 72 -328
WIRE -40 -296 -40 -312
WIRE 40 -296 -40 -296
WIRE -40 -280 -40 -296
WIRE 168 -280 104 -280
WIRE 200 -280 168 -280
WIRE 40 -264 8 -264
WIRE 72 -216 72 -248
WIRE -40 -168 -40 -200
WIRE 8 -152 8 -264
WIRE 72 -152 8 -152
WIRE 168 -152 168 -280
WIRE 168 -152 152 -152
WIRE 8 -136 8 -152
WIRE -360 -104 -360 -120
WIRE -248 -104 -248 -120
WIRE 264 -104 264 -136
WIRE 360 -104 360 -136
WIRE 8 -24 8 -56
WIRE 8 -24 -24 -24
WIRE -360 -8 -360 -24
WIRE -248 -8 -248 -24
WIRE 264 -8 264 -24
WIRE 360 -8 360 -24
WIRE -8 24 -40 24
WIRE -8 56 -8 24
WIRE 104 136 104 120
WIRE -8 152 -8 136
WIRE 72 152 -8 152
WIRE -8 168 -8 152
WIRE 200 168 136 168
WIRE 216 168 200 168
WIRE 72 184 40 184
WIRE 104 232 104 200
WIRE -8 280 -8 248
WIRE 40 296 40 184
WIRE 104 296 40 296
WIRE 200 296 200 168
WIRE 200 296 184 296
WIRE 40 312 40 296
WIRE 40 424 40 392
WIRE 40 424 8 424
FLAG -360 -8 0
FLAG 264 -8 0
FLAG -360 -120 Vin
FLAG 360 -136 0
FLAG 264 -136 Vcc
FLAG 104 120 Vcc
FLAG 360 -8 Vss
FLAG 104 232 Vss
FLAG 216 168 Vo1
IOPIN 256 192 Out
FLAG -8 280 0
FLAG -248 -8 0
FLAG -248 -120 Vref
FLAG 8 424 Vref
IOPIN 48 448 In
FLAG -40 24 Vin
IOPIN 0 48 In
FLAG 72 -328 Vcc
FLAG 72 -216 Vss
FLAG -40 -168 0
FLAG -24 -24 Vref
IOPIN 16 0 In
FLAG -72 -424 Vin
IOPIN -32 -400 In
FLAG 200 -280 voIdeal
IOPIN 240 -256 Out
SYMBOL res 8 152 R180
SYMATTR InstName R1
SYMATTR Value 10k
SYMBOL res 8 264 R180
SYMATTR InstName R2
SYMATTR Value 10k
SYMBOL res 56 408 R180
SYMATTR InstName R3
SYMATTR Value 2k
SYMBOL res 200 280 R90
SYMATTR InstName R4
SYMATTR Value 10k
SYMBOL voltage -360 -120 R0
SYMATTR Value PWL(0 0 1m 10 2m 0 3m 10)
SYMATTR InstName V1
SYMBOL voltage 264 -120 R0
SYMATTR InstName V3
SYMATTR Value 10
SYMBOL OpAmps\\opamp2 104 104 R0
SYMATTR InstName U1
SYMATTR Value LM324
SYMBOL voltage -248 -120 R0
SYMATTR Value 2
SYMATTR InstName V2
SYMBOL voltage 360 -120 R0
SYMATTR InstName V4
SYMATTR Value 0
SYMBOL res -24 -296 R180
SYMATTR InstName R5
SYMATTR Value 10k
SYMBOL res -24 -184 R180
SYMATTR InstName R6
SYMATTR Value 10k
SYMBOL res 24 -40 R180
SYMATTR InstName R7
SYMATTR Value 2k
SYMBOL res 168 -168 R90
SYMATTR InstName R8
SYMATTR Value 10k
SYMBOL OpAmps\\UniversalOpAmp5 72 -280 R0
SYMATTR InstName U2