libsidplayfp 2.15.0
|
#include <OpAmp.h>
Public Member Functions | |
OpAmp (const std::vector< Spline::Point > &opamp_voltages, double Vddt, double vmin, double vmax) | |
void | reset () const |
double | solve (double n, double vi) const |
Find output voltage in inverting gain and inverting summer SID op-amp circuits, using a combination of Newton-Raphson and bisection.
+---R2--+ | | vi ---R1--o--[A>--o-- vo vx
From Kirchoff's current law it follows that
IR1f + IR2r = 0
Substituting the triode mode transistor model K*W/L*(Vgst^2 - Vgdt^2) for the currents, we get:
n*((Vddt - vx)^2 - (Vddt - vi)^2) + (Vddt - vx)^2 - (Vddt - vo)^2 = 0
where n is the ratio between R1 and R2.
Our root function f can thus be written as:
f = (n + 1)*(Vddt - vx)^2 - n*(Vddt - vi)^2 - (Vddt - vo)^2 = 0
Using substitution constants
a = n + 1 b = Vddt c = n*(Vddt - vi)^2
the equations for the root function and its derivative can be written as:
f = a*(b - vx)^2 - c - (b - vo)^2 df = 2*((b - vo)*dvo - a*(b - vx))
|
inline |
Opamp input -> output voltage conversion
opamp | opamp mapping table as pairs of points (in -> out) |
Vddt | transistor dt parameter (in volts) |
vmin | |
vmax |
|
inline |
Reset root position
double reSIDfp::OpAmp::solve | ( | double | n, |
double | vi | ||
) | const |
Solve the opamp equation for input vi in loading context n
n | the ratio of input/output loading |
vi | input voltage |