Stateflow.op.OperatingPointContainer - Operating point information for state, box, or function - MATLAB (original) (raw)
Operating point information for state, box, or function
Description
A Stateflow.op.OperatingPointContainer
object contains a snapshot of a state, box, or function in a Stateflow® chart during simulation. The operating point includes information about:
- Active substates
- State and function local data
- Persistent variables in MATLAB® functions and truth tables
Creation
When you save the final operating point for a Simulink® model, as described in Save Operating Points, you create a Stateflow.op.BlockOperatingPoint object for each Stateflow chart in the model. This object contains aStateflow.op.OperatingPointContainer
object for each state, box, or function in the chart.
Access a Stateflow.op.OperatingPointContainer
object by using the property that matches the name of the state, box, or function in the parentStateflow.op.BlockOperatingPoint
orStateflow.op.OperatingPointContainer
. For example, suppose thatop
is the Stateflow.op.BlockOperatingPoint
object for a chart. To access the Stateflow.op.OperatingPointContainer
object for a top-level state called state
, enter:
Similarly, to access the Stateflow.op.OperatingPointContainer
object for a substate called substate
in the top-level state state
, enter:
Properties
The Stateflow.op.OperatingPointContainer
object contains a property for each substate, box, function, local data, and persistent variables in the state, box, or function. The name of the property matches the name of the state, function, box, or data. For example:
- If a state has a substate named
substate
, theStateflow.op.OperatingPointContainer
object for the state has a property namedsubstate
that is specified as aStateflow.op.OperatingPointContainer
object. - If a MATLAB function has a persistent variable named
persistentVar
, theStateflow.op.OperatingPointContainer
object for the function has a property namedpersistentVar
that is specified as a Stateflow.op.OperatingPointData object.
Object Functions
Examples
- Open the
sf_car
model.
For more information about this model, see Model a Car with Automatic Transmission. - Set the model to save the final operating point. Open the Configuration Parameters dialog box and, in the Data Import/Export pane:
- Select Final states and enter a name for the operating point. For this example, use
xSteadyState
. - Select Save final operating point.
- Click OK.
- Select Final states and enter a name for the operating point. For this example, use
- Set the stop time for this simulation segment. In the Simulation tab, set Stop Time to
3
. - Run the simulation.
- Access the
Stateflow.op.BlockOperatingPoint
object that contains the operating point information for theshift_logic
chart.
blockpath = "sf_car/shift_logic";
op = get(xSteadyState,blockpath)
op =
Block: "shift_logic" (handle) (active)
Path: sf_car/shift_logic
Contains:- gear_state "State (AND)" (active)
- selection_state "State (AND)" (active)
gear "State output data" gearType [1, 1]
down_th "Local data" double [1, 1]
up_th "Local data" double [1, 1]
datasetWrittenToVector "Data set written to vector" logical 4x1
- Access the Stateflow.op.OperatingPointContainer object that contains the operating point information for the
gear_state
state.
ans =
State: "gear_state" (handle) (active)
Path: sf_car/shift_logic/gear_state
Contains:- first "State (OR)" (active)
- fourth "State (OR)"
- second "State (OR)"
- third "State (OR)"
- Highlight the states that are active in the chart at t = 3.
highlightActiveStates(op) - Change the substate activity in the state
gear_state
to reflect a change in gear.
setActive(op.gear_state.second) - Verify that the substate
second
in the stategear_state
is active in the modified operating point.
isActive(op.gear_state.second) - Remove the highlighting of active states in the Stateflow Editor.
Version History
Introduced in R2009b
Stateflow.SimState.SimStateContainer
is now calledStateflow.op.OperationPointContainer
. The behavior remains the same.
See Also
Objects
- Stateflow.op.BlockOperatingPoint | Stateflow.op.OperatingPointData | Simulink.op.ModelOperatingPoint (Simulink)