Diode model not working as expected with ModelingToolkit

The solver you have chosen is compatible, the problem is that no solver can “see” the fact that there is a discontinuity in the dynamics, based on the information it has available (the past, the current point and it’s derivative) it’s safe to take large steps. Suddenly, this is no longer true, but the solver didn’t notice because it stepped too far over the problematic point to notice that there was a problematic point in the first place. When you limit the maximum step size, the solver cannot step far over the discontinuity and the error control notices that something has happened and reduces the step size to accurately handle the discontinuity.

For an analogy, imagine that you’re keeping track of the weather outside. If it’s sunny for several days in a row, you might relax your sample interval slightly and not look outside as often anymore, but then you run the risk of missing the fact that a small storm passes by.

2 Likes