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.

example

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.

example

Examples

collapse all

  1. Open the sf_boiler model.
    For more information about this model, see Model Bang-Bang Temperature Control System.
  2. Set the model to save the final operating point. Open the Configuration Parameters dialog box and, in the Data Import/Export pane:
    1. Select Final states and enter a name for the operating point. For this example, use xFinal.
    2. Select Save final operating point.
    3. Click OK.
  3. Set the stop time for this simulation segment. In the Simulation tab, set Stop Time to 100.
  4. Run the simulation.
  5. 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);
  6. Verify that the state On in the box Heater is not active.
  7. 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:
    []
  8. 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")
  9. 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

collapse all

Name of the new previously active substate, specified as a string scalar or a character vector.

Version History

Introduced in R2009b