getChanges
Get changed artifacts linked to artifacts in Safety Analysis Manager
Since R2024b
Syntax
Description
returns the detected changes in the specified Safety Analysis Manager
spreadsheet. The spreadsheet must be in a project.detectedChanges
= getChanges(spreadsheet
)
This function requires Requirements Toolbox™.
returns the detected changes in the specified spreadsheet row.detectedChanges
= getChanges(spreadsheetRow
)
returns the detected changes in the specified spreadsheet cell.detectedChanges
= getChanges(spreadsheetCell
)
Examples
Get Detected Changes in Spreadsheet
This example shows how to get detected changes in Safety Analysis Manager spreadsheets. You make a change to the fault linked to two cells in the spreadsheet, then detect and return the change information 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 fault in the FuelSysFMEA.mldatx
spreadsheet by using the detectChanges
function.
detectChanges(FMEAName)
Each artifact that links to the fault detects the change. Get the detected changes from each linked artifact as an array of ChangeInformation
objects.
myChanges = getChanges(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)
Get Detected Changes in Spreadsheet Cell
This example shows how to get detected changes in a Safety Analysis Manager spreadsheet cell. You make a change to the fault linked to two cells in the spreadsheet, then detect and return the change information in one of 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 get the detected change from the cell.
myCell = getCell(FMEAName,1,1); myChange = getChanges(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.
Output Arguments
detectedChanges
— Detected changes
array of ChangeInformation
objects
Detected changes in the Safety Analysis Manager artifact, returned as an
array of ChangeInformation
objects.
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)