Documentation Home Page HYPERSIM Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

Simulink | Using Multiple Time-Step Code Generation


  • Note that this feature is only supported from MATLAB R2015b, and is not compatible with confidential model compilation.
  • Also, protected S-Functions are not supported by multiple-time step code generation. Be careful as many libraries may include such functions.



To be able to use a model over a given time step range on HYPERSIM, it is possible to generate the code in advance for multiple time steps. To do so, in the Simulink Code Generation option in the HyperLink code generation options panel, check the Simulink Model is a multi-time step compatible option and provide the minimum and maximum time steps to be used for the generation of the multi-time step code along with the size of the time step increment:

The time step of your model should be set to ‘Ts’ and the variable need to be defined in your workspace.

On the MATLAB console, set the HYPERSIM_DIR environment variable to the directory where HYPERSIM is installed:

Set environment variable
>> setenv('HYPERSIM_DIR','C:\OPAL-RT\HYPERSIM\hypersim_%version%')


The code can now be generated and used on HYPERSIM using the standard workflow.

If the time step used in HYPERSIM is out of the specified range, the model will not run and an error message displaying the allowed range will be displayed in the model console.

Note that this feature also supports multi-rate models.

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323