Using the Simcenter Amesim to Simulink Interface
Importing the model into Simulink
The Simcenter Amesim model has now been created. It must be imported into Simulink.
Note
When using the Simcenter Amesim to Simulink interface, be careful to save the Simulink subsystem with a name that differs from all the names of he Simcenter Amesim models that will be imported. Otherwise variable name conflicts could occur within the MATLAB workspace.
Remember that when you close Simcenter Amesim, the files defining your system are compressed into a single file. This means that Simulink will not have access to the S-Function. For this reason, it is normal to have Simcenter Amesim and Simulink running simultaneously when using the interface. This way, you can change the parameters in the Simcenter Amesim model and restart the simulation very rapidly. You can also examine the results in Simcenter Amesim.
Note
As the Simcenter Amesim solver is not used in the AME2SL interface mode, observing results in Simcenter Amesim may be less accurate than observing them in Simulink. If accuracy is not sufficient, you should either consider setting Simcenter Amesim as the master tool (using SL2AMECosim mode), or observe the results in Simulink.
Another mode of working is to close Simcenter Amesim but then to type in a terminal (under Linux) or DOS window (under Windows):
AMELoad skyhook
...to expand the single file into its constituent parts. Simulink will then have access to all the files it needs.
Note
For the rest of this exercise it will be assumed you employ the first mode of working.
A graphical interface is available to help you to import the Simcenter Amesim model into Simulink and to configure it. It runs under Windows or Linux. In this exercise, it will be assumed this version will be used.
This interface is available only if Simulink is started from Simcenter Amesim:
using the Tools > Start MATLAB menu then start Simulink from MATLAB or
using the Tools > Simulink menu
When MATLAB is started, the path list is automatically updated as shown in the following figure.
Figure 9: The Simcenter Amesim environment installation
AMESimLib is added automatically, ensuring that the MATLAB version is compatible with the use of the graphical interface.
The graphical interface is launched from a specialized Simulink block grouped in a Simulink library.
Figure 10: The Simcenter Amesim Interfaces library
When you start the Simulink Library Browser, the Simcenter Amesim library (figure above) contains two blocks. The first one, called AME2SL, AME2SL is used in case of standard interfaces between Simcenter Amesim and Simulink. This one will be used in the current exercise.
From the library browser, drag and drop the AME2SL block to a Simulink subsystem. Now, the Simcenter Amesim import block is ready to be configured using the graphical interface. The graphical interface is launched by double-clicking on the block. The main window of the interface is now available as shown in the following figure.
Figure 11: Starting with AME2SL block
The main window shows that the Simcenter Amesim model "system" does not exist by displaying its name in red. The first thing to do is to select the name of the Simcenter Amesim model to import. This can be done in two ways:
Write the name of model in the edit box (case sensitive), in this example skyhook and push on the Load model button.
Select the mex file from the file browser dialog by clicking on the 'open file' icon as shown in the following figure. Figure 12: Selecting the mex file
Note
The extension of the mex file is automatically pre-defined by the interface according to the platform and MATLAB architecture. The list of mex file extensions is available using the MATLAB command mexext. In this example the extension is mexw64 because the platform is Windows and using MATLAB 64 bits.
Note
As of Simcenter Amesim 2020.2, it is no longer necessary to set the working directory of your Simulink model to the same location as the Simcenter Amesim model. To save the location of the Simcenter Amesim model to your MATLAB path for later reuse, it is possible to execute a savepath command right after importing the Simcenter Amesim model. If this location is no longer in the MATLAB path, it can be added automatically with a double-click on the AME2SL/AME2SLCosim block.
Moreover, AME2SL and AME2SLCosim blocks are now compatible with Simulink "linked libraries". This permits library publishers to propagate changes applied to Simcenter Amesim-originating models to all end-user models containing those models (these models will inherit the changes made to the libraries they are linked with). Note however that changing parameters in such models directly (in other words, not in the linked library) is not allowed unless the link is deactivated.
Once the Simcenter Amesim model has been read, the AME2SL block is automatically sized with the appropriate number of inputs and outputs. Input and output labels and the name of the Simcenter Amesim model are displayed on the block icon (figure below).
Figure 13: Imported Simcenter Amesim model
Warning
Important note:
If your Simcenter Amesim model has more than one input coming from Simulink, the input signals to Simcenter Amesim have their order reversed when compared to what is sent from Simulink. This is due to the fact that Simcenter Amesim numbers the ports in counter-clockwise order while the Mux block in Simulink numbers them starting at the top. The output side of the interface block is not affected by this, since in this case the variables are numbered from the top in both softwares. This can be seen by comparing the model in Simcenter Amesim and Simulink as shown in the figures below:
Figure 14: Order of inputs and outputs
The graphical interface can be closed at any time by clicking on the close button. To open it again, just double click on the AME2SL block.
At this stage, the Simcenter Amesim model has been imported and the Simulink system can be completed as shown in the following figure.
Figure 15: The system ready to run
Note
The values of Gain and Gain 1 come from the Car suspension example in A simple mechanical system of the Simcenter Amesim Tutorial manual.
Why has the transfer function been inserted?
This is a consequence of the fact that the Simcenter Amesim interface S-Function is defined as having direct feed through. This means that the outputs from the block may be directly dependent on the input. For most realistic Simcenter Amesim systems this is not true, there are normally state variable(s) between inputs and outputs. The way the S-Function is created makes it necessary to specify that all systems have a direct feed through in every case.
The transfer function (a first order lag) that is inserted is required to break the algebraic loop that Simulink sees due to this direct feed through. For the current system it can be regarded as the dynamics of the actuator that applies the damping force.
Once the Simulink system is completed, it is time to configure the run parameters. Open the main window interface and click on the Run parameters icon . The run parameters window appears as shown in the following figure.
Figure 16: The run parameters window for a standard interface
With a normal Simcenter Amesim run, a print interval is specified which enables you to control the size of the results file. Simulink runs in a somewhat different way and consequently the Simcenter Amesim result files can become unacceptably large. To prevent this from occurring a special Simcenter Amesim print interval is specified. The data added to the Simcenter Amesim results file will be spaced with a time interval not less than this value.
The Create result file create result file
create result file check-box
check-box indicates whether a Simcenter Amesim result is to be created. The interface makes it possible to specify the print interval. The print interval parameter can be defined by a MATLAB expression. Furthermore, through this window you can load the print interval parameter defined in the Simcenter Amesim run parameters popup by clicking on the Get Simcenter Amesim parameters button.
Note
The Run parameters of the Simcenter Amesim model are not used for the simulation, except for the Activity index calculation. If you want the activity variables to be calculated during the simulation, proceed as follows in Simcenter Amesim:
Open the Run Parameters dialog box.
Select the Standard options tab and tick the Activity check-box
Simcenter Amesim forces the model to recompile.
Select File > Write files for simulation
Note
All parameter windows in the graphical interface work in this way:
Press the OK button to validate change and close window
Press the Cancel button to cancel change and close window
Press the Apply button to validate change, the window keeps opened
The Close button of the window is disabled. Closing the main window forces the closure of all children parameter windows.
Now you can set the Simulink simulation parameters.
Figure 17: Setting the simulation parameters
In Simulink it seems that both solvers for stiff systems can be used for Simcenter Amesim models. In this particular case, use the ode15s (stiff/NDF) method (in older versions, Gear and Adams/Gear were the ones most suitable). Set the stop time to 5 seconds, this will be quite enough to produce some interesting results (figure above).
Initiate the Simulink run and observe the output from the Scope block. This will give the input force supplied to the car suspension as shown in the following figure.
Figure 18: Force in Simulink
Enabling Result file creation allows us to observe the same quantity plotted within Simcenter Amesim (figure below). If you chose to generate a Simcenter Amesim result file, it is possible from within Simcenter Amesim to access the full range of variables of the Simcenter Amesim model. These can be plotted like a normal Simcenter Amesim simulation.
Figure 19: Force in Simcenter Amesim
The following figure shows the body and wheel displacements. These can be plotted from the Simcenter Amesim components:
Figure 20: Force in Simcenter Amesim
Now we demonstrate how to change model parameters through the graphical interface. Open the main interface and click on the Model parameters icon . The model parameter window appears as shown in the following figure.
Figure 21: The model parameters window
This window summarizes all global parameters defined in the Simcenter Amesim model. The value of each parameter can be modified by editing the Value field for each line. The value of Global Parameters can be defined by a MATLAB expression.
Furthermore, this window allows you to:
Reset all parameters to their default values by clicking on the Set to default value button.
Quickly load the global parameter set defined in Simcenter Amesim by clicking on the Get Simcenter Amesim parameters button.
Note
If a global (real or integer) parameter is set as an expression in Simcenter Amesim the expression will not be visible or usable from Simulink. Text parameters are treated as text and can thus contain any type of text- including expressions.
Since the totalmass parameter is an expression of two other parameters, it is reasonable to assume that it should not be possible to set it independently of the other parameters. This is the reason why the interface will ignore this parameter.
To illustrate the correct updating of parameters we can for example set the body mass value to 100kg as shown in the following figure.
Figure 22: Modifying model parameters
Click on the Apply button and run the simulation; we can now look at the displacement curves plotted in Simulink (figure below) and notice the difference with the preceding simulation (figure: Figure 20).
Figure 23: Result changes
Note
All values of run parameters and model parameters are saved in the Simulink model independently of their values defined in Simcenter Amesim. This means that data modified are persistent, and are not lost when the Simulink model is closed.
Click on the IO connection icon to launch the model connection window (see the following figure).
Figure 24: The model connection window
To help in model adjustment, you can disconnect each input and output of the Simcenter Amesim model in the Simulink subsystem and set a constant value instead of real signal.
Furthermore, this window allows you to:
Disconnect/connect all inputs of the Simcenter Amesim model by clicking on the Disconnect all or Connect all button in the Input panel.
Disconnect/connect all outputs of the Simcenter Amesim model by clicking on the Disconnect all or Connect all button in the Output panel. Figure 25: The model connection window
For example, disconnecting the road input and setting the signal value to 0.5 as shown in the figure above, produces the following simulation result (see the following figure).
Figure 26: Road entry disconnected
The simulation runs using the specified input value instead of the signal delivered by the pulse generator. Disconnected inputs and outputs are indicated by a diamond symbol on the block as shown in the following figure for the Road input
Figure 27: Disconnected input for Road
Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.Simulink/Importing_the_model_into_Simulink · retrieved 2026-07-17