Simulink® Requirements™ enables you to author, organize, and edit requirements in the Simulink Editor. A specialized view, the Requirements Perspective, helps you to visualize the links between requirements and the parts of a model. Using an integrated environment simplifies linking requirements to the parts of your model that implement them.
This integrated environment has other advantages. For details, see Introduction to Simulink Requirements.
In Simulink Requirements, you organize your requirements in groups called requirements sets. In each requirements set, you can create additional levels of hierarchy for when you need more requirements to describe the details of a requirement.
In this tutorial, you use the Requirements Editor to create a requirements set to organize related requirements and add requirements to the set.
Suppose that you are writing requirements for a controller model of an automobile cruise control system. You develop these requirements, using your company’s numbering standard for requirements (R1, R2, and so on).
|ID and Description||Rationale|
|R1: The maximum input throttle is 100%||The maximum value of the throttle from the acceleration pedal can be no greater than 100%.|
|R2: Cruise control has a speed operation range||Cruise control has a minimum and maximum operating speed.|
|R2.1: The vehicle speed must be at least 40 km/h||The speed of the vehicle must be at least 40 km/h for the cruise control system to engage.|
|R2.2: The vehicle speed cannot be greater than 100 km/h||The maximum operational speed of the cruise control system for the vehicle is 100 km/h.|
Add these requirements to a model called
The model and supporting files are in a Simulink project. Open the project. At the MATLAB® command prompt, enter:
Open the model. At the command prompt, enter:
Open the Requirements Editor. In the Simulink Editor, select Analysis > Requirements > Requirements Editor.
The Requirements Editor opens with the requirements in view in the requirements
browser, arranged by requirements set. The
has two requirements sets that you can see in the browser:
Add a requirements set in the requirements browser. From the Requirements Editor toolbar, click New Requirement Set .
You save requirements sets to external files. Save your requirements set to a
writeable location and name it
When you save requirements sets to external files, you can share requirements with other models.
Add a requirement to your requirements set. Select the requirements set and click Add Requirement .
In the Properties pane, enter details for the requirement. You can copy and paste or drag requirements from another source to the Properties pane.
Custom ID: R1
Summary: Max input throttle %
Description: The maximum input throttle is 100%.
If you do not specify a custom ID, the Requirements Editor numbers requirements in order. Custom IDs let you use your company standards for labeling requirements and set the numeric order. (Custom IDs cannot contain a # character.) You can also use an ID to help locate a requirement by searching. Keywords also aid in searching for a requirement.
Create the requirement
and select Add Requirement After. Enter details for the
Custom ID: R2
Summary: Cruise control speed operation range
Description: Cruise control has a minimum and maximum operating speed.
Create the child requirement of
R2 and select Add Child
Requirement. Enter details for the requirement:
Custom ID: R2.1
Summary: Maximum vehicle speed
Description: The speed of the vehicle must be at least 40 km/h for the cruise control system to engage.
Add the other child to requirement
R2 if you want.
You can rearrange the hierarchy by using the or by dragging requirements.
You can create links between your requirements and the Simulink blocks or Stateflow® objects that implement them. By linking between the model elements that implement requirements, you can track whether all your requirements have been implemented. You can also keep requirements and implementation in sync, for example, if a requirement changed or if the implementation causes you to revise your requirements.
In this tutorial, you use the Requirements Perspective to work with your requirements in the cruise control model. As in the Requirements Editor, you can add requirements sets and requirements in the Requirements Perspective. In both views, you can link requirements with blocks. In the Requirements Perspective, visual elements help you to see the links between requirements and blocks.
crs_controller model, to preview the perspectives
associated with the model, click the perspectives control in the lower-right
To open the Requirements Perspective, click the Requirements image.
The Requirements Perspective includes the Requirements Browser, docked at the bottom of the Simulink editor. When you select a requirement, the Property Inspector displays the Simulink Requirements Properties pane.
Link a requirement to the model element that implements it. Search for the
requirement that you want to link from. In the Requirements Browser search box,
Enable Switch Detection. As you type, matches are
To create a link, select the matching requirement and drag it onto the
enbl inport block. A badge appears on the block to show that
a link was created. You see badges only in the Requirements Perspective.
To see more information about the requirement, click the badge and select Show.
Clicking Show displays a requirement annotation on the model canvas. The annotation displays the ID, the summary, and the relationship between the block and the requirement. In this example, the block implements the requirement. For other possible relationships, see Requirement Links.
To see the requirement description, double-click the annotation.
To edit the requirement, right-click the annotation and select Select in browser. The requirement properties appear in the Property Inspector, where you can edit them.
Exit the Requirements Perspective. Click the perspectives control and click the requirements image.