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

FMU input variables

FMU input variables

I am trying to setup/run an FMU in OpenModelica (r19572), and I have problems attaching source signals to my input variables.

I create a new model and load an instance of my FMU using the "Import FMU" functionality. I'm trying to connect a step source signal to my input variable, which is "continous". When I run the simulation I can plot the values from the FMU output variable, and I can verify that these values are fetched using fmiGetReal. But I never get a call to fmiSetReal for the input which is connected to the step source signal.

What am I doing wrong here?

Re: FMU input variables

There should be a call to

Code:

fmi1Functions.fmi1Set*

in the equation section for your input variables right after

Code:

flowTime = fmi1Functions.fmi1SetTime(fmi1me, time);

I can't tell more without seeing the code.

Adeel.

Re: FMU input variables

I see these declarations in the equation section

Code:


  flowControl = fmi1Functions.fmi1DoStep(fmi1cs, time, communicationStepSize, true);
  {theOutput} = fmi1Functions.fmi1GetReal(fmi1cs, {1.0}, flowControl);

but no fmi1Set*

Here is the imported modeldescription.xml

http://pastebin.com/cn2yb2kt

and here is the generated .mo-file from the import

http://pastebin.com/W9MSYQWc

Re: FMU input variables

Ahh you are trying to import a co-simulation FMU. This is not fully done yet.
Try adding the following line,

Code:

{theInput} = fmi1Functions.fmi1SetReal(fmi1cs, {0.0}, {theInput});

before doStep. Add a trac ticket about it. We don't fully support co-simulation import.

Adeel.

Re: FMU input variables

Hi. I am a new user in openmodelica. I woulld like to know how do yo get this fmu file for Co-simulation by using openmodelica.
When i am trying to export a model , i get a fum file for ModelExchange.
Can you help me please ?

PS: i use the version 1.9.1Beta2

fmu cosimulation OMedit
useravatar
Offline
7 Posts

Re: FMU input variables

I currently get my CoSimulation FMU from another non-modelica export tool. But I am also very interested in exporting CoSimulation modules from OpenModelica when this is available.

Re: FMU input variables

Thank you for replying.

So i can guess it is not yet  available ?

fmu cosimulation OMedit
useravatar
Offline
7 Posts

Re: FMU input variables

Hello,

I noticed the recent released of the latest OpenModelica version (1.9.3) which has a "further improved FMI 2.0 co-simulation support". I installed it and tried to export a Co-Sim FMU 2.0 but I obtained a Model-Exchange FMU 2.0. I looked for an answer in previous forum posts, documentation and papers (that are well detailed in some cases, thank you!) but I did not find answers that could solve my issue.

I am still a rookie with OpenModelica, so is it possible that I missed examples or tutorials?
I understood that your team is still working on FMI 2.0, but is an export of a co-simulation FMU 2.0 possible?
Is it the nature of the modelica model that determine the kind of the FMU between 'Model Exchange ' and 'Co-simulation' or is some special lines needed in the generation code?

Could someone help me on this?

Pierre

PS: I would like to give thanks to the OpenModelica team for its work and documentation.

Edited by: pierreD - Sep-10-15 09:59:58

Re: FMU input variables


FMI-CoSimulation export is on the way, I'm testing it now and hopefully we'll have it next week.


We would need to do some changes to OMEdit to support export of FMI for CoSimulation as currently there is only support for ModelExchange.

Re: FMU input variables

Fine, alright!

There are 0 guests and 0 other users also viewing this topic