I'm trying to simulate my Dymola FMU multiple times with PyFMI and the function do_step()
after each run it is supposed to start from the beginning.
The first simulation runs as expected, but afterwards, the initialization fails / is stuck and stops:
"FMIL: module = b'Model', log level = 4: b'[][FMU status:OK] Non-linear solver will attempt to handle this problem.\n'
FMIL: module = b'Model', log level = 4: b'[][FMU status:OK] Residual was NaN or Inf.\n'"
"Pseudo Code":
model = load_fmu(r'path', kind="CS", log_level=4)
model.initialize()
model.setup_experiment(start_time=start_time)
for run in range(2):
for step in steps:
status = model.do_step([:], new_step=True)
model.setup_experiment(start_time=start_time)
model.initialize() # <- Fails
FMU created with Dymola 2022.
Has anyone had a similar problem? I didn't have issues with other FMUs and this python library.
Edit:
I have tried using FMpy where it runs no problem, but is much slower.