主要内容

本页采用了机器翻译。点击此处可查看最新英文版本。

从导入文件重定向引用需求链接

从文件导入需求链接后,需将链接重定向到模型中的引用需求。在将链接转换为引用需求链接后,这些链接会以 SLREQX 文件的形式包含在模型中,以充分利用 Requirements Toolbox™ 的功能。

从 Word 文件导入需求链接

运行代码前,请按照以下步骤准备工作区。

注意:仅在 Windows® 上支持从导入的文件中导入或链接需求。不支持从存储在 SharePoint® 或 OneDrive 中基于网页的 Microsoft® Office 文件进行操作。请将此文件及其支持文件保存在本地文件夹中,以便继续。

1.打开 Microsoft Word 文件 Functional_Requirements.docx,其中列出了各项需求。突出显示要链接的需求。例如,突出显示以下几行。

1.1.2	Flight Computer
ID: 25
Description: Aircraft shall provide a flight computer to autonomously
conduct safe flight operations from launch to recovery

2.打开 reqImportExample.slx 模型。

model = systemcomposer.openModel("reqImportExample");

3.在模型中,选择要链接需求的组件 FlightComputer。右键点击 FlightComputer 组件,然后选择需求 > 链接到 Word 中的所选内容。保持 Word 文件 Functional_Requirements.docx 打开,以便进行后续操作。

The Select Link to Selection in Word option is selected in the context menu for the component.

在模型中整合需求链接之前,这些链接依赖于源文档,即 Word 文件 Functional_Requirements.docx。要查看需求链接,请从 reqImportExample.slx 模型选项板的右下角打开“需求透视”。

The Requirements Perspective shows a requirement link that references a word document and not a requirement set imported into the model.

将链接重定向到引用需求

按照以下步骤重定向需求链接,以便与模型集成并在模型中引用。

1.导出 reqImportExample.slx 模型并保存到外部文件:exportedModel.xls

exportedSet = systemcomposer.exportModel("reqImportExample");
SaveToExcel("exportedModel",exportedSet);

2.使用外部文件 exportedModel.xls 将需求链接导入另一个模型:reqNewExample.slx

structModel = ImportModelFromExcel("exportedModel.xls","Components","Ports", ...
"Connections","PortInterfaces","RequirementLinks");
structModel.readTableFromExcel

systemcomposer.importModel("reqNewExample",structModel.Components, ...
structModel.Ports,structModel.Connections,structModel.Interfaces,structModel.RequirementLinks);

3.将需求链接整合到新模型 reqNewExample.slx,在模型内重定向引用。

systemcomposer.updateLinksToReferenceRequirements("reqNewExample",...
"linktype_rmi_word","Functional_Requirements.docx")

4.将视图设置为需求,从模型调板右下角打开“需求透视”,查看 FlightComputer 组件上的新 Flight Computer 需求。

The Requirements Perspective shows a referenced requirement saved in a requirement set associated with the model.

该需求保存在需求集 Functional_Requirements.slreqx 中,并直接用于需求链接。将视图更改为链接以查看需求链接。

The Requirements Perspective shows a requirement link that is linked to a requirement from a requirement set and a component in the model.

另请参阅

| |

主题