Repository navigation
Adapt to fmi4c instance handles - #1638
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1638 +/- ##
=======================================
Coverage 27.43% 27.43%
=======================================
Files 72 72
Lines 13889 13917 +28
Branches 8966 8982 +16
=======================================
+ Hits 3810 3818 +8
- Misses 8876 8896 +20
Partials 1203 1203
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
📝 WalkthroughWalkthroughThe change separates FMU descriptor handles from instantiated FMI 2 and FMI 3 component handles. FMI 3 derivative retrieval is implemented. FMI 3 expected outputs no longer include loading messages. The ChangesFMI instance handle separation
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested reviewers: Merge Risk: 🟡 Moderate · up to The update changes FMI runtime handle usage but currently treats FMI 3 derivative failures as successful calls, which can allow invalid values into simulations. This bounded correctness issue should be fixed before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 1.46% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 137 functions across 15 files. (1 skipped: 1 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b5b77758-3e86-4f99-a4f5-f526989ccf90
📒 Files selected for processing (35)
3rdPartysrc/OMSimulatorLib/Component.hsrc/OMSimulatorLib/ComponentFMU3CS.cppsrc/OMSimulatorLib/ComponentFMU3CS.hsrc/OMSimulatorLib/ComponentFMU3ME.cppsrc/OMSimulatorLib/ComponentFMU3ME.hsrc/OMSimulatorLib/ComponentFMUCS.cppsrc/OMSimulatorLib/ComponentFMUCS.hsrc/OMSimulatorLib/ComponentFMUME.cppsrc/OMSimulatorLib/ComponentFMUME.hsrc/OMSimulatorLib/FMUInfo.cppsrc/OMSimulatorLib/FMUInfo.hsrc/OMSimulatorLib/SignalDerivative.cppsrc/OMSimulatorLib/SignalDerivative.hsrc/OMSimulatorLib/Variable.cppsrc/OMSimulatorLib/Variable.htestsuite/tests/CompositeModels/FeedthroughConnections.pytestsuite/tests/CompositeModels/FeedthroughSetValue1.pytestsuite/tests/CompositeModels/FeedthroughSetValue2.pytestsuite/tests/CompositeModels/connectFmi2AndFmi3.pytestsuite/tests/reference-fmus/3.0/cs/BouncingBall-cs.pytestsuite/tests/reference-fmus/3.0/cs/Dahlquist-cs.pytestsuite/tests/reference-fmus/3.0/cs/Feedthrough-cs.pytestsuite/tests/reference-fmus/3.0/cs/Resource-cs.pytestsuite/tests/reference-fmus/3.0/cs/Stair-cs.pytestsuite/tests/reference-fmus/3.0/cs/VanDerPol-cs.pytestsuite/tests/reference-fmus/3.0/me/BouncingBall-me.pytestsuite/tests/reference-fmus/3.0/me/Dahlquist-me.pytestsuite/tests/reference-fmus/3.0/me/Feedthrough-me.pytestsuite/tests/reference-fmus/3.0/me/Resource-me.pytestsuite/tests/reference-fmus/3.0/me/Stair-me.pytestsuite/tests/reference-fmus/3.0/me/VanDerPol-me.pytestsuite/tests/simulation/FMI3_SimpleSimulation1.pytestsuite/tests/simulation/FMI3_SimpleSimulation2.pytestsuite/tests/simulation/FMI3_SimpleSimulation3.py
💤 Files with no reviewable changes (19)
- testsuite/tests/CompositeModels/connectFmi2AndFmi3.py
- testsuite/tests/CompositeModels/FeedthroughSetValue2.py
- testsuite/tests/simulation/FMI3_SimpleSimulation1.py
- testsuite/tests/reference-fmus/3.0/me/Dahlquist-me.py
- testsuite/tests/reference-fmus/3.0/cs/Stair-cs.py
- testsuite/tests/reference-fmus/3.0/cs/Resource-cs.py
- testsuite/tests/CompositeModels/FeedthroughSetValue1.py
- testsuite/tests/reference-fmus/3.0/me/Stair-me.py
- testsuite/tests/simulation/FMI3_SimpleSimulation2.py
- testsuite/tests/reference-fmus/3.0/cs/VanDerPol-cs.py
- testsuite/tests/simulation/FMI3_SimpleSimulation3.py
- testsuite/tests/reference-fmus/3.0/cs/BouncingBall-cs.py
- testsuite/tests/reference-fmus/3.0/me/Feedthrough-me.py
- testsuite/tests/reference-fmus/3.0/me/BouncingBall-me.py
- testsuite/tests/reference-fmus/3.0/me/Resource-me.py
- testsuite/tests/reference-fmus/3.0/cs/Dahlquist-cs.py
- testsuite/tests/reference-fmus/3.0/cs/Feedthrough-cs.py
- testsuite/tests/reference-fmus/3.0/me/VanDerPol-me.py
- testsuite/tests/CompositeModels/FeedthroughConnections.py
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.
3d9b6a2 to
5574cc1
Compare
fmi4c renamed fmiHandle to fmuHandle and moved all runtime calls to fmi2InstanceHandle/fmi3InstanceHandle returned by the instantiate functions. Store that instance per component and pass it to every get/set/step/terminate call, and reset it after freeInstance to avoid a double free in the destructor. SignalDerivative is split into FMI 2 and FMI 3 variants, since the handle types no longer alias; FMI 3 has no setRealInputDerivatives. Drop the "Loading FMI version 3..." line from the expected test results, which fmi4c no longer prints.
SignalDerivative fetched output derivatives in its constructor, so a failing fmi2_getRealOutputDerivatives/fmi3_getOutputDerivatives was only logged and getRealOutputDerivative still returned oms_status_ok with undefined values. Fetch them through getRealOutputDerivatives, which returns the status and clears the derivatives on failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0532139 to
0e256f9
Compare
The pinned OMSimulator (381bc560) looks for libOMSimulator.dll in OMSimulator/../../../bin, which in the lib/<arch>/omc install layout is lib/bin, one level too high, so the OMSimulator Python server does not start on Windows and OMEdit cannot open SSP models there. Brings in, among others: - OpenModelica/OMSimulator#1659: the DLL directory is computed by CMake for the install layout, with a search fallback (fixes #17146) - OpenModelica/OMSimulator#1664: SSP MetaData, including the SSD-level MetaData that attaches omuq studies, is kept on import/export (#17074) - OpenModelica/OMSimulator#1638: adapt to fmi4c instance handles - reset support and instance name fixes in the fmu class, the PySide6 OMSimulatorGui enabled by default, macOS arm64 CI Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Related Issues
Some users want to compile OMSimulator on macOS. But there are some issues like OpenModelica/OMSimulator-3rdParty#94.
We should update fmi4c to the latest version. Another upside: We get rid of many compiler warnings.
Purpose
Approach
fmi4c renamed
fmiHandletofmuHandleand moved all runtime calls tofmi2InstanceHandle/fmi3InstanceHandlereturned by the instantiate functions. Store that instance per component and pass it to everyget/set/step/terminatecall, and reset it afterfreeInstanceto avoid a double free in the destructor.SignalDerivativeis split into FMI 2 and FMI 3 variants, since the handle types no longer alias; FMI 3 has nosetRealInputDerivatives. Output derivatives are now fetched bygetRealOutputDerivatives, which returns the FMI status instead of logging it inside a constructor, sogetRealOutputDerivativereports a failed request asoms_status_errorand no undefined values are forwarded to connected inputs.Drop the
"Loading FMI version 3..."line from the expected test results, which fmi4c no longer prints.🤖 Generated with Claude Code