ModelingToolkit.jl -- intermediate symbolic variables calculated from solutions output in the state vector

When getting a solution from ODEProblem which was created with ModelingToolkit.jl. Is there a way of evaluating symbolic variables/equations that are not in the state vector in plots, etc. Is there an easy way to maybe put the U vector from the solution and reference it back into the symbolic world so it can evaluate through all of the symbols to calculate these intermediate variables that aren’t captured by the solver states?

This is literally the first day I’ve used this toolbox and I’m wondering how to see the rest of the derived world that are not the state variables.

Partial example cut out from larger function:

@variables u(t), v(t), w(t) # Velocity in x,y, and z Axes
...
β = atan(v,u)
...
Cy = Cγβ*β + CγδR * δR
...
Fy = Cy * q̄ * S
...

D(v) ~ Fy / m + (p*w - u*r) + gy,  # v is a state I can see in the solution output

So I have slapped together pieces for an example that probably would not work as is, but I get “v” out in the solution state vector. Fy is a symbolic variable created from “v” and other variables.
After evaluating the solution, how can I put “v” back into this symbolic world and calculate all of my intermediate variables like Fy and Beta.

Noob question I’m sure.

Best Regards,
Allan Baker

Not a noob question because it’s just not complete. You’d make them states and then rely on alias_elimination(sys) to remove the explicit equations. We’re aiming to get a full examples on this in the first week of February so hold your :horse: .

I was wondering if there was an observation field where you could list variables that you would like to track at the output rate. The other thing I was thinking is that I could use some kind of wrapper function to take output state vector and remake the variables if I knew the syntax to evaluate the symbolic variables by substituting back in the calculated states.

observed. But if you do alias elimination it handles all of that automatically. These next two weeks we’re working on the general interface around this.

Have you posted the full example and could you please provide the link?

This is a question from 3 years ago. Everything is in ModelingToolkit now. Just see the documentation: