acceptAllChanges
Accept detected changes to linked artifacts in Safety Analysis Manager
Since R2024b
Syntax
Description
acceptAllChanges(
accepts the
detected changes in the specified Safety Analysis Manager spreadsheet. The
spreadsheet must be in a project.spreadsheet
)
This function requires Requirements Toolbox™.
acceptAllChanges(
accepts the
detected changes in the specified spreadsheet row.spreadsheetRow
)
acceptAllChanges(
accepts the
detected changes in the specified spreadsheet cell.spreadsheetCell
)
Examples
Accept Changes in Spreadsheet
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)
Get and Accept Changes Detected in Rows
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)
Accept Changes in Spreadsheet Cell
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)
Input Arguments
spreadsheet
— Spreadsheet in Safety Analysis Manager
Spreadsheet
object
Spreadsheet in the Safety Analysis Manager, specified as a
Spreadsheet
object.
spreadsheetRow
— Row in Safety Analysis Manager spreadsheet
SpreadsheetRow
object
Row in the Safety Analysis Manager spreadsheet, specified as a
SpreadsheetRow
object.
spreadsheetCell
— Cell in Safety Analysis Manager
SpreadsheetCell
object
Cell in the Safety Analysis Manager spreadsheet, specified as a
SpreadsheetCell
object.
Tips
Use this function to establish the baseline before tracking changes.
Version History
Introduced in R2024b
See Also
Apps
Objects
slreq.Link
(Requirements Toolbox) |slreq.LinkSet
(Requirements Toolbox) |ChangeInformation
|Spreadsheet
|SpreadsheetCell
|SpreadsheetRow
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)