The Functional Mock-up Interface (FMI) standard supports two flavors of Functional Mock-up Units (FMUs), including: Co-Simulation (CS) and Model Exchange (ME). But, do you know the difference?
As an expert in the standard it’s my goal to help users understand the commonalities and differences – getting you to a point in which you’re choosing the best possible technique to achieve your goal! Let’s first look at what the two kinds of FMUs have in common.
If the FMI standard is brand new to you, you may want to read this first: What is FMI?
A common source of confusion lies in the names of the two kinds of FMU: Model Exchange and Co-Simulation. Because in fact, both ME and CS FMUs can be used both for exchanging models and for simulating multiple models together. More specifically:
So you may be asking…..then what is the difference?
The difference between the two kinds consist of how the importing tool makes the FMU step forward in time.
Models that represent physical quantities such as temperature or velocity are generally described by differential equations. The way that the quantities change with time depend on the value of the quantities themselves (the state), and what external influence they are subjected to (the inputs).
Let's take the following example: A very simple mathematical model for how the temperature of a house evolves can be written as:
dThouse/dt = k1*(Tout-Thouse) k2*BoilerPower k3
Here, the rate of change of the quantity (dThouse/dt) depends on the state (Thouse) and the inputs (Tout and BoilerPower). k1, k2, and k3 are parameters that do not change with time. To compute how the temperature in the house changes with time, the differential equation needs to be hooked up to a numerical solver.
When you simulate a CS FMU, the numerical solver is embedded and supplied by the exporting tool. The importing tool will set the inputs, tell the FMU to step forward a given time, and then read the outputs.
When you simulate an ME FMU, the numerical solver is supplied by the importing tool. The FMU provides functions to set the state and inputs, and to compute the state derivatives (i.e., the left hand side of the equation). The solver in the importing tool will determine what time steps to use, and how to compute the state at the next time step.
Based on the FMI 2.0 standard, an FMU may be both an CS and ME FMU. That means that it provides both the ME functions that can be hooked up to a solver in the importing tool, and an internal solver if you choose to use the FMU as CS.
This is a question that I get asked all the time. And the answer is: it depends. To understand the pros and cons of the two types, I like to compare to vector and bitmap graphics.
Does that mean that you should always use ME? No. Just like you don't always use vector graphics formats. Some reasons to choose CS include:
A general guideline could be to try and see if ME works. If you work with "simple" models (small, linear, non-stiff), ME is often an excellent choice because it allows more flexibility. If you have models that take in the order of minutes or more to simulate (even in native tools with specialized solvers) ME could likely be challenging and you should consider CS instead.
Check with tool vendors for both importing and exporting tools in your intended tool chain to see what options are available. An overview for different tools is available here.
Modelon Deployment Suite: Learn about Modelon's comprehensive suite of deployment products, designed to rapidly deploy system models across multiple platforms, varying tools, and organizations.
Training: Check out our one-day FMI course! Find a scheduled training session or talk to us about giving it on-site for your whole team.
Maria Henningsson is product manager for Modelon's FMI products. She helps customers integrate and implement FMI in workflows, toolchains and processes, enabling simulation models to be optimized for longevity. She holds an MSc in Engineering Mathematics and a PhD in Combustion Engine Control, both from Lund University.