User`s guide
3 Writing S-Functions As C-MEX files
3-32
* the size specified by the port which is usually referred to as
* the block width.
*
* SS_OPTION_DISALLOW_CONSTANT_SAMPLE_TIME - This is used to disable
* your S-function block from inheriting a constant sample time.
*
* SS_OPTION_ASYNCHRONOUS - This option applies only to S-functions that
* have no input ports and 1 output port. The output port must be
* configured to perform function calls on every element. If any of
* these requirements are not met, the SS_OPTION_ASYNCHRONOUS is
* ignored. Use this option when driving function-call subsystems that
* will be attached to interupt service routines.
*
* SS_OPTION_ASYNC_RATE_TRANSITION - Use this when your s-function converts
* a signal from one rate to another rate.
*
* SS_OPTION_RATE_TRANSITION - Use this why your S-function is behaving
* as a unit delay or ZOH. This option is only supported for these two
* operations. An unit delay operation is identified by the presence
* of mdlUpdate and if not present then the operation is ZOH.
*/
ssSetOptions( S, 0); /* general options (SS_OPTION_xx) */
} /* end mdlInitializeSizes */
For an example, see the timestwo S-function on page 3-7.
Masked Multiport S-Functions
Ifyou aredevelopingmaskedmultiportS-functionblockswhosenumberofport
varies based on some parameter, and if you want to place them in a Simulink
library, then you must specify that the mask modifies the appearance of the
block. To do this, before saving the library execute this command
set_param('block','MaskSelfModifiable','on')
at the MATLAB p rompt. Failure to specify that the mask modifies the
appearance of the block will mean that when the library link is loaded, the
number of ports will not always match what is shown in the library.
Configuring Input and Output Port Properties
In mdlInitializeSizes, you can specify the port widths as a positive nonzero
integer. In this case, the corresponding input/output signal will have the
specified width when accessed by your S-function routines during the
simulation loop. However, if you specify
SS_OPTION_ALLOW_INPUT_SCALAR_EXPANSION and apositive nonzero integer,N,
for an input port width, then the width of the corresponding signal will be