S-Functions in Normal Mode Referenced Models
For additional information, see Model Reference Requirements and Limitations.
When a C S-function appears in a referenced model that executes in Normal mode, successful execution is impossible if all of the following are true:
The S-function has both an
mdlProcessParametersfunction and an
mdlProcessParametersfunction depends on the
The referenced model calls
Execution fails because
mdlProcessParameters has dependency
mdlStart has not satisfied. Automated analysis cannot
guard against all possible causes of such failure: you must check your code manually and
mdlProcessParameters is not in any way dependent on
mdlStart being called first. Examples of such dependency include:
Allocating memory in
mdlStartand using that memory in
mdlProcessParameters. This is often done using
Initializing any DWork or any global memory in
mdlStartand reading the values in
To remind you to check for any such dependency problems, an error message appears by
default for any S-function that is used in a Normal mode referenced model and contains both an
mdlProcessParameters function and an
function. The error message does not mean that any dependency problems exist, but only that
they might exist.
If you get such an error message, check for any problematic dependencies in the
S-function, and recode as needed to eliminate them. When no such dependencies exist, you can
safely suppress the error message and use the S-function in a Normal mode referenced model. To
certify that the S-function is compliant, and the message is therefore unnecessary, include
the following statement in
ssSetModelReferenceNormalModeSupport (S, MDL_START_AND_MDL_PROCESS_PARAMS_OK);
For information about referenced models, see Model Reference Basics.
Supporting the Use of Multiple Instances of Referenced Models That Are in Normal Mode
You may need to modify S-functions that are used by a model so that the S-functions work
with multiple instances of referenced models in Normal mode. The S-functions must indicate
explicitly that they support multiple
For C S-functions, use
For MATLAB® file S-functions, use
blockSupportMultipleExecInstances = true.
The limitations for using S-functions with multiple instances of referenced models in Normal mode are the same as the limitations that apply to using S-functions with For Each Subsystem block.
Level-2 MATLAB S-Function | S-Function Builder | S-Function | MATLAB Function