Skip to content

Add FMI3 support - #817

Draft
davidhjp01 wants to merge 8 commits into
masterfrom
fmi3
Draft

davidhjp01 wants to merge 8 commits into
masterfrom
fmi3

Conversation

@davidhjp01

Copy link
Copy Markdown
Member

FMI 3 Co-Simulation support

Summary

Add a bounded FMI 3.0.2 Co-Simulation implementation to the existing importer
and execution framework, while retaining FMI 1 and FMI 2 support. FMI 3 FMUs
can be used directly or alongside FMI 1/2 FMUs in a connected simulation.

Changes

  • Detect and import FMI 3 Co-Simulation FMUs, including dual-interface FMUs
    through their Co-Simulation interface. Keep the instantiation token separate
    from FMI 1/2 UUIDs and identify cached FMI 3 archives independently of that
    token.
  • Extend model metadata and value access for exact floating-point and integer
    widths, Boolean, String, Binary and Enumeration values, plus whole arrays.
    Validate types, permissions, dimensions and flattened value counts; support
    structural parameters and permitted runtime reconfiguration.
  • Implement the FMI 3 lifecycle, detailed step results, status handling,
    logging, Event Mode and Intermediate Update callbacks. Support capability-
    gated FMU state, serialization, derivatives and variable dependencies.
  • Extend fixed-step and ECCO execution to coordinate supported events, early
    returns, Clock schedules and Clock-associated data. Add fixed-step
    decimation, event-iteration limits and supported execution snapshots.
  • Extend whole-value connections, functions, observers, modifiers and
    scenarios. Add OSP 0.2.0 and SSP 2.0 configuration support for exact
    values and fixed-shape arrays, including OSP Clock sources.
  • Add FMI 3 integration and regression coverage, including mixed-version
    systems, event and Clock behavior, invalid inputs, capability checks and
    failure paths. Separate test FMU generation from normal test builds and add
    a manually dispatched fixture-building workflow.
  • Add Sphinx documentation for the public APIs, execution design and
    implemented FMI 3 features, together with documentation and quality CI.

Scope and limitations

  • Model Exchange and Scheduled Execution are not supported; FMUs that offer
    only those interfaces are rejected. FMI 3 Clock support is for
    Co-Simulation, not Scheduled Execution.
  • Optional operations require the FMU's advertised capabilities and a valid
    lifecycle state. Early return must be negotiated; events cannot be handled
    away from a completed communication point without it.
  • If an already-advanced participant cannot safely rewind after an early
    return, event delivery can be delayed. Clock-capable participants cannot
    use fixed-step decimation, and ECCO does not support decimation.
  • Connections require compatible exact types and shapes; numeric widths are
    not implicitly converted. Runtime array resizing does not renegotiate
    connections in an existing execution.
  • SSP support is limited to flat FMU systems and fixed-size dimensions;
    variable-size connector dimensions and mapping transformations are not
    supported.

Test coverage

The branch adds tests using Reference FMUs and purpose-built fixtures for
values, lifecycle and status handling, events, Clocks, callbacks, snapshots,
derivatives, configuration, and mixed FMI versions. FMU fixtures must be
provisioned separately before running the relevant tests.

@davidhjp01 davidhjp01 self-assigned this Nov 23, 2026
@davidhjp01 davidhjp01 added enhancement New feature or request fmi3 labels Nov 23, 2026
@davidhjp01

Copy link
Copy Markdown
Member Author

Unfortunately, at some point, my local git history re-wrote the whole git graph that led to completely diverged git history from the first commit. This could not be easily replayed and merged into libcosim master, so I had to create a single commit that contains all changes..

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy (v23.1.7) reports: 1 concern(s)
  • src/cosim/algorithm/clock_router.hpp:235:32: error: [misc-include-cleaner]

    no header providing "boost::multiprecision::cpp_int" is directly included

       20 |         boost::multiprecision::cpp_int origin_numerator;
          |                                ^

✨ Powered by cpp-linter • 💬 Feedback

Pin CI to clang-format 23.1.6 and use clang-tidy 23; verify the formatter version and increase lint parallelism. Document the tool versions and add status messages to clang-check.ps1.
Use the GCC 14 container to match Linux Release runtimes and configure Conan shared dependencies. Pin clang-format 23.1.6 and install LLVM tooling without sudo; update version validation for Debian and Ubuntu output.
Add explicit includes and IWYU annotations across public headers to make dependencies self-contained, and update FMI headers and namespaces. Enhance clang-check.ps1 to summarize emitted diagnostics by tool pass and report failures. Remove redundant clang-format version verification from the quality workflow and update contributing guidance for the new summaries and FMI 3 cleanup behavior.
Invoke extensionless and `.py` run-clang-tidy scripts through Python 3 or the `py -3` launcher, while retaining direct invocation for native executables and command wrappers. Document the Windows runner behavior in CONTRIBUTING.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request fmi3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant