Contenido principal

acceptAllChanges

R2026b

Accept detected changes to linked artifacts in Safety Analysis Manager

Since R2024b

Description

Spreadsheets

acceptAllChanges(spreadsheet) accepts the detected changes in the specified Safety Analysis Manager spreadsheet. The spreadsheet must be in a project.

This function requires Requirements Toolbox™.

example

acceptAllChanges(spreadsheetRow) accepts the detected changes in the specified spreadsheet row.

example

acceptAllChanges(spreadsheetCell) accepts the detected changes in the specified spreadsheet cell.

example

Fault Trees

acceptAllChanges(faultTreeDocument) accepts the detected changes in the specified Safety Analysis Manager fault tree document. The fault tree document must be in a project.

acceptAllChanges(event) accepts the detected changes in the specified fault tree document event.

acceptAllChanges(gate) accepts the detected changes in the specified fault tree document gate.

acceptAllChanges(failureModel) accepts the detected changes in the specified fault tree document failure model.

Examples

collapse all

This example shows how to detect and accept changes in a Safety Analysis Manager spreadsheet. You make a change to the fault linked to two cells in the spreadsheet, then detect and accept the changes in the linked cells. 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 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 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. Save the fault information by using the Simulink.fault.save function.

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

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

detectChanges(FMEAName)

Accept the detected changes in the spreadsheet.

acceptAllChanges(FMEAName)

This example shows how to detect, get, and accept changes in a Safety Analysis Manager spreadsheet that links rows to faults in a model. 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.

The example project contains a model and a Safety Analysis Manager spreadsheet. Open the sldemo_fuelsys_fault_analyzer model and the FuelSysFMEA.mldatx spreadsheet. Run the fuelSysFaultSetupNoLinksProject function to add faults to the model.

mdlName = "sldemo_fuelsys_fault_analyzer";
FMEAName = safetyAnalysisMgr.openDocument("FuelSysFMEA.mldatx");
open_system(mdlName)
fuelSysFaultSetupNoLinksProject

Get the first row from the spreadsheet by using the getRow function.

myRow = getRow(FMEAName,1);

Retrieve the faults from the model by using the Simulink.fault.findFaults function.

myFaults = Simulink.fault.findFaults("sldemo_fuelsys_fault_analyzer");

Link the fault on the ego signal to the row and save the link set.

myLink = slreq.createLink(myRow,myFaults(1));
myLinkSet = linkSet(myLink);
save(myLinkSet);

Detect the changes by using the detectChanges function.

detectChanges(FMEAName)

The row that links to the fault detects the change. Get the detected change in the first row.

myChanges = getChanges(myRow)
myChanges = 
  ChangeInformation with properties:

    AffectedElement: [1×1 safetyAnalysisMgr.SpreadsheetRow]
               Type: 'linkCreated'
           Relation: []
    ChangedArtifact: [1×1 slreq.Link]

Accept the changes in the spreadsheet row. Accepting the changes updates the baseline for the row.

acceptAllChanges(myRow)

This example shows how to accept detected changes to faults in a model that link to cells in a Safety Analysis Manager spreadsheet. You make a change to the fault linked to two cells in the spreadsheet, then detect and accept the changes in the linked cells. 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 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 function.

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

Get the fault 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. 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 by using the detectChanges function.

detectChanges(FMEAName)

Each cell in the spreadsheet that links to the fault detects the change, including the first cell in the first column. Get the first cell in the first column by using the getCell function and accept the change.

myCell = getCell(FMEAName,1,1);
acceptAllChanges(myCell)

Since R2026b

Suppose you have an open project that contains a model and a fault tree document, and both files are open. You delete two faults that are linked to artifacts in the fault tree document. Detect and accept the changes in the fault tree document.

Save the fault information by using the Simulink.fault.save function.

mdl = gcs;
Simulink.fault.save(mdl)

Detect the changes in the fault tree document by retrieving the FaultTreeDocument object. Use the detectChanges function on the object.

faultTreeDoc = safetyAnalysisMgr.getCurrentDocument;
detectChanges(faultTreeDoc)

Accept the changes.

acceptAllChanges(faultTreeDoc)

Since R2026b

Suppose that you have an open project that contains a model and an open fault tree document. You delete a fault that is linked to the Event object myEvent1. Detect and accept the changes in myEvent1.

Save the fault information by using the Simulink.fault.save function.

mdl = gcs;
Simulink.fault.save(mdl)

Detect the changes by using the detectChanges function on the fault tree document.

faultTreeDoc = safetyAnalysisMgr.getCurrentDocument;
detectChanges(faultTreeDoc)

Accept the change in myEvent1.

acceptAllChanges(myEvent1)

Since R2026b

Suppose that you have an open project that contains a model and an open fault tree document. You delete a fault that is linked to the Gate object myGate1. Detect and accept the changes in the gate.

Save the fault information by using the Simulink.fault.save function.

mdl = gcs;
Simulink.fault.save(mdl)

Detect the changes by using the detectChanges function on the fault tree document.

faultTreeDoc = safetyAnalysisMgr.getCurrentDocument;
detectChanges(faultTreeDoc)

Accept the changes in the gate.

acceptAllChanges(myGate1)

Since R2026b

Suppose that you have an open project that contains an open fault tree document and a requirement set. You delete a requirement that is linked to the FailureModel object myFailureModel. Detect and accept the change in the failure model.

Save the link set and requirement set by using the function.

myReqSet = slreq.find(Type="ReqSet");
myLinkSet = slreq.find(Type="LinkSet");
save(myReqSet)
save(myLinkSet)

Detect the changes by using the detectChanges function on the fault tree document.

faultTreeDoc = safetyAnalysisMgr.getCurrentDocument;
detectChanges(faultTreeDoc)

Accept the change in the failure model.

acceptAllChanges(myFailureModel)

Input Arguments

collapse all

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

Row in the Safety Analysis Manager spreadsheet, specified as a SpreadsheetRow object.

Cell in the Safety Analysis Manager spreadsheet, specified as a SpreadsheetCell object.

Fault tree document in the Safety Analysis Manager, specified as a FaultTreeDocument object.

Event in the Safety Analysis Manager fault tree document, specified as an Event object.

Gate in the Safety Analysis Manager fault tree document, specified as a Gate object.

Failure model in the Safety Analysis Manager fault tree document, specified as a FailureModel object.

Tips

  • You can use this function to establish the baseline before detecting changes.

Version History

Introduced in R2024b

expand all