Main Content

systemcomposer.updateLinksToReferenceRequirements

Redirect requirement links to model reference requirements

Since R2020b

    Description

    systemcomposer.updateLinksToReferenceRequirements(modelName,linkDomain,documentPathOrID) imports the external requirement document into Requirements Toolbox™ as a reference requirement and redirects the requirement links to point to the imported set.

    You can use the systemcomposer.updateLinksToReferenceRequirements function in System Composer™ to make the requirement links point to imported referenced requirements instead of external documents.

    example

    Examples

    collapse all

    After importing requirement links from a file, redirect links to reference requirements in the model. When you convert the links to reference requirement links, the links are contained in the model in an SLREQX file to make full use of Requirements Toolbox™ functionality.

    Import Requirement Links from Word File

    Before running the code, follow these steps to prepare your workspace.

    Note: Importing or linking requirements from an imported file is only supported on Windows®. A web-based Microsoft® Office file stored in SharePoint® or OneDrive does not work. Save this file and supporting files in a local folder to continue.

    1. Open the Microsoft Word file Functional_Requirements.docx with the requirements listed. Highlight the requirement to link. For example, highlight these lines.

    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. Open the reqImportExample.slx model.

    model = systemcomposer.openModel("reqImportExample");
    

    3. In the model, select the FlightComputer component to which to link the requirement. Right-click the FlightComputer component and select Requirements > Link to Selection in Word. Keep the Word file Functional_Requirements.docx open for the next steps.

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

    Before requirement links are integrated within the model, the links depend on the source document, the Word file Functional_Requirements.docx. To view the requirement links, open the Requirements Perspective from the bottom-right corner of the reqImportExample.slx model palette.

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

    Redirect Links to Reference Requirements

    Follow these steps to redirect requirement links to integrate with and reference from within the model.

    1. Export the reqImportExample.slx model and save to an external file: exportedModel.xls

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

    2. Use the external file exportedModel.xls to import requirement links into another model: 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. To integrate the requirement links to the new model reqNewExample.slx, redirect references within the model.

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

    4. Open the Requirements Perspective from the bottom right corner of the model palette to view the new Flight Computer requirement on the FlightComputer component by setting View to Requirements.

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

    This requirement is saved in a requirement set Functional_Requirements.slreqx and used directly in the requirement link. Change the View to Links to view the requirement link.

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

    Input Arguments

    collapse all

    Name of model, specified as a character vector or string.

    Example: "exMobileRobot"

    Data Types: char | string

    Link domain, specified as a character vector or string. See Link Types (Requirements Toolbox) for more information on identifying your link type or generating custom link types.

    Example: "linktype_rmi_word"

    Data Types: char | string

    Full document path, specified as a character vector or string.

    Example: "Functional_Requirements.docx"

    Data Types: char | string

    More About

    collapse all

    Version History

    Introduced in R2020b