If you’re familiar with Simulink, chances are you’ve heard of or used S-functions. S-functions can be thought of as Simulink’s “custom” block. If you want to model time-varying behavior that is not already covered by the standard blocks in the Simulink library, you can create an S-function. The S-function includes both continuous- and discrete-time dynamics, handles parameterization and initialization, and more.
While very capable, S-functions, like any proprietary format, come with one drawback: they’re controlled by a single vendor, meaning the user’s transparency into changes to S-functions is limited. If big changes occur to the usability or structure of S-functions, it can catch users by surprise and may force them to change integral parts of their workflows within a limited timeframe.
In comparison, the Functional Mock-up Interface (FMI) is an open standard interface that allows both commercial and open source tools to freely implement support for exporting and importing models. Though developed only ten years ago, the FMI standard has already been adopted by more than one hundred tools, and counting.
What does it mean for FMI to be built upon open standards, and how does that help users? An open standard interface, such as FMI, enables compatibility between as many tools as possible, thus making it easy to share models internally and externally. In addition, both users and tool vendors have full transparency into the format and updates of the FMI standard – allowing users to create workflows they can rely on. The decision to move towards an open standard interface comes with additional business and technical benefits, including:
- Avoiding vendor lock-in and lowered switching costs. When organizations switch from vendor to vendor, the cost to retrain users, migrate data and adjust workflows significantly increases overall switching costs beyond the difference in solution price. By deploying FMI-based workflows, organizations can significantly reduce switching costs with the assurance that their FMI-based workflows will transfer seamlessly to a new tool.
- The ability to easily share and import models across a wide range of FMI compliant tools. With FMI, engineers can integrate a peer’s model into their own familiar tool. Additionally, FMI comes with custom IP protection, ensuring that models can be securely shared with OEMs, suppliers, coworkers, and third-party collaborators.
The document defining the standard is available for direct download on the FMI standard webpage.
Here are just a few questions we’ve answered about how S-functions and FMI stack up against each other.
What are the key differences between FMI and S-functions?
S-functions and FMI are quite comparable in usability, however, there are a few important differences that we’ve summarized below.
What’s the difference in simulation performance when using S-functions versus using FMI?
Simulation performance depends on a variety of factors: the importing and exporting tools, the type of FMU being used, the solver settings, and more. In our experience, there is nothing inherent in the FMI standard that necessarily degrades performance. Depending on the implementation details in the importing or exporting tools, you can have both better and worse simulation performance with FMUs compared to S-functions.
What technical limitations are there in FMI compared to S-functions?
While a common concern brought up by Simulink users is the limited number of data types that are supported by FMI, the upcoming 3.0 standard is planned to include support for both arrays and a binary data type that could be used as a container for a larger variety of data types. Additionally, workarounds can normally be found in practice within the 2.0 standard.
I hand-code my S-functions. Can I do that with FMUs as well?
Yes. To do so, you may want to use the FMU SDK as a starting point. You can also convert S-functions or Simulink models to FMUs using Modelon’s FMI Toolbox .
Can the FMI standard also be used for systems of models similar to Simulink?
A standard for describing systems of FMUs, analogous to Simulink diagrams, is under development. The SSP standard is an open standard, just like FMI, and is planned to be released in the near future. FMI Composer from Modelon already supports a draft version of the standard.
Can I convert S-functions to FMUs?
Yes, you can include S-functions in a Simulink model, and then export the Simulink model as an FMU using Modelon’s FMI Toolbox.
So what’s best for me?
If you’d like the freedom to import a single model across a wide range of tools, and standardize your workflows across your entire toolset, you should consider FMI. S-functions are great for Simulink users, but if you see yourself considering a different simulation tool in the future, FMI opens more options and reduces the overall costs involved in tool migration. Due to the level of visibility FMI provides, users and organizations are better equipped to change to their workflows.
The pros and cons of FMI require careful review against your organization’s requirements, and some hard work to realize – but the payoff is clear. At Modelon, we’re dedicated to the open standards approach and have helped companies from all major industries switch to FMI.
If you’re still wondering if FMI is right for you, let us help you figure it out. Contact us below to speak with one of our experts about implementing FMI within your organization.