0

I am trying to export a couple of models from OpenModelica as FMU 2.0 for Model Exchange.

In order to check the generated FMUs I import them back to OpenModelica and simulate there. Everything works well with simple continuous systems like a single integrator or series connection of the first order filters. However the blocks with triggered events, e.g. a standard modelica block "Modelica.Blocks.MathInteger.TriggeredAdd", don't work within FMU. Their output remains zero unaffected from inputs. It seems that I am doing something wrong but I have no idea what exactly. Please help me :) Here is an example code for exported model:

model trig_int_sum

Modelica.Blocks.MathInteger.TriggeredAdd triggeredAdd1 annotation(...);  
Modelica.Blocks.Interfaces.IntegerInput u annotation(...);
Modelica.Blocks.Interfaces.BooleanInput u1 annotation(...);   
Modelica.Blocks.Interfaces.IntegerOutput y annotation(...);

equation
connect(y, triggeredAdd1.y) annotation(...);
connect(triggeredAdd1.u, u) annotation(...);
annotation(...);

end trig_int_sum;
Paha_X
  • 1
  • 1

1 Answers1

0

FMU import in Modelica does not work very well (numerical issues such as this one) due to the Modelica language being decoupled from the numerical solvers, so the import cannot be very precise unless Modelica extensions are used (and OpenModelica does not add any extensions just to be able to import FMUs). Test the FMU in OMSimulator instead - it knows about FMUs.

sjoelund.se
  • 3,468
  • 12
  • 15
  • Thank you for your answer. The problem is that the exported FMUs are planned to be used in Modelica-based simulator. Could you suggest a tool for FMU-export that will allow the import of Model-Exchange FMU in Modelica? – Paha_X Feb 02 '19 at 20:17
  • Exporting Modelica models to be used as FMUs is not a problem. It's importing FMUs in a Modelica tool that is problematic. That's why OpenModelica now comes with the OMSimulator tool which is written to simulate connected FMUs (so you can export the Modelica model as FMU and use other FMUs to co-simulate them). – sjoelund.se Feb 03 '19 at 09:13