# Help with ModelingToolkit

**URL:** <https://discourse.julialang.org/t/help-with-modelingtoolkit/72328>\
**Category:** Modelling & Simulations\
**Tags:** modelingtoolkit\
**Created:** [December 1, 2021, 1:07am UTC](https://discourse.julialang.org/t/help-with-modelingtoolkit/72328 "2021-12-01T01:07:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)\
**Post date:** [December 1, 2021, 1:07am UTC](https://discourse.julialang.org/t/help-with-modelingtoolkit/72328/1 "2021-12-01T01:07:31Z")

</div>

I am playing with the `continuous_events` feature in ModelingToolkit and have gotten stuck. My current example is [here](https://gist.github.com/contradict/354fba92fdc7034a1a6ab8ab1dff514c). With ModelingToolkit 7.1.3, running `limit_example()` produces the error

```julia
ERROR: AssertionError: maximum(eq_ind2affect) == length(affect_functions)

```

> **Stacktrace**
>
> ```julia
> Stacktrace:
> [1] generate_rootfinding_callback(cbs::Vector{ModelingToolkit.SymbolicContinuousCallback}, sys::ODESystem, dvs::Vector{Any}
> , ps::Vector{Sym{Real, Base.ImmutableDict{DataType, Any}}}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple
> {}}})
> @ ModelingToolkit ~/.julia/packages/ModelingToolkit/r5ZaU/src/systems/diffeqs/abstractodesystem.jl:207
> [2] generate_rootfinding_callback
> @ ~/.julia/packages/ModelingToolkit/r5ZaU/src/systems/diffeqs/abstractodesystem.jl:163 [inlined]
> [3] #generate_rootfinding_callback#204
> @ ~/.julia/packages/ModelingToolkit/r5ZaU/src/systems/diffeqs/abstractodesystem.jl:159 [inlined]
> [4] generate_rootfinding_callback(sys::ODESystem, dvs::Vector{Any}, ps::Vector{Sym{Real, Base.ImmutableDict{DataType, Any}}
> }) (repeats 2 times)
> @ ModelingToolkit ~/.julia/packages/ModelingToolkit/r5ZaU/src/systems/diffeqs/abstractodesystem.jl:157
> [5] (ODEProblem{true})(sys::ODESystem, u0map::Dict{Num, Float64}, tspan::Tuple{Float64, Float64}, parammap::SciMLBase.NullP
> arameters; callback::Nothing, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
> @ ModelingToolkit ~/.julia/packages/ModelingToolkit/r5ZaU/src/systems/diffeqs/abstractodesystem.jl:658
> [6] (ODEProblem{true})(sys::ODESystem, u0map::Dict{Num, Float64}, tspan::Tuple{Float64, Float64}, parammap::SciMLBase.NullP
> arameters) (repeats 2 times)
> @ ModelingToolkit ~/.julia/packages/ModelingToolkit/r5ZaU/src/systems/diffeqs/abstractodesystem.jl:655
> [7] ODEProblem(::ODESystem, ::Dict{Num, Float64}, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{()
> , Tuple{}}})
> @ ModelingToolkit ~/.julia/packages/ModelingToolkit/r5ZaU/src/systems/diffeqs/abstractodesystem.jl:634
> [8] ODEProblem(::ODESystem, ::Dict{Num, Float64}, ::Vararg{Any})
> @ ModelingToolkit ~/.julia/packages/ModelingToolkit/r5ZaU/src/systems/diffeqs/abstractodesystem.jl:634
> [9] limit_example()
> @ Main ~/Desktop/PneumaticServoSimulation/limited_oscillator.jl:135
> [10] top-level scope
> @ REPL[52]:1
> 
> ```

I only add 2 conditions and one affect, `maximum(eq_ind2affect) = [9, 9]` and `length(affect_functions) = 11`, so I tried changing that `==` to a `<=` and got this error

`ERROR: UndefVarError: l₊fixed₊x not defined`

> **Stacktrace**
>
> ```julia
> Stacktrace:
> [1] macro expansion
> @ ~/.julia/packages/SymbolicUtils/fgHzN/src/code.jl:346 [inlined]
> [2] macro expansion
> @ ~/.julia/packages/Symbolics/LTmGT/src/build_function.jl:344 [inlined]
> [3] macro expansion
> @ ~/.julia/packages/SymbolicUtils/fgHzN/src/code.jl:304 [inlined]
> [4] macro expansion
> @ ~/.julia/packages/RuntimeGeneratedFunctions/KrkGo/src/RuntimeGeneratedFunctions.jl:129 [inlined]
> [5] macro expansion
> @ ./none:0 [inlined]
> [6] generated_callfunc
> @ ./none:0 [inlined]
> [7] (::RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xb4060ebc, 0x19d998a6, 0x7ea3327b, 0x99119623, 0x0258bc73)})(::SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, ::Vector{Float64}, ::Vector{Float64}, ::Float64)
> @ RuntimeGeneratedFunctions ~/.julia/packages/RuntimeGeneratedFunctions/KrkGo/src/RuntimeGeneratedFunctions.jl:117
> [8] #1247
> @ ~/Desktop/PneumaticServoSimulation/dev/ModelingToolkit/src/systems/diffeqs/abstractodesystem.jl:200 [inlined]
> [9] determine_event_occurance
> @ ~/.julia/packages/DiffEqBase/b1nST/src/callbacks.jl:503 [inlined]
> [10] find_callback_time(integrator::OrdinaryDiffEq.ODEIntegrator{Rodas5{5, true, DefaultLinSolve, Val{:forward}}, true, Vector{Float64}, Nothing, Float64, Vector{Float64}, Float64, Float64, Float64, Float64, Vector{Vector{Float64}}, ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Base.Pairs{Symbol, VectorContinuousCallback{ModelingToolkit.var"#1247#1257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xb4060ebc, 0x19d998a6, 0x7ea3327b, 0x99119623, 0x0258bc73)}}, ModelingToolkit.var"#1249#1259"{Vector{Function}, Vector{Int64}}, ModelingToolkit.var"#1249#1259"{Vector{Function}, Vector{Int64}}, typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Int64, Rational{Int64}, Nothing, Int64}, Tuple{Symbol}, NamedTuple{(:callback,), Tuple{VectorContinuousCallback{ModelingToolkit.var"#1247#1257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xb4060ebc, 0x19d998a6, 0x7ea3327b, 0x99119623, 0x0258bc73)}}, ModelingToolkit.var"#1249#1259"{Vector{Function}, Vector{Int64}}, ModelingToolkit.var"#1249#1259"{Vector{Function}, Vector{Int64}}, typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Int64, Rational{Int64}, Nothing, Int64}}}}, SciMLBase.StandardODEProblem}, Rodas5{5, true, DefaultLinSolve, Val{:forward}}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Rosenbrock5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, OrdinaryDiffEq.Rodas5Tableau{Float64, Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Vector{Float64}, Vector{Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, DefaultLinSolve, SparseDiffTools.ForwardColorJacCache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.UJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 5}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.UJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 5}}, Vector{Float64}, Vector{Vector{NTuple{5, Float64}}}, UnitRange{Int64}, Nothing}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.TimeGradientWrapper{ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Vector{Float64}, Vector{Float64}}, Float64}, Float64, 1}}}}, DiffEqBase.DEStats}, ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, OrdinaryDiffEq.Rosenbrock5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, OrdinaryDiffEq.Rodas5Tableau{Float64, Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Vector{Float64}, Vector{Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, DefaultLinSolve, SparseDiffTools.ForwardColorJacCache{Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.UJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 5}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.UJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 5}}, Vector{Float64}, Vector{Vector{NTuple{5, Float64}}}, UnitRange{Int64}, Nothing}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.TimeGradientWrapper{ODEFunction{true, ModelingToolkit.var"#f#257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7ff80265, 0xa9a09f24, 0xa8f50969, 0x1a051df2, 0x181b4495)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x9489f5b8, 0x014f951b, 0xed2d7d75, 0xb0e2f583, 0x7d558f98)}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#239#generated_observed#264"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Vector{Float64}, Vector{Float64}}, Float64}, Float64, 1}}}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{VectorContinuousCallback{ModelingToolkit.var"#1247#1257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xb4060ebc, 0x19d998a6, 0x7ea3327b, 0x99119623, 0x0258bc73)}}, ModelingToolkit.var"#1249#1259"{Vector{Function}, Vector{Int64}}, ModelingToolkit.var"#1249#1259"{Vector{Function}, Vector{Int64}}, typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Int64, Rational{Int64}, Nothing, Int64}}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Vector{Float64}, Float64, DiffEqBase.CallbackCache{Vector{Float64}, Vector{Float64}}, OrdinaryDiffEq.DefaultInit}, callback::VectorContinuousCallback{ModelingToolkit.var"#1247#1257"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:??out, :??arg1, :??arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xb4060ebc, 0x19d998a6, 0x7ea3327b, 0x99119623, 0x0258bc73)}}, ModelingToolkit.var"#1249#1259"{Vector{Function}, Vector{Int64}}, ModelingToolkit.var"#1249#1259"{Vector{Function}, Vector{Int64}}, typeof(DiffEqBase.INITIALIZE_DEFAULT), typeof(DiffEqBase.FINALIZE_DEFAULT), Float64, Int64, Rational{Int64}, Nothing, Int64}, counter::Int64)
> @ DiffEqBase ~/.julia/packages/DiffEqBase/b1nST/src/callbacks.jl:734
> [11] find_first_continuous_callback
> @ ~/.julia/packages/DiffEqBase/b1nST/src/callbacks.jl:466 [inlined]
> 
> Truncated due to discourse message size limits.
> 
> ```

Any idea what has gone wrong? Is the change to the assert valid? I’m still trying to sort this one out but I’m not sure why it can’t see that variable.

---

<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:** [December 1, 2021, 1:34pm UTC](https://discourse.julialang.org/t/help-with-modelingtoolkit/72328/2 "2021-12-01T13:34:28Z")

</div>

Please open an issue on the MTK repository

---

<div class="post-metadata">

**Author:** ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)\
**Post date:** [December 1, 2021, 6:14pm UTC](https://discourse.julialang.org/t/help-with-modelingtoolkit/72328/3 "2021-12-01T18:14:39Z")

</div>

Issue [here](https://github.com/SciML/ModelingToolkit.jl/issues/1396)
