Hybrid Co-simulation: It's About Time

Fabio Cremona, Marten Lohstroh, David Broman, Edward A. Lee, Michael Masin, Stavros Tripakis

TL;DR

This paper identifies a fundamental flaw in how the industry-standard Functional Mock-up Interface (FMI) handles time: using floating-point numbers leads to precision errors that break hybrid simulations. The authors propose FMI-HC, an extension that uses integer-based "superdense time" and a resolution negotiation protocol to ensure that discrete events and continuous physics interact with mathematical certainty.

What Problem Does This Paper Address?

In the world of Cyber-Physical Systems (CPS)—think self-driving cars or smart grids—engineers must simulate the interaction between continuous physical processes (governed by differential equations) and discrete software logic. The Functional Mock-up Interface (FMI) is the go-to standard for "co-simulation," allowing different specialized tools to work together.

However, FMI 2.0 represents time as a floating-point number (double). This is a nightmare for discrete logic. Because of rounding errors, two events that should happen at the exact same time might be recorded nanoseconds apart. This "jitter" can break causality, cause simulations to get stuck in infinite loops (Zeno behavior), or lead to missed signals. Essentially, the Newtonian ideal of "continuous real-valued time" doesn't translate well to the finite precision of digital computers.

Methods

The authors propose a concrete set of extensions to the FMI standard, dubbed FMI-HC (Hybrid Co-simulation). Key technical shifts include:

  • Integer Time Representation: Replacing floating-point time with 64-bit unsigned integers. This eliminates rounding errors and makes the concept of "simultaneity" absolute.
  • Superdense Time: Adopting a $(t, n)$ model where $t$ is the integer time and $n$ is a "microstep" index. This allows multiple discrete events to occur in a specific sequence without any time actually passing.
  • Resolution Negotiation: Since different components (FMUs) might operate at different scales (e.g., femtoseconds for circuits vs. milliseconds for mechanical parts), the authors introduce a protocol where the "Master Algorithm" negotiates a global time resolution (usually a power of ten, like $10^{-9}$ seconds) that satisfies all components.
  • Absent Signals: New API functions (getHybrid/setHybrid) allow components to explicitly communicate that a signal is "absent" at a specific microstep, which is crucial for reactive discrete-event logic.
  • Modular Wrappers: To avoid requiring every tool vendor to rewrite their software, the authors demonstrate how "wrappers" can translate between legacy floating-point FMUs and the new integer-time master algorithm.

Datasets

The paper does not use traditional training datasets. Instead, it evaluates the proposed FMI-HC framework using synthetic benchmark models designed to trigger failure modes in standard FMI:

  • Zero-delay feedback model: A classic "simplest possible" nontrivial hybrid system involving an integrator, a zero-crossing detector, and a discrete delay.
  • Cascade composition: A model with two components operating at different time resolutions to test the quantization and conversion logic.
  • FIDE Implementation: The methods were implemented and tested within the FIDE (FMI Integrated Development Environment) reference tool.

Key Insights and Ideas

  • Floating point is non-associative: The authors remind us that in floating-point math, $(t_1 + t_2) + t_3$ does not always equal $t_1 + (t_2 + t_3)$. For a simulation master trying to coordinate dozens of tools, this lack of associativity is a recipe for non-deterministic chaos.
  • The "Ceiling" Operator is Key: When converting a component's internal time to the master's integer time, the authors use a ceil (round up) function. This ensures that the simulation always moves forward, preventing the "stuttering" that occurs when rounding down results in a zero-length time step.
  • Decimal is better than Binary for Humans: By choosing time resolutions as powers of ten ($10^n$), the system can exactly represent human-defined parameters (like a 0.1s sampling rate) that would be repeating fractions in binary floating-point.

Key Results

  • Elimination of Quantization Errors: The integer-time approach successfully handled the "Zero-delay feedback" model, which typically causes floating-point simulators to fail or produce inconsistent results.
  • Deterministic Execution: The FMI-HC extensions proved to be determinate, meaning the same simulation will produce the exact same results regardless of the underlying hardware's floating-point quirks.
  • Backward Compatibility: The wrapper approach showed that legacy FMUs can be integrated into an FMI-HC environment with minimal overhead, though they still suffer from internal floating-point limitations.

Limitations and Future Work

  • Standardization Hurdles: The primary limitation is adoption. While the authors propose this as a standard, it requires the FMI steering committee and tool vendors to implement these new API calls.
  • Internal Quantization: Even if the interface uses integers, a legacy FMU might still use double internally. The "quantization error" is moved to the boundary of the FMU rather than being eliminated entirely within the black box.
  • Overflow: While 64-bit integers provide a massive range (e.g., 584 years at nanosecond resolution), theoretical overflow remains a concern for extremely long-running or high-precision simulations.
  • Future Work: The authors suggest extending this logic to handle "rollback" (where a component needs to undo a step) more gracefully within the integer-time framework.

Summary updated

BibTeX
@inproceedings{cremona2018hybrid,
  author = {Fabio Cremona and Marten Lohstroh and David Broman and Edward A. Lee and Michael Masin and Stavros Tripakis},
  title = {{Hybrid Co-simulation: It's About Time}},
  booktitle = {MoDELS},
  year = {2018},
  doi = {10.1145/3239372.3242896},
}
Figure