Abstract

The RTW S-Function Block is used together with the RTW S-Function target to generate a model as a S-Function which can then be used inside another model. This is useful for speeding up simulations, sharing models with others, and preventing change to portions of a model. The model that contains the RTW S-Function can again be generated as a RTW S-Function, this block passes along the necessary information by using the makefile (*.mk) file associated with the mex file. At any level of nesting, a RTW executable can be created from a model with RTW S-Function(s) using the Generic Real-Time(grt) or Generic Real-Time Malloc (grt_malloc) targets. Also, user S-Functions and Stateflow blocks can be present in a model that is generated as a RTW S-Function. By default, when the RTW S-Function is built, a untitled model is opened and this block placed in it with the name of the s-function already entered. The block can then be copied to another model if desired. A user can also copy this block from rtwlib to a model and enter a RTW S-Function mex-file name.