This example shows how to define and register custom requirement types and custom link types by using an sl_customization
file.
Create an sl_customization
File
In MATLAB®, select the Home tab and click New Script. Copy and paste this code in the script.
function sl_customization(cm)
cObj = cm.SimulinkRequirementsCustomizer;
end
Select the Editor tab and click Save. Save the file as sl_customization.m
.
Define Requirements Toolbox Customizations
Define a custom requirement type called Stakeholder
by using the addCustomRequirementType
function. Define the custom requirement type as a subtype of the built-in Functional
type, then provide a description for the custom requirement type. Copy and paste this code in the sl_customization
file.
addCustomRequirementType(cObj,"Stakeholder",slreq.custom.RequirementType.Functional,...
"Stakeholder functional requirements");
Define a custom link type as a subtype of the built-in Relate
type called Trace
by using the addCustomLinkType
function. Define the forward and backward link direction as Traces
and Traced from
, respectively, then provide a description for the custom link type. Copy and paste this code in the sl_customization
file and click Save.
addCustomLinkType(cObj,"Trace",slreq.custom.LinkType.Relate,"Traces",...
"Traced from","General purpose link type from requirement to other item.");
Register the Requirements Toolbox Customizations
The updated sl_customization
file defines the requirement type and link type customizations.
function sl_customization(cm)
cObj = cm.SimulinkRequirementsCustomizer;
addCustomRequirementType(cObj,"Stakeholder",slreq.custom.RequirementType.Functional,...
"Stakeholder functional requirements");
addCustomLinkType(cObj,"Trace",slreq.custom.LinkType.Relate,"Traces",...
"Traced from","General purpose link type from requirement to other item.");
end
Register the Requirements Toolbox customizations.
View Customizations in the Requirements Editor
Open the basicReqSet
requirement set in the Requirements Editor.
In the Requirements Editor, click Show Requirements and then select the requirement with index 1
. In the right pane, under Properties, in the Type menu, select Stakeholder
from the list.
Click Show Links and select link #1
. In the right pane, under Properties, in the Type menu, select Traces
from the list.