Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Error:Operator reinit may only be used in the body of a when equation

Error:Operator reinit may only be used in the body of a when equation

I am getting this error when trying to import an FMU and simulate it using OMPython 3.3(OpenModelica 1.17). I have also tried to import the same FMU through OMShell, but got the error "failed to build model". For the same FMU in OMEdit, whenever I click on simulate, I get the same error as OMPython and am prompted to use  the old frontend. When I choose that option, the simulation works fine. Please suggest how to use the old frontend to simulate the FMU using OMPython.

Re: Error:Operator reinit may only be used in the body of a when equation

Well, you could use the command setCommandLineOptions("-d=-newInst") through OMPython. But a better solution would be to fix the code since it is not legal Modelica code.

Re: Error:Operator reinit may only be used in the body of a when equation

@sjoelund.se, we are generating the illegal code when we generate a Modelica model as a wrapper for the FMU.

Re: Error:Operator reinit may only be used in the body of a when equation

@sjoelund.se, OpenModelica version 1.17 by default has -d=newInst enabled. I need to choose the old frontend or any other work around for the abovementioned error. Both the model and fmu are generated in OpenModelica 1.17.

Re: Error:Operator reinit may only be used in the body of a when equation

What if the reinit is inside an Algorithm part?
OMPython is not allowing me to load a Model I built from scratch having this struct. I can run it perfectly in OpenModelica but not from Python (3.8).
Any ideas why?
Thank you in advance

Re: Error:Operator reinit may only be used in the body of a when equation

rasc5 wrote:


What if the reinit is inside an Algorithm part?
OMPython is not allowing me to load a Model I built from scratch having this struct. I can run it perfectly in OpenModelica but not from Python (3.8).
Any ideas why?
Thank you in advance

reinit is only allowed in equations: https://specification.modelica.org/mast … tml#reinit

There are 0 guests and 0 other users also viewing this topic
You are here: