User`s guide
3 Writing S-Functions As C-MEX files
3-108
ssGetInputPortBufferDstPort
(S,inputPortIdx)
Can be used in any run-time (see p. 3-14) S-function
routine to determine the index number of an output port
when the specified input port has been overwritten by
theoutputport.Thiscanbeusedwhenyouhave
specified the following:
• The input port and some output port on an S-Function
are not test points (
ssSetInputPortTestPoint and
ssSetOutputPortTestPoint)
• The input port is over writable
(
ssSetInputPortOverWritable)
If you have this set of conditions, then one of your
S-functions’s output ports (provided its test point has
been turned off) may reuse the same buffer as the input
port. If this hap pens, then after model initialization, the
following macro re turns the index of the output port t hat
reuses the specified input port’s buffer. If none of the
S-Function’s output ports reuse this input port b uffer,
then this macro returns
INVALID_PORT_IDX (= -1).
ssGetNumOutputPorts(S)
Canbeusedinanyroutine(exceptmdlInitializeSizes)
to determine how many output ports you have set.
ssGetOutputPortWidth
(S,outputPortIdx)
Canbeusedinanyroutine(except
mdlInitializeSizes)to determine the width of an
output port where the output port index starts a t 0 and
must be less than the number of output ports.
ssGetOutputPortSampleTime
(S,outputPortIdx)
Canbeusedinanyroutine(exceptmdlInitializeSizes)
to determine the sample time of an output port. This
should only be used if you have specified port-based
sample times.
Table 3-7: Input and Output Port Signal SimStruct Macros (Continued)
Macro Description