clone - Copy operating point for Stateflow chart - MATLAB (original) (raw)
Main Content
Copy operating point for Stateflow chart
Syntax
Description
[newOp](#clone%5Fsep%5Fmw%5F5113146c-a8cb-4132-8501-8215cf0e16e8) = clone([op](#clone%5Fsep%5Fmw%5Fe6902ad8-17a1-440f-965d-4fe3757338fc))
creates a copy of the operating point op
for a Stateflow® chart.
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
xFinal
. - 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
10
. - Run the simulation.
- Access the Stateflow.op.BlockOperatingPoint object that contains the operating point information for the
shift_logic
chart.
blockpath = "sf_car/shift_logic";
op = get(xFinal,blockpath); - 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)"
- fourth "State (OR)"
- second "State (OR)" (active)
- third "State (OR)"
The operating point shows that the substatesecond
is active.
- Create a copy of the operating point.
- Modify the new operating point by changing the active substate of
gear_state
.
setActive(newOp.gear_state.first) - Verify that the substate
first
is active in the modified operating point.
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)"
- Verify that the substate
second
is active in the original operating point.
ans =
State: "gear_state" (handle) (active)
Path: sf_car/shift_logic/gear_state
Contains:- first "State (OR)"
- fourth "State (OR)"
- second "State (OR)" (active)
- third "State (OR)"
Input Arguments
Output Arguments
Version History
Introduced in R2009b