setPrevActiveChild - Set previously active substate - MATLAB (original) (raw)
Main Content
Set previously active substate
Syntax
Description
setPrevActiveChild([stateOp](#setPrevActiveChild%5Fsep%5Fmw%5Fee715be9-b80d-42b3-bf5e-383613435ffe),[substateOp](#setPrevActiveChild%5Fsep%5Fmw%5F5113146c-a8cb-4132-8501-8215cf0e16e8))
sets the state that corresponds to the operating point substateOp
as the previously active substate in the operating point stateOp
.stateOp
must be an operating point for an inactive state that contains a history junction.
setPrevActiveChild([stateOp](#setPrevActiveChild%5Fsep%5Fmw%5Fee715be9-b80d-42b3-bf5e-383613435ffe),[substateName](#mw%5Fcd879c78-ae22-4be1-b3c5-380912c6a71a))
marks the state called substateName
as the previously active substate in stateOp
.
Examples
- Open the
sf_boiler
model.
For more information about this model, see Model Bang-Bang Temperature Control System. - 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
100
. - Run the simulation.
- Access the Stateflow.op.BlockOperatingPoint object that contains the operating point information for the
Bang-Bang Controller
chart.
blockpath = "sf_boiler/Bang-Bang Controller";
op = get(xFinal,blockpath); - Verify that the state
On
in the boxHeater
is not active. - Find the previously active substate of state
On
.
getPrevActiveChild(op.Heater.On)
ans =
State: "HIGH" (handle)
Path: sf_boiler/Bang-Bang Controller/Heater/On/HIGH
Contains:
[] - Modify the previously active substate of state
On
. Specify the substate as a Stateflow.op.OperatingPointContainer object.
setPrevActiveChild(op.Heater.On,op.Heater.On.NORM)
Alternatively, specify the name of the substate by using a string scalar or a character vector.
setPrevActiveChild(op.Heater.On,"NORM") - Verify that the substate
NORM
is the previously active substate in the modified operating point.
getPrevActiveChild(op.Heater.On)
ans =
State: "NORM" (handle)
Path: sf_boiler/Bang-Bang Controller/Heater/On/NORM
Contains:
[]
Input Arguments
Name of the new previously active substate, specified as a string scalar or a character vector.
Version History
Introduced in R2009b