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

Modelica model simulating successfully in OMEdit but not as FMU

Modelica model simulating successfully in OMEdit but not as FMU

I am trying to export and simulate a model with the CVode solver.
If I simulate the model in OMEdit (Windows) using CVode the simulation finishes successfully, even if I use something like a rectangular pulse as input. However, if I export the model as FMU (via omc on Linux) with CVode simulation flag I get the following Error after some time:

[CVODE ERROR] CVode tout too close to t0 to start integration.
fmi2DoStep: ##CVODE## -27 error occurred at time = 1.001.Traceback (most recent call last):
...
Exception: fmi2DoStep failed with status 4.

To export the FMU I am using sundials-5.7.0 and for OMEdit OpenModelica1.17.0.

To my knowledge OMEdit uses the exact same solver, so I do not really understand why the simulation works in one case but not in the other.

Might this be related to running on Windows vs Linux, or does OMEdit maybe change some default simulation settings?

Any hints on possible causes and solutions are very welcome!

Notice: The CVode settings when simulating the FMU look like this:
LOG_SOLVER        | info    | CVODE linear multistep method CV_BDF
LOG_SOLVER        | info    | CVODE maximum integration order CV_ITER_NEWTON
LOG_SOLVER        | info    | CVODE use equidistant time grid YES
LOG_SOLVER        | info    | CVODE Using relative error tolerance 1.000000e-06
LOG_SOLVER        | info    | CVODE Using dense internal linear solver SUNLinSol_Dense.
LOG_SOLVER        | info    | CVODE Use internal dense numeric jacobian method.
LOG_SOLVER        | info    | CVODE uses internal root finding method NO
LOG_SOLVER        | info    | CVODE maximum absolut step size 0
LOG_SOLVER        | info    | CVODE initial step size is set automatically
LOG_SOLVER        | info    | CVODE maximum integration order 5
LOG_SOLVER        | info    | CVODE maximum number of nonlinear convergence failures permitted during one step 10
LOG_SOLVER        | info    | CVODE BDF stability limit detection algorithm OFF

Edited by: TimSchim2 - Jul-20-21 09:10:41

Re: Modelica model simulating successfully in OMEdit but not as FMU

Hey TimSchim2!

What tool are you using to simulate the FMU and what size are your communication intervals?
Is time=1 the stopTime for the simulation? The error suggests that `communicationStepSize` for fmi2DoStep is so small that CVODE is complaining. But you should get an error message if the step size is below 1e-13. Can you post the complete error message?

By default the Sundials packed with OpenModelica (v1.17.0) is used and compiled/copied into the FMU, which is version 5.4.0.
Maybe (but I hope unlikely) the simulation is using the wrong CVODE from your OS. You could try to run the the FMU on a system without sundials installed or in a docker image or by uninstalling sundials. But maybe messing with your system is not my best idea.

Are you able to share the Modelica model and the FMU that shows this problem? If not public you can send them to us via email: OpenModelica@ida.liu.se

Best
Andreas

There are 0 guests and 0 other users also viewing this topic
You are here: