OpenModelica / OMSimulator

The OpenModelica FMI & SSP-based co-simulation environment.
Other
71 stars 51 forks source link

Endless loop cvode error test failed #1113

Closed AnHeuermann closed 2 years ago

AnHeuermann commented 2 years ago

Description

I'm running the example from https://github.com/OpenModelica/OMTeaching/tree/master/Tutorials/MODPROD21/Tutorial2/Solutions/DualMassOscillator for a weakly connected system of FMUs and did run into a endless loop.

Steps to reproduce the behavior

Download DualMassOscillator.System1.fmu and DualMassOscillator.System2.fmu and run

oms_setLogFile("excercise2_cs.log")
oms_setTempDirectory("./temp-exercise2/")

oms_newModel("model_sc")
oms_addSystem("model_sc.root", oms_system_sc)

oms_setResultFile("model_sc", "dualMassOscillator_wc_res.csv")
oms_setCommandLineOption("--skipCSVHeader=true --stripRoot=true")

-- Add sub models for System1.fmu and System2.fmu
oms_addSubModel("model_sc.root.system1", "fmus/DualMassOscillator.System1.fmu")
oms_addSubModel("model_sc.root.system2", "fmus/DualMassOscillator.System2.fmu")

-- Add connections between System1 and System2
oms_addConnection("model_sc.root.system2.F","model_sc.root.system1.F")
oms_addConnection("model_sc.root.system1.v1","model_sc.root.system2.v1")
oms_addConnection("model_sc.root.system1.s1","model_sc.root.system2.s1")
oms_addConnection("model_sc.root.system1.a1","model_sc.root.system2.a1")

-- Set Simulation settings (tolerance 1e-6)
oms_setTolerance("model_sc", 1e-6, 1e-6)
oms_setFixedStepSize("model_sc", 2e-4)

-- instantiate and set start values to variables
oms_instantiate("model_sc")

-- Initialize, simulate and terminate the model
oms_initialize("model_sc")
oms_simulate("model_sc")
oms_terminate("model_sc")

oms_delete("model_sc")

The following error message is repeated forever:

[CVODE ERROR]  CVode
  At t = 0 and h = 0.0002, the error test failed repeatedly or with |h| = hmin.

These FMUs were generated a year ago and can be simulated by OMSimulator when using a weakly coupled system oms_system_wc.

Expected behavior

End with an error message after a few tries or actually simulate the FMUs.

Version and OS

AnHeuermann commented 2 years ago

It seems the culprit is

oms_setFixedStepSize("model_sc", 2e-4)
stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.