Skip to content
Advertisement

How to edit parameters of modelica model with OMPython or Python CLI interface

I want to edit modelica model parameters in Python CLI interface, But don’t know how to find the correct method to make it.

Modelica model code :

JavaScript

Python code :

JavaScript

In a folder i have around 10 text files, I want to run the modelica model for all the text files. How to do that with Python interface. Thanks

Advertisement

Answer

I made this package for testing in HePackage.mo:

JavaScript

Then using this setModifiers.mos script:

JavaScript

You get via running: omc setModifiers.mos:

JavaScript

I used a .mos script but you can use these commands via OMPython.

I don’t know what you need to do, it might be easier to just build another model on the fly at the top level, something like:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement