# Ideal diode switching with multiple voltage sources in ModelingToolkit , solver gets stuck at t=0

**URL:** <https://discourse.julialang.org/t/ideal-diode-switching-with-multiple-voltage-sources-in-modelingtoolkit-solver-gets-stuck-at-t-0/137086>\
**Category:** Modelling & Simulations\
**Tags:** modelingtoolkit\
**Created:** [May 12, 2026, 8:24am UTC](https://discourse.julialang.org/t/ideal-diode-switching-with-multiple-voltage-sources-in-modelingtoolkit-solver-gets-stuck-at-t-0/137086 "2026-05-12T08:24:44Z")\
**Posts on this page:** 1\
**Showing post:** 24

<div class="post-metadata">

**Author:** ![pierre-haessig](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pierre-haessig/32/217129_2.png) [@pierre-haessig](https://discourse.julialang.org/u/pierre-haessig)\
**Post date:** [May 13, 2026, 12:54pm UTC](https://discourse.julialang.org/t/ideal-diode-switching-with-multiple-voltage-sources-in-modelingtoolkit-solver-gets-stuck-at-t-0/137086/24 "2026-05-13T12:54:18Z")

</div>

By the way, what is the status of derivative discontinuity detection these days in MTK/Dyad. Would it be now possible to implement a [piecewise linear diode model like I posted back in late 2023](https://discourse.julialang.org/t/ideal-diode-and-ideal-switch-instability-problem/107769/4)?

If not, perhaps it’s possible to blend the smooth-but-ill-conditioned Shockley with a small-but-not-too-small resistance `Ron` in series (to limit the di/dv derivative of the I-V curve when conducting) and a large-but-not-too-large resistance in parallel (to limit reverse voltage when blocked). Or as put in Modelica Standard Library, a small conductance `Goff`.

I feel that using resistive “numerical snubber” is safer than capacitors (unless of course the goal is to model a genuine physical snubber in the circuit), because I find it easier to reason about (how much voltage or current error does it bring for a given forward current or reverse voltage).

---

_[View the full topic](https://discourse.julialang.org/t/ideal-diode-switching-with-multiple-voltage-sources-in-modelingtoolkit-solver-gets-stuck-at-t-0/137086)._
