Main Content

Safety Analysis Manager

Create and edit documents for safety analyses

Since R2023b

Description

Use the Safety Analysis Manager app to create documents used for safety analyses, such as Failure Mode and Effects Analyses (FMEAs) and Functional Hazard Assessments (FHAs). Link elements in spreadsheets to model artifacts such as requirements and faults.

This image shows the Safety Analysis Manager. The Safety Analysis Manager has an untitled spreadsheet loaded with two rows and five columns. The first three columns are empty, and the last two columns have empty check boxes.

Open the Safety Analysis Manager App

  • Simulink® Toolstrip: On the Apps tab, under Model Verification, Validation, and Test, click Safety Analysis Manager.

  • Fault Analyzer tab: In the Management section, click Safety Analysis Manager.

Examples

expand all

You can create a new spreadsheet by creating an empty spreadsheet or using a template that has specified columns and column types. To create a spreadsheet:

  1. In the Safety Analysis Manager, in the File section, click New.

  2. Create an empty spreadsheet by clicking Empty Spreadsheet. Alternatively, open a template in the From Template section. If you select Custom Template, you must select a MLDATX template file.

To open a spreadsheet, in the File section, click Open. You can also press Ctrl+O if you are already in a spreadsheet. You must select a MLDATX spreadsheet file.

To create a spreadsheet using external files, such as an Excel® file, in the File section, click Import. For more information on importing spreadsheets from Excel, see Import Excel Files into the Safety Analysis Manager.

To add a row to a spreadsheet, in the Spreadsheet section, click Add Row. To add a new column, in the Spreadsheet section, click Add Column.

Rows automatically adjust to the height of the content in their cells. You can adjust the width of the columns manually.

To delete a column, click on the column label and, in the Edit section, click Delete. To delete a row, click on the row index and, in the Edit section, click Delete.

Since R2024a

By default, all columns are visible in Safety Analysis Manager spreadsheets. To hide columns:

  1. Open an existing spreadsheet or create a new spreadsheet with at least two columns.

  2. In the Spreadsheet section, click View Columns.

  3. In the View Columns window, clear the columns that you want to hide and click OK.

Hidden columns retain their index, and you can still access their content by using programmatic options. For more information on programmatic options, see Spreadsheet and Create and Configure Safety Analysis Manager Spreadsheets Programmatically.

Safety Analysis Manager spreadsheets must have at least one visible column.

By default, the Add Column button creates a text column. You can specify the type of column as you create it or after you add it.

To create a new check box column:

  1. Open an existing spreadsheet or create a new spreadsheet.

  2. In the Spreadsheet section, click Add Column.

  3. Right-click the column label to access the context menu and click Column Type > Checkbox.

You can also change the column type after you set it from the context menu.

To create an enumeration column, define an enumeration class definition file on path. See Define Enumeration Classes. Then, specify an enumeration column and assign the enumeration class to the column. The entries in the column are limited to the entries in the class definition.

For example, to create an enumeration column that specifies a day out of the week:

  1. In a new MATLAB® file, define an enumeration class named WeekDays.

    classdef WeekDays
       enumeration
          Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
       end
    end

    Save the class definition on your file path with the name WeekDays.m.

  2. In the Safety Analysis Manager, open an existing spreadsheet or create a new spreadsheet.

  3. In the Spreadsheet section, click Add Column.

  4. Right-click the column label to access the context menu and click Column Type > Enumeration.

  5. In the Enumeration Class window, enter the name of the class, WeekDays, and click OK.

In the column, double-click a cell to expand the available values.

A spreadsheet with an enumeration column that uses the WeekDays class definition. The seven days of the week are available, and the cursor points to Monday.

Click the value to set the cell value.

Suppose you have a spreadsheet with two text columns, Column1 and Column2, and you want to create a column that takes the strings in those columns and creates a new string. Create a derived column that uses MATLAB.

  1. In the Spreadsheet section, click Add Column.

  2. Right-click the column label to access the context menu and click Column Type > Derived.

  3. Right-click the column label and click Edit Formula.

  4. In the Column Formula Editor window, retrieve the adjacent values of the column cells by using the sfa_columnValue operator, and assigning the new string to the cell by using the sfa_derivedCell keyword:

    x = sfa_columnValue("Column1");
    y = sfa_columnValue("Column2");
    sfa_derivedValue = x + " " + y;
  5. Close the Column Formula Editor window. The column now derives its cells from the adjacent cell values in Column1 and Column2.

To add a description to a spreadsheet:

  1. Open or create a new Safety Analysis Manager spreadsheet.

  2. In the Properties pane, in the Spreadsheet tab, add a description in the Description section.

To add a description to a cell in a spreadsheet:

  1. Click a cell in the spreadsheet.

  2. In the Properties pane, in the Cell tab, add a description in the Description section.

If you have Requirements Toolbox™, you can link spreadsheet cells to other model artifacts, including blocks, test cases, and faults. For example, to link a cell to a fault:

  1. In a model with faults, in the Apps tab, click Fault Analyzer.

  2. In the Fault Analyzer tab, in the View section, click Fault Table.

  3. Click the Fault tab.

  4. Expand the model element list and click the fault that you want to link.

  5. In a saved Safety Analysis Manager spreadsheet that contains at least one cell, click the cell.

  6. In the Links section, click Add Link > Link to Selection in Fault Table.

For more information on linking cells to other model artifacts, see Link Safety Analysis Manager Cells to Linkable Items.

To find cells containing specified text:

  1. Open an existing spreadsheet or create a new spreadsheet.

  2. In the Search section, click Find or press Ctrl+F. The search bar opens.

  3. Enter the text that you want to find. You can specify if the search is case sensitive and if it searches for only whole cell content matches. The search highlights the matching text in the cells in yellow.

You can use callbacks to run MATLAB scripts when you do tasks like loading, analyzing, saving, or closing a document. To create a callback:

  1. Open a document.

  2. In the Analyze section, click Edit Callbacks. The Callbacks Editor window opens.

  3. Enter your code in one or more of these callback types:

    Callback TypeWhen Callback Executes
    PreLoadFcnBefore the spreadsheet loads
    PostLoadFcnAfter the spreadsheet loads
    AnalyzeFcnWhen you click Analyze Spreadsheet or press F5
    PreSaveFcnBefore the spreadsheet is saved
    PostSaveFcnAfter the spreadsheet is saved
    CloseFcnBefore the spreadsheet is closed

  4. Exit the Callbacks Editor window to save the callbacks.

For more information, see Write Callbacks to Analyze Safety Analysis Manager Documents.

The AnalyzeFcn callback type includes a default callback that is always enabled. You can also add custom AnalyzeFcn callbacks that you can enable or disable. (since R2024a) See Create and Select Custom Callbacks for Safety Analysis Manager Documents.

The Diagnostics pane lists diagnostics from the scripts that you create in callbacks. The pane displays the same types of diagnostic messages that appear in the Diagnostic Viewer in Simulink models. See Diagnostic Viewer. You can use filters to display errors, warnings, or information.

  1. At the bottom of the Safety Analysis Manager, expand the Diagnostics pane by clicking the Expand Bottom button .

  2. To display:

    • Information — Click the Show/Hide information button .

    • Warnings — Click the Show/Hide warnings button .

    • Errors — Click the Show/Hide errors button .

The pane displays the number of each kind of diagnostic message next to the corresponding button. Each message links to the document that contains the diagnostic.

To clear the diagnostics, click the Clear all diagnostics button .

After generating diagnostics, you can export them to a separate TXT file. To export diagnostics:

  1. At the bottom of the Safety Analysis Manager, expand the Diagnostics pane by clicking the Expand Bottom button .

  2. Click the Export diagnostics button .

  3. Save the diagnostics as a TXT file.

To export a spreadsheet to Excel:

  1. Open an existing spreadsheet.

  2. In the Share section, click Export.

  3. Save the file. When running Simulink in Windows®, you can save the file with the .xls, .xlsb, .xlsm, or .xlsx extension. When running Simulink in macOS or Linux®, you can save the file with the .xls, .xlsm, or .xlsx extension.

To create document attributes:

  1. Open an existing spreadsheet or create a new spreadsheet.

  2. In the Properties pane, in the Spreadsheet tab, in the Document attributes section, click the Add new document attribute button .

To delete a document attribute, select the attribute and click the Delete document attribute button .

Related Examples

Programmatic Use

expand all

safetyAnalysisMgr.openManager opens the Safety Analysis Manager app.

Version History

Introduced in R2023b

expand all

See Also