OMPython icon indicating copy to clipboard operation
OMPython copied to clipboard

How to use `ModelicaSystem.convertFmu2Mo()`

Open ondras12345 opened this issue 8 months ago • 4 comments

I haven't found any examples or tests for it.

Do I really have to create a dummy .mo model file, load it and compile it (see ModelicaSystem.__init__()) just to convert a *.fmu to a *.mo? At first glance, I think this function would be easier to use if it was a @classmethod that constructed a ModelicaSystem from the FMU.

ondras12345 avatar Jun 14 '25 23:06 ondras12345

@ondras12345 here is a test case which does that https://github.com/OpenModelica/OMPython/blob/master/tests/test_FMIExport.py

arun3688 avatar Jun 17 '25 08:06 arun3688

Isn't that the other way around? I see convertMo2Fmu() in the test case, but I was asking about convertFmu2Mo().

ondras12345 avatar Jun 17 '25 18:06 ondras12345

Here it could help to split ModelicaSystem.__init__() into two parts:

(1) basic setup of the class and (2) definition of all model related options (fileName, modelName, lmodel, variableFilter (?), build)

Thus, one could run __init__ and after that a new method handling part (2) or convertFmu2Mo() (as method or defined as @classmethod returning a ModelicaSystem on its own; however, in the later case, the options for (1) must be provided)

syntron avatar Aug 23 '25 18:08 syntron

@syntron is this already fixed?

adeas31 avatar Dec 02 '25 21:12 adeas31