Highlight Active Time Intervals by Using Activity-Based Time Slicing
Stateflow® states and transitions can be active, inactive, or sleeping during model simulation. You can use Model Slicer to constrain model highlighting to only highlight the time intervals in which certain Stateflow Represent Operating Modes by Using States (Stateflow) and Transition Between Operating Modes (Stateflow) are active. Therefore, you are able to refine your area of interest to only those portions of your model that affect model simulation during the operation of the selected states and transitions. You can also constrain model highlighting to the intersection of the time intervals of two or more states or transitions.
Highlighting the Active Time Intervals of a Stateflow State or Transition
The slslicer_fuelsys_activity_slicing
model contains a
fault-tolerant fuel control system. In this tutorial, you use activity-based time
slicing to refine a model highlight to only those time intervals in which certain
states and transitions are active. You must be familiar with how to Highlight Functional Dependencies by using Model Slicer.
Create a Dynamic Slice Highlight for an Area of Interest
Add the example folder to the search path.
addpath(fullfile(docroot,'toolbox','simulink','examples'))
Open the
slslicer_fuelsys_activity_slicing
model.open_system('slslicer_fuelsys_activity_slicing')
Open Model Slicer and add the
control logic
Stateflow chart in the fuel rate controller subsystem as a Model Slicer starting point.Highlight the portions of the model that are upstream of the
control logic
Stateflow chart.Simulate the model within a restricted simulation time window (maximum 20 seconds) to highlight only the areas of the model upstream of the starting point and active during the time window of interest.
Constrain the Model Highlight to the Active Time Interval of a Stateflow State
On the Apps tab, under Model Verification, Validation, and Test gallery, click Model Slicer.
Navigate to the
control logic
Stateflow chart in thefuel rate controller
subsystem.open_system('slslicer_fuelsys_activity_slicing/fuel rate controller/control logic')
To constrain the model highlight to only those time intervals in which the Fueling_Mode > Running > Low_Emissions > Warmup state is active, right-click the
Warmup
state and select Model Slicer > Constrain to active time intervals for “Warmup”.Model Slicer is updated to highlight only those portions of the model that are active during the time intervals in which the
warmup
state is active.The Model Slice Manager is also updated to show the time interval in which the
warmup
state is active:Actual simulation time: 0.01 to 3.86 seconds : 1 active interval
The highlight shows a
normal
tofail
transition in thePressure
state, showing that a pressure failure occurred during the time interval in which theWarmup
state was active.
Constrain the Model Highlight to the Intersection of the Active Time Intervals of a Stateflow State and Transition
Clear any time interval constraints from the Model Slice Manager.
Constrain the model highlight to only those time intervals in which the O2 > fail state is active.
Model Slicer is updated to highlight only those portions of the model that are active during the time intervals in which the O2 > fail state is active. The Model Slice Manager is also updated to show the time interval in which the O2 > fail state is active:
Actual simulation time: 4.83 to 20 seconds : 1 active interval
To constrain the highlighting to the time interval in which the O2 > fail state is active and the
normal
tofail
transition occurs for theThrottle
chart, right-click thenormal
tofail
transition and add it as a constraint. Model Slicer is updated to highlight only those portions of the model that are active during the intersection of the time intervals in which the O2 > fail state is active and thenormal
tofail
transition occurs for theThrottle
chart.The Model Slice Manager is also updated to show the time interval in which the O2 > fail state is active and the
normal
tofail
transition occurs for theThrottle
chart:Actual simulation time: 13.87 to 13.87 seconds : 1 active interval
Activity-Based Time Slicing Limitations and Considerations
For limitations and considerations of activity-based time slicing, see Model Slicer Considerations and Limitations.
Stateflow State and Transition Activity
For more information on Stateflow state and transition activity, see Chart Simulation Semantics (Stateflow), Types of Chart Execution (Stateflow), and Syntax for States and Transitions (Stateflow).