A conditionally executed referenced model, or conditional model, allows you to control its execution with an external signal. The external signal, called the control signal, is attached to the control input port. Conditional models are useful when you create complex model hierarchies that contain components whose execution depends on other components.
You can set up referenced models to execute conditionally, similar to conditional subsystems. For information about conditional subsystems, see Conditionally Executed Subsystems Overview.
Simulink® software supports these conditional model types:
An enable port executes a referenced model at each simulation step for which the control signal has a positive value. To add an enable port to a Model block, insert an Enable block in the referenced model.
This image displays the contents of a simple enabled referenced model.
For an example of an enabled subsystem, see Enabled Subsystems. A corresponding enabled referenced model uses the same blocks as are in the enabled subsystem.
A trigger port executes a referenced model each time a trigger event occurs. To add a trigger port to a Model block, insert a Trigger block in the referenced model.
This image displays the contents of a simple triggered referenced model.
For an example of a triggered model, see Introduction to Managing Data with Model Reference.
|Triggered and Enabled|
A Model block can have both trigger and enable ports. If the enable control signal has a positive value at the time step for which a trigger event occurs, a triggered and enabled model executes once.
A function-call port executes a referenced model each time a
function-call event occurs. To add a function-call port to a
Model block, insert a Trigger block in
the referenced model. Then, open the Block Parameters dialog box and set
the Trigger type to
A Stateflow® chart, a Function-Call Generator block, a Hit Crossing block, or an appropriately configured custom S-function can provide function-call events. See Using Function-Call Subsystems.
This image displays the contents of a simple function-call referenced model.
For an example of a function-call model, see Model Reference Function-Call.
Conditional models must meet the requirements for:
Conditional models must also meet the requirements specific to each type of conditional model.
Signal attributes of the trigger port in the referenced model must be consistent with the input that the Model block provides to that trigger port.
|Triggered and Enabled||See requirements for triggered models and enabled models.|
At the root level of the referenced model, insert one of the following blocks:
|Type of Model||Blocks to Insert|
Triggered and Enabled
Trigger and Enable
For an enabled model, go to Step 3.
For the Trigger block, set the Trigger type parameter:
|Type of Model||Trigger Type Parameter Setting|
Triggered and enabled
One of the following:
Use the Model block ports to connect the referenced model to other ports in the parent model.
The top of the Model block displays an icon that corresponds to the control signal type expected by the referenced model. For a triggered model, the top of the Model block displays this icon.