AmesimKnowledge

Creating and exporting FMU

Simple example: exporting a model containing input and output ports

The aim of this example is to build an FMU containing input and output ports, and customize the set of exported parameters and variables. Open the driveline model located in the tutorial subdirectory of the Simcenter Amesim root directory.

In sketch mode, modify the model as shown in the figure below:

  • remove the signal source connected to the torque source (torquecon [TORQC]) on the left

  • remove the signal sink connected to the rotary speed sensor (rotaryspeedsensor [MECRSS0A]). Figure 69: Sketch being modified

Pull down the Interfaces > Create interface block menu command. In the Interface Icon Creation dialog box, specify the following:

  • select “Functional Mock-up Interface (FMI)” as type of interface in the list box

  • set the number of inputs to 1 using the spin buttons

  • set the number of outputs to 1 using the spin buttons

  • type speed as the name of the block input in the left text area, just after > 1

  • type torque as the name of the  block output in the right text area, in front of 1 >

  • in the three text areas in the middle of the dialog box, enter the label Functional Mock-up Interface for Co-simulation block

The Interface Icon Creation dialog box should look like the figure below.

Figure 70: Adding input and output variables to the FMI for Co-simulation block

Click the OK button and drop the block onto the sketch. Once it is done, its output can be connected to the input of the torque source (torquecon [TORQC]), and its input to the output of the rotary speed sensor (rotaryspeedsensor [MECRSS0A]), as shown in the figure below. The labels “speed” and “torque” define the names of the input and output variables as they will appear in the FMU. The variables of the FMI for Co-simulation block represent the interfaces of the FMU from the point of view of the Simcenter Amesim sketch, which is the inside of the FMU. This means that the block inputs (here labeled “speed”) are the outputs of the FMU, and the block outputs (here labeled “torque”) are the inputs of the FMU. When working with FMI blocks on the Simcenter Amesim sketch, you must always remember that:

  • Simcenter Amesim components (represented by submodel or supercomponent icons) are inside the FMU ·

  • The FMI for Co-simulation block represents the outside world, i.e. a model with which the Simcenter Amesim model is connected

Figure 71: FMI for co-simulation block connected to sensor and actuator blocks of the models

Enter Simulation mode, the model is ready to be exported. Pull down the Interfaces > FMU export assistant menu command. Since the FMU now has some  input and output variables (the torque as input and the speed as output), it is worth restricting the parameter and variable visibility to only these variables. During the first step of the assistant, select the Visibility level radio button entitled Low, leaving the other fields as they are: FMU type and version as Co-simulation 1.0, the Embed Tables checkbox selected, and the FMU for real-time checkbox not selected (see figure below).

Figure 72: First step of the FMU Export Assistant, showing the Low visibility option selected

Proceed to the second step of the assistant (by clicking the Next button), choose the architecture and compiler combination available on the computer, and click the Generate button. The FMU is updated with the new interfaces regarding the input and output variables. As it is not always interesting to expose everything in the interface of an FMU, the export tool allows you to expose only a restricted set of parameters and variables. As an example, we show how to set up an FMU with only one parameter and one variable. Open the global parameters list using the Configure > Global parameters menu command, and drag and drop the v1000 global parameter onto the Watch parameters area (see figure below).

Figure 73: Watch parameters

Then, select the wsig@rotaryspeedsensor variable from the contextual variable list and drag and drop it onto the Watch variables area (see figure below).

Figure 74: Watch variables

To update the FMU, restart the FMU Export Assistant. During the first step, select User-defined for the visibility level (see figure below) and proceed to the two other steps as before.

Figure 75: First step of the FMU Export Assistant showing the User-defined visibility option selected

Now the FMU is updated and only the watch parameters and watch variables are visible to the importing environment, in addition to the input and output variables which are always present for connecting the FMU to the environment. The FMU is ready for co-simulation in an FMI for Co-simulation 1.0 environment.

Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.Functional_Mockup_Interface/xid1223899 · retrieved 2026-07-17