Search code examples
modelicaopenmodelica

Options for batch running OpenModelica models automatically with parameter sweep?


I'm looking for a recommendation on how to run parameter sweeps to optimise/tweak an OM model, in terms of what is possible and how difficult it is to go about it.

From what I understand, there are three options that present themselves - OMOptim, OMPython and some arrangement involving iterators/for loops inside a typical OM model. And I think I've seen another alternative where OM is invoked through the command line with a text file describing commands.

Unfortunately, it appears that OmOptim from the 1.18 OpenModelica release does not run (and is a known issue according to the OM forums). That leaves me a few complicated options to absorb and implement in a short time.

My list of required features is really rather short - automatic running of simulations with some parameters changed from simulation to simulation; and automated generation of a CSV output of results.

If there are any particular advantages to one method or another I'd be happy to hear them.


Solution

  • Write a mos-script and run it through the command line is the easiest option available. See an example of such a mos-script here https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/scripting_api.html#simulation-parameter-sweep