Simulating basic op-amp (TLV333) non-inverting model different result vs LTSpice

I have moderate experience with LTspice and thought it would be nice to try the integrated simulator in KiCad so I don’t have to re-create circuits. I tried a simple hello world example for a non-converting amplifier using a common TLV333 (sometimes known as OPA333) model downloaded from Texas Instruments. When I did the .dc sweep of a 0-1V signal into the OPAMP- pin, I saw the Voutput (in red) had some weird glitches or dips which made the output behave accordingly. I noticed Vinput / Vop+ (in yellow, drawn in since I forgot to show it) was normal, however the Vop- pin had similar glitches.

  1. I did a sanity check with a .op simulation at those swept voltages, and indeed it was so.
  2. I replaced with the built in op-amp model and did not recreate the issue.
  3. I exported to a .cir file and simulated in LTSpice program and did not recreate.
  4. I changed the load resistor to 10k and the issue went away.

I can see that the load is affecting the performance of the circuit. I just can’t understand why that would create such weird dips at specific voltages.


Edit: posted file!
test-sim-kica.zip (71.1 KB)

You have already self promoted to basic user so you should be able to post the file.

I can reproduce your findings.

I am working on a fix which will be available in ngspice-44.

For now you might put this

.control
optran 1 1 1 1u 100u 99.9u
.endc

into a text box on the Eeschema canvas.

1 Like

Firstly thank you, I am new to eeschema/ngspice and I did not expect a reply so fast! KiCAD with ngspice is a game-changer as it accelerates electronics intuition development. Seriously, the Tune function is awesome (how is it so fast?)

Can you share some background on the nature of the bug for my curiosity? Is it a fundamental bug? or some side quirk in the interaction with this particular model?

Just for completeness, I’ve spent some time trying to understand the fix you gave. Some questions:

  1. The first ‘1’ indicates an initial condition? What is the unit?
  2. The second ‘1’ indicates gmin stepping? Isn’t that quite large? I thought a standard starting point is 1e-6 per my research
  3. The third ‘1’ is something about source stepping
  4. The rest ‘1u 100u 99.9u’ indicates an extra transient sim with step size 1us, until 100us, but what is 99.9u?

My source is this info from google:

The command optran 0 0 0 100p 2n 0 , to be given in .spiceinit, does take care of this method. 0 0 0 denotes: no initial iteration, no gmin stepping, no source stepping, 100p 2n 0 then denotes: use an extra transient simulation with step size 100 ps and about 20 steps until 2 ns to set up all dc voltages, without explicitedly setting a voltage ramp. Only after a successful operating point calculation by optran the normal transient sim is started.

1 1 1 is just switching on initial iteration, gmin stepping, and source stepping. When initial iteration is successful, its outcome is taken as operating point, the rest of the sequence is discarded. Only when all three fail, transient op is used, a transient simulation with step 1u, stop 100u. 99.9u is the end of voltage ramping. During this transient all voltages are ramped linearily. After 100u optran stops. The data in the matrix then are taken as the operating point, e.a. real transient (or ac or other) may then be started.

The default optran is 1 1 1 1u 10n 0, it has been used for IC simulation, but is not that useful for discrete or analog stuff.

The TI opamp models are somewhat incompatible with the standard settings of ngspice. Thus a suitable optran command may be required, for op, but also for dc simulation.

2 Likes

Given my limited understanding that operating point ‘just’ creates KCL and KVL equations and solves them. Or maybe I am wrong.

  1. What does initial iteration enabled do?
  2. Also what does source stepping do?

A. Can you elaborate on IC vs discrete vs analog in this context? To me spice simulation is all ‘analog’.

The time constants are most often vastly different, mixed signal ICs act much faster than, say the TLV333.

To the other questions: I am not inclined to teach basic spice here, there is a lot of literature around. Of course questions towards the curren KiCad/ngspice setup are welcome.

Thanks for the reply! I’ll have to think learn about the inner workings of spice some more to understand how faster time constants in ‘mixed signal’ ICs would affect the simulation.

Fair! I found the optran info in KiCAD manual.

Although, still wondering why there is a source of stepping flag, since source stepping is for .dc sweep and .ac analysis, not sure why it would be used in an .op or a .tran or .optran calculation.