Define Custom Requirement and Link Types by Using
All requirement and link objects in Requirements Toolbox™ have a
Type property. The
property can be one of the built-in requirement
types or link types
or a custom requirement or link type. Custom requirement and link types must be a subtype of
one of the built-in types and inherit functionality from that type.
Alternatively, you can use stereotypes to define custom requirement or link types that also have custom properties. For more information, see Define Custom Requirement and Link Types and Properties.
Create and Register Custom Requirement and Link Types
To create a custom requirement or link type:
sl_customization.mfile in the current working folder. In MATLAB®, in the Home tab, click New Script. Copy and paste this code and save the file as
function sl_customization(cm) cObj = cm.SimulinkRequirementsCustomizer; end
Add definitions to the customization file to create custom requirement types or custom link types.
Custom link types do not inherit the link direction from the built-in link type. When you create subtypes for the
Confirmbuilt-in types, use the same link direction as the built-in type so that the test item contributes to the verification status. For more information, see Link Types.
For example, this code creates a custom requirement type called
Headingthat is a subtype of the built-in requirement type
Container. It also creates two custom link types called
Solvethat are subtypes of the built-in link types
Implement, respectively. For more information, see Requirement Types and Link Types.
function sl_customization(cm) cObj = cm.SimulinkRequirementsCustomizer; cObj.addCustomRequirementType('Heading',slreq.custom.RequirementType.Container,... 'Headings for functional requirements'); cObj.addCustomLinkType('Satisfy', slreq.custom.LinkType.Verify,'Satisfies', ... 'Satisfied by','Links from verification objects to requirements'); cObj.addCustomLinkType('Solve', slreq.custom.LinkType.Implement,'Solves', ... 'Solved by','Links from implementation objects to requirements'); end
Register the customization. At the MATLAB command line, enter:For more information, see
Custom requirement and link types inherit some functionality from the built-in type they are a subtype of, including how they contribute to the implementation and verification status and the direction and impact of links. For more information, see Choose a Built-in Type as a Base Behavior.
Set the Type in the Requirements Editor
You can select the custom requirement or link type from the Requirements Editor. To set a requirement to a custom requirement type, click Show Requirements and select a requirement. In the right pane, under Properties, select the custom requirement type from the Type drop-down list.
To set a link to a custom link type, click Show Links and select a link. In the right pane, under Properties, select the custom link type from the Type drop-down list.