主要内容

Make Requirements Fully Traceable with a Traceability Matrix

此示例显示了如何找到无法追溯到基于模型的设计项目的要求,以及如何通过与可追溯性矩阵创建链接来追踪这些需求。

A traceability matrix displays links between items in Model-Based Design artifacts such as Simulink® Requirements™ objects, Simulink model elements, Simulink Test™ objects, and MATLAB® code lines. You can apply filters and focus only on the items that you want to see. You can use the matrix to identify unlinked items and implement them in your design.

To read more about how to use the traceability matrix, see带有可追溯性矩阵的轨道需求链接

Open the Requirements Definition for a Cruise Control Model project. Load theCRS_REQ_FUNC_SPECrequirement set.

slreqCCProjectStart; slreq.load('CRS_REQ_FUNC_SPEC');

生成可追溯性矩阵

打开可追溯性矩阵窗口。

slreq.generateTraceabilitymatrix;

In the Traceability Matrix window, clickAdd。在“选择工件”对话框中toCRS_REQ_FUNC_SPEC。slreqx和set最佳tocrs_controller.slx。然后单击生成矩阵。生成一个可追溯性矩阵,其中左侧的指定要求设置,顶部的Simulink模型。金宝app

确定未链接要求

要识别未链接项目,请单击Highlight Missing Links。未链接的要求以黄色突出显示,左列中的黄色要求在顶行中突出显示了未链接的模型元素。

滚动到System Interface>输入parent requirement. Click范围to focus the matrix view on that hierarchy. The child requirements under输入请勿在Simulink模型中具有指向块的链接。金宝app但是,您创建的可追溯性矩阵仅显示CRS_REQ_FUNC_SPEC需求集和crs_controller模型。这CRS_REQ_FUNC_SPEC需求集可能在您的项目中具有更多指向其他工件的链接。

产生具有多个伪影的可追溯性矩阵

To view links between multiple artifacts at the same time, you can create a multi-artifact matrix. ClickConfigure Matrix为您的矩阵添加更多文物。在“配置矩阵”对话框中可用的工件pane, selectCRS_REQ_FUNC_SPEC。slreqx。这artifacts that have links between the selected artifact are highlighted in the可用的工件pane. In this case, each artifact contains links between theCRS_REQ_FUNC_SPEC要求设置,除了CRS_REQ_FUNC_SPEC。slreqx本身。将所有突出显示的文物拖到顶级人工制品列表中。扩展图标() in the matrix preview indicates that there are links between items in these artifacts.

点击更新Matrixto add the artifacts to your traceability matrix. Starting from the far-left column in the top row, select each artifact and click全部收缩。矩阵中的蓝线表示一个人工制品结束的位置,另一个人开始。

选择输入父母要求,然后单击范围专注于输入child requirements. ClickHighlight Missing Links。现在您可以看到一些孩子的要求输入链接到项目中的项目crs_plant模型。

Link Unlinked输入建模元素

crs_controllercrs_plantmodels contain model elements that are related to the输入child requirements, however not all of the输入儿童要求链接。Link all of the输入对模型元素的儿童要求,以实现全面的可追溯性。首先,单击Configure Matrix并从可追溯性矩阵中删除所有伪像CRS_REQ_FUNC_SPEC在左边,crs_controllercrs_planton the top by right-clicking the artifacts and selectingRemove Artifacts。点击更新Matrix。在更新的矩阵中,选择输入父母要求,然后单击范围专注于输入child requirements.

Some of the child requirements link to items incrs_plant。Link the remaining unlinked输入儿童要求建模元素crs_controller。选择对应于crs_controller然后单击范围

要专注于未链接要求,请应用缺少链接filter. In theFilter Panel, 在下面, 在下面Link, 点击缺少链接。这filter omits rows with linked items. You can verify this by clickingHighlight Missing Links

崩溃CruiseControlmode,driverswrequestTargetSpeedThrottle子系统通过选择每个子系统并单击全部收缩。在Enable Switchrequirement and theenbl通过选择与这两个项目相对应的单元格,然后单击创造。In the Create Links dialog box, set类型to工具,然后单击创造在这两个项目之间创建一个链接。

You can create multiple links at a time when you holdCtrl,选择要创建链接的单元格,然后单击创建链接。在其余要求和相应的模型元素之间创建链接:

  • 取消开关requirement and thecncl堵塞

  • 设置开关requirement and theset堵塞

  • 简历开关requirement and theresume堵塞

  • 增量开关requirement and theInc堵塞

  • Decrement Switchrequirement and the12月堵塞

  • 关键位置requirement and thekey堵塞

在“创建链接”对话框中,设置类型to工具for all of the links.

Clear the缺少链接单击过滤清除过滤器in the top artifact list. ClickShow All展示所有文物。全部输入child requirements link to design items, so they are no longer highlighted. Collapse the hierarchies undercrs_controllercrs_plant。扩展图标()表示所有输入儿童要求链接。

Open Items in Artifact Context

You can open items in rows and columns in their artifact context by double-clicking the cell corresponding to an item. For example, double-clicking a cell corresponding to a Simulink block opens the Simulink model and subsystem that the block is in.

Open theEnable Switchrequirement in the Requirements Editor by double-clicking it. Add additional text to the requirement描述:”Cruise只要满足所有其他条件,纽扣就可以实现巡航控制。”然后单击节省

In the Requirements Editor, the requirement summary and the associated link (listed in theDetailspane, under链接)以红色突出显示,因为与此要求关联的链接存在变化问题。

查看和清除变更问题

When you change a requirement that is linked to another item, the requirement is highlighted in red to indicate that there is a change issue associated with the link. The link has a change issue because you changed the description for theEnable Switch要求。

Return to the Traceability Matrix. Click更新刷新矩阵。选择输入父母要求,然后单击范围专注于输入child requirements. ClickHighlight Missing Links>突出显示更改的链接,然后单击Highlight Missing Links>Show Changed Links Only。显示了具有关联更改问题的链接,并以红色突出显示了需求,链接项目和链接。

因为您仅更改了描述,所以更改不会影响要求实现或验证。通过选择包含链接的单元格,请单击“更改问题”明确的变更问题。Under评论, 进入 ”Added additional information to the requirement description.“然后单击Clear All

You can view the comment when you select the link in the Requirements Editor, in theDetailspane, under评论

Generate a Report from the Traceability Matrix

更新the matrix to reflect the cleared change issues by clicking更新。选择输入父母要求,然后单击范围。通过选择包含扩展图标的单元格来扩展所有链接()并点击展开全部。Collapse any hierarchies that don't contain links by clicking全部收缩。此视图显示了指向输入child requirements. Generate an HTML report that contains a static snapshot of the current view of the traceability matrix by clicking出口>Generate HTML Report。选择一个位置来保存文件,然后单击节省

Cleanup

清除打开的需求集和链接集,并关闭“可追溯性矩阵”窗口。关闭所有开放型号。关闭当前项目。

slreq.clear;bdclose全部; slproject.closeCurrentProject();

See Also

|

相关话题