Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leveraging Simulation and Automation for System-Theoretic Process Analysis (STPA)

Open in MATLAB Online

This example shows how Model-Based Design workflows can support a System-Theoretic Process Analysis (STPA) study for a helicopter flight control concept.

The scenario focuses on a proposed "Level Cruise Mode" capability. The example uses a simplified helicopter model, a Stateflow implementation of the mode logic, a System Composer™ control structure, Safety Analysis Manager artifacts, and Simulink Test™ assets to walk through a representative STPA workflow. The goal is to illustrate how simulation, traceability, and structured safety artifacts can help engineering teams explore hazards, unsafe control actions, and candidate mitigations.

This example demonstrates how cross-disciplinary teams can use automation, traceability, and simulation to conduct a systematic, comprehensive STPA program. Specific attention is paid to the use of simulation in Simulink® to identify loss scenarios.

What This Example Includes

  • A behavior model for a helicopter flight control system in Simulink and Stateflow
  • A control structure model created with System Composer
  • Safety analysis artifacts for accidents, hazards, unsafe control actions, and safety constraints
  • Simulation-based exploration of a loss scenario involving a gust during mode entry
  • Test cases that compare nominal behavior, the proposed design, and a modified design
  • Traceability links across models, tests, and safety artifacts

This repository is intended as an educational and demonstration example. It can help teams understand how MathWorks tools may be used in a safety analysis workflow, but the applicant or developer remains responsible for defining requirements, conducting the analysis, and assembling any compliance or certification evidence needed for a project.

Repository Contents

  • HelicopterSTPA.mlx Main Live Script that walks through the example workflow
  • HelicopterSTPA.slx Baseline system behavior model
  • HelicopterSTPAFixed.slx Modified model with a candidate mitigation
  • ControlStructure/HelicopterSTPAControlStructure.slx Control structure model used in the STPA discussion
  • STPA Analysis/ Safety Analysis Manager spreadsheets used in the example
  • helicopterSTPATests.mldatx Simulink Test file containing the test cases referenced in the Live Script
  • setupBehaviorModel.m Helper script that initializes key variables used by the behavior model sections
  • startupHelicopterSTPAProject.m Project startup script

Products Used

This example uses the following MathWorks products:

  • MATLAB®
  • Simulink®
  • Stateflow®
  • System Composer™
  • Requirements Toolbox™
  • Simulink Fault Analyzer™
  • Simulink Test™
  • Aerospace Blockset™

Getting Started

  1. Clone this repository.

  2. Open MATLAB.

  3. Open the project:

    openProject("HelicopterSTPA.prj")
  4. Open the Live Script:

    open("HelicopterSTPA.mlx")

Suggested Workflow

  1. Open the project.
  2. Run HelicopterSTPA.mlx section by section.
  3. Review the nominal behavior model and the proposed Level Cruise Mode logic.
  4. Explore the STPA artifacts in Safety Analysis Manager.
  5. Run the referenced Simulink Test cases.
  6. Compare the proposed design and the modified design.
  7. Use the traceability section to inspect linked artifacts.

Notes

  • The example is designed for interactive use in MATLAB.
  • Some sections open models, spreadsheets, test artifacts, and visualization utilities.
  • The Live Script uses project assets stored in subfolders, so running it outside the project context may cause file resolution errors.

Reference

Leveson, N. G., and Thomas, J. P., STPA Handbook, MIT Partnership for a Systems Approach to Safety (PSAS), Cambridge, MA, Mar. 2018. Available from the MIT PSAS site.

Copyright 2026 The MathWorks, Inc.

About

Leveraging Simulation and Automation for System-Theoretic Process Analysis (STPA)

Resources

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages