Track Changes in Safety Analysis Manager Documents
If you have a Requirements Toolbox™ license and your files are in a project, you can detect changes to links or linked artifacts in Safety Analysis Manager spreadsheet cells and rows. For more information on creating links to cells and rows, see Link Safety Analysis Manager Spreadsheet Cells and Rows to Linkable Items. After you detect the changes, you can view the changed artifacts and accept the changes.
Establish a Baseline and Detect Changes
To detect changes to links or linked artifacts, the Safety Analysis Manager compares the changes to a baseline for each row and cell. To establish a baseline state, in the Analyze Changes section, click Accept All.
Note
You cannot use a previously defined baseline. Consequentially, defining a baseline is irreversible.
After establishing the baseline, you can detect changes to the links or linked artifacts, as long as the files are on the file path. To detect the changes, make the changes and save the files that contain the artifacts or the links. Then, in the Analyze Changes section, click Detect. The spreadsheet adds a detected changes badge to cells and rows with changes.
The Safety Analysis Manager identifies when you:
Create a link to a cell or row.
Delete a link from a cell or row.
Update the properties of a link to a cell or row.
Change an artifact that is linked to a cell or row. For more information on linkable artifacts, see Linkable Items (Requirements Toolbox).
The Safety Analysis Manager also detects when you change a dependent file associated with a linked artifact. For example, if you link a test case that has a model under test to a cell, and you save the model, the cell indicates a change when you detect changes.
If the artifact is in a Simulink® model, the Safety Analysis Manager only indicates that the model changed when you detect changes.
Save the Simulink model that contains an artifact that links to a cell or row.
Note
If you save the model and detect changes, the spreadsheet reports changes in the cells or rows that link to artifacts in the model, even if those artifacts are unchanged.
View Affected Artifacts and Accept Changes
The detected changes badge can represent more than one changed artifact. You can navigate to the source of the change from the spreadsheet by pointing to the badge and clicking the source name.
To view a list of the changes in the spreadsheet, row, or cell, in the Properties pane, in either the Spreadsheet, Row, or Cell tabs, expand the Changes section.
You can accept a single change or all of the changes in a cell, row, or the spreadsheet. To accept individual changes, point to the right of the row or cell, or individual change, and click the green check mark . To accept the changes in the spreadsheet, in the Analyze Changes section, click Accept All. Accepting a change updates the baseline.
If the change is caused by link creation, you cannot accept the change individually. To accept this kind of change, you must accept all of the changes listed in the cell, row, or spreadsheet that contains the change.
Programmatically Detect Changes
To programmatically detect changes:
Use the
detectChanges
function on the spreadsheet.Accept the changes in the spreadsheet, spreadsheet row, or spreadsheet cell by using the
acceptAllChanges
function.Retrieve more information about the changes with the
ChangeInformation
object. CreateChangeInformation
objects by using thegetChanges
function on the spreadsheet, spreadsheet row, or spreadsheet cell.
Track Changes in Safety Analysis Manager Spreadsheet Example
This example shows how to detect changes to links and linked artifacts to a Safety Analysis Manager spreadsheet that links to a model of a fault-tolerant control system. The model represents a fuel control system for a gasoline engine, and is a modified version of the model in Evaluate Fault Combinations on a Fault-Tolerant Fuel System.
Open the Project and Set Up the Model and Spreadsheet
Open the project, EvaluateFaultsFuelSysProject
.
openProject("EvaluateFaultsFuelSystemProject");
This example contains a model, sldemo_fuelsys_fault_analyzer
, and a Failure Mode and Effects Analysis (FMEA) spreadsheet, FuelSysFMEA.mldatx
. When you first open the project, the model does not have faults or links to the Safety Analysis Manager spreadsheet. Open the model and the spreadsheet, and run the fuelSysFaultSetupProject
helper function to add the faults and the links.
mdlName = "sldemo_fuelsys_fault_analyzer"; FMEAName = safetyAnalysisMgr.openDocument("FuelSysFMEA.mldatx"); open_system(mdlName) fuelSysFaultSetupProject
Open the Safety Analysis Manager to view the spreadsheet and the links.
safetyAnalysisManager
The helper function establishes the current start of the model as the baseline state by executing the acceptAllChanges
function. In the Analyze Changes section, click Detect to confirm that the spreadsheet does not detect changes.
Change the Fault Property
The model has three faults, one on the third input port to the To Controller
subsystem, and two on the fourth input port of the To Controller
subsystem. The fault on the third input port has a timed trigger that has a trigger time of 5
. In this example, adjust the trigger time and detect the changes in the spreadsheet.
In the
sldemo_fuelsys_fault_analyzer
model, open the Fault Analyzer App. In the Apps tab, click Fault Analyzer. The Fault Table pane opens.In the Fault Table pane, in the Fault tab, expand the To Controller/Inport/3 model element to view the fault on the third input port of the
To Controller
subsystem,ego_fault
.Right-click the fault and click Properties.
In the Property Inspector, In the Fault section, set the Trigger fault at time property to
10
.In the Fault Analyzer tab, in the File section, click Save All.
In the
FuelSysFMEA.mldatx
spreadsheet, detect the changes. In the Analyze Changes section, click Detect.
The spreadsheet detects changes in the first and third cells that link to the fault.
To accept the changes individually, point to each detected changes badge and click the green check mark next to the change.