Main Content

detectChanges

Detect changes to linked artifacts in Safety Analysis Manager document

Since R2024b

Description

detectChanges(spreadsheet) detects changes to the links and linked artifacts in the specified Safety Analysis Manager spreadsheet.

This function requires Requirements Toolbox™.

example

Examples

collapse all

Open the example and the project.

openExample('faultanalyzer/ChangeTrackingSpreadsheetExample')
openProject("EvaluateFaultsFuelSystemProject");

The example contains a model and a Safety Analysis Manager spreadsheet that does not have links or faults. Open the sldemo_fuelsys_fault_analyzer model and the FuelSysFMEA.mldatx spreadsheet. Create the faults and the links between the faults and the spreadsheet by using the fuelSysFaultSetupProject helper function.

mdl = "sldemo_fuelsys_fault_analyzer";
open_system(mdl);
FMEAName = safetyAnalysisMgr.openDocument("FuelSysFMEA.mldatx");
fuelSysFaultSetupProject

Get the fault from the model on the third input port of the To Controller subsystem by using the Simulink.fault.findFaults function.

myFault = Simulink.fault.findFaults(...
mdl,ModelElement=mdl + "/To Controller/Inport/3");

Set the trigger time of the fault to 10 by changing the Fault object property values and save the fault information by using the Simulink.fault.save function.

myFault.StartTime = 10;
Simulink.fault.save(mdl)

Detect the changes to the linked artifact in the FuelSysFMEA.mldatx spreadsheet.

detectChanges(FMEAName)

In the Safety Analysis Manager, the detected changes badge indicates the cells linked to the changed fault.

The FMEA associated with the model after detecting changes. The first and third cell in the Failure Mode column now have a detected changes badge.

Input Arguments

collapse all

Spreadsheet in the Safety Analysis Manager, specified as a Spreadsheet object.

Version History

Introduced in R2024b