ModelingToolkit.jl
ModelingToolkit.jl copied to clipboard
`continuous_events` and `difference_callbacks` fail if states are moved to `observed`
Running limit_example()
from this script produces the error
ERROR: AssertionError: maximum(eq_ind2affect) == length(affect_functions)
As a guess, I changed that ==
to a <=
and got this error:
ERROR: UndefVarError: l₊fixed₊x not defined
Which looks like maybe it can't see observed states? Stack traces here
Hello and thank you for the issue! I believe your idea about the observed equations is correct, I see the same problem in the discrete callbacks for systems with discrete update equations. I'll look into it, the solution will probably be the same in both cases, i.e., reconstructing states from observed equations if required
Hi,
has there be some progress about this issue or a workaround? The issue about observed variables is especially a problem when buildung acausal models. For these models there are many algebraic constraints, even if only a small number of components are used. In my case I want to use the callbacks to handle discontinuous dynamics like diodes to catch the moment if it is blocking or te current starts to flow again.
I also think it is linked to #1409
Thanks for any response.