How to model an opamp? (the implications on simulation)

It’s a question I always asked myself. Models in SPICE are usually for full models, or you can use a gain voltage gain as well. What are the implications of selecting one model over another for a real time model? Let’s go for the more complex model to the simplest ones. 

The implications on the simulation are not just about precision against the real electronic circuit. It’s also about the simulation speed. The simplest the model, the faster you expect it to be. It may not account for all imperfections, but you may not hear the differences.

There will be still implications on the simulation through the matrix condition number. The higher the number the more unstable the simulation.

A simple simulation

To understand the implications of the matrix condition number, let’s start with a simple model with two voltage dividers. This show how to derive the condition number from the model and what it means.

Let’s start with a simple double voltage divider circuit.

Double Voltage Divider

From there, we get the following system of equations:

\begin{cases} \frac{V-V_{in}}{R} + \frac{V}{R} + \frac{V-V_{out}}{R} = 0 \\ \frac{V_{out}-V}{R} + \frac{V_{out}}{R} = 0\end{cases}

We can simplify this further into:

\begin{cases} \frac{3}{R} V + \frac{-1}{R} V_{out} = \frac{1}{R} V_{in} \\ \frac{2}{R} V_{out} + \frac{1}{R} V = 0\end{cases}

I put all the variable parts on the left side and the input on the right side. From this, we have the parameter matrix [3.618, 1.382]. We get from there a condition number lower than 3, which is very well behaved.

Modeling an opamp

Let’s now look at a simple opamp circuit:

Non-Inverting Circuit

We don’t really care about the values of the resistors, as the circuit basically follows the input voltage. The question is how well?

A not-so-simple model

Let’s start form a model of the opamp that has a resistor between V_+ and V_- and the output is a voltage source set at tanh(G (V_+-V_-)). The non-linear function models everything that happens outside the small-signal range.

The equation system is now:

\begin{cases} (\frac{2}{R}+\frac{1}{R_{op}}) V_+ + \frac{-1}{R_{op}} V_- = \frac{1}{R} V_{in} \\ (\frac{2}{R}+\frac{1}{R_{op}}) V_- + \frac{-1}{R_{op}} V_+ + \frac{-1}{R} V_{out} = 0 \\ -V_{out} + tanh(G (V_+ - V_-)) = 0 \end{cases}

We can check the eigenvalues around 0, with R=100, R_{in}=1000000 and a gain G=20000 and we get [0.02, -45.2143, 44.2343]. Here, we have a condition number that is quite different around 2000, which is very different from the condition number we had earlier.

If we assume that the opamp is saturated, then we get a condition number of “only” 50. Still higher than the first circuit, but it’s a manageable number.

Using a fixed voltage gain

Let’s remove the distortion part as well as the opamp resistor (setting it to infinite). Our matrix doesn’t change that much, and the eigenvalues as such are basically the same at [0.02, -45.2143, 44.2343]. This means that the the input resistor basically has no impact no the result and this approximation is sound.

The same can be said for the distortion. If we keep to the part of the tanh where the linear approximation is correct, then the system is exactly the same.

The actual perfect opamp

The question I always asked myself is that SPICE provides all the above models, but there is no model for the perfect opamp. And it’s a model we use always when we identify that an opamp is in linear mode. When writing equations, you do it with the perfect linear model.

This model is simply V_+ - V_-=0. There is nothing more. The circuit will do what is required to fulfill the equation. But this changes the top eigenvalues tremendously: $latex [0.02, -0.090499, 0.110499] which gives a condition number of 4.5, so just above the simple passive double voltage divider. It’s more stable and it also involves less computations.

Conclusion

The more complex models are interesting and they fulfill a purpose, but the amount of distortion you get from it needs to be measured: there is no point in using this model if you don’t get anything out of it. Additional complexity cost time, as a consequence, using any model must respond to a reason and must have a tangible effect on the end result. If the perfect linear model is enough for you, don’t let SPICE tell you to use a more complex one!

 

Buy Me a Coffee!
Other Amount:
Your Email Address:
Series Navigation

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.