AmesimKnowledge

Using the Simcenter Amesim to Simulink Interface > Using the Simcenter Amesim-Simulink Black-box interface

Importing and using the Black-box manually

System without global parameters

The generated S-function is a normal S-function, more or less, as they have always been generated from Simcenter Amesim. The new feature introduced is the access to global parameters. If you don't need (or want) to give the end-user easy access to global parameters in the Simcenter Amesim system, the S-function can be used in the same way as the S-functions normally created by Simcenter Amesim. After putting the S-function block on the Simulink sketch you only need to change the name in the S-function parameters popup and it is ready for use. The two parameters normally given to a Simcenter Amesim S-function concern the creation of a result file, but since an ASBB never creates a result file these parameters are not really useful.

If you plan to only use the amecreatebbmask command you can stop reading here.

Figure 55: Black-box s-function without global parameters

Systems with global real parameters

The next step is to add the access to the global real parameters in the Simcenter Amesim model.

To do this you will need to add the two dummy parameters again, this time as an array. The actual values are not important but they must be present.

Then follows two matrices: the first with the names of the global real parameters and the second with their values.

Note that Simulink requires that every row in text matrices has the same length. So blanks have to be added to fill up every row to the same length (as shown in the following figure). You can achieve this by using the strvcat function. So writing [strvcat('gain', 'damping', 'freq')] as the second matrix will ensure that all rows have the same length without having to count spaces.

Figure 56: Black-box s-function with global parameters

Note that the third matrix (with the values) must be a matrix of numbers. It could also be a matrix of MATLAB workspace variables as in [matlab_gain ; matlab_damping; matlab_frequency] (as in the figure below). This will of course make it possible to perform batch runs in MATLAB with different values on the MATLAB variables.

Figure 57: Using workspace parameters

What was described here is basically what the amecreatemask command does. It reads the global parameter file (using amegetgpar) and creates a mask using this information. The S-function arguments are created to fit with the created mask. The following figure shows the S-function parameters created by amecreatebbmask. Note that both the name and the value matrices consist of variables. These variables are "mask" variables that are set in the initialization commands for the mask (figure: Figure 59).

Figure 58: S-function parameters created by amecreatebbmask.m

Figure 59: Initialization commands for the mask

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