I’ve always wanted to reverse engineer the formulas that EC uses to simulate MOSFETs but I never did manage to do it until now. So, I’m posting my results here in this save which contains all the equations that EC uses to simulate a MOSFET. Also note that all the explanations and equations below are for N-type MOSFETs. P-type MOSFETs are exactly the same except all the voltages and currents are reversed, so N- and P-type MOSFETs have the same relationship to each other as NPN and PNP bipolar transistors (BJTs).
First, some terminology. MOSFETs have a drain, gate, and source, which roughly correspond to the collector, base, and emitter of a bipolar transistor. However, unlike a bipolar transistor, EC MOSFETs are symmetrical. That is to say, EC makes no distinction between drain and source. The drain is simply whichever of the two terminals is at a higher voltage and the source is the other terminal. This means that you can flip all the MOSFETs on every circuit you have ever made and EC will simulate them identically. This is not how they work in real life and doing so on real circuits will cause the circuits to fail because of the internal body diode that EC doesn’t simulate. This body diode is a consequence of how the MOSFETs are constructed and is effectively a diode between the source and drain and allows current to flow from the source to the drain if the source is at a higher voltage than the drain (although as per usual for a diode it does need at least 0.7V or so to start conducting).
Now it’s time for some math. First I need to define the variables. The voltages at the drain, gate, and source are D, G, and S respectively. Length, Width, KP, VTO, and Lambda are the parameters of the MOSFET. These are the variables I’ll be using in the equations:
V = D - S (this is the drain to source voltage. Also note that because of the way drain and source are defined this number is never negative)
Vg = G - S - VTO (this is how many volts the gate is above the activation voltage)
K = Width / Length * KP / 2 (I call this the transconductance)
L = Lambda
Now for the equations. When V < Vg the current is defined by this equation:
-K*L*(V^3) + K*(2*L*Vg - 1)*(V^2) + 2*K*Vg*V
And when V > Vg the current is defined by this equation:
K*(Vg^2)*(L*V + 1)
When V = Vg then both equations give the same result.
When Lambda is zero and V > Vg then the current is simply:
K*(Vg^2)
In this case the current does not depend on V. In reality the current does in fact depend on V even when V > Vg so no real MOSFET has a Lambda of 0.
When V << Vg (V is much less than Vg) then the MOSFET can be treated like a resistor. The resistance is determined by this formula:
1/(2*K*Vg)
So if the K is 295μA/V^2 (assuming a width of 1μm, a length of 200nm, and a KP of 118μA/V^2) and Vg is 1V (which would correspond to a gate to drain voltage of 1.43V assuming a VTO of 430mV) then the effective resistance for very small values of V would be about 1.7kΩ (actually 1.695kΩ to be a bit more precise).
A Desmos graph of these equations can be found here: https://www.desmos.com/calculator/4nk4x8fllg
|