I have a rather large model which has two variables:
@variables q, x
that have some equations, let’s say
eqs = [
Differential(t)(x) ~ log(q),
q ~ something
]
After my equations are created x
remains a state variable but q
remains an observable.
When I run the real system as an ODE solve, it turns out that q
becomes negative somehow, even though it shouldn’t, and my solve
errors with domain error and the helpful message of NaN arithmetic. I know I am doing something wrong, coz there is an alternative form of equations that solves. In my real example I have lots of equations, and it doesn’t make sense for me to produce a “MWE”, as removing equations would obviously remove the problem.
My question: Using standard Julia functions, I know how I can track the value of q
as the time evolution progresses. I could add a standard print
statement in the function that would estimate q
.
How do I do something similar? How do I make MTK print the value of q
as it solves the problem, so that there are values of q
I can see before the error is thrown?