User`s guide

3 Writing S-Functions As C-MEX files
3-106
ssSetOutputPortReusable
(S,outputPortIdx,value)
Used in mdlInitializeSizes (after
ssSetNumOutputPorts) to specify whether output ports
have a test point. This macro can take on two values:
Off (
value=0) specifies that the output port is not
reusable. This is the default.
On (
value=1) specifies that the o utput port is
reusable.
In Simulink, reusable sign als share the same memory
space. When this macro is turned on, t he output port
signal to the S-function may be reused by other signals in
the model. This reuse results in less memory use during
Simulink simulation and more efficiency in the
Real-Time Workshop generated code.
Whenyoumarkanoutputportasreusable,your
S-function must update the output once in
mdlOutputs.
It cannot expect the previous output value to be
persistent.
By default, the output port signals are not reusable. This
forces Simulink’s simulation engin e (and the R eal -Time
Workshop) to allocate global memory for these output
port signals. Hence this memory is only writ ten to by
your S-function and persists between model execution
steps.
ssGetNumInputPorts(S)
Canbeusedinanyroutine(exceptmdlInitializeSizes)
to determine how many input ports you have set.
ssGetInputPortWidth
(S,inputPortIdx)
Canbeusedinanyroutine(exceptmdlInitializeSizes)
to determine the width of an input port.
ssGetInputPortDirectFeedThrough
(S,inputPortIdx)
Canbeusedinanyroutine(except
mdlInitializeSizes)to determine if an input port has
direct feedthrough.
Table 3-7: Input and Output Port Signal SimStruct Macros (Continued)
Macro Description