AmesimKnowledge

Concluding remarks and FAQs > Common problems and their solutions

Not possible to run sequential simulations

This used to be a common problem but the solution has been partially automated and fortunately now is much rarer.

Versions

MATLAB r11, r12 and r13 under Linux and Windows.

Situation

  • A Simulink model containing the S-Function corresponding to a Simcenter Amesim model (.DLL, .mexsol, ...) is opened.

  • The first simulation in Simulink works fine.

  • When running a new simulation, the following error message ( mdlInitializeConditions mdlInitializeConditions) is systematically displayed:

Solutions

Under most circumstances it is necessary to force Simulink to reload the Simcenter Amesim model for each new simulation. To avoid any problems, we recommend that you always do this.

One way to achieve this is to clear the Simcenter Amesim mex function from (MATLAB) memory before starting a new simulation. This can be done in two ways, manually or automatically:

  • The manual way is to type "clear mex" or "clear xxxx_" where xxxx is the Simcenter Amesim system name. This needs to be done before each new simulation starts (or after each simulation).

  • In Simulink version 2 and higher it is possible to specify a command to be executed after each simulation. Taking the Simulink system in the Figure 15 figure as an example we can type: set_param('skyhook/S-Function','StopFcn','clear skyhook_') at the MATLAB command prompt. This makes Simulink unload the Simcenter Amesim mex function after each simulation, and thus forcing it to be reloaded when a new simulation is run.

If the Java interface (MATLAB 6 or higher) is used, a menu item File > Model properties exists in the Simulink menu bar that does the same thing as the set_param command. In the Simulation stop function zone add the expression "clear xxxx_" where xxxx is the Simcenter Amesim system name. Click on the Apply button. Save the Simulink model so that modifications are definitely taken into account.

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