Documentation

Test a Chart with Fault Detection and Redundant Logic

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 the description for Modeling Fault Management 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 SimState at t = 3, load and modify the SimState, and then simulate again between t = 3 and 10.

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

Define the SimState

  1. Open the model.

    Type sf_aircraft at the command prompt.

  2. Enable saving of a SimState.

    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 complete SimState in final state 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 simulation state at t = 3 in the variable xFinal in the MATLAB® base workspace.

  5. Disable saving of a SimState.

    This step prevents you from overwriting the SimState 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 complete SimState in final state check box.

    3. Clear the Final states check box.

    4. Click OK.

     Programmatic equivalent

Modify SimState Values for One Actuator Failure

  1. Enable loading of a SimState.

    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 SimState of your chart: xFinal.

    4. Click OK.

     Programmatic equivalent

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

    At the command prompt, type:

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

    Tip

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

    c = xFinal.getBlockSimState(gcb);

     What does the getBlockSimState method do?

  3. Look at the contents of the SimState.

    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 SimState 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 SimState 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 SimState by using this command:

    xFinal = xFinal.setBlockSimState(blockpath, c);

Test the SimState 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 SimState 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 SimState by using this command:

    xFinal = xFinal.setBlockSimState(blockpath, c);

Test the SimState 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 SimState of your chart to test the response of the right elevator to actuator failures, you get similar results.

Was this topic helpful?