The FMU does not simulate on the first try but on the second

2 posts / 0 new
Last post
Joined: 2014-06-03
The FMU does not simulate on the first try but on the second

I have generated an FMU from Dymola 2014 FD01 32-bit (FMI 1.0 for model exchange) and I want to use PyFMI to simulate the FMU. At the first attempt with model.simulate I get an error, i.e. it does not simulate. When I then try model.simulate again, it simulates (still with a warning from the initialization). The FMU is attached.

1) Why does it run the second time, but not the first? I will run the FMU using PyFMI from another application and it has to simulate on the first try.

2) How do I get information of the cause of the error? I can not get any information from model.get_log(), how does this work? I have tried to enable logging with model.set_debug_logging(True), but without success (I'm a Python novice).

See python commands and the following error at the first attempt with model.simulate:

>>> from pyfmi import load_fmu
>>> model = load_fmu('CMDO_DTG.fmu')
>>> res = model.simulate(final_time=50)
WARNING:root:Initialize returned with a warning. Check the log for information (FMUModel.get_log).
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "fmi.pyx", line 2800, in pyfmi.fmi.FMUModelME1.simulate (src\pyfmi\fmi.c:24731)
  File "fmi.pyx", line 258, in pyfmi.fmi.ModelBase._exec_simulate_algorithm (src\pyfmi\fmi.c:4497)
  File "C:\Python27\lib\site-packages\pyfmi\", line 660, in solve
    self.simulator.simulate(self.final_time, self.ncp)
  File "ode.pyx", line 129, in assimulo.ode.ODE.simulate (assimulo\ode.c:4530)
  File "ode.pyx", line 243, in assimulo.ode.ODE.simulate (assimulo\ode.c:4121)
  File "explicit_ode.pyx", line 101, in assimulo.explicit_ode.Explicit_ODE._simulate (assimulo\explicit_ode.c:3560)
  File "explicit_ode.pyx", line 204, in assimulo.explicit_ode.Explicit_ODE._simulate (assimulo\explicit_ode.c:3206)
  File "C:\Python27\lib\site-packages\pyfmi\simulation\", line 327, in handle_event
  File "fmi.pyx", line 2537, in pyfmi.fmi.FMUModelME1.event_update (src\pyfmi\fmi.c:23521)
pyfmi.fmi.FMUException: Failed to update the events.

Joined: 2014-06-03
Comment to previous post:

When I import the FMU in Dymola i get the follownig warning: 

The initial conditions for variables of type Real are not fully specified.
Dymola has selected default initial conditions.

Assuming fixed start value for the discrete states:
fmi_TNext(start = fmi_TNext_Start)

Login or register to post comments