Specify if S-function can be used in referenced model simulating in normal mode
void ssSetModelReferenceNormalModeSupport(SimStruct *S, ssModelReferenceNormalModeSupport mode)
S
SimStruct representing an S-Function block.
mode
Flag for normal mode simulation support when the S-Function block is
used in a referenced model. Options are
DEFAULT_SUPPORT_FOR_NORMAL_MODE
(0
) or
MDL_START_AND_MDL_PROCESS_PARAMS_OK
(1
).
Use in mdlInitializeSizes
to specify if an S-function with both
an mdlStart
and an mdlProcessParameters
method
can be used in a referenced model simulating in normal mode. Permissible values
are:
DEFAULT_SUPPORT_FOR_NORMAL_MODE
: The Simulink® engine produces an error if the S-function is in a referenced
model simulating in normal mode.
MDL_START_AND_MDL_PROCESS_PARAMS_OK
: The Simulink engine allows normal mode simulation of the S-function in a
referenced model.
The ssSetModelReferenceNormalModeSupport
flag indicates to the
engine if the code in mdlProcessParameters
is independent of the
code in mdlStart
. This information is important because the
engine modifies its normal mode simulation process for S-functions in a referenced
model. If the S-function is not in a referenced model, the engine always executes
the mdlStart
method prior to the
mdlProcessParameters
method. However, during normal mode
simulation of referenced models, the engine may decide to execute the S-function's
mdlProcessParameters
method prior to
mdlStart
. If the mdlProcessParameters
method requires data initialized in mdlStart
, the engine cannot
successfully change the order of execution.
By default, the engine produces an error if it finds an S-function with both an
mdlStart
and an mdlProcessParameters
method in a referenced model simulating in normal mode. The default behavior is
equivalent to specifying the DEFAULT_SUPPORT_FOR_NORMAL_MODE
option for ssSetModelReferenceNormalModeSupport
. If the
S-function does not depend on the execution order of these two methods, specify the
MDL_START_AND_MDL_PROCESS_PARAMS_OK
option to enable normal
mode simulation.
C, C++
See the S-function sfun_frmad.c
used in sfcndemo_frame
for an example that uses this function.
Running this model requires a DSP System Toolbox™ license.