# ODEFunctionExpr and observed variables \[Modeling Toolkit\]

**URL:** https://discourse.julialang.org/t/odefunctionexpr-and-observed-variables-modeling-toolkit/89728
**Category:** Modelling & Simulations
**Tags:** modelingtoolkit
**Created:** [November 3, 2022, 5:30pm UTC](https://discourse.julialang.org/t/odefunctionexpr-and-observed-variables-modeling-toolkit/89728 "2022-11-03T17:30:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![lxsilva](https://avatars.discourse-cdn.com/v4/letter/l/e495f1/32.png) [@lxsilva](https://discourse.julialang.org/u/lxsilva)
#### Post date: [November 3, 2022, 5:30pm UTC](https://discourse.julialang.org/t/odefunctionexpr-and-observed-variables-modeling-toolkit/89728/1 "2022-11-03T17:30:44Z")

</div>

Hello!

so, I’m using MTK as a tool for modeling.

I’m using ModelingToolkitStandardLibrary in order to build my models (great tool btw).

After I build my ODESystem and run “structural\_simplify” I would like to save my models into files such that I can load them in a format suitable for ODEProblem. In this way I hope to avoid building the ODESystem each time I want to use a model.

I found the possibility of building an ODEFunctionExpr or a julia function expr (using generate\_function). Then I can easily save them to a julia file and load them using “include(“myfile.jl”)”.

My problem is that when I do this I’m not able to use the observed variables information anymore…which is a big problem to me. I know that If I build an ODEFunction from my ODESystem I will keep this information, but if I load from file this information is not present anymore.

I digged a bit into the source code and I noticed that in fact when calling the ODEFunctionExpr on my ODESystem the observed variables are indeed left out. Why does this happen? Is this intended? How can I keep/recover the observed variables information?

Thank you in advance!
