Link and Trace Requirements
This example shows how to work with requirements in an architecture model.
Define requirements for your architecture model using the Requirements Editor (Requirements Toolbox). For more information, see Author Requirements in MATLAB or Simulink (Requirements Toolbox). A Requirements Toolbox™ license is required to link, trace, and manage requirements in System Composer™.
Allocate functional requirements to components to establish traceability. By creating a link between a component and the related requirement, you can track whether all requirements are represented in the architecture. You can also keep requirements and design in sync, for example, if a requirement changes or if the design warrants a revision of the requirements. You can link components to requirements in Requirements Toolbox, test cases in Simulink® Test™, or selections in MATLAB®, Microsoft® Excel®, or Microsoft Word.
Open Model
Open the model exMobileRobot
.
systemcomposer.openModel("exMobileRobot");
Launch Requirements Perspective
Manage requirements and architecture together in the Requirements Manager from Requirements Toolbox. Navigate to Apps > Requirements Manager. You are now in the Requirements Perspective in System Composer.
Links can be created and managed through the Requirements Perspective. For more information, see Manage Requirements. This example shows an alternative approach using the Requirements Editor.
Use Requirements Editor to Link Requirements to Components
Open the requirements in the Requirements Editor (Requirements Toolbox).
slreq.load('MobileRobotRequirements');
slreq.editor
Select the requirement to be linked.
Select the component to be linked in the architecture model. Right-click and select Requirements > Link to Selection in Requirements Browser.
When you first link a requirement in an architecture model, a link set file with extension .slmx
is created to store requirement links. The Requirements context menu displays the linked requirements.
You can also create a link using the Requirements Editor. First, select the component in the architecture model. Then, in the Requirements Editor, right-click the requirement and select Link from "<Component Name>" (Component).
You can also create requirement links with blocks and subsystems in Simulink models. For more information, see View and Link Requirements in Simulink (Requirements Toolbox).
Use Open Outgoing Links Dialog to Trace Requirement Links to Components
The badge on a component indicates that it is linked to a requirement. This badge also shows at the lower-left corner of the architecture model.
To trace requirement links to a component, right-click the Command
component and select Requirements > Open Outgoing Links dialog. Here, you can create new requirements, delete existing ones, and change their order.