Defining Function-Call Models

About Function-Call Models

Simulink® allows certain blocks, such as a Function-Call Generator or an appropriately configured custom S-function, to control execution of a referenced model during a time step, using a function-call signal. See Function-Call Subsystems for more information. A referenced model capable of being invoked in this way is called a function-call model.

Function-Call Model Demo

To view a function-call model demo, select Simulink > Modeling Features > Model Reference > Model Reference Function-Call from the Demos pane of the MATLAB® Help Browser or execute sldemo_mdlref_fcncall at the MATLAB command line.

Creating a Function-Call Model

To create a function-call model:

  1. Insert a Trigger block at the root level of the model.

  2. Set the Trigger block's Trigger type parameter to function-call.

  3. Create and connect any other blocks required to implement the model.

  4. Ensure that the model satisfies the conditions imposed on function-call models. See Function-Call Model Requirements for details.

You can now simulate the function-call model either by itself or by running a model that references the function-call model directly or indirectly.

Referencing a Function-Call Model

To create a reference to a function-call model:

  1. Create a Model block in the referencing model that references the function-call model. See Creating a Model Reference for details.

    The top of the Model block displays a function-call port corresponding to the function-call trigger port in the function-call model.

  2. Connect a Stateflow® chart, Function-Call Generator block, or other function-call-generating block to the Model block's function-call port. The signal connected to the port must be scalar.

  3. Connect the Model blocks inputs and outputs if any to the appropriate blocks in the parent model.

  4. Create and connect any other blocks required to implement the parent model.

  5. Ensure that the referencing model satisfies the conditions for a model to reference other models. See Simulink® Model Referencing Requirements and Simulink® Model Referencing Limitations for details.

You can now simulate the model that references the function-call model.

Function-Call Model Requirements

To be a function-call model, a referenced model must meet the following requirements in addition to the requirements that every referenced model must meet.

  


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