Simple op-amp circuit with finite power supplies (+/- 15V) gives -30GV output in dc sweep SOLVED

I made a simple op-amp circuit with +/- 15V rails:

https://www.circuitlab.com/circuit/qaygjp/non-ideal-non-ideal-op-amp-1/

A dc sweep on Vi (plotting Vo) should result in a line with slope close to -5/4 V/V. Circuitlab, however, shows an output of -30GV for some reason at low input voltages. This is obviously wrong, since there are no components in the circuit capable of outputting this kind of voltage. Spice, of course, agrees with me, as does reality.

Anyone know what is going on here?

by collinstocks
April 02, 2013

Hi collinstocks,

Sorry, I’m not an expert here ( @signality, help?) but i have some comments for you:

1) CL’s op amps have some limitations, unfortunately not in the output voltage (even with having rails).

2) I guess the DC sweep is not really helpful with your circuit (albeit it shows other issues of CL’s solver which I did not encounter before). To check your schematic I’d suggest to use the Time Domain Simulation.

3) Your circuit’s problem is caused by CL’s solver (I call it a bug, but I dunno), in particular the initial conditions. This can easily be seen in the Time Domain at time = 0 (or even before that moment) when power is applied to your circuit. As a workaround you should always ramp up the power supply to your circuit - until you know exactly that you don’t need it (see example below, but also search in CL for “initial”).

I really don’t know enough to explain how that could affect the DC sweep, but obviously it does. :-(

4) Regarding your circuit (sorry if I’m wrong, I’m not an expert) it’s questionable whether your R2 makes sense:

The first op amp being a (high impedance) non inverting stage to keep your input signal (your source) “free” of load is OK, but the kind of feedback (R2) renders that nearly to void. You could easily forget R2 and adjust gain by R21 only ?

However, I assume the circuit should work in reality, at least with low frequencies, until the time lag in both stages becomes dominant (but I dunno …).

Regards, Sancho

by Sancho_P
April 04, 2013

Hmm, I suspected it was the solver.

A note about R2 (and the rest of the circuit): This was an assignment which was meant mostly to get us familiar with different simulation software, rather than to learn something about circuitry. Basically, the assignment was to use "ideal" op-amps to create an amplifier with gain=2, and then hook that amplifier up with negative feedback as if it were itself an op-amp. The goal was to verify our calculations that if you wire up an op-amp with gain=2 as an inverting amplifier with nominal gain -5, you really get a gain of -5/4.

We could spend an arbitrary amount of time discussing the merits of the assignment, but yes, I agree that the actual circuit is pretty useless...

The DC sweep was meant to verify that the output is a linear function of the input. Transient response is not really very useful in this context, since I'm looking for steady-state. (Yes, I know that they are the same in this circuit because there are no complex impedances or delay elements.)

That's really too bad about the solver's limitations. I really like the editor---it's the best one I've worked with recently. Unfortunately, since the solver can't compete with SPICE, I'll have to go back to writing netlists or using poorly-conceived user interfaces...

Any chance of CL being able to output a SPICE netlist any time soon? Because I'd love to use the CL editor if I am still able to run the simulations in SPICE.

by collinstocks
April 04, 2013

@collinstocks,

Welcome to - and possibly farewell from - CL ...

before you go, could you post this explicitly as a bug report?

(Bug reports in:

https://www.circuitlab.com/forums/support/topic/8s9n9hav/how-to-use-the-circuitlab-support-forum/)

:)

CL has come a long way in just over a year but it has a set of solvers that are written from scratch rather than building much on existing spice code. That's a nice idea but I think the guys at CL underestimated the magnitude (and possibly the phase as well) of what they were trying to do.

The CL solvers - and some of the models - still have some serious problems. Some bits work really well: I'm particularly impressed with how well the Laplace block works. Other bits can be less than impressive.

About opamp models in CL.

Please be aware that opamps in CL do not correctly model output voltage and current limit behaviour, nor do they model current drains through the supply pins.

Basically they are very crude models so in many respects, they do not behave like the parts they purport to represent.

If you need that level of accuracy then you need to be using something like:

http://www.linear.com/designtools/software/#LTspice

and much more realistic device models.

FYI:

https://www.circuitlab.com/circuit/7k7nbh/cl-opamp-models-do-not-show-supply-currents/

https://www.circuitlab.com/circuit/vr8fd7/cl-opamps-do-not-model-vout-vs-iout/

If you're feeling really curious, you might like to have a read through this and the rest of the series of articles:

http://masteringelectronicsdesign.com/buildi-an-op-amp-spice-model-from-its-datasheet/

This is another excellent tutorial:

http://qucs.sourceforge.net/docs/opamp.pdf

(BTW, QUCS is a FOSS simulation tool: http://qucs.sourceforge.net/ )

And:

http://www.ecircuitcenter.com/OpModels/OpampModels.htm

(Note that spice netlists from ecircuitcenter can be run here:http://www.ngspice.com/)

Finally, if you've not tried it yet, I would very much recommend you give LTspiceIV a serious pasting.

It's free (though sadly, not FOSS).

It's unlimited.

It's a general purpose spice simulator (in that it can run any unencrypted spice models).

It's mixed mode (it has a small library of highly efficient digital primitives).

It's a native Windows program but runs pretty much flawlessly on Linux and Mac using WINE.

It has a very helpful user group:

http://tech.groups.yahoo.com/group/LTspice/

and there's some good info here:

ltwiki.org

and:

http://ltspice.linear.com/LTspiceWorldTour.zip

Get it from:

http://www.linear.com/designtools/software/#LTspice

by signality
April 05, 2013

Yesterday when investigating the circuit I’ve seen several bad points and started to write them down, today I’ll add the bug reports. But I may have missed (or misinterpreted) some details …

Regards, Sancho

by Sancho_P
April 05, 2013

Thanks for the way you're handling this!

I'm glad you know about LTspiceIV. I've been using it, and I've been very happy with the simulation results (but not so much with the user interface). It's not so bad, though, once you learn some of the keyboard shortcuts.

I'll just sort of add to my wishlist of being able to export a netlist from CircuitLab... The editor interface is certainly very nice, and I would love to continue using it if possible.

by collinstocks
April 05, 2013

The above comment by Ueinfopedia is spam. Maybe there should be a way to report a comment as spam?

by collinstocks
July 02, 2013

Hi @collinstocks, I believe the op-amp simulation issue has now been fixed in our latest set of updates!

by mrobbins
July 09, 2013

@mrobbins, @collinstocks,

Yup. That's fixed.

Well done CL.

by signality
July 10, 2013

Post a Reply

Please sign in or create an account to comment.

Home · My Workbench · Plans & Pricing · Blog · Forums · About Us · Contact Us · FAQ · Terms of Service · Privacy Policy · Twitter ·