AmesimKnowledge

Using the Simulink to Simcenter Amesim Interface

Importing the generated code into Simcenter Amesim-Co-simulation Mode

Once the created submodel has been added to the Simcenter Amesim category, you can use the exported model in Simcenter Amesim as a normal Simcenter Amesim submodel.

Remember to add the path to the new category (for instance C:\AMETest\libsl2ame) to your Simcenter Amesim path list (accessible from the Sketch menu).

The automatically-created category is present in the Library Tree:

Figure 76: The category in the Library Tree

Figure 77: Using the exported model

The exported submodel has the same number of input ports as there are input blocks on the Simulink root diagram. The same rule is valid for the output ports.

The current version of SL2AMECosim only supports scalar input/output blocks. The main reason for this is that there are very few submodels in Simcenter Amesim with vector ports.

The parameters of the exported submodel are the parameters available in the Simulink blocks plus one additional integer parameter.

This integer parameter is called undersample - the Simulink system will use the fixed step solver step that was specified in Simulink (you can check the generated help file to see the step size used). By default the Simcenter Amesim model will exchange with the Simulink model every Simulink time step - and generate a Simcenter Amesim discontinuity. Using this parameter it is possible to let the Simulink solver take several steps between each communication with Simcenter Amesim, thus reducing the number of generated discontinuities.

Figure 78: The Change Parameters window

After a simulation, you have access to the following variables for plotting:

  • inputs

  • outputs

  • I/O blocks

Note

The input/output variables will get their names from the Simulink sketch if MATLAB 2011a or later is used. In older versions of MATLAB a generic name will be used.

Figure 79: The variables

The generated submodel has a special help file (*.html) that is directly accessible via the Help buttons in the Parameter List and Variable List dialog boxes.

Figure 80: Help

The quantity of parameters or variables available depends on the code generation options (see SL2AMECosim advanced topics and refer to the Real Time Workshop User's Guide).

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