Skip to content

Set discrete inputs of ME FMUs in event mode - #1733

Merged
arun3688 merged 2 commits into
OpenModelica:masterfrom
arun3688:me-discrete-inputs
Dec 2, 2026
Merged

arun3688 merged 2 commits into
OpenModelica:masterfrom
arun3688:me-discrete-inputs

Conversation

@arun3688

@arun3688 arun3688 commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Purpose

An ME FMU in its own solver unit gets discrete inputs (discrete Real, Integer, Boolean) from a different unit. SystemSC sets these inputs during continuous-time mode, and the FMU rejects the call: fmi2SetBoolean: Illegal call sequence. This commit adds a test that expects the correct values.

Assisted-by: Claude Code

An ME FMU in its own solver unit gets discrete inputs (discrete Real, Integer, Boolean) from a different unit. SystemSC sets these inputs during continuous-time mode, and the FMU rejects the call: fmi2SetBoolean: Illegal call sequence. This commit adds a test that expects the correct values. The fix follows.

Assisted-by: Claude Code
An ME FMU accepts discrete inputs (Integer, Boolean and discrete Real)
only in event mode. When an ME FMU was in its own solver unit, the
master set these inputs in continuous-time mode.

Now a changed discrete input in continuous-time mode is kept and
handled in an event of the SC system:
- If the input is set between two steps, the event occurs right away.
  The outputs are then correct when the master reads them in the same
  exchange.
- If the input is set during a step, the event occurs at the start of
  the next step.

The test now has a third CS FMU that reads the outputs of the ME FMU,
to check that the values arrive at the same time.

Assisted-by: Claude Code
@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 59.42029% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.18%. Comparing base (c1aabc5) to head (909c1a2).

Files with missing lines Patch % Lines
src/OMSimulatorLib/SystemSC.cpp 53.22% 16 Missing and 13 partials ⚠️
src/OMSimulatorLib/Component.cpp 70.21% 9 Missing and 5 partials ⚠️
src/OMSimulatorLib/ComponentFMU3ME.cpp 38.46% 5 Missing and 3 partials ⚠️
src/OMSimulatorLib/ComponentFMUME.cpp 76.92% 0 Missing and 3 partials ⚠️
src/OMSimulatorLib/System.h 0.00% 1 Missing ⚠️
src/OMSimulatorLib/Variable.h 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1733      +/-   ##
==========================================
+ Coverage   32.89%   33.18%   +0.29%     
==========================================
  Files          74       74              
  Lines       14809    14943     +134     
  Branches     9526     9584      +58     
==========================================
+ Hits         4871     4959      +88     
- Misses       8420     8446      +26     
- Partials     1518     1538      +20     
Flag Coverage Δ
linux 33.18% <59.42%> (+0.29%) ⬆️

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.

@arun3688
arun3688 merged commit 932b407 into OpenModelica:master Dec 2, 2026
6 checks passed
@arun3688
arun3688 deleted the me-discrete-inputs branch December 2, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant