Simulink Fault Analyzer Essentials, Part 3: Create Spreadsheets in the Safety Analysis Manager - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 5:25
Loaded: 3.05%
Stream Type LIVE
Remaining Time 5:25
 
1x
  • Chapters
  • descriptions off, selected
  • en (Main), selected
    Video length is 5:25

    Simulink Fault Analyzer Essentials, Part 3: Create Spreadsheets in the Safety Analysis Manager

    From the series: Simulink Fault Analyzer Essentials

    You can perform safety analysis such as failure mode and effects analysis (FMEA) while leveraging traceability data and simulation results using the Safety Analysis Manager. Learn how to create spreadsheets in the Safety Analysis Manager to conduct systematic safety analysis.

    Published: 23 Aug 2023

    Hello, everyone. I'm Scott, a documentation writer for Simulink Fault Analyzer. Did you know that you can perform safety analysis in Simulink? With Simulink Fault Analyzer, you can create spreadsheets for common safety analyzes, like failure mode and effects analysis or functional hazard assessment. You can then leverage the power of MATLAB to analyze your spreadsheet and your model.

    Before you start analyzing your spreadsheets, though, it might help to learn how to make them. Here we'll make a simple spreadsheet that takes a few column inputs and generates the values in another column. First, let's make a new spreadsheet. To do that, we need to open the Safety Analysis Manager.

    In Simulink, in the Apps tab, click Safety Analysis Manager. We'll create a new spreadsheet for now. But you can make templates, if you'd like, and load them on your own. For more information on that process, see the Create and Register Templates in the Safety Analysis Manager topic in the Simulink Fault Analyzer documentation.

    To make a new spreadsheet, click Empty Spreadsheet. The spreadsheet that opens has one cell. Can't really do much with one cell. So let's add some rows and some columns. To add a row, click Add Row. Let's add three rows for right now. To add a column, click Add Column. Here we'll just add two columns. I seem to have added an extra column. That's not a problem though. I'll just highlight the column and click Delete. You could do this for rows too.

    These labels aren't really informative right now. And we could do better than this. So let's change their headings. For the first one, we'll change the name of the column to the word Text. To change the label, right-click it, and click Edit Label. Then enter the name of the column, named Text in this case. Click OK. And then, there we go, the column label updates.

    Let's repeat that process for the other columns too. We'll call the second one Check Box and the third one Derived. You don't really need to know what those mean now. That will become apparent later.

    Before we fill in the columns, though, we need to specify what kind of column it is. In R2023b, you can specify four kinds of columns-- a text column, which accepts strings as its cell values; a checkbox column, which accepts a logical value as its cell values; an enumeration column, which accepts a value defined from an enumeration class as its cell values; or a derived column, which accepts a MATLAB formula that calculates the column cell values.

    In this example, we'll keep the first column as a text column. Make the second column a checkbox column and the third column a derived column. Let's change the second one first. To do that, right-click the column label, and click Column Type, then Checkbox. Repeat this process for the third column, but select Derived instead.

    That derived column isn't really doing anything right now. Well, it guess that makes sense though. We haven't defined what it's supposed to derive its values from. So we need to write some MATLAB code. How do we do that? Well, right-click the column label, and click Edit Formula to get started.

    The column formula determines the value for each cell in the column. We can use that capability to derive the value of the cell from other cells. To do that for other cells in the same row, you can use the sfa_columnValue operator. This operator retrieves the value associated with the specified column and its input argument. I'll demonstrate.

    First, retrieve the values of the cells from the Text and Check Box column. And store them in a variable by using this code. For each cell, x retrieves the value in the Text column, and y retrieves the value in the Check Box column. Now let's make some code that does something with these values.

    Let's make the output of each derived cell follow these rules, for instance. First, if the Text column cell has some content and the Check Box column cell is true, then the Derived column cell should output the string "complete." Otherwise, it should just output "incomplete."

    Following those last two lines of code we just entered, we can construct this formula as an if statement. Enter this following code just below the last two lines we entered. And that's it for the column formula. To save it, just close the window. The Derived column now calculates the cell values based on the values in the first and second column.

    You can actually test this. Try entering some values in the Text column and Check Box column. And hey, look at that. The Derived column updates based on those values automatically.

    If you want to keep this spreadsheet for later, you can save it. In the File section, click Save. And save the spreadsheet as whatever you'd like, in the folder of your choice. I'll call this something like get_started_spreadsheet. After you create the spreadsheet, you can perform additional tasks, like saving spreadsheet templates or analyzing your spreadsheets. To learn more about these additional features, take a look at our documentation, specifically the Safety Analysis category.

    Related Products