# Diode model not working as expected with ModelingToolkit

**URL:** <https://discourse.julialang.org/t/diode-model-not-working-as-expected-with-modelingtoolkit/95125>\
**Category:** Modelling & Simulations\
**Tags:** modelingtoolkit\
**Created:** [February 24, 2023, 11:38am UTC](https://discourse.julialang.org/t/diode-model-not-working-as-expected-with-modelingtoolkit/95125 "2023-02-24T11:38:55Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [February 24, 2023, 1:32pm UTC](https://discourse.julialang.org/t/diode-model-not-working-as-expected-with-modelingtoolkit/95125/4 "2023-02-24T13:32:31Z")

</div>

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.

---

_[View the full topic](https://discourse.julialang.org/t/diode-model-not-working-as-expected-with-modelingtoolkit/95125)._
