1. FMU Background Functional Mock-up Units have the following history and properties:
- Based on standards from the Functional Mockup Interface (https://fmi-standard.org/) or FMI organization, with first standard published in 2010.
- Any dynamic simulation model that utilizes the standard can be used. In this article, examples will be shown using Simcenter Amesim, but any simulation code that supports the FMI standards can be utilized.
- Time histories are the inputs and outputs from an FMU. To access an FMU, a user does not need to know the software interface of the dynamic simulation tool. Instead, the FMU defines the inputs and outputs and some changeable simulation parameters.
- The FMU interface does not define the engineering units (g’s, radians, etc.) of the inputs and outputs. This information must be set when creating the FMU and communicated separately to the hosting application.
- Depending on the code being used, a license of the simulation code and software libraries may be needed, even if the FMU is already available. In the case of Simcenter Amesim, a runtime only license called “Unitary Runtime License” (IL-TOL.30.1) is the minimum license needed in addition to the FMU file and a minimal installation software package.
An FMU (*.fmu) method is the interface to a simulation based dynamic model in the Simcenter Testlab Neo Process Designer workflow (as shown in Figure 1).
Figure 1: Time history test data can be input into a dynamic simulation model Functional Model Unit (FMU) and output to a Simcenter Testlab processing method.
Test based time histories can be input, and simulation time histories output, from the FMU via Simcenter Testlab Neo 2019.1 and later.2. Creating an FMU in Simcenter AmesimTo create an FMU, inputs and outputs must be identified.In the case of Simcenter Amesim, any function used as an input or output must be “unplugged”. In Figure 2, the model on the left is fully plugged, the model on the right has two unplugged functions.
Figure 2: Left – Fully plugged Simcenter Amesim model. Right – Model with two unplugged components.
What is a plug? In Simcenter Amesim, the total energy of any system must be conserved. In a fully complete Simcenter Amesim model that has been compiled and run, there are no open ports on components where energy could “leak out” and be unaccounted. Plugs are used on open ports that are not connected to other components to prevent energy from “escaping”.To create an open port where an FMU can be attached to the model, right click on the plug and delete it, as shown in Figure 3.
Figure 3: To unplug a port in an Amesim model, right click on the plug an delete it. The colors of the attached component will become inverted.
Unplugged ports are easy to see. The colors of the component are converted, and have a colored background rather than a white background.
With unplugged ports, a Functional Mock-up Interface model can be made (Figure 4).
Figure 4: In the Create Interface Block menu, select the type as Functional Mock-Up Interface.
Do the following steps in Simcenter Amesim:
- Press the Sketch tab
- Press the Create Interface Block button
- Select “Functional Mock-up Interface (FMI)”
Next select the inputs and outputs to be defined for the FMU being created. In the “Interface Icon Creation” menu, increase both the Number of Inputs and Number of Outputs fields to the desired numbers (Figure 5).
Figure 5: Enter the desired number of inputs and outputs in the FMI definition menu.
Enter the desired names for the inputs and outputs (Figure 6). Note that this is “reversed”:
- The inputs defined in Functional Mockup Interface will be the outputs when the FMU is used in Simcenter Testlab.
- The outputs defined in Functional Mockup Interface will be the inputs when the FMU is used in Simcenter Testlab.
Figure 6: Enter the desired names of the input and outputs in the Function Mock-Up Interface definition.
As many Functional Mock-Up Interface icons can be defined or made in Simcenter Amesim as desired. Regardless of the number of defined interfaces, only one FMU file will be created for the Simcenter Amesim model (see Figure 7).
Figure 7: Equivalent definitions of inputs and output for FMU creation. Left – A single interface icon with one input and one output. Right – Two interface icons, one with single output and one with single input.
The FMU will encompass all of the defined interfaces whether they are defined separately or in a group.
Press the “OK” button and position the FMU interface icon in the Sketch viewer. Then define connections between the Definition icon and model by connecting lines as shown in Figure 8.
Figure 8: Position the Interface definition window and connect to the desired components in the Simcenter Amesim model. A successful connection is indicated by the thin dashed red line.
Use connections between the Functional Mock-Up Interface definition and the Simcenter Amesim model:
- Position the Functional Mock-Up Interface where needed.
- Click just outside the connection on the Interface and drag a line to the desired port on the model.
- Click near the component port on the Simcenter Amesim model.
A thin dashed red line indicates a connection was successfully made. In this case, the driver request is connected to the output of the FMU, while the engine rpm is connected to the input of the FMU. The component colors will also return to normal, rather than being inverted.
Another key is that the connection arrows on the Simcenter Amesim model and Interface module must be properly aligned for a successful connection (Figure 9).
![User-added image](media/0EM4O000000qcqm)
Figure 9: Valid connections can only be made between output of Interface to input of model and vice versa.
The output of the Interface Defintion must connect to an input port of the model. If the connection is not successful, it is indicated by thick red lines as shown in Figure 10.
Figure 10: Thick red line indicates an unsuccessful connection.
When selecting the inputs and outputs for the FMU, be sure to careful notes as to the units (g’s, rpm, psi, etc) of each input and output. When using the FMU later in Simcenter Testlab, these units cannot be determined by interrogating only the FMU file.
3. Exporting an FMU from Simcenter Amesim
Will the input and output definition done, a FMU file can be created from Simcenter Amesim. This requires a FMI Export license (IL-FMI.01.2), which is not accessible via Simcenter Amesim tokens.
Click on the Simulation tab in Simcenter Amesim and choose “Run Parameters” as shown in Figure 11.
![User-added image](media/0EM4O000000qcr1)
Figure 11: Run Parameters include the total simulation time.
The parameter “Final Time” is very important. For example, the default is 10 seconds, which means the FMU model will simulate 10 seconds of operation. In Simcenter Testlab, if a 100 second measurement is run, the resulting calculations will still only have 10 seconds of data. They will be limited by this parameter. Increase this number as needed.
From the main menu, then select “Interfaces -> FMU export assistant…” (Figure 12).
Figure 12: FMU Export Assistant menu
Choose level of “exposure” in the FMU for the simulation model. Also select a destination directory as shown in Figure 13.
![User-added image](media/0EM4O000000qcxT)
Figure 13: Define output FMU file and the parameters to be exposed.
Choose the type of compiler to be used for the FMU. Generally, the Microsoft Visual C++ compiler will be the fastest. However, this compiler is not always loaded and available on a Windows PC, so a safe choice is the GNU GCC compiler (see Figure 14) which is delivered with Simcenter Amesim.
![User-added image](media/0EM4O000000qcxY)
Figure 14: The GNU GCC compiler is always available with Simcenter Amesim.
Press the “Generate” button.
If the FMU is successfully created, a message like Figure 15 should be shown.
![User-added image](media/0EM4O000000qcxd)
Figure 15: Successful FMU generation message.
The FMU file with extension *.fmu should be stored in the specified directory. Now the FMU can be used in Simcenter Testlab.
4. Importing an FMU in Simcenter Testlab
Open the Simcenter Testlab Neo Process Designer. Under “File -> Add-ins” turn on the “Interactive Analysis” add-in.
Then add the “FMU” method from the Method library to the current process flow as shown in Figure 16.
Figure 16: A Functional Mockup Unit (FMU) is added to the process area of Simcenter Testlab Neo.
Make sure some time data to be processed in the input basket.
Click on the FMU method and edit the properties as shown in Figure 17.
![User-added image](media/0EM4O000000qcxn)
Figure 17: FMU Parameters than can be changed and set from Simcenter Testlab.
The following parameters can be changed in the Properties Pane:
- Browse FMU Path – Select the FMU file (*.fmu)
- Inputs – With the Channel ID showing of the data to be processed, open the input dialog to assign a measured data channel to the input of the FMU.
- Outputs – Rename the output of the FMU if desired. For example, to match the channel name of measured data for easier comparison.
The inputs of the FMU can be connected to a measurement channel using the Channel ID field as shown in Figure 18.
Figure 18: The inputs parameters allows a measurement channel to be matched to the FMU input.
To view the Channel number more clearly, click on the “Cx-DOFID vs Function” in the home ribbon. The Channel identification will be of the form C1, C2, C3, etc.
Under Parameters, any exposed values used in the model can be changed (Figure 19). For example, different spring rates of a torsional damper could be tried.
![User-added image](media/0EM4O000000qcyC)
Figure 19: The parameters menu allows different values to be used solving the model.
Press the RUN button! The FMU model will be used as part of the Simcenter Testlab Neo process (Figure 20).
Figure 20: Colormap from Simcenter Amesim model of engine RPM. This was virtually measured from the model and processed along with the actual measured data.
Enjoy!
Related Links: