Skip to content

fmi-ls-dae: support the semi-explicit form (#1692) - #1693

Open
adrpo wants to merge 1 commit into
OpenModelica:masterfrom
adrpo:fmi-ls-dae-semi-explicit
Open

adrpo wants to merge 1 commit into
OpenModelica:masterfrom
adrpo:fmi-ls-dae-semi-explicit

Conversation

@adrpo

@adrpo adrpo commented Nov 2, 2026

Copy link
Copy Markdown
Member

Fixes #1692.

What

fmi-ls-dae only defines semi-explicit index-1 DAEs since modelica/fmi-ls-dae#67. In that form the manifest has <ContinuousStateDerivative> entries, the FMU computes the derivatives in DAE mode, and the residuals only cover the algebraic variables. OpenModelica exports this form from OpenModelica/OpenModelica#17714 on. OMSimulator rejected it so far.

  • Both forms are accepted. A manifest without <ContinuousStateDerivative> is the fully implicit form of older exports (DaeLoopA), and works as before.
  • Semi-explicit: for each component, the rows are x' - der(x) from fmi3GetContinuousStateDerivatives, then its residuals. The master does not set the derivatives, and the derivative value references come from the manifest.
  • The check expects one residual per algebraic variable, plus one per state for the fully implicit form.
  • The Jacobian sparsity takes the derivative rows from the <ContinuousStateDerivative> dependencies. Each row also gets its own state column, through x'.

Tested locally

  • New DaeSemiExplicit1.py: the DaeMode1.py loop with DaeSemiLoopA, which is the same model exported by OpenModelica with #17714 (--simCodeTarget=C+Rust, so x86_64-linux only). It gives x(1) = 0.701445, the analytic value, with the same IDA statistics as DaeMode1.py. The system has 6 unknowns instead of 5.
  • ctest: 130 of 130 pass on Linux.

AI use: written with Claude Code; the changes and test runs above were checked by hand.


🤖 Generated with Claude Code

The fmi-ls-dae draft only covers semi-explicit index-1 DAEs, which
the manifest marks with <ContinuousStateDerivative> entries. Accept
that form beside the fully implicit one of older exports: the FMU
computes the derivatives, so a component's rows are x' - der(x) and
then its residuals, and the Jacobian sparsity takes the derivative
rows from the manifest's dependencies.

Test DaeSemiExplicit1.py runs the DaeMode1.py loop with DaeSemiLoopA,
exported by OpenModelica in the semi-explicit form.

Assisted-by: Claude Opus 5.5
@adrpo adrpo self-assigned this Nov 2, 2026
@adrpo adrpo added the project/openscaling OpenSCALING related issues and pull requests label Nov 2, 2026
@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.32%. Comparing base (3046f82) to head (5aab7c9).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/OMSimulatorLib/SystemSC.cpp 78.94% 1 Missing and 3 partials ⚠️
src/OMSimulatorLib/ComponentFMU3ME.cpp 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1693      +/-   ##
==========================================
+ Coverage   30.22%   30.32%   +0.09%     
==========================================
  Files          74       74              
  Lines       14661    14680      +19     
  Branches     9432     9444      +12     
==========================================
+ Hits         4431     4451      +20     
+ Misses       8892     8891       -1     
  Partials     1338     1338              
Flag Coverage Δ
linux 30.32% <83.33%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

project/openscaling OpenSCALING related issues and pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fmi-ls-dae: support the semi-explicit form

1 participant