I'm trying to simulate a linear voltage controlled current source with ngspice and Kicad. This is the minimal circuit I've redrawn for the purposes of simulation.
I do want to be able to simulate transient behavior for a step change in the input voltage, ,but otherwise I'm not too concerned about the frequency response of the circuit. IN is essentially a DC level being adjusted very slowly by a DAC, let's say at most once per 0.1s.
This question is only related to the DC operating point simulation, in the image above set to 2V. I expect the inverting input of U1 to also reach around 2V, but instead the simulation reports 2.32V. At IN=0.7V, 1V, and 1.5V this difference does not arise.
I expect it has something to do with limitations in the Gain of U1. Below are the Gain vs Frequency graphs in the datasheet of the ADA4522. The opamp itself claims a GBW of 3MHz. The actual gain simulated at this DC operating point, however, is only 62.5x.
I've used the following models :
I haven't yet figured out how to export a portable netlist from a Kicad schematic. I could upload the Kicad .sch file and the models in a zip file, made with Kicad v8.0.4, if it helps. For the moment, this is the netlist for the above circuit without the models included:
.title KiCad schematic
.include "ADA4522.cir"
.include "OPAx388.LIB"
.include "TIP142.LIB"
R1 Net-_R1-Pad1_ Net-_Q2-B_ 100
XU1 IN MONITOR_I VPP 0 Net-_R1-Pad1_ ADA4522
RHTR1 Net-_Q2-E_ VSHUNT 32
XQ2 VPP Net-_Q2-B_ Net-_Q2-E_ tip142
C1 VSHUNT 0 470p
RSHUNT1 VSHUNT 0 0.1
XU2 VSHUNT Net-_U2--_ +5V 0 MONITOR_I OPAx388
R2 Net-_U2--_ MONITOR_I 39k
R3 Net-_U2--_ 0 1k
V3 IN 0 DC 2 SIN( 2 3 10 0 0 0 ) AC 3
V2 +5V 0 DC 5
V1 VPP 0 DC 48
.end
- Why is the inverting input at 2.32V and not 2.00V?
- Is this a simulation issue or a circuit issue?
- Is there any way in which this difference can be reduced?
Edit :
Transient Analysis Results
I've run transient analysis by changing VSIN to VPULSE with y1=0 y2=2 td=100m tr=1u tf=1u tw=1 per=2
. This is the result I get :
I'd want to do something about the overshoot and ringing, but in principle it seems to be working fine. Does this mean the DC operating point simulation is not doing what I assumed it would do?
I've also done the same with y1=1, and the shape of the curve looks about the same. The DC operating point simulation at 1V does return the correct 1.00V volt result, though, with the same transient simulation shape, unlike 2.32V for 2V.
Transient simulation with VSIN also provides some other unusual results:
I don't expect there to be any clipping here, yet transient analysis of a sinusuoidal input is creating it. The fact that it's clipping at 3.5V suggests to me it might be a problem with the ADA4522 model, which has a maximum input level of 3.5V when powered by 0/5V.
A DC Sweep with the same configuration also produces a strange artifact at ~1.2V input. Though I must say the DC sweep results have been a little strange for some time, and these artifacts seem to occasionally disappear when I restart kicad. Note, however, that the DC sweep does suggest more than 1A (42W across 32 ohm) is indeed accessible to this circuit.
Interestingly enough, DC Operating Point simulation at 4.00V works perfectly with 4.00V at MONITOR_I, while transient simulation with a 0-4V step saturates at about 3.3V at MONITOR_I.