Skip to content

FMPy-0.3.29 regression compared to FMPy-0.3.21 #863

Description

@adrpo

Newer versions of FMPy fail to simulate FMU.

(lpy) adrpo33@win06527:~/testing/fmi$ pip install FMPy
(lpy) adrpo33@win06527:~/testing/fmi$ python3 -m fmpy --version
FMPy version 0.3.29
// simulate with FMPy
python3 -m fmpy simulate  --output-file Buildings_latest_Buildings.DHC.Plants.Combined.Controls.BaseClasses.Validation.StagingPlant_res.csv --start-time 0 --stop-time 30000 --timeout 800 --relative-tolerance 1e-06 --interface-type ModelExchange --solver CVode --output-interval 12 Buildings_latest_Buildings_DHC_Plants_Combined_Controls_BaseClasses_Validation_StagingPlant.fmu
[ERROR][rank 0][/home/runner/work/FMPy/FMPy/native/sundials-7.5.0/src/cvode/cvode.c:3739][cvHandleFailure] At t = 1057.17731931344 and h = 0.0006, the error test failed repeatedly or with |h| = hmin.
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/adrpo33/lpy/lib/python3.12/site-packages/fmpy/__main__.py", line 4, in <module>
    main()
  File "/home/adrpo33/lpy/lib/python3.12/site-packages/fmpy/cli.py", line 186, in main
    result = simulate_fmu(args.fmu_filename,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/adrpo33/lpy/lib/python3.12/site-packages/fmpy/simulation.py", line 788, in simulate_fmu
    result = simulateME(model_description, fmu, start_time, stop_time, solver, step_size, relative_tolerance, start_values, apply_default_start_values, input, output, output_interval, record_events, timeout, step_finished, validate, set_stop_time)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/adrpo33/lpy/lib/python3.12/site-packages/fmpy/simulation.py", line 1101, in simulateME
    state_event, roots_found, time = solver.step(time, next_communication_point)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/adrpo33/lpy/lib/python3.12/site-packages/fmpy/sundials/__init__.py", line 185, in step
    raise RuntimeError("CVode error (code %s) in module %s, function %s: %s" % self.error_info)
RuntimeError: CVode error (code -3) in module cvHandleFailure, function /home/runner/work/FMPy/FMPy/native/sundials-7.5.0/src/cvode/cvode.c: At t = 1057.17731931344 and h = 0.0006, the error test failed repeatedly or with |h| = hmin.

Install a older version:
(lpy) adrpo33@win06527:~/testing/fmi$ pip install FMPy==0.3.21
(lpy) adrpo33@win06527:~/testing/fmi$ python3 -m fmpy --version
FMPy version 0.3.21

Works fine:
(lpy) adrpo33@win06527:~/testing/fmi$ python3 -m fmpy simulate  --output-file Buildings_latest_Buildings.DHC.Plants.Combined.Controls.BaseClasses.Validation.StagingPlant_res.csv --start-time 0 --stop-time 30000 --timeout 800 --relative-tolerance 1e-06 --interface-type ModelExchange --solver CVode --output-interval 12 Buildings_latest_Buildings_DHC_Plants_Combined_Controls_BaseClasses_Validation_StagingPlant.fmu

You can generate the FMU with OpenModelica via:

// b.mos script
loadModel(Buildings); getErrorString();
buildModelFMU(Buildings.DHC.Plants.Combined.Controls.BaseClasses.Validation.StagingPlant,fileNamePrefix="Buildings_latest_Buildings_DHC_Plants_Combined_Controls_BaseClasses_Validation_StagingPlant",fmuType="me",version="2.0",platforms={"static"}); getErrorString();

// generate the FMU
omc b.mos

But is also uloaded here (Linux version).
Buildings_latest_Buildings_DHC_Plants_Combined_Controls_BaseClasses_Validation_StagingPlant.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions