User`s guide
3 Writing S-Functions As C-MEX files
3-102
Table 3-7: Input and Output Port Signal SimStruct Macros
Macro Description
ssSetNumInputPorts
(S,nInputPorts)
Used in mdlInitializeSizes to set to the number of
input p o r ts to a n onnegative integer. It should b e invoke d
using:
if (!ssSetNumInputPorts(S,nInputPorts))
return;
where ssSetNumInputPorts returns a 0 if nInputPorts is
negative or an error occurred while creating the ports.
When this occurs, and you return out of your S -function,
Simulink will display an error message.
ssSetInputPortWidth
(S,inputPortIdx,width)
Used in mdlInitializeSizes (after
ssSetNumInputPorts) to specify a nonzero positive
integer width or
DYNAMICALLY_SIZED for each input port
index starting at 0.
ssSetInputPortDirectFeedThrough
(S,inputPortIdx,dirFeed)
Used in mdlInitializeSizes (after
ssSetNumInputPorts) to specify the directfeedthrough(0
or 1) for each input port index. If not specified, the
default direct feedthrough is 0. Setting direct
feedthrough to 0 for an input port is equivalent to saying
that the corresponding input port signal is not use d in
mdlOutputs or mdlGetTimeOfNextVarHit.Ifitisused,
you may or may not see a delay of one simulation step in
the input signal. This may cause the simulation solver to
issue an error due to simulation inconsistencies.
ssSetInputPortSampleTime
(S,inputPortIdx,period)
Used in mdlInitializeSizes (after
ssSetNumInputPorts)tospecifythesampletimeperiod
as continuous or as a discrete value for each input port.
Input port index numbers start at 0 and end at the total
number of i nput ports minus 1. You should use this
macro only if you have specified p ort-based sample times.