# Zerocrossing detection with ModelingToolkit

**URL:** <https://discourse.julialang.org/t/zerocrossing-detection-with-modelingtoolkit/99150>\
**Category:** Modelling & Simulations\
**Tags:** question, package, modelingtoolkit\
**Created:** [May 20, 2023, 7:21am UTC](https://discourse.julialang.org/t/zerocrossing-detection-with-modelingtoolkit/99150 "2023-05-20T07:21:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [May 20, 2023, 7:21am UTC](https://discourse.julialang.org/t/zerocrossing-detection-with-modelingtoolkit/99150/1 "2023-05-20T07:21:05Z")

</div>

I Simulink many components have the option to turn “zero crossing detection” on or off, which has a large influence on the simulation time, stability and accuracy.

How is this issue handled in ModelingToolkit?

---

<div class="post-metadata">

**Author:** ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Post date:** [May 20, 2023, 8:22am UTC](https://discourse.julialang.org/t/zerocrossing-detection-with-modelingtoolkit/99150/2 "2023-05-20T08:22:19Z")

</div>

For convenience of readers not familiar with Simulink, let me add that “zero-crossing detection” [as used in Simulink](https://www.mathworks.com/help/simulink/ug/zero-crossing-detection.html) is essentially implemented as [ContinuousCallback](https://docs.sciml.ai/DiffEqDocs/stable/features/callback_functions/#SciMLBase.ContinuousCallback) in DifferentialEquations.jl. The question can boil down to the options of ContinuousCallback used within ModelingToolkit, can’t it?
