Link Blocks and Requirements
You can track requirements implementation by linking requirements to model elements that implement the requirements. Linking also enables change notification, so that you can review and act on changes to requirements or models.
In this tutorial, link requirements to a model by using the model requirements perspective. Visual elements highlight links between requirements and blocks.
Open the
CruiseRequirementsExample
project. At the MATLAB® command prompt, enter:slreqCCProjectStart
Open the
crs_controller
model from themodels
folder. At the MATLAB command prompt, enter:open_system("models/crs_controller")
In the model canvas, click the perspectives control in the lower-right corner.
Open the requirements perspective by clicking the Requirements icon.
The Requirements Browser appears at the bottom of the model canvas. When you select a requirement, the Property Inspector displays the requirement's properties.
Link a requirement to a model element:
In the Requirements Browser, search for
Enable Switch Detection
.Link to the
enbl
Inport block by clicking and dragging the requirement to the block. An annotation template appears.Place the requirement annotation by clicking on the canvas. Create a link without an annotation by clicking outside the canvas.
The block displays a link badge. To display information about the requirement, click the badge and select Show.
Clicking Show displays the requirement ID, requirement summary, and link type. For information on link types, see Create and Store Links.
To see the requirement description, double-click the annotation.
To edit the requirement, right-click the annotation and select Select in Requirements Browser. Edit the requirement properties in the Property Inspector.
Exit the requirements perspective. Click the perspectives control and click the requirements icon.
Work with Simulink Annotations
Convert Simulink Annotations to Requirements
You can convert the annotations in your Simulink® models to requirements by using the context menu in the Requirements
Perspective View and by using the API. See slreq.convertAnnotation
for more information on converting
annotations to requirements by using the API.
To convert annotations to requirements by using the context menu in the Requirements Perspective View:
Open the Simulink model and enter the Requirements Perspective View.
Select a requirement set from the Requirements Browser. This is the destination requirement set for the new requirement.
Right click the annotation you want to convert to a requirement and click Convert to Requirement.
The annotation is converted to a requirement and is linked to the system or subsystem at which the annotation was present.
Link Requirements to Simulink Annotations
Use the Requirements Perspective View to link requirements to text and area annotations on the Simulink Editor. To create a link, select a requirement and drag it onto the annotation. If you link requirements to an area annotation, a badge appears on the annotation to show that the link was created. You see badges only in the Requirements Perspective View. To see more information about the requirement, click the badge and select Show.