Open lochel opened 4 days ago
@Primkins have you tried with the latest version 1.24.2?
@casella we have tested the issue in the latest version 1.24.2. issue status remains same.
We need more information on how you tested this. How do you call OMSimulator? I get this with OM v1.25.0-dev-115-g6254a2ee46 for export and OMSimulator v2.1.2.post8-gf48ed62-mingw-notlm-debug.
c:\temp>"%OPENMODELICAHOME%"\bin\OMSimulator PumpingSystem.fmu
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
LOG_ASSERT | warning | [C:/Users/adrpo33/AppData/Roaming/.openmodelica/libraries/Modelica 4.0.0+maint.om/Fluid/Interfaces.mo:1027:9-1032:39:writable]
| | | | The following assertion has been violated at time 0.000000
| | | | ((pipe.flowModel.m_flows[1] >= 0.0 and pipe.flowModel.m_flows[1] <= 1e5)) --> "Variable violating min/max constraint: 0.0 <= pipe.flowModel.m_flows[1] <= 1e5, has value: -141.424"
info: Result file: model_res.mat (bufferSize=10)
error: [fmi2logger] c:/temp/model-tvf7xlol/temp/0001_PumpingSystem (logStatusError): C:/Users/adrpo33/AppData/Roaming/.openmodelica/libraries/Modelica 4.0.0+maint.om/Media/Water/IF97_Utilities.mo:1642: IF97 medium function g1: the input pressure (= 2.49291e+09 Pa) is higher than 100 MPa
We have tested this FMU using Python-V3.x with OMSimulator. Attached the sample code to see this issue. FMU-OMSimulator-Issue.zip
Thanks for the test script. While the test works fine with the strongly coupled system (oms_system_sc), I can confirm that there is an issue in co-simulation mode (oms_system_wc). We'll need to investigate a bit more.
I generated a linux version of the fmu and run it with valgrind:
LOG_ASSERT | warning | [/home/lochel/.openmodelica/libraries/Modelica 4.0.0+maint.om/Fluid/Interfaces.mo:1027:9-1032:39:writable]
| | | | The following assertion has been violated at time 0.000000
| | | | ((pipe.flowModel.m_flows[1] >= 0.0 and pipe.flowModel.m_flows[1] <= 1e5)) --> "Variable violating min/max constraint: 0.0 <= pipe.flowModel.m_flows[1] <= 1e5, has value: -141.424"
info: Result file: model_res.mat (bufferSize=10)
error: [fmi2logger] /home/lochel/issues/omc_13272/model-ejudl3dt/temp/0001_PumpingSystem (logStatusError): /home/lochel/.openmodelica/libraries/Modelica 4.0.0+maint.om/Media/Water/IF97_Utilities.mo:1642: IF97 medium function g1: the input pressure (= 2.49291e+09 Pa) is higher than 100 MPa
==23617== Invalid read of size 4
==23617== at 0x4E89205: longjmp (longjmp.c:32)
==23617== by 0xA05F035: omc_assert_fmi (in /tmp/fmi4c_OElnHD/binaries/linux64/PumpingSystem.so)
==23617== by 0xA086360: omc_Modelica_Media_Water_IF97__Utilities_BaseIF97_Basic_g1 (in /tmp/fmi4c_OElnHD/binaries/linux64/PumpingSystem.so)
==23617== by 0xA07F118: omc_Modelica_Media_Water_IF97__Utilities_waterBaseProp__pT (in /tmp/fmi4c_OElnHD/binaries/linux64/PumpingSystem.so)
==23617== by 0xA024D9C: PumpingSystem_eqFunction_458 (in /tmp/fmi4c_OElnHD/binaries/linux64/PumpingSystem.so)
==23617== by 0xA028569: PumpingSystem_functionODE (in /tmp/fmi4c_OElnHD/binaries/linux64/PumpingSystem.so)
==23617== by 0xA074B7D: internalGetEventIndicators (in /tmp/fmi4c_OElnHD/binaries/linux64/PumpingSystem.so)
==23617== by 0xA075B0C: fmi2DoStep (in /tmp/fmi4c_OElnHD/binaries/linux64/PumpingSystem.so)
==23617== by 0x30EF90: fmi2_doStep (fmi4c.c:3800)
==23617== by 0x2611A9: oms::ComponentFMUCS::stepUntil(double) (ComponentFMUCS.cpp:862)
==23617== by 0x215126: oms::SystemWC::doStep() (SystemWC.cpp:581)
==23617== by 0x21641A: oms::SystemWC::stepUntil(double) (SystemWC.cpp:677)
==23617== Address 0x40 is not stack'd, malloc'd or (recently) free'd
Description
When running an FMU (created using Modelica.Fluid.Examples.PumpingSystem) in Python with OMSimulator, the following errors occur:
Software Versions
Originally reported by @Primkins in OpenModelica/OMSimulator#1294.