Adding and Viewing Requirement Links

Object and Document Types

You can add requirements to the following types of objects:

The Requirements Management Interface supports the following built-in types of requirements documents:

You can also link to an item in the Telelogic DOORS software (see Linking Objects to DOORS Requirements), or register your own custom type of documents to link to (see Linking to Custom Types of Requirements Documents).

Location Types

Depending on the document type, you can link to specific locations within a document.

Document TypeLocation Options
Text
  • Search text — Type a string in the Location text field. The Requirements Management Interface searches for the first occurrence of the text string within the document. This search is not case sensitive.

  • Line number — Type a line number in the Location text field. The Requirements Management Interface makes a link to the specified line.

HTML

You can link only to a named anchor.

For example, if you define the anchor

	<A NAME=valve_timing> ...contents... </A>

in your HTML requirements document, you can enter valve_timing in the Location text field or click the Document Index tab to select valve_timing from an automatically generated list of anchors in the document.

Microsoft Word
  • Search text — Type a string in the Location text field. The Requirements Management Interface searches for the first occurrence of the text string within the document. This search is not case sensitive.

  • Named item — Link to a bookmark within the document. The Requirements Management Interface automatically generates a document index based on its headings and bookmarks, or you can type the name in the Location text field.

  • Page/item number — Type a page number in the Location text field. The Requirements Management Interface makes a link to the top of the page.

Microsoft Excel
  • Search text — Type a string in the Location text field. The Requirements Management Interface searches for the first occurrence of the text string within the document. This search is not case sensitive.

  • Named item — Link to a named item within the document (defined in the Excel® software using Insert > Name). Type the name in the Location text field.

  • Sheet range — Type a cell number or a range of cells (such as C5:D7) in the Location text field. The Requirements Management Interface makes a link to the specified cell or cells.

PDF
  • Named item — Link to a bookmark within the document. The Requirements Management Interface automatically generates a document index based on its headings and bookmarks, or you can type the bookmark name in the Location text field.

  • Page/item number — Type a page number in the Location text field. The Requirements Management Interface makes a link to the top of the page.

Web Browser URLYou can link to a URL location only. Type the URL location string in the Document text field. When you follow the link, the document opens in a Web browser.

Adding Requirement Links to an Object

You use the Requirements dialog box to associate a requirements document with a requirements object. You can link a particular location in an existing Microsoft Word or HTML document to a block in a Simulink diagram or a Stateflow object in a Stateflow chart. In this procedure, you add three requirement links to a Simulink block in the demo model sf_car. In later topics, you modify both the links and the documents they point to.

  1. Create and save the Microsoft Word document requirements.doc with the following format. Style the header lines (Primary Requirements, Second Requirements, Tertiary Requirements) as Heading 1 in Microsoft Word.

  2. Type sf_car at the MATLAB prompt to open the demo model sf_car.

  3. Right-click the Engine block and, from the pop-up menu, select Requirements > Edit/Add Links.

    The Requirements dialog box for the Engine block appears.

  4. In the Requirements dialog box, click New to add a new requirement.

    Fields and tools of the Requirements dialog box are now enabled for the new requirement.

  5. Click in the Description field and enter Requirement 1.

  6. Click Browse next to the Document type field, browse to the requirements document requirements.doc, and select Open.

    The Document type field is now set to Microsoft Word. If you specify the document type in the Document type field prior to browsing for the requirements document, only the files of the appropriate type appear. If you set Document type to Unspecified Type, all files are listed.

  7. To define a particular location in the document, click the Document Index tab to create an index of the requirements document.

  8. Select Primary Requirements from the automatically generated list of headings and bookmarks in the document.

    If your document does not contain headings or bookmarks, click the Requirements tab.

    Select Search text from the Location drop-down list and enter Primary Requirements in the text field. The search text feature is not case-sensitive; primary requirements and PRIMARY REQUIREMENTS work the same in this example.

  9. To provide additional details about the current requirement, enter text in the User tag field. Entering text in the User tag field is optional.

  10. Click Apply.

  11. Select Requirement 1 and click Copy to create a copy of Requirement 1 as a new requirement.

  12. In the Description field, replace Copy of Requirement 1 with Requirement 2, and link Requirement 2 to the text "Secondary Requirements" in requirements.doc.

    In addition to the Copy tool, you can edit existing requirements using the following tools.

    Tool Button

    Description

    Delete

    Deletes the requirement.

    Up

    Moves the selected requirement up one line in the list of requirements.

    Down

    Moves the selected requirement down one line in the list of requirements.

    The Requirements dialog box makes it easier for you to enter a previous document name by remembering up to five of the most recent documents entered. The list of five is taken for all entries made across all models. For example, if you add a new requirement after entering two requirements for the Engine block, and click the drop-down arrow in the Document field for the new requirement, a selectable list of previous requirements documents like the following example would appear.

  13. Click Apply to apply the requirement links you have added and click OK to close the Requirements dialog box.

  14. Save the model as my_sf_car.mdl.

    You use this model in Viewing Requirements Documents.

Viewing Requirements Documents

You can access a requirements document through its associated model element. In this section, you access the requirements document using one of the Engine block requirements links:

  1. In the my_sf_car model, right-click the Engine block and select Requirements from the context menu.

    The requirements you added now appear as submenu selections.

  2. Select Requirement 2 from the submenu.

    requirements.doc opens in its editor, the Microsoft Word software, and the first occurrence of Secondary Requirements is highlighted.

    If string text is not specified or does not exist in the requirements document, the requirements document opens with the cursor at the beginning of the file.

  3. Keep requirements.doc and the my_sf_car model open; you will use them in Adding Requirement Links to Multiple Objects Simultaneously.

Resolving the Document Path

Browsing for a document to enter it in a requirements link enters 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. In many cases it is preferable to use a relative path so that the document is not constrained to a single location in the file system. With a relative path the Requirements Management Interface resolves the exact location of the requirements document in this order:

  1. An attempt is made to resolve the path relative to the current MATLAB directory.

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

  3. If the document is not located relative to the current directory or the MATLAB search path, it is resolved relative to the model file directory.

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

Relative Path Specified Example

Current MATLAB directory:

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

No Path Specified Example

Current MATLAB directory:

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 Specified Example

Current MATLAB directory:

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

Adding Requirement Links to Multiple Objects Simultaneously

You can add or delete requirement links for a selection of multiple Simulink blocks or Stateflow objects as follows:

  1. In the my_sf_car model, select the Engine, engine RPM, and transmission blocks.

    You can select multiple Simulink blocks or Stateflow objects in one of the following ways:

  2. Right-click any of the selected blocks and select Requirements > Add Links to All.

    The Add Requirements dialog box appears, as shown, for the three selected blocks.

  3. Add a new Requirement 3 for these blocks that points to the text "Tertiary Requirements" in the file requirements.doc.

    Add the requirement as you would for a single block, as described in Adding Requirement Links to an Object.

  4. Click Apply to apply the requirement links.

  5. Click OK to close the Requirements dialog box.

  6. In the my_sf_car model, click outside the three objects to deselect them.

  7. Right-click the Engine block and select Requirements.

    The Engine block now has three requirements, as shown.

  8. Right-click the engine RPM and transmission blocks to verify that they have only one requirement—Requirement 3.

  9. Save the my_sf_car model.

Deleting All Requirement Links for Multiple Objects Simultaneously

To delete the existing requirements for a group of selected blocks, right-click any of a group of selected blocks and, from the resulting context menu, select Requirements > Delete All. This deletes all the requirement links for all the selected blocks, whether they were added individually or as a group.

Selection-Based Linking

Selection-based linking is a quick way to create links between model elements and selected portions of a requirements document, which can be a Microsoft Word or Excel file only. This method creates a two-way link by embedding a Microsoft ActiveX control into the requirements document next to the selected string or cell.

Configuring Selection-Based Linking

Use the following procedure to configure selection-based linking:

  1. Open the my_sf_car model, if necessary.

  2. In the model window, select Tools > Requirements > Link settings. The Selection-based linking dialog box opens.

  3. Select the check box next to Word if necessary.

  4. Specify the following preferences on the Selection-based linking dialog box:

  5. Click OK to close the Selection-based linking dialog box.

Making Selection-Based Links

Use the following procedure to create selection-based requirement links:

  1. Right-click the Engine block and select Requirements > "Requirement 1".

    requirements.doc opens in a Microsoft Word window.

  2. Select a portion of the text that documents the desired requirement. For this example, select a "Dummy text." string.

  3. In the Simulink model, right-click the Engine block and select Requirements > Add link to Word selection.

    The Requirement Management Interface creates the link. If you right-click the Engine block and select Requirements, the Engine block now has four requirement links.

    If you select Requirements > Dummy text., a Microsoft Word window opens with the requirements document scrolled to the appropriate text.

    If you configured two-way linking, an ActiveX control is embedded in the requirements document next to the selected string.

  4. Click the ActiveX control to display the my_sf_car model, with the Engine block highlighted.

  


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