OMPython icon indicating copy to clipboard operation
OMPython copied to clipboard

FMIImport

Open syntron opened this issue 3 months ago • 4 comments

During rework of the last pull request, I noted one of the TODO items:

https://github.com/OpenModelica/OMPython/blob/8a50b5f2d86884a50366fbc99f1180e1813decb6/tests/test_FMIImport.py#L35

Is this really needed for any FMU to import? Are there other possibilities?

I do expect that such a functionality should be possible using only standard Modelica, or?

syntron avatar Nov 19 '25 19:11 syntron

This was added by you in #351

I suppose it should work without it. You can make a PR and see if the test pass.

adeas31 avatar Nov 20 '25 13:11 adeas31

This was added by you in #351

I suppose it should work without it. You can make a PR and see if the test pass.

I know that I added it - at that time I did not ask why it is not working - however, it is still failing; see the checks of my test branch at: https://github.com/syntron/OMPython/actions/runs/19550820822/job/55981548974

Error message:

FAILED 😰  tests/test_FMIImport.py::test_FMIImport - OMPython.ModelicaSystem.ModelicaSystemError: Error executing 'buildModel(M_me_FMU, variableFilter=".*")': OMC error occurred for 'sendExpression(buildModel(M_me_FMU, variableFilter=".*"), True):
00: [translation:error:618] [/tmp/cde47604-2523-4ebd-81ee-cddb62bce9b5/M_me_FMU.mo:false:59:7:59:37] Operator reinit may not be used in an algorithm section (use translation flag --allowNonStandardModelica=reinitInAlgorithms to ignore).

syntron avatar Nov 20 '25 20:11 syntron

The generated Modelica code from FMU uses reinit inside algorithm section which is not allowed anymore. So in order to run this one need to use --allowNonStandardModelica=reinitInAlgorithms.

I guess this won't fix since we use OMSimulator now for importing FMUs. The importFMU API is kind of depreciated and there are no future plans for it.

adeas31 avatar Dec 02 '25 21:12 adeas31

I guess this won't fix since we use OMSimulator now for importing FMUs. The importFMU API is kind of depreciated and there are no future plans for it.

If FMU import in OpenModelica is depreciated what would be the recommended way to load an FMU and extend it by additional code using OpenModelica? As I read the description of OMSimulator is mainly for simulating an FMU; not for the extending part ...

syntron avatar Dec 03 '25 22:12 syntron

see also https://github.com/OpenModelica/OpenModelica/pull/10974 as reference about the status of FMI import

syntron avatar Jan 11 '26 19:01 syntron

See also https://github.com/OpenModelica/OpenModelica/issues/5345

I have no idea if we are going to fix FMI import in future. But for now in order to make it work one need to use --allowNonStandardModelica=reinitInAlgorithms.

adeas31 avatar Feb 04 '26 14:02 adeas31

I have no idea if we are going to fix FMI import in future. But for now in order to make it work one need to use --allowNonStandardModelica=reinitInAlgorithms.

That's a job for MAP-Lang/MAP-Lib. We're working on it.

casella avatar Feb 04 '26 23:02 casella