This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Test a Chart with Fault Detection and Redundant Logic

An operating point is a snapshot of the state of a Simulink® model at a specific time during simulation. For a Stateflow® chart, an operating point includes:

  • Activity of chart states

  • Values of chart local data

  • Values of chart output data

  • Values of persistent data in MATLAB® functions and Truth Table blocks

For more information, see Using Operating Points in Stateflow.

Goal of the Tutorial

Suppose that you want to test the response of the sf_aircraft model to one or more actuator failures in an elevator system. For details of how this model works, see Fault Detection Control Logic in an Aircraft Elevator Control System.

The Mode Logic chart monitors the status of actuators for two elevators. Each elevator has an outer (primary) actuator and an inner (secondary) actuator. In normal operation, the outer actuators are active and the inner actuators are on standby.

When the four actuators are working correctly, the left and right elevators reach steady-state positions in 3 seconds.

Suppose that you want to see what happens at t = 3 when at least one actuator fails. You can simulate the model, save the operating point at t = 3, load and modify the operating point, and then simulate again between t = 3 and 10.

StepTaskReference
1Define the operating point for your chart.Define the Operating Point
2Load the operating point and modify values for one actuator failure.Modify Operating Point Values for One Actuator Failure
3Test the modified operating point by running the model.Test the Operating Point for One Failure
4Modify operating point values for two actuator failures.Modify Operating Point Values for Two Actuator Failures
5Test the modified operating point by running the model again.Test the Operating Point for Two Failures

Define the Operating Point

  1. Open the sf_aircraft model.

  2. Enable saving of an operating point.

    1. Open the Model Configuration Parameters dialog box and go to the Data Import/Export pane.

    2. Select the Final states check box.

    3. Enter a name, such as xFinal.

    4. Select the Save final operating point check box.

    5. Click Apply.

     Programmatic equivalent

  3. Define the stop time for this simulation segment.

    1. In the Model Configuration Parameters dialog box, go to the Solver pane.

    2. For Stop time, enter 3.

    3. Click OK.

     Programmatic equivalent

  4. Start simulation.

    When you simulate the model, you save the complete operating point at t = 3 in the variable xFinal in the MATLAB base workspace.

  5. Disable saving of an operating point.

    This step prevents you from overwriting the operating point you saved in the previous step.

    1. Open the Model Configuration Parameters dialog box and go to the Data Import/Export pane.

    2. Clear the Save final operating point check box.

    3. Clear the Final states check box.

    4. Click OK.

     Programmatic equivalent

Modify Operating Point Values for One Actuator Failure

  1. Enable loading of an operating point.

    1. Open the Model Configuration Parameters dialog box and go to the Data Import/Export pane.

    2. Select the Initial state check box.

    3. Enter the variable that contains the operating point of your chart: xFinal.

    4. Click OK.

     Programmatic equivalent

  2. Define an object handle for the operating point values of the Mode Logic chart.

    At the command prompt, type:

    blockpath = 'sf_aircraft/Mode Logic';
    c = xFinal.get(blockpath);

    Tip

    If the chart appears highlighted in the model window, you can specify the block path using gcb:

    c = xFinal.get(gcb);

     Use the get method for Operating Points

  3. Look at the contents of the operating point.

    c = 
    
      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]
    

    The operating point of your chart contains a list of states, functions, and data in hierarchical order.

  4. Highlight the states that are active in your chart at t = 3.

    At the command prompt, type:

    c.highlightActiveStates;

    Active states appear highlighted. By default, the two outer actuators are active and the two inner actuators are on standby.

    Tip

    To check if a single state is active, you can use the isActive method. For example, type:

    c.Actuators.LI.L1.Standby.isActive

    This command returns true (1) when a state is active and false (0) otherwise. For information on other methods, see Methods for Interacting with the Operating Point of a Chart.

  5. Change the state activity in the chart to reflect one actuator failure.

    Assume that the left outer (LO) actuator fails. To change the state, use this command:

    c.Actuators.LO.Isolated.setActive;

    The newly active substate appears highlighted in the chart.

    The setActive method ensures that the chart exits and enters the appropriate states to maintain state consistency. However, the method does not perform entry actions for the newly active substate. Similarly, the method does not perform exit actions for the previously active substate.

  6. Save the modified operating point by using this command:

    xFinal = xFinal.set(blockpath, c);

Test the Operating Point for One Failure

  1. Define the new stop time for the simulation segment to test.

    1. Go to the Solver pane of the Model Configuration Parameters dialog box.

    2. For Stop time, enter 10.

    3. Click OK.

    You do not need to enter a new start time because the simulation continues from where it left off.

     Programmatic equivalent

  2. Start simulation.

    Chart animation shows that the other three actuators react appropriately to the failure of the left outer (LO) actuator.

    This actuator...Switches from...Because...
    Left inner (LI)Standby to activeThe left elevator must compensate for the left outer (LO) actuator failure.
    Right inner (RI)Standby to activeThe same hydraulic line connects to both inner actuators.
    Right outer (RO)Active to standbyOnly one actuator per elevator can be active.

    Both elevators continue to maintain steady-state positions.

Modify Operating Point Values for Two Actuator Failures

  1. Change the state activity in the chart to reflect two actuator failures.

    Assume that the left inner (LI) actuator also fails. To change the state, use this command:

    c.Actuators.LI.Isolated.setActive;
  2. Save the modified operating point by using this command:

    xFinal = xFinal.set(blockpath, c);

Test the Operating Point for Two Failures

  1. In the Model Configuration Parameters dialog box, verify that the stop time is 10.

  2. Restart simulation.

    Because of failures in both actuators, the left elevator stops working. The right elevator maintains a steady-state position.

If you modify the operating point of your chart to test the response of the right elevator to actuator failures, you get similar results.

Related Topics