User`s guide

3 Writing S-Functions As C-MEX files
3-112
Table 3-10: State and Work Vector SimStruct Macros
Macro Description
ssSetNumContStates
(S,nContStates)
Used in mdlInitializeSizes to specify the number of
continuous states as 0, a positive intege r , o r
DYNAMICALLY_SIZED. If you specify DYNAMICALLY_SIZED,then
you can optionally specify the true (positive integer) width in
mdlSetWorkWidths, otherwise the w id th to be used w ill be the
width of the signal passing through the block. If your S-function
has continuous states, then it needs to return the derivatives of
the states in
mdlDerivatives so that the solvers can integrate
them. Continuous states will be logged when you have clicked
the
States checkbox on the Workspace I/O page of the
Simulation Paramete rs dialog box.
ssSetNumDiscStates
(S,nDiscStates)
Used in mdlInitializeSizes to specify the number of discrete
state s as 0, a positive integ er, or
DYNAMICALLY_SIZED.Ifyou
specify
DYNAMICALLY_SIZED, t hen yo u can opt io nally specify the
true (positive integer) width in
mdlSetWorkWidths,otherwise
the width to be used will be the wid th of the signal passing
through the block. If your S-function has discrete states, then it
should return the next discrete state (in place) in
mdlUpdate.
Discrete states will be logged when you have clicked the
States
checkbox on the Workspace I/O page of the Sim ulation
Parameters
dialog box.
ssSetNumRWork(S,nRWork)
Used in mdlInitializeSizes to specify the number of real_T
work vector elements as 0, a positive integer, or
DYNAMICALLY_SIZED. If you specify DYNAMICALLY_SIZED,then
you can optionally specify the true (positive integer) width in
mdlSetWorkWidths, otherwise the w id th to be used w ill be the
width of the signal p assing through the block.
ssSetNumIWork(S,nIWork)
Used in mdlInitializeSizes to specify the number of int_T
work vector elements as 0, a positive integer, or
DYNAMICALLY_SIZED. If you specify DYNAMICALLY_SIZED,then
you can optionally specify the true (positive integer) width in
mdlSetWorkWidths; otherwise the w id th to be used w ill be the
width of the signal p assing through the block.