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
  • Index
  • » Users
  • » jakesson
  • » Profile

Posts

Posts

Ok, sounds good.

Best
/Johan

Hello,

it seems that you did not install the Assimulo package, which is a dependency of PyFMI. Assimulo is available from www.assimulo.org - can you try again after installing Assimulo?

PyFMI provides the FM import functionality, whereas the Assimulo package provides the integrators.

Let me know how it goes.

Best regards
/Johan

Dear all,

I tried the FMI export from OpenModelica 1.8.1 beta with the Python packages PyFMI (www.pyfmi.org) and Assimulo (www.assimulo.org) to test scripting of simulations of OpenModelica models in Python. PyFMI is a general purpose package for loading and interacting with compiled models compliant with the Functional Mock-up Interface standard (FMI), and Assimulo is a Python simulation package that interfaces several state of the art integrators, including IDAS and CVODES from the SUNDIALS suite and Hairer's Radau codes. Also, sensitivity analysis is supported by Assimulo. Together, the packages offer Python scripting of simulations as a complement to FMI compliant modeling tools.

When I first tested the functionality, I used a nightly build (r10787), and with this version, simulation works, apart from a minor issue: the name of the dll file should according to the FMI spec use the <modelIdentifier> string from the XML file, which is not the case in the FMUs generated by OpenModelica.  We have added a temporary workaround in PyFMI (http://trac.jmodelica.org/ticket/1758) so that OpenModelica FMUs can be used with PyFMI.

In OpenModelica 1.8.1 beta, there seems to be a bug in that there is a parameter value that is set to zero in the FMU:

In [34]: m=FMUModel('Simple.fmu')
In [35]: res=m.simulate(final_time=10)
ERROR: Division by zero in partial equation: (firstorder1.k * sine1.y - firstorder1.y) / firstorder1.T because firstorder1.T == 0.

The model I tried is the following:

model Simple
  Modelica.Blocks.Sources.Sine sine1;
  Modelica.Blocks.Continuous.FirstOrder firstorder1;
equation
  connect(sine1.y,firstorder1.u);
end Simple;

Hope this helps!

Best regards
/Johan

  • Index
  • » Users
  • » jakesson
  • » Profile
You are here: