Conditionally Executed Subsystems and Models
A conditionally executed subsystem, also known as a conditional subsystem, is a nonvirtual subsystem that allows you to control its execution with an external signal. The external signal, called the action signal or control signal, is attached to the action input or control input port. Conditional subsystems are useful when you create complex models that contain components whose execution depends on other components.
Simulink® supports these types of conditional subsystems:
Action Subsystem — Executes at each time step when a logical condition is true in an If Action Subsystem or when a signal has one of a specified set of values in a Switch Case Action Subsystem. See Select Subsystem Execution.
Enabled Subsystem — Executes at each time step while the control signal is positive. Execution starts at the time step when the control signal crosses zero from the negative to the positive direction. See Using Enabled Subsystems.
Triggered Subsystem — Executes at each time step when the control signal rises or falls to zero or crosses zero. See Using Triggered Subsystems.
Enabled and Triggered Subsystem — Executes at the time step when the enable control signal has a positive value and the trigger control signal rises or falls to zero. See Using Enabled and Triggered Subsystems.
Message Triggered Subsystem and Message Polling Subsystem — Uses messages as a control signal, and executes based on whether a message is available at the control port. See Using Message Polling and Message Triggered Subsystems.
Function-Call Subsystem — Executes when the control port receives a function-call event. Events can occur one or more time during a time step. See Using Function-Call Subsystems.
Simulink also supports the Resettable Subsystem, which executes at each time step but resets all blocks within the subsystem to their initial condition when the control signal rises or falls to zero or crosses zero. See Using Resettable Subsystems.
You can configure a referenced model for conditional execution like a subsystem. See Conditionally Execute Referenced Models.
Blocks
Functions
Simulink.getOutportInheritsInitialValue | Determine if conditional subsystem Outport block inherits initial output value (Since R2021a) |
Model Settings
Context-dependent inputs | Diagnostic action to take when function-call subsystem can change its inputs |
Topics
Basics of Conditionally Executed Subsystems
- Conditionally Executed Subsystems Overview
Overview of conditionally executed subsystems. - Conditionally Execute Referenced Models
Execute referenced models conditionally, similar to conditionally executed subsystems. - Ensure Output Port Is Virtual
Prevent buffering of conditional subsystem or model output. - Use Control Flow Logic
How to use control flow blocks to model control logic.
Types of Conditionally Executed Subsystems
- Select Subsystem Execution
Execute subsystem once during a time step in response to an action signal. - Using Enabled Subsystems
Create a subsystem that executes when a control signal has a positive value. - Using Triggered Subsystems
Create a subsystem that executes with a trigger signal. - Using Enabled and Triggered Subsystems
Create a subsystem that executes with a trigger signal or control signal with a positive value. - Using Message Polling and Message Triggered Subsystems
Demonstrate and compare Message Triggered Subsystems and Message Polling Subsystems. - Using Function-Call Subsystems
Create a subsystem that executes with a function call. - Using Resettable Subsystems
Create a subsystem that resets all block states with a trigger signal. - Fixed-Point Data Type Support for If Block
This topic explains how to use a Compare To Constant block for If block fixed-point data type support.
Subsystem Output Initialization
- Conditional Subsystem Initial Output Values
Specify initial output values for a conditional subsystem. - Conditional Subsystem Output Values When Disabled
Specify output behavior when conditional subsystem is disabled. - Simplified Initialization Mode
Control initial values for conditional subsystems.