Message Boards Message Boards

0
|
6569 Views
|
9 Replies
|
2 Total Likes
View groups...
Share
Share this post:

FMU generated by SM does not run in Simulation Center

Posted 3 years ago

I exported a model to FMU that depends on external files to work, but when I run it the simulation center does not compute variables, it just show parameters. If I run normally the modelica file it runs fine, but when I load the FMU generated by the same System Modeler the problem occurs. I've put the external files in system modeler working directory.

The model represents a Hybrid Electric Vehicle and it comes inside a package with a library. The Package comes with many other models. I simulated and exported the "SHEVpowerFiltSocOO" model. I modified it a little bit so that it have a real output now (outputs battery SOC variable). The picture below shows the expected result (run normally): SOC variable expected behavior

But when I load the FMU version and run it shows: SOC variable wrong behavior

The SOC variable was just for example, but other variables have the same issue.

The FMU is the 2.0 version for Co-Simulation. I've attached the package, lib and external files (.txt).

The original package is here: http://omwebbook.openmodelica.org/SMEHV

The only modification was the SOC_Output variable, which is just a Real Output interface with causality as output.

POSTED BY: Michel Oliveira
9 Replies

For a co simulation FMUs the FMU and Modelica model exchange input/outputs at discrete communication points. The FMU wrapper in System Modeler offers two ways of controlling that, using an externa trigger signal (useTriggerInput_=true) or periodically with the step size given by step_ (useTriggerIntput_false).

POSTED BY: Otto Tronarp

For a co simulation FMUs the FMU and Modelica model exchange input/outputs at discrete communication points. The FMU wrapper in System Modeler offers two ways of controlling that, using an externa trigger signal (useTriggerInput_=true) or periodically with the step size given by step_ (useTriggerIntput_false)

Got it, but are the "step" and "stepTrigger" variables that appear in modelica code of the imported FMU created by SM at the time it opens or are they in some "hidden place" in the FMU? I'm asking because I'm developing an application where I execute SM FMU's.

POSTED BY: Michel Oliveira

Got it, but are the "step" and "stepTrigger" variables that appear in modelica code of the imported FMU created by SM at the time it opens or are they in some "hidden place" in the FMU? I'm asking because I'm developing an application where I execute SM FMU's.

No they are not part of the FMU, they are part of the Modelica wrapper that is generated when you import an FMU into System Modeler. So you would get them for every imported co-simulation FMU regardless of the tool used to produce the FMU.

Otto

POSTED BY: Otto Tronarp

I'm suspecting you are simulating the imported FMU with useTriggerInput_=true, but without anything connected to the trigger. You could connect it to a BooleanPulse or SampleTrigger, but the easiest solution is to simply set the useTriggerInput_=false and specify a step_ size.

enter image description here

I hope that helps.

Otto

POSTED BY: Otto Tronarp

Hi Otto, Thanks for the response, I've attached the files that I modified and used. the difference is highlighted on the image below. enter image description here

I'm using System Modeler 12.1, where can I find those simulation options?

POSTED BY: Michel Oliveira

I'm using System Modeler 12.1, where can I find those simulation options?

It's a parameter in the model that is generated when you import the FMU. So you should get that Co-simulation tab when you open the generated model.

Otto

POSTED BY: Otto Tronarp

I found the tab here, set the parameters as you said and it worked! My bad! Thanks for the help Otto!

Michel

POSTED BY: Michel Oliveira

Hi again, I was wondering what the

useTriggerInput_

parameter means? is it a kind of enable signal generator for the solver?

in the FMU that I generated in systemModeler there is a variable:

Interfaces_.Boolean_DiscreteInput stepTrigger_ if useTriggerInput_  >>;

I noticed that SM just generate it if the FMU is for Co-Simulation. So if I'm correct it is a synchronization mechanism for other programs or process that simulate other part of the system.

POSTED BY: Michel Oliveira

Hi,

I cannot reproduce your issue, for me it works (tested with 12.2). Perhaps it's best if you publish the actual model that you used (including the modification).

Otto

enter image description here

POSTED BY: Otto Tronarp
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract