Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Using S-Functions in Normal Mode Referenced Models

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:

Execution fails because mdlProcessParameters has dependency requirements that mdlStart has not satisfied. Automated analysis cannot guard against all possible causes of such failure: you must check your code manually and verify that mdlProcessParameters is not in any way dependent on mdlStart being called first. Examples of such dependency include:

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 mdlStart 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 mdlInitializeSizes:

ssSetModelReferenceNormalModeSupport (S, MDL_START_AND_MDL_PROCESS_PARAMS_OK);

For information about referenced models, see Referencing a Model in Using Simulink, and Creating Model Components in the Real-Time Workshop documentation .

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS