ModelingToolkit systems from the XML file

Hi All,

From this link
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!

What kind? CellML?

SBML?

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.

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

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.

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)

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 could be for you.

Are you looking to “convert” somehow Modelica to Julia/MTK code?
Then the presentation “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 is the current incarnation of that work.

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