circuitjs1 icon indicating copy to clipboard operation
circuitjs1 copied to clipboard

Potential lead for MOSFET Convergence Errors: Inductor Oscillation

Open OmegaHaxors opened this issue 7 years ago • 4 comments

http://tinyurl.com/y7ffn254

Creating this small circuit causes the MOSFET to ring chaotically when the control voltage is 0. On its own, it's not a harmful bug but I find that too many of these going off at once creates a Convergence Failure.

The example provided is extremely idealistic with its 1M beta and 0 Threshold Voltage, though I think it pinpoints the underlying issue that has been creating countless Convergence errors for me in the past.

OmegaHaxors avatar Nov 08 '17 01:11 OmegaHaxors

If you replace the MOSFET with a 800M resistor (which is what the MOSFET presents itself as when in the off state), you also get oscillations. The oscillations go away when you reduce the timestep to 100n or less even with the MOSFET.

So this seems to be just a case of the CFL condition or something analogous.

aheid avatar Jan 16 '18 18:01 aheid

The oscillations go away when you reduce the timestep to 100n or less even with the MOSFET.

@aheid @sharpie7 I would be good to have a (Github Repo) Wiki page about how to correctly simulate MOSFET's. (How is anyone to know that we need to change the timestep to get correct results?)

E3V3A avatar Feb 25 '19 20:02 E3V3A

@E3V3A As I remember it, the core issue is that very large resistors (and similar) can lead to a very "stiff" system, and the stiffer the system the smaller timestep one need to use. Ideally the simulator should be able to calculate some timestep bounds, ala CFL1, and guide the user to select a maximum viable timestep.

Alternatively I remember wrong and the above is nonsense :)

Until that is in place, it would indeed be nice to document this.

aheid avatar Feb 25 '19 21:02 aheid

You should turn off the trapezoidal approximation checkbox on any inductor attached to a switch, or something that acts like one. This should be documented. It might be good for the simulator to detect this oscillation and warn about it, maybe providing a link the documentation.

pfalstad avatar Feb 26 '19 00:02 pfalstad