# Obtaining Odesystem equations in code format from SBML file

**URL:** https://discourse.julialang.org/t/obtaining-odesystem-equations-in-code-format-from-sbml-file/103844
**Category:** New to Julia
**Tags:** question
**Created:** [September 14, 2023, 9:39am UTC](https://discourse.julialang.org/t/obtaining-odesystem-equations-in-code-format-from-sbml-file/103844 "2023-09-14T09:39:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Mies2027](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@Mies2027](https://discourse.julialang.org/u/Mies2027)
#### Post date: [September 14, 2023, 9:39am UTC](https://discourse.julialang.org/t/obtaining-odesystem-equations-in-code-format-from-sbml-file/103844/1 "2023-09-14T09:39:55Z")

</div>

Hi,  
I am new to Julia and have a question regarding ModelingToolkit and SBML.  
I imported an SBML file and converted the model into an ODESystem:

```julia
mdl = readSBML("Kok2020.xml", doc -> begin
    set_level_and_version(3, 2)(doc)
    convert_promotelocals_expandfuns(doc)
end)
odesys = ODESystem(mdl)  
structural_simplify(odesys)

```

However, I am wondering if there is a function to obtain the equations,  
parameters, variables and their values into a code format.  
Namely, I want to add and change the equations for my own adjusted model.  
Currently, the output is in Latex format and prevents me from easily  
changing the equations.  
So I want to obtain this, but than for the SBML model:

```julia
function SIRModel!(du, u, p, t)
  
  # unpack p
  β, γ = p

  # unpack u
  S, I, R = u

  # define equations
  dSdt = -β*I*S
  dIdt = β*I*S - γ*I
  dRdt = γ*I

  du[1:3] = [dSdt, dIdt, dRdt]

  nothing # return nothing
end

u0 = [0.9999, 0.0001, 0.]
p = [0.09, 0.008]

```

Can anyone help me with this?

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [September 14, 2023, 11:29am UTC](https://discourse.julialang.org/t/obtaining-odesystem-equations-in-code-format-from-sbml-file/103844/2 "2023-09-14T11:29:33Z")

</div>

`ODEProblemExpr(sys)` gives the ODEProblem as a Julia expression instead of as the object itself. That’s one tool here.

> [@Mies2027](#):
>
> Namely, I want to add and change the equations for my own adjusted model.

You can check `equations(odesys)` and then create a new equation array that you then create a new system from.
