AmesimKnowledge

Using the Simcenter Amesim to Simulink Interface > Co-simulation interface

Usage of the co-simulation interface

We will reuse the Simcenter Amesim system created earlier (figure: Figure 1). Save the system as skyhookcosim. Now we add the interface block. The process is similar to the process for creating the standard Simulink interface, except that we select SimuCosim in the field labeled Type of interface instead of Simulink. See the following figure.

Figure 29: Creating the icon for co-simulation

Go into Parameter mode and then Simulation mode. Next we create the Simulink system as shown in the Figure 31 figure.

To create the Co-Simulation interface in Simulink, the only difference is to select the block AME2SLCoSim in the library browser, instead of the AME2SL block.

Again drag and drop the block in the subsystem and double click it to open the main interface window, as shown in the following figure

Figure 30: Starting with an AME2SLCoSim block

Select the Simcenter Amesim model to import: skyhookcosim, and connect the block. The co-simulation subsystem is ready to use.

Figure 31: Simulink model - Co-simulation

At this time, the co-simulation parameters must be set. Open the Run parameters window by clicking on the dedicated icon () from the main window. The run parameter window for co-simulation appears as shown in the following figure.

Figure 32: The run parameters window for the co-simulation interface

This window presents most of the Simcenter Amesim run parameters that can be adjusted from the Simulink interface. Once the run parameters are modified from the Simulink interface, they are saved independently of any run parameters defined in Simcenter Amesim.

Furthermore, this window allows you to load the run parameters defined in the Simcenter Amesim run parameters popup by clicking on the Get Simcenter Amesim parameters button.

The run parameters are listed below:

Parameter Description
Integrator type Select the type of integrator, variable (standard) or fixed step solver.
General parameters
Sample time Time between exchange of values between Simcenter Amesim and Simulink. This parameter must absolutely set according to the model dynamics. It can be defined by a MATLAB expression.
Print interval Define the print interval in the result file, the same as in the Simcenter Amesim run parameters popup. It can be defined by a MATLAB expression.
Statistics The same as in the Simcenter Amesim run parameters popup.
Monitor time The same as in the Simcenter Amesim run parameters popup.
Standard options
Tolerance The same as in the Simcenter Amesim run parameters popup. It can be defined by a MATLAB expression.
Maximum time step The same as in the Simcenter Amesim run parameters popup. It can be defined by a MATLAB expression.
Solver type Adjust the optimization solver level, the same as in the Simcenter Amesim run parameters popup.
Discontinuities printout The same as in the Simcenter Amesim run parameters popup.
Fixed step options
Integration method The same as in the Simcenter Amesim run parameters popup.
Order Order of the integration method: 1 for Euler 2 to 4 for Adams or Runge-Kutta
Step Time step of integration method. The same as in the Simcenter Amesim run parameters popup.

Warning

It is possible to set the sample time to the value -1. This means that the sample time is inherited from the Simulink workflow. It will probably cause a backward integration that is not supported by Simcenter Amesim, and produce an error during the simulation.

To prevent this problem, we may use an inherited sample time only when a fixed-step solver is configured in Simulink, or using the Simcenter Amesim model in a triggered subsystem.

Set the sample time to 10-2 s and the print interval to 10-3 s.

The sample time chosen in this example is set fairly high on purpose, to make the effects of the sampling more obvious. The chosen sample time is for this case the maximal sampling time possible to use. The damping force calculated by the Simulink model is shown in the Figure 33 figure using a sample time of 0.01s, compare this with the force in the Figure 18 figure. The stability of the system has gone down due to the sampled controller.

Figure 33: Force as calculated by Simulink using a sample time of 0.01 s

Looking more closely at the input to the Simcenter Amesim system (figure below) we can easily observe the time-discrete nature of the force. The sampled controller results for the body and wheel displacements are more oscillatory (figure: Figure 37) than with the continuous controller (figure: Figure 20). By selecting a smaller sample time we can get a result that is more similar to the one we had with the standard interface (continuous controller). In figures Figure 35 and Figure 37 the sample time is set to 0.001s and the Simcenter Amesim communication interval is set to 0.0002 s.

Figure 34: Detailed view of force input to Simcenter Amesim model using sample time of 0.01 s

Figure 35: Body and wheel displacement with a sample time of 0.01 s

Figure 36: Actual input to the Simcenter Amesim model using a sample interval of 0.01 s

Figure 37: Body and wheel displacement with a sample time of 0.001 s

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