Products & Services Solutions Academia Support User Community Company

Learn more about Simulink Verification and Validation   

Linking a Simulink Object to a Location in a Requirements Document

What Is Selection-Based Linking?

Selection-based linking is linking a Simulink object to a selected item in a requirements document. Using selection-based linking, the RMI creates a link from the object to the requirement text.

The following tutorial takes you through the steps to link a block in a Simulink model to text in a Microsoft Word document.

Creating a Requirements Document in Microsoft Word

For this tutorial, create and save a Microsoft Word 2007 document, requirements.docx, with the content shown in the following graphic. Style the header lines "Transmission Requirements" and "Engine Requirements" as Heading 1.

Linking from a Simulink Object to a Selected Item in a Requirements Document

Open a Simulink demo model. Create a link from a block in the model to the text you selected in the requirements document:

  1. At the MATLAB prompt, type sf_car to open the model.

  2. In requirements.docx, select the paragraph under "Engine Requirements".

  3. Right-click the Engine block and select Add link to Word selection.

  4. Verify the link from the Engine block by right-clicking the Engine block and selecting Requirements.

    A shortened version of the requirements text appears at the top of the context menu.

  5. Click the requirement text to navigate to that location in the requirements document.

  6. Save the model as sf_car_linking.

  7. The RMI inserts a bookmark into the requirements document when creating the link. Save the requirements document.

Customizing Selection-Based Linking

You can customize selection-based linking. From the Model Editor window, select Tools > Requirements > Settings. On the Selection-based linking tab, the following options are available.

Selection-Based Linking OptionDescription

Document types

Specify the document types for which you want selection-based linking to be available.

Document file reference

Specify how to store the requirements document. Valid options are:

  • absolute path

  • path relative to current directory

  • path relative to model directory

  • filename only (on MATLAB path)

For more information, see Resolving the Document Path.

Modify documents to include links to models

Select this option to enable the RMI to insert navigation objects into the requirements document. By default, the RMI inserts only bookmarks (when needed) into the requirements document.

Model file reference

Specify how to locate the model path from a requirements document. Valid options are:

  • absolute

  • none (on MATLAB path)

For more information, see Resolving the Document Path.

Linking from a Simulink Object to a Specified Location in a Requirements Document

In the following step, you create a link from another Simulink object to another requirement in the requirements document that you created. Use document indexing instead of selection-based linking.

  1. In the sf_car_linking model, right-click the transmission block and select Requirements > Edit/Add Links.

    The Requirements dialog box for the Engine block opens.

  2. In the Requirements: transmission dialog box, click New to add a new requirement.

  3. In the Description field, enter Tranmission requirements.

  4. In the Document type field, select Microsoft Word to search only for those file types.

  5. Next to the Document type field, click Browse.

  6. Locate the requirements document, requirements.docx, and select Open.

    The file path appears in the Document field.

  7. Click the Document Index tab to create an index of the requirements document so that you can easily access specific locations in the document.

      Note   After you click the Document Index tab, the document indexing begins immediately. You see the following status bar.

      If you do not want the document index or if it takes too long to process the file, click Cancel. If you click Cancel, processing stops and the software creates a partial document index. You cannot resume the document indexing unless you restart your MATLAB session.

  8. From the automatically generated list of headings and bookmarks in the document, select Transmission Requirements.

  9. Click Apply to create the link from the requirements document text to the Engine block and redisplay the Requirements tab.

  10. (Optional) To provide additional details about the current requirement, on the Requirements tab, in the User tag field, enter additional, descriptive text.

  11. To verify the link from the transmission block to the requirement, right-click the transmission block and select Requirements.

    The name of the requirement in the new link is a submenu selection.

  12. Save the sf_car_linking model.

Creating a Requirements Document in a Microsoft Excel Spreadsheet

For the next two tutorials, create a requirements document in a Microsoft Excel spreadsheet with the following content and save it as requirements.xlsx.

Adding Requirement Links to Multiple Objects Simultaneously

You can add or delete links to requirements for a selection of multiple Simulink or Stateflow objects. In this example, you modify the requirements document to add a third requirement, and link two objects in the model to the new requirement:

  1. Open the Microsoft Excel requirements document (requirements.xlsx).

  2. In the sf_car_linking model, select two objects together:

    • transmission

    • shift_logic

  3. Right-click any of the blocks that you selected and then select Requirements > Add Links to All.

    The Add requirements dialog box opens for those two blocks.

  4. Add a new requirement called Shift logic requirements.

  5. Browse to the Microsoft Excel requirements document and click Open.

  6. In the Location drop-down list, select Sheet range.

  7. Next to the Location drop-down list, enter A1:A2 to specify the range of cells for the Shift Logic Requirements.

  8. Click OK to close the Add requirements dialog box.

  9. In the sf_car_linking model, verify that both the shift_logic Stateflow chart and the transmission block have a new requirement, Shift logic requirements.

  10. Save the sf_car_linking model.

Linking a Signal Builder Block to a Requirement

The RMI can create a link from a Signal Builder block to a requirements document:

  1. In the sf_car_linking model, double-click the User Inputs block.

    The Signal Builder dialog box opens, displaying four groups of signals.

  2. At the far-right end of the toolbar, click the Show verification settings button . You see a Requirements pane in the Signal Builder dialog box.

  3. Place your cursor in the window, right-click, and select Edit/Add Links.

    The Requirements dialog box opens.

  4. Click New. In the Description field, enter User input requirements.

  5. Browse to the Microsoft Excel requirements document and click Open.

  6. In the Location drop-down list, select Search text to link to specified text in the spreadsheet.

  7. Next to the Location drop-down list, enter User Input Requirements.

  8. Click Apply to create the link.

  9. To verify that the RMI creates the link, in the Model Editor, select the User Inputs block, right-click, and select Requirements.

  10. Save the sf_car_linking model.

Resolving the Document Path

When you browse and select a requirements document, the RMI optionally stores the location of the document with a fully specified absolute path. You can also enter a relative path for the document location. A relative path can be a partial path or no path at all. If you use a relative path, the document is not constrained to a single location in the file system. With a relative path, the RMI resolves the exact location of the requirements document in this order:

  1. The software attempts to resolve the path relative to the current MATLAB folder.

  2. If there is no path specification and the document is not in the current folder, the software uses the MATLAB search path to locate the file.

  3. If the RMI cannot locate the document relative to the current folder or the MATLAB search path, the RMI resolves the path relative to the model file folder.

The following examples illustrate the procedure for locating a requirements document.

Relative (Partial) Path Example

Current MATLAB folder

C:\work\scratch

Model file

C:\work\models\controllers\pid.mdl

Document link

..\reqs\pid.html

Documents searched for
(in order)

C:\work\reqs\pid.html
C:\work\models\reqs\pid.html

Relative (No) Path Example

Current MATLAB folder

C:\work\scratch

Model file

C:\work\models\controllers\pid.mdl

Requirements document

pid.html

Documents searched for
(in order)

C:\work\scratch\pid.html
<MATLAB path dir>\pid.html
C:\work\models\controllers\pid.html

Absolute Path Example

Current MATLAB folder

C:\work\scratch

Model file

C:\work\models\controllers\pid.mdl

Requirements document

C:\work\reqs\pid.html

Documents searched for

C:\work\reqs\pid.html

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS