Define Custom Requirement and Link Types
All requirement and link objects in Requirements Toolbox™ have a Type
property. The Type
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.
Create and Register Custom Requirement and Link Types
To create a custom requirement or link type:
Create an
sl_customization.m
file in the current working folder. In MATLAB®, in the Home tab, click New Script. Copy and paste this code and save the file assl_customization.m
.function sl_customization(cm) cObj = cm.SimulinkRequirementsCustomizer; end
Add definitions to the customization file to create custom requirement types or custom link types.
Note
Custom link types do not inherit the link direction from the built-in link type. When you create subtypes for the
Verify
orConfirm
built-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
Heading
that is a subtype of the built-in requirement typeContainer
. It also creates two custom link types calledSatisfy
andSolve
that are subtypes of the built-in link typesVerify
andImplement
, 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, seeslreq.refreshCustomizations
slreq.refreshCustomizations
.
Inherited Functionality from the Built-In Type
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.
Custom Requirement Type Contribution to Implementation and Verification Status
Only the functional built-in requirement type contributes to the implementation
and verification status. When you create a requirement type that is a subtype of
Functional
, it also contributes to the implementation and
verification status. Custom requirement types that are subtypes of the other
built-in types do not contribute to those statuses. For more information, see Review Requirements Implementation Status and
Review Requirements Verification Status.
In the example code above, the Heading
custom requirement type
does not contribute to the implementation or verification statuses because it is a
subtype of the built-in Container
requirement type.
Custom Link Type Contribution to Implementation and Verification Status
To implement a functional requirement, you must link the requirement to a
Model-Based Design item by using a link with the link type
Implement
. For more information, see Review Requirements Implementation Status.
Similarly, to verify a functional requirement, you must link the requirement to a
supported test item with the link type Verify
or, if it is linked
to an external test result, the link type Confirm
. For more
information, see Review Requirements Verification Status and
Include Results from External Sources in Verification Status.
When you create a custom link type that is a subtype of
Implement
, Verify
, or
Confirm
, the custom link type contributes to the
implementation or verification status.
In the example code above, the Satisfy
and
Solve
custom link types contribute to the implementation and
verification statuses for Functional
requirements because they
are subtypes of the Verify
and Implement
link
types, respectively.
Custom Link Type Impact Direction
Impact direction describes how changes propagate between nodes in a traceability diagram. For more information, see the Impact Direction section of Visualize Links with a Traceability Diagram. Custom link types inherit the impact direction from the built-in type that they are a subtype of. However, because custom link types do not inherit the link direction, use the same link direction as the built-in types for consistency in the traceability diagram. For more information, see the table under Link Types.
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 Details 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 Details pane, under Properties, select the custom link type from the Type drop-down list.
See Also
Requirements
Editor | slreq.refreshCustomizations