What does the error message "cyclic behavior during switching" mean?

Problem description: 

I have tried multiple settings and the waveforms before the error occurs look good. What is the reason for this error and is there anything I can do about it?

Solution: 

The error condition 'Cyclic behavior during switching' means that a switch receives an opening command and a closing command in the same time step, and so PLECS is unable to determine a conduction state. A diode, for instance, might turn on at one instant, because it measures a positive voltage, but after having turned on, the current through it is instantly negative, so it turns off again.

The problem usually arises due to numerical problems, and there is no single recipe against it. Changing the following settings may help:

  • The circuit parameter 'Diode turn-on threshold' is used to delay the natural turn-on instant of diodes and thyristors. Increasing this value (from 0 to 1e-3 or 1e-2) can reduce the chance that the post-turn-on current might be negative. This setting can be found under Simulation > Simulations parameters… (Standalone) or Simulation > PLECS parameters… (Blockset).
  • Tightening the relative tolerance of the solver (from 1e-3 to 1e-5 or 1e-6). This setting can be found under Simulation > Simulations parameters… (Standalone) or Simulation >Simulink parameters… (Blockset).
  • When using the PLECS Blockset, switching from the default Simulink solver 'ode45' to a stiff solver such as 'ode23tb' and, where applicable, setting the 'Solver reset method' to 'Robust'. This setting can be found under Simulation > Simulations parameters… (Standalone) or Simulation >Simulink parameters… (Blockset).