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

User SFunction


Prior to Release 13 of Real-Time Workshop, the RT-LAB targets used the SimStruct data-structure to capture and store model-wide information. Since the SimStruct was also used by noninlined Sfunctions, it suffered from the drawback that some of its fields remained unused when it was used to capture root (model-wide) information.

To avoid this drawback, Version 5.0 of RTW introduces a special data structure called the rtModel to capture root model data.

RT-LAB now supports the data structure rtModel. Support for this structure will help make RT-LAB compatible with new MatLab toolboxes, such as Simscape toolbox with SimDriveline, SimHydraulics, SimMechanics and will give access in the future release of RT-Lab to new RTW functionality, such as support of Model Reference Block ...etc

For most users, this new structure should have no impact on the use of RT-Lab. Only users who have created their own libraries from S-Function will need to build their libraries with a new compilation flag.

Changes Resulting from the Replacement of SimStruct with the rtModel

The implications resulting from the use of this new structure will apply only to users of Simulink SFunction.

Using Simulink Sfunction consists of three parts:

  • Users of Sfunction built with RT-LAB model: No modification required.
  • Users of external Sfunction included in external library: these users need to compile their library with a new compilation flag.
  • In order to compile the Sfunction source code for Rtmodel support, the user must also prepare its associated makefile. It is assumed here that the reader is familiar with setting up C makefiles. A new compilation flag "USE_RTMODEL" should be added to support rtmodel data structure.


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