Is there any way to import a Model from Modelica-file to Julia lang? I mean I have the model in the Modelica that can be simulated by Dymola. Of course, I can get the fmu compiled file and load it to Julia.
But can I get a Model from the Modelica source code? I’m looking for something like a Modelica lang parser…
Yep,
I’m looking for a way to import the equations from the Modelica source to Julia to make it possible to do gradient-based (Jacobian-based) optimization, sensitivity analysis, etc.
It’s not released yet. The packages for it are all private right now. The lead author’s thesis defense is next month and it should follow that, but I assume he’s pretty busy getting it all done right now .
That’s a Julia interface to OpenModelica, which is different from what (was) called OpenModelica.jl which is a Modelica parser to ModelingToolkit intermediate representation.
The other thing is that the ModelingToolkit Standard Library is becoming fairly complete to the Modelica Standard Library.
So while the auto-translation tooling is neat, this will likely be the direction more people will want to go to reduce maintenance and improve flexibility. We’re making sure that the pieces that overlap with the MSL are close enough to make translations simple.
Besides the standard library, there are other extensive domain specific Modelica libraries where translation would help a lot. But I don’t know whether the mentioned “translator” can only translate the standard library or was only tested for the standard library in the paper, but is generally applicable to any Modelica model or whether it makes any difference.
That’s why some of the stuff we’re working on as part of JuliaSim are proprietary domain-specific libraries, similar to what has been developed in the Modelica universe. Of course, our competitive advantage is that we have complete control over the symbolic and numeric stack to make sure the entire system is optimized for these domains, so more details on this of course coming later. But yes, the ModelingToolkitStandardLibrary.jl repo serves as a lighthouse to show other developers a good way to build MTK-based component libraries, and then we are building a bunch of such domain-specific component libraries for areas where we see we can innovate and have clear customers.
The translator is something that could in theory work in some cases, for example may on the Modelica Buildings library, but I’m not sure. Some of those libraries are using such specific features that they are supported by Dymola but not OpenModelica, so I think it would take quite a bit to get the more difficult libraries to work in such a system. But we are watching closely how this is evolving (and helping out of course), so we’ll have to see how well the transpilation can do.
In my domain (power system dynamics) it is actually the industry who pushes the open source approach. Power systems are extremely large, complicated (more and more distributed renewable generation) and operated by various entities (system operators). The interconnected parts interfere with each other. So system operators aim to have open source models to guarantee a certain standard and reliable simulation outcome. It would be chaos (well actually is atm) if each of them uses a different proprietary and closed software.
So far these open source efforts use mainly OpenModelica (though there are efforts in Julia such as PowerSimulationsDynamics.jl). Having a “translator” helps as a first step to switch to SciML and MTK. Whether this is sustainable in the long run in terms of maintenance remains to be seen, but it is at least an argument that can be made when trying to convince OpenModelica users to switch.
In my area, we have the different (multiphysics) models mostly done in Modelica/Dymola (we use standard Modelica libs) and our main challenge is the optimization of such models (parameters estimations, etc), so it will be great if we can use very advanced Julia mathematical optimization libs.
I am the author of OM.jl. Things are proceeding I am currently working on some new features and standard library functionality, quite recently I managed to get a large subset of the MSL working in the frontend. I have some of this features on experimental branches at the moment. If you are interested in using testing them send me an email and I can help you set it up!
Hi @JKRT , my target pipeline is to convert Modelica files to Julia and then use gradient-based optimization on Julia’s side. Does your Library support gradient-based calculations from Julia based on the ReverseDiff/ForwardDiff?