Repository navigation
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1687 +/- ##
==========================================
+ Coverage 30.22% 31.36% +1.13%
==========================================
Files 74 74
Lines 14661 14989 +328
Branches 9432 9646 +214
==========================================
+ Hits 4431 4701 +270
- Misses 8892 8911 +19
- Partials 1338 1377 +39
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:
|
) Acausal components, each an FMI 3.0 Model Exchange FMU with fmi-ls-dae and OpenModelica's fmi-ls-dae-acausal manifest, are connected through their terminals and integrated as one DAE with IDA. - The members of an acausal component's terminals become connectors of SSP 2.0 kind "unspecified". A connection between two of them is acausal (oms_connection_acausal): it stays out of the directed graphs, a member may be connected any number of times, and the SSD stores it as an ordinary connection. - SystemSC builds the connection sets and replaces the residuals the manifest names for the connected flows (flow = 0) with the equations of the sets: k-1 rows for the potentials, one flow-sum row. The system stays square; the rows' sparsity comes from the replaced residuals. Mixed or unbalanced sets, and acausal connections outside DAE mode, are refused. - Stream variables: the manifest names, per stream variable of a terminal, the residual that reads inStream(h) = h (StreamResidual), and the terminal's TerminalStreamMemberVariable names the variable that stands for its inStream. The stream variable is connected like the other members, and SystemSC replaces each connected stream's residual by the mixing rule of its set, s_i - sum_{j<>i} max(-m_j, eps)*h_j / sum_{j<>i} max(-m_j, eps) (s_i - h_j for two members), m_j being the flow of h_j's terminal. - A terminal member may be an FMI 3.0 <Alias> (b.p with a.p = b.p), which the FMI library does not list; it is resolved from modelDescription.xml. A terminal member that is a (calculated) parameter, e.g. the fixed pressure of a boundary, is connected acausally too. - Python: Causality.unspecified, the terminals read from the FMU, and addConnection between two terminals expands them member by member. Tests: DaeMode3.py (source, RC, ground) and DaeMode4.py (a three-way node, an unconnected component, a flow connected to a potential) with three electrical FMUs, and DaeMode5.py (a source, a volume and a sink; two branches mixing in a node of three terminals) with two fluid FMUs, all exported by OpenModelica --fmuAcausalComponent (OpenModelica/OpenModelica#17665), x86_64-linux only. Refs OpenModelica#1686, OpenModelica#1432 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adrpo
force-pushed
the
fmi-ls-dae-acausal
branch
from
November 1, 2026 19:41
cf2d9ed to
bf1c8ad
Compare
Member
Author
|
This has a connection with how SSP terminals are handled #1548. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #1686, part of #1432: acausal components, each a separate FMI 3.0 Model Exchange FMU with fmi-ls-dae, connected through their terminals in an SSP and integrated as one DAE with IDA. It builds on #1646. The FMUs come from OpenModelica with
--simCodeTarget=C+Rust --daeMode --fmuAcausalComponent(OpenModelica/OpenModelica#17665, not merged yet).What the FMUs carry
inflowfor flows andsignalfor potentials, and aTerminalStreamMemberVariableper stream variable that pairs it with the variable standing for its inStream ('inStream(port.h_outflow)');extra/org.openmodelica.fmi-ls-dae-acausal/fmi-ls-manifest.xml, which names the residual standing for each flow (ConnectorResidual) and for each stream's inStream (StreamResidual). While its terminal is unconnected, those residuals readflow = 0andinStream(h) = h.What this does
Connectors: the members of an acausal component's terminals (
p.v,p.i) become connectors of SSP 2.0 kindunspecified, the kind SSP defines "for acausal connections of Modelica models". In C++ they areoms_causality_bidir.Connections: a connection between two such connectors is acausal (
oms_connection_acausal).ssd:Connection.addConnectionbetween two terminals expands them member by member and refuses terminals whose members differ.System: in DAE mode,
SystemSC::collectAcausalConnectionsbuilds the connection sets and replaces the residuals of the connected flows with the equations of the sets:v_1 - v_m = 0for the potentials of a set of k members;sum(i_m) = 0for its flows.The unknowns don't change, and the system stays square. Each row reads the members' values from the FMU. That is needed because a member may be computed by the component, not be an unknown: in the source,
n.iis the alias-p.i, and the ground'sp.vis a constant. A row's sparsity is the member's own column plus the columns the replaced residuals reach, since those take the flow and the potentials as arguments.Streams: a stream variable is connected like the other members, by its member name. Each connected stream's
StreamResidualrow becomes the mixing rule of its set:s_i - sum_{j≠i} max(-m_j, eps)*h_j / sum_{j≠i} max(-m_j, eps) = 0, wheres_istands for inStream(h_i),m_jis the flow of h_j's terminal into its component, and eps = 1e-7 (OpenModelica's flowThreshold);s_i - h_j = 0.The terminal of a connected stream must have exactly one flow. The row's sparsity is built as for the other rows, from the inStream variable and the other members' stream and flow variables.
Aliases and parameters: a terminal member may be an FMI 3.0
<Alias>(b.pin a component witha.p = b.p). The FMI library doesn't list aliases, so the terminals reader resolves them frommodelDescription.xml, in C++ and in Python. A terminal member that is a (calculated) parameter, such as a boundary's fixed pressure, is connected acausally too.Refused: a set that mixes flows, potentials and stream variables, sets that don't give as many equations as they free residuals, and an acausal connection whose component is not in DAE mode.
Tests
Three electrical FMUs (source, RC branch, ground) and two fluid FMUs (a pressure/enthalpy boundary, and a mixing volume behind a flow resistance), exported with the compiler of OpenModelica/OpenModelica#17665. The models are in the comments of
DaeMode3.pyandDaeMode5.py. Like DaeMode1/2, the tests only run on Linux: the FMUs carry only x86_64-linux binaries, and those need glibc 2.38.DaeMode3.pyvc(1) = 0.632121,i = 0.367879DaeMode4.pyvc2(1) = 0.393469, source current0.671145DaeMode4.pyp.i = 0DaeMode4.pyDaeMode5.pyh(1) = 1.632121, 1 kg/sDaeMode5.pyh3(1) = 1.160709, nodep = 1.666667, mix1.566937Locally, ctest gives 132 tests, 0 failed.
Not in this PR
flow = 0, soexitInitializationModefails. DaeMode5 therefore uses pressure boundaries and flow resistances;🤖 Generated with Claude Code