Circuits that store energy in inductive elements resist rapid current changes. Opening or closing a switch in such a circuit leads to the release of the stored energy, which in real life is often manifested in a spark across the switch terminals, unless an appropriate snubber is supplied.
To model this behavior numerically, one requires a dramatic decrease in the simulation sample time around the event of opening/closing of the switch. This is possible with variable-step continuous solvers, e.g. ODE23TB, which correctly model rapidly decaying current in the circuit at the moment the switch is opened. This is not true for fixed-step solvers. Since the current decay time is usually on the order of one sample time or less, the decay process is undersampled and leads to the numerical instability.
To model the behavior of such a circuit accurately and to prevent the occurrence of the numerical instability, use one of the variable-step solvers. If the use of a fixed-step solver is unavoidable, make sure that the sample time is set low enough to adequately sample the decay process. However, a very small sample time can drastically degrade the overall speed of the simulation.
Best Answer