# ModelingToolkit systems from the XML file

**URL:** https://discourse.julialang.org/t/modelingtoolkit-systems-from-the-xml-file/80991
**Category:** Modelling & Simulations
**Tags:** sciml, modelingtoolkit, fmiexport
**Created:** [May 13, 2022, 3:50am UTC](https://discourse.julialang.org/t/modelingtoolkit-systems-from-the-xml-file/80991 "2022-05-13T03:50:33Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mzhenirovskyy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzhenirovskyy/32/7549_2.png) [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)
#### Post date: [May 13, 2022, 3:50am UTC](https://discourse.julialang.org/t/modelingtoolkit-systems-from-the-xml-file/80991/1 "2022-05-13T03:50:33Z")

</div>

Hi All,

From this link  
[https://help.juliahub.com/JuliaSim/Tutorials/FMUs/](https://help.juliahub.com/JuliaSim/Tutorials/FMUs/)  
I can see that we can generate FMU and XML from ModelingToolkit.  
The question is: can we do a vice verse, get ModelingToolkit systems from the XML file.

Thanks!

---

<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: [May 13, 2022, 9:14am UTC](https://discourse.julialang.org/t/modelingtoolkit-systems-from-the-xml-file/80991/2 "2022-05-13T09:14:18Z")

</div>

> [@mzhenirovskyy](#):
>
> The question is: can we do a vice verse, get ModelingToolkit systems from the XML file.

What kind? CellML?

> **[GitHub - SciML/CellMLToolkit.jl: CellMLToolkit.jl is a Julia library that...](https://github.com/SciML/CellMLToolkit.jl)**
>
> CellMLToolkit.jl is a Julia library that connects CellML models to the Scientific Julia ecosystem. - GitHub - SciML/CellMLToolkit.jl: CellMLToolkit.jl is a Julia library that connects CellML models...

SBML?

> **[GitHub - SciML/SBMLToolkit.jl: SBML differential equation and chemical...](https://github.com/SciML/SBMLToolkit.jl)**
>
> SBML differential equation and chemical reaction model (Gillespie simulations) for Julia's SciML ModelingToolkit - GitHub - SciML/SBMLToolkit.jl: SBML differential equation and chemical reactio...

Both of those are XML files. Saying just XML is a bit overloaded so you’d have to specify which XML-based markdown language you were looking for.

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [May 13, 2022, 12:11pm UTC](https://discourse.julialang.org/t/modelingtoolkit-systems-from-the-xml-file/80991/3 "2022-05-13T12:11:05Z")

</div>

Well, I guess the FMI standard is pretty well defined: [https://fmi-standard.org/](https://fmi-standard.org/)

---

<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: [May 13, 2022, 12:12pm UTC](https://discourse.julialang.org/t/modelingtoolkit-systems-from-the-xml-file/80991/4 "2022-05-13T12:12:41Z")

</div>

Nothing in the first post mentions that it should be the XML that goes with an FMU though, and note that the XML which goes with an FMU is just metadata and cannot define a ModelingToolkit system because it does not have any symbolic description of the system (the only system implementation in an FMU is a binary), so I think that’s not the XML OP is looking to use.

---

<div class="post-metadata">

### Author: ![mzhenirovskyy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzhenirovskyy/32/7549_2.png) [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)
#### Post date: [May 14, 2022, 3:32am UTC](https://discourse.julialang.org/t/modelingtoolkit-systems-from-the-xml-file/80991/5 "2022-05-14T03:32:50Z")

</div>

I’m asking this question because I’m looking for a way to import Modelica source code to Julia. I think about the following workaround - I can create an XML - file from Open Modelica (e.g. with python script) and then import it to Julia.

But it seems OpenModelica doesn’t support either CellML or SBML…  
It has a different XML format (the command I use is - dumpXMLDAE)

---

<div class="post-metadata">

### Author: ![bilderbuchi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bilderbuchi/32/13562_2.png) [@bilderbuchi](https://discourse.julialang.org/u/bilderbuchi)
#### Post date: [May 14, 2022, 8:02am UTC](https://discourse.julialang.org/t/modelingtoolkit-systems-from-the-xml-file/80991/6 "2022-05-14T08:02:53Z")

</div>

> I’m looking for a way to import Modelica source code to Julia

Are you looking for driving Modelica source/models from Julia? (I think not)  
Then [GitHub - OpenModelica/OMJulia.jl: Julia scripting OpenModelica interface](https://github.com/OpenModelica/OMJulia.jl) could be for you.

Are you looking to “convert” somehow Modelica to Julia/MTK code?  
Then the [presentation](https://ecp.ep.liu.se/index.php/modelica/article/view/186) “OpenModelica.jl: A modular and extensible Modelica compiler framework in Julia targeting ModelingToolkit.jl” could be relevant (AFAIK this is work in progress).  
Maybe as one of the steps generated Julia source code will be accessible.  
Edit: Probably [this](https://github.com/JKRT/OM.jl) is the current incarnation of that work.

---

<div class="post-metadata">

### Author: ![mzhenirovskyy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzhenirovskyy/32/7549_2.png) [@mzhenirovskyy](https://discourse.julialang.org/u/mzhenirovskyy)
#### Post date: [May 16, 2022, 7:36pm UTC](https://discourse.julialang.org/t/modelingtoolkit-systems-from-the-xml-file/80991/7 "2022-05-16T19:36:19Z")

</div>

> [@bilderbuchi](#):
>
> Are you looking to “convert” somehow Modelica to Julia/MTK code?

Yep, I’m looking to convert Modelica src to Julia/MTK code.
