Main Content

Stateflow.op.BlockOperatingPoint

Operating point information for Stateflow chart

Description

A Stateflow.op.BlockOperatingPoint object contains a snapshot of a Stateflow® chart during simulation. The operating point includes information about:

  • Active states

  • Chart output data

  • Chart, 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 Simulink.op.ModelOperatingPoint (Simulink) object that contains a Stateflow.op.BlockOperatingPoint object for each Stateflow chart in the model.

Access the Stateflow.op.BlockOperatingPoint object for a chart by calling the get (Simulink) function and using the block path to the chart. For example, if the final operating point for the model is xFinal and the block path to your chart is "myModel/Chart", enter:

op = get(xFinal,"myModel/Chart");

Properties

The Stateflow.op.BlockOperatingPoint object contains a property for each state, box, function, local data, and output data in the chart. The name of the property matches the name of the state, function, box, or data. For example:

  • If a chart has a state named state, the Stateflow.op.BlockOperatingPoint object for the chart has a property named state that is a Stateflow.op.OperatingPointContainer object.

  • If a chart has a chart output named output, the Stateflow.op.BlockOperatingPoint object for the chart has a property named output that is a Stateflow.op.OperatingPointData object.

Object Functions

highlightActiveStatesHighlight active states
removeHighlightingRemove highlighting of active states
cloneCopy operating point for Stateflow chart
openDisplay object in editing environment

Examples

collapse all

  1. Open the sf_aircraft model.

    openExample("sf_aircraft")

    For more information about this model, see Detect Faults in Aircraft Elevator 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 xSteadyState.

    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 3.

  4. Run the simulation.

  5. Access the Stateflow.op.BlockOperatingPoint object that contains the operating point information for the Mode Logic chart.

    blockpath = "sf_aircraft/Mode Logic";
    op = get(xSteadyState,blockpath)
    op = 
    
      Block:    "Mode Logic"    (handle)    (active)
      Path:     sf_aircraft/Mode Logic
    
      Contains:
    
        + Actuators          "State (OR)"                    (active)
        + LI_act             "Function"
        + LO_act             "Function"
        + L_switch           "Function"
        + RI_act             "Function"
        + RO_act             "Function"
        + R_switch           "Function"
          LI_mode            "State output data"		sf_aircraft_ModeType [1,1]
          LO_mode            "State output data"		sf_aircraft_ModeType [1,1]
          RI_mode            "State output data"		sf_aircraft_ModeType [1,1]
          RO_mode            "State output data"		sf_aircraft_ModeType [1,1]
  6. Access the Stateflow.op.OperatingPointContainer object that contains the operating point information for the Actuators state.

    op.Actuators
    ans = 
    
      State:    "Actuators"    (handle)    (active)
      Path:     sf_aircraft/Mode Logic/Actuators
    
      Contains:
    
        + LI            "State (AND)"         (active)
        + LO            "State (AND)"         (active)
        + RI            "State (AND)"         (active)
        + RO            "State (AND)"         (active)
    
  7. Highlight the states that are active in the chart at t = 3.

    highlightActiveStates(op)

    Stateflow chart showing active states.

  8. Change the substate activity in the state LO to reflect a failure of the left-outer actuator.

    setActive(op.Actuators.LO.Isolated)

    Stateflow chart showing active states.

  9. Verify that the substate Isolated in the state LO is active in the modified operating point.

    isActive(op.Actuators.LO.Isolated)
    ans =
    
      logical
    
       1

  10. Remove the highlighting of active states in the Stateflow Editor.

    removeHighlighting(op)
  1. Open the model old_sf_car.

    openExample("old_sf_car")
  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 xSteadyState.

    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 10.

  4. Run the simulation.

  5. Access the Stateflow.op.BlockOperatingPoint object that contains the operating point information for the shift_logic chart.

    blockpath = "old_sf_car/shift_logic";
    op = get(xSteadyState,blockpath)
    op = 
    
    Block:    "shift_logic"    (handle)    (active)
      Path:     old_sf_car/shift_logic
    
      Contains:
    
        + gear_state         "State (AND)"          (active)
        + selection_state    "State (AND)"          (active)
          gear               "Block output data"    double [1, 1]
          
  6. Highlight the states that are active in the chart at t = 10.

    highlightActiveStates(op)

    Stateflow chart showing active states.

  7. Access the Stateflow.op.OperatingPointData object that contains the operating point information for the chart output gear.

    op.gear
    ans = 
    
          Description: 'Block output data'
             DataType: 'double'
                 Size: '[1, 1]'
                Range: [1x1 struct]
         InitialValue: [1x0 double]
                Value: 4
     
  8. Change the value of gear to 1.

    op.gear.Value = 1;
  9. Inspect the modified operating point information for the chart output gear.

    op.gear
    ans = 
    
          Description: 'Block output data'
             DataType: 'double'
                 Size: '[1, 1]'
                Range: [1x1 struct]
         InitialValue: [1x0 double]
                Value: 1
    

Version History

Introduced in R2009b

expand all