Main Content

rmi

Work programmatically with Requirements Toolbox

Description

Get Link Information

linkedDest = rmi("get",modelOrBlock) returns the link destinations for the outgoing links from the model or model element specified by modelOrBlock.

example

numLinks = rmi("count",modelOrBlock) returns the number of outgoing links from the top-level model or model element specified by modelOrBlock.

example

descriptions = rmi("descriptions",modelOrBlock) returns the descriptions of the link destinations for the model or model element specified by modelOrBlock.

example

codeComments = rmi("codeComment",modelOrBlock) returns the code comments that correspond to the requirements linked from the model or model element specified by modelOrBlock. Requirements Toolbox™ inserts these comments in the generated code when you generate code from the model. For more information, see Trace Requirements to Code Generated from Models.

example

linkedDest = rmi("codeReqs",modelOrBlock) returns the link destinations that Requirements Toolbox includes in the generated code for links to requirements from the model or model element specified by modelOrBlock. If the model element is a referenced instance of a block from a Simulink® library, the link destinations include links from the library block as well as the reference block. If the model element is not a reference instance of a block from a Simulink library, the output of this function is the same as the output of rmi("get",modelOrBlock). For more information about referenced instances of library blocks, see Linked Blocks (Simulink)

example

Delete Links

rmi("clearAll",modelOrBlock) opens a dialog box that prompts you to delete the outgoing links from the top-level model or model element.

example

rmi("clearAll",model,"deep") opens a dialog box that prompts you to delete the outgoing links from the model.

example

rmi(___,"noPrompt") deletes the outgoing links without opening a dialog box. Use one of the previous two syntaxes, followed by the argument noPrompt.

example

Work with Models

rmi("highlightModel",model) highlights the model elements that have outgoing links in the model specified by model.

example

rmi("unhighlightModel",model) turns off highlighting in the model specified by model.

example

[blockHandles,modelIndices,isSf,objSIDs] = rmi("getObjectsInModel",model) returns the block handles, blockHandles, the model hierarchy indices, parentIndices, indicators for whether or not the model element belongs to a Stateflow® chart, isSf, and the model element SIDs, objSIDs, for each model element in the model specified by model.

example

[modelOrBlockName,modelOrBlockType] = rmi("getObjLabel",modelOrBlock) returns the name and type for the model or model element specified by modelOrBlock.

example

guidChar = rmi("guidGet",modelOrBlock) returns the globally unique identifier for the model or model element specified by modelOrBlock. If modelOrBlock does not have a globally unique identifier, the function creates one. Only REQ files use globally unique identifiers.

example

handle = rmi("guidLookup",model,guid) returns the numeric handle of the model or model element that corresponds to the globally unique identifier guid in the Simulink model specified by model. Only REQ files use globally unique identifiers.

example

Report Traceability

rmi("report",artifactToReport) generates a traceability report in HTML format for the artifact specified by artifactToReport. For more information about traceability reports, see Create and Customize Requirements Traceability Reports.

example

rmi projectReport generates a traceability report in HTML format for the files in the current project. The top-level page of this report has links to reports for each project file that has outgoing links. For more information, see Create Requirements Traceability Report for Projects.

example

Integrate with Third-Party Tools

rmi register myCustomDocInterface registers the custom document interface specified by the registration function myCustomDocInterface, which enables you to create direct links to requirements in a third-party application that Requirements Toolbox does not provide built-in support for. For more information, see Define Custom Document Interface for Direct Linking to Requirements.

example

rmi unregister myCustomDocInterface unregisters the custom document interface specified by the registration function myCustomDocInterface. For more information, see Define Custom Document Interface for Direct Linking to Requirements.

example

rmi httpLink activates an internal HTTP server that you can use to navigate to linked items in MATLAB® or Simulink from backlinks in a browser-based third-party requirements tool that uses HTTP protocol. Backlink navigation on the HTTPS server is enabled by default.

Note

Alternatively, you can active the internal HTTP server by using the rmipref function and setting the UnsecureHttpRequests preference to true. When the UnsecureHttpRequests preference is true, MATLAB activates the internal HTTP server on startup.

example

connectorStatus = rmi("httpLink","status") returns the port numbers for the internal HTTP server. If the port number is 0, the server is not active.

example

rmi setup prompts you at the command line to configure Requirements Toolbox for interaction with Microsoft® Office and IBM® DOORS®. For more information, see Configure Requirements Toolbox for Interaction with Microsoft Office and IBM DOORS.

example

rmi setup doors prompts you at the command line to configure Requirements Toolbox for interaction with IBM DOORS. For more information, see Configure Requirements Toolbox for Interaction with Microsoft Office and IBM DOORS.

example

rmi("doorsSync",model) opens the IBM DOORS synchronization settings dialog box for the Simulink model specified by model. For more information about IBM DOORS synchronization, see Synchronize Requirements Traceability in IBM DOORS by Using Surrogate Modules.

example

currentSettings = rmi("doorsSync",model,"settings") returns the current IBM DOORS synchronization settings for the Simulink model specified by model. To change the settings, use the IBM DOORS synchronization settings dialog box to make changes, then click Save settings.

Tip

To return the default settings, specify model as [].

example

rmi("doorsSync",model,syncSettings) uses the synchronization settings specified by syncSettings to create an IBM DOORS surrogate module from the Simulink model specified by model. If an IBM DOORS surrogate module already exists, this function re-synchronizes the model and module and updates the surrogate module. For more information about IBM DOORS synchronization, see Synchronize Requirements Traceability in IBM DOORS by Using Surrogate Modules.

example

numScreenshots = rmi("surrogateUpdateScreenshots",model) adds screenshots to the surrogate module of each model element that corresponds to an object in the surrogate module and returns the number of screenshots added. If the surrogate module already has screenshots, the function updates the screenshots.

example

currentTemplate = rmi("getDoorsLabelTemplate") returns the current template for labels of links to requirements in IBM DOORS.

example

tf = rmi("setDoorsLabelTemplate",customTemplate) sets the current IBM DOORS template for link labels to requirements to the format specified by customTemplate and returns the success status. The default label template contains the section number and object heading for the DOORS requirement link target.

Tip

To revert the link label template to the default template, enter this code at the MATLAB command prompt:

tf = rmi("setDoorsLabelTemplate","")

example

label = rmi("doorsLabel",moduleID,doorsReqID) returns the link label that Requirements Toolbox uses when it creates a link to the IBM DOORS requirement specified by doorsReqID in the module specified by moduleID.

example

numUpdatedLinkLabels = rmi("updateDoorsLabels",model) updates the link labels for the outgoing links to requirements in IBM DOORS from the model specified by model and outputs the number of link labels updated. The function uses the current link label template, currentTemplate.

example

Check Links for Validity and Consistency

validationProblems = rmi("checkDoc") checks the validity of the links from requirements in Microsoft Word, Microsoft Excel®, or IBM DOORS. The function prompts you at the command line for the document type, the document name, returns the number of problems detected, and opens a report that contains information about the validity of the links. For more information, see Validate Requirements Links in a Requirements Document.

example

validationProblems = rmi("checkDoc",docName) checks the validity of the links to requirements in the document specified by docName, returns the number of link validation problems detected, and opens a link validation report for the document. For more information, see Validate Requirements Links in a Requirements Document.

example

consistencyProblems = rmi("check",artifactToCheck) checks the consistency of the links from the artifact specified by artifactToCheck and opens a link consistency report for the file. For more information, see Check Direct Links for Validity.

example

Examples

collapse all

Open the CruiseRequirementsExample project. Load the crs_controller model.

openProject("CruiseRequirementsExample");
model = "crs_controller";
load_system(model);

Get the link destination for the Switch block in the OpMode subsystem of the CruiseControlMode subsystem.

modelElement = model+"/CruiseControlMode/opMode/Switch";
linkedDest = rmi("get",modelElement)
linkedDest = struct with fields:
            doc: 'crs_req_func_spec.slreqx'
             id: '25'
         linked: 1
    description: '#25: Precedence of mode determination'
       keywords: ''
         reqsys: 'linktype_rmi_slreq'

Open the CruiseRequirementsExample project and load the crs_controller model.

openProject("CruiseRequirementsExample");
model = "crs_controller";
load_system(model)

Get the block handles and Stateflow® IDs for model elements that have outgoing links.

[blockHandles,sfIDs] = rmi("getHandlesWithRequirements",model);

Create a variable called modelElement and assign the first block handle as the value.

modelElement = blockHandles(1);

Get the number of links from the model element.

numLinks = rmi("count",modelElement)
numLinks = 
1

Get the link description for the link.

desc = rmi("descriptions",modelElement)
desc = 1x1 cell array
    {'#19: Cruise Control Mode'}

Get the code comment that corresponds to the linked requirement.

codeComment = rmi("codeComment",modelElement)
codeComment = 
    '*  1. Cruise Control Mode
     *  2. [crs_controllerdic.sldd:brake_threshold] Threshold value for brake pressure
     *  3. [crs_controllerdic.sldd:tsp_max] Maximum Target Speed
     *  4. [crs_controllerdic.sldd:tsp_min] Minimum Target Speed'

Get the link destinations for the links that Requirements Toolbox™ includes in the generated code for the model from the model element.

linkedDest = rmi("codeReqs",modelElement)
linkedDest=4×1 struct array with fields:
    doc
    id
    linked
    description
    keywords
    reqsys

Open the CruiseRequirementsExample project and load the crs_controller and crs_plant models.

openProject("CruiseRequirementsExample");
model1 = "crs_controller";
load_system(model1);
model2 = "crs_plant";
load_system(model2);

Delete Links from Model Elements

Get the model elements in the crs_controller model that have outgoing links.

[blockHandles,sfIDs] = rmi("getHandlesWithRequirements",model1);

Inspect the link for the first model element.

modelElement = blockHandles(1);
linkedDest = rmi("get",modelElement)
linkedDest = struct with fields:
            doc: 'crs_req_func_spec.slreqx'
             id: '19'
         linked: 1
    description: '#19: Cruise Control Mode'
       keywords: ''
         reqsys: 'linktype_rmi_slreq'

Delete the links from the first model element by following the prompts.

rmi("clearAll",modelElement)

Confirm that you deleted the link.

linkedDest = rmi("get",modelElement)
linkedDest =

     []

Inspect the link for the second model element.

modelElement = blockHandles(2);
linkedDest = rmi("get",modelElement)
linkedDest = struct with fields:
            doc: 'crs_req_func_spec.slreqx'
             id: '36'
         linked: 1
    description: '#36: Disabling override'
       keywords: ''
         reqsys: 'linktype_rmi_slreq'

Delete the links from the second model element without opening a dialog box.

rmi("clearAll",modelElement,"noprompt")

Confirm that you deleted the link.

linkedDest = rmi("get",modelElement)
linkedDest =

     []

Delete Links from Models

Get the model elements in the crs_controller model that have outgoing links.

[blockHandles,~] = rmi("getHandlesWithRequirements",model1)
blockHandles = 62×1
103 ×

    0.3360
    0.3470
    0.3630
    0.3790
    0.3840
    0.3890
    0.4360
    0.4830
    0.4880
    0.4930
      ⋮

Delete the outgoing links from the crs_controller model by following the prompts.

rmi("clearAll",model1,"deep")

Confirm that you deleted the links.

[blockHandles,~] = rmi("getHandlesWithRequirements",model1)
blockHandles =

  0×1 empty double column vector

Get the model elements in the crs_plant model that have outgoing links.

[blockHandles,~] = rmi("getHandlesWithRequirements",model2)
blockHandles = 5×1
103 ×

    2.1400
    2.1420
    2.1440
    2.1460
    2.4080

Delete the outgoing links from the crs_controller model by following the prompts.

rmi("clearAll",model2,"deep","noprompt")

Confirm that you deleted the links.

[blockHandles,~] = rmi("getHandlesWithRequirements",model2)
blockHandles =

  0×1 empty double column vector

Open the CruiseRequirementsExample project and load the crs_controller model.

openProject("CruiseRequirementsExample");
model = "crs_controller";
load_system(model);

Highlight the model elements that have outgoing links and open the model.

rmi("highlightModel",model)
open_system(model);

Turn off highlighting in the model.

rmi("unhighlightModel",model)

Open the CruiseRequirementsExample project. Load the crs_controller model.

openProject("CruiseRequirementsExample");
model = "crs_controller";
load_system(model);

Get the globally unique identifier for the enbl inport.

modelElement = model+"/enbl";
guID = rmi("guIDGet",modelElement)
guID = 
'GIDa_2c46e0e0_faec_4db3_b02b_c348e8a91d9d'

Get the numeric block handle from the globally unique identifier for the model element.

handle = rmi("guidlookup",model,guID)
handle = 
154.0001

Open the CruiseRequirementsExample project. Load the crs_controller model.

openProject("CruiseRequirementsExample");
model = "crs_controller";
load_system(model);

Get the objects in the crs_controller model.

[blockHandles,modelIndices,isSf,objSIDs] = rmi( ...
    "getObjectsInModel",model);

Get the block name and block type for the 13th model element.

modelElement = blockHandles(13);
[blockName,blockType] = rmi("getObjLabel",modelElement)
blockName = 
'CruiseControlMode'
blockType = 
'SubSystem'

Open the CruiseRequirementsExample project. Load the crs_controller model.

openProject("CruiseRequirementsExample");
model = "crs_controller";
load_system(model);

Generate a traceability report for the crs_controller model.

rmi("report",model)
    Beginning report
    Looping on model "crs_controller"
    Looping on system "CruiseControlMode"
    Looping on system "DriverSwRequest"
    Looping on system "TargetSpeedThrottle"
    Looping on system "disableCaseDetection"
    Looping on system "opMode"
    Looping on system "outOfRange"
    Looping on system "decrement"
    Looping on system "doNot Repeat"
    Looping on system "increment"
    Looping on system "activated"
    Looping on system "disabled"
    Looping on system "enabled"
    Looping on system "targetSpeed"
    Looping on system "IsKeyPositionOn"
    Looping on system "IsShiftDrive"
    Looping on system "isbrake"
    Looping on system "IncrementDecrement"
    Looping on system "activateCondition"
    Looping on system "disableCondition"
    Looping on system "enableCondition"
    Looping on system "resumeCondition"
    Looping on system "counter"
    Looping on system "getNewTargetSpeed"
    Looping on system "getThrottleValue"
    Looping on system "PI controller"
  "chapter" contains no content and will not be inserted into document
    Converting report
    Report complete

Generate a traceability report for the project.

rmi projectReport
    Beginning report
    Converting report
    Report complete
C:\Users\jdoe\CruiseRequirementsExample\data\crs_controllerdic.sldd done.
    Beginning report
    Looping on model "crs_controller"
    Looping on system "CruiseControlMode"
CPPMICROSERVICE WARNING: Empty mw.installpath for bundle: com_mathworks_dastudio_test_blocks
    Looping on system "DriverSwRequest"
    Looping on system "TargetSpeedThrottle"
    Looping on system "disableCaseDetection"
    Looping on system "opMode"
    Looping on system "outOfRange"
    Looping on system "decrement"
    Looping on system "doNot Repeat"
    Looping on system "increment"
    Looping on system "activated"
    Looping on system "disabled"
    Looping on system "enabled"
    Looping on system "targetSpeed"
    Looping on system "IsKeyPositionOn"
    Looping on system "IsShiftDrive"
    Looping on system "isbrake"
    Looping on system "IncrementDecrement"
    Looping on system "activateCondition"
    Looping on system "disableCondition"
    Looping on system "enableCondition"
    Looping on system "resumeCondition"
    Looping on system "counter"
    Looping on system "getNewTargetSpeed"
    Looping on system "getThrottleValue"
    Looping on system "PI controller"
  "chapter" contains no content and will not be inserted into document
    Converting report
    Report complete
C:\Users\jdoe\CruiseRequirementsExample\models\crs_controller.slx done.
    Beginning report
    Looping on model "crs_plant"
    Looping on system "crs_plant"
    Looping on system "Vehicle1"
    Looping on chart "shift_logic"
    Looping on and state "gear_state"
    Looping on and state "selection_state"
    Looping on or state "fourth"
    Looping on or state "third"
    Looping on or state "second"
    Looping on or state "first"
    Looping on or state "steady_state"
    Looping on or state "upshifting"
    Looping on or state "downshifting"
  "chapter" contains no content and will not be inserted into document
    Converting report
    Report complete
C:\Users\jdoe\CruiseRequirementsExample\models\crs_plant.slx done.
    Beginning report
    Running FOR loop, RPTGEN_LOOP = 1
    Converting report
    Report complete
C:\Users\jdoe\CruiseRequirementsExample\tests\DriverSwRequest_Tests.mldatx done.
    Beginning report
  "chapter" contains no content and will not be inserted into document
    Converting report
    Report complete

Register a custom document interface that enables direct linking to requirements in Microsoft® PowerPoint® presentations.

rmi register customPowerPointInterface

Unregister the interface.

rmi unregister customPowerPointInterface

Get the internal HTTP server status.

status = rmi("httpLink","status")
status = struct with fields:
     httpPort: 0
    httpsPort: 31515

Activate the internal HTTP server.

rmi httpLink

Get the internal HTTP server status.

status = rmi("httpLink","status")
status = struct with fields:
     httpPort: 31415
    httpsPort: 31515

Configure Requirements Toolbox for interaction with Microsoft Office and IBM DOORS.

rmi setup
Ensuring required Active-X controls ..
Verifying MATLAB automation server path ..

Register this MATLAB installation as ActiveX Automation Server? (Y/N):_y
Registering this MATLAB executable as an automation server ..
 
Welcome to the DOORS-MATLAB Interface setup utility.
This will perform all the steps necessary so that you
can start using Simulink and Stateflow with IBM DOORS.
 
NOTE: You should close IBM DOORS before continuing with
this installation.
 
Checking Windows Registry to locate IBM DOORS installation(s)...
 
Please select IBM DOORS installation to configure for MATLAB:
    [1]  9.6  C:\Program Files\IBM\Rational\DOORS\9.6\
 
If your target IBM DOORS Client installation is not listed above,
select one of the following options:
    [2]  Manually enter IBM DOORS installation directory
    [3]  Exit, making no changes
    [4]  Make no changes in IBM DOORS directory but ensure IBM DOORS integration is enabled in MATLAB
 
Selection: 1
 
C:\Program Files\IBM\Rational\DOORS\9.6\lib\dxl\addins\dmi\dmi.inc is up to date.

Configure Requirements Toolbox™ for interaction with IBM DOORS by executing this code:

rmi setup doors

Open DOORS Project

In this example, you use the faultTolerantControlSystem.dpa file in IBM DOORS, which contains requirements modules that describe a fault-tolerant control system.

In IBM DOORS, create a new project:

  1. Select File > New > Project.

  2. In the New Project dialog, set Name to faultTolerantControlSystem.

  3. In the Description field, enter Fault-tolerant control system project.

  4. Select Use a project archive.

  5. Click Browse and select faultTolerantControlSystem.dpa.

  6. Click OK to create the project.

The New Project dialog box in DOORS. The Use a project archive button is selected and the file path specifies the faultTolerantControlSystem.dpa archive file.

Get the Synchronization Settings

Open the faultTolerantControlSystem model.

model = "faultTolerantControlSystem";

Get the current synchronization settings for the model.

currentSettings = rmi("doorsSync",model,"settings")
currentSettings = struct with fields:
    surrogatePath: '/faultTolerantControlSystem/faultTolerantControlSystem'
      detailLevel: 4
        doorsToSl: 0
        slToDoors: 1
    purgeSimulink: 0
       purgeDoors: 1
        saveModel: 1
    saveSurrogate: 1

Set the value of the detailLevel field to 4.

currentSettings.detailLevel = 4;

Create the Surrogate Module

Create the surrogate module.

rmi("doorsSync",model,currentSettings)
Verifying MATLAB automation server path ..
Registering this MATLAB executable as an automation server ..

Add screenshots to the model.

numScreenshots = rmi("surrogateUpdateScreenshots",model)
    Beginning report
    Looping on system "faultTolerantControlSystem"
    Looping on system "engine gas dynamics"
    Looping on system "Mixing & Combustion"
    Looping on system "system lag"
    Looping on system "Throttle & Manifold"
    Looping on system "Intake Manifold"
    Looping on system "Throttle"
    Looping on system "fuel rate controller"
    Looping on system "Airflow calculation"
    Looping on system "Fuel  Calculation"
    Looping on system "Switchable Compensation"
    Looping on system "LOW Mode"
    Looping on system "RICH Mode"
    Looping on system "Sensor correction and Fault Redundancy"
    Looping on system "MAP Estimate"
    Looping on system "Speed Estimate"
    Looping on system "Throttle Estimate"
    Looping on chart "control logic"
    Converting report
    Report complete
Using ./snapshots_html_files/image-001-sl.png for faultTolerantControlSystem

Missing screenshot for faultTolerantControlSystem/Test inputs

Using ./snapshots_html_files/image-003-sl.png for faultTolerantControlSystem/engine
gas
dynamics

Using ./snapshots_html_files/image-005-sl.png for faultTolerantControlSystem/engine
gas
dynamics/Mixing & Combustion

Using ./snapshots_html_files/image-007-sl.png for faultTolerantControlSystem/engine
gas
dynamics/Mixing & Combustion/system lag

Using ./snapshots_html_files/image-009-sl.png for faultTolerantControlSystem/engine
gas
dynamics/Throttle & Manifold

Using ./snapshots_html_files/image-011-sl.png for faultTolerantControlSystem/engine
gas
dynamics/Throttle & Manifold/Intake Manifold

Using ./snapshots_html_files/image-013-sl.png for faultTolerantControlSystem/engine
gas
dynamics/Throttle & Manifold/Throttle

Using ./snapshots_html_files/image-015-sl.png for faultTolerantControlSystem/fuel rate
controller

Using ./snapshots_html_files/image-017-sl.png for faultTolerantControlSystem/fuel rate
controller/Airflow calculation

Using ./snapshots_html_files/image-019-sl.png for faultTolerantControlSystem/fuel rate
controller/Fuel  Calculation

Using ./snapshots_html_files/image-021-sl.png for faultTolerantControlSystem/fuel rate
controller/Fuel  Calculation/Switchable
Compensation

Using ./snapshots_html_files/image-023-sl.png for faultTolerantControlSystem/fuel rate
controller/Fuel  Calculation/Switchable
Compensation/LOW Mode

Using ./snapshots_html_files/image-025-sl.png for faultTolerantControlSystem/fuel rate
controller/Fuel  Calculation/Switchable
Compensation/RICH Mode

Using ./snapshots_html_files/image-027-sl.png for faultTolerantControlSystem/fuel rate
controller/Sensor correction and
Fault Redundancy

Using ./snapshots_html_files/image-029-sl.png for faultTolerantControlSystem/fuel rate
controller/Sensor correction and
Fault Redundancy/MAP Estimate

Using ./snapshots_html_files/image-031-sl.png for faultTolerantControlSystem/fuel rate
controller/Sensor correction and
Fault Redundancy/Speed Estimate

Using ./snapshots_html_files/image-033-sl.png for faultTolerantControlSystem/fuel rate
controller/Sensor correction and
Fault Redundancy/Throttle Estimate

Using ./snapshots_html_files/image-035-sf.png for faultTolerantControlSystem/fuel rate
controller/control logic

Processed 19 subsystems, 0 items added in module 0000010e
numScreenshots = 19

Load the faultTolerantControlSystem model.

model = "faultTolerantControlSystem";
load_system(model)

Open the IBM DOORS synchronization settings dialog box for the model.

rmi("doorsSync",model)

Configure Requirements Toolbox™ for interaction with IBM® DOORS® by executing this code:

rmi setup doors

Load the slvnvdemo_fuelsys_doorsreq model. Get a handle to the link set for the model.

model = "slvnvdemo_fuelsys_doorsreq";
load_system(model);
myLinkSet = slreq.load(model);

Open DOORS Project

In this example, you use the faultTolerantControlSystem.dpa file in IBM DOORS, which contains requirements modules that describe the fault-tolerant control system.

In IBM DOORS, create a new project:

  1. Select File > New > Project.

  2. In the New Project dialog, set Name to faultTolerantControlSystem.

  3. In the Description field, enter Fault-tolerant control system project.

  4. Select Use a project archive.

  5. Click Browse and select faultTolerantControlSystem.dpa.

  6. Click OK to create the project.

The New Project dialog in DOORS. The Use a project archive button is selected and the file path specifies the faultTolerantControlSystem.dpa archive file.

Redirect Links for DOORS Project

Redirect the links to point to the IBM DOORS module IDs in the new project.

In IBM DOORS, open the faultTolerantControlSystem project.

The DOORS Database window shows the faultTolerantControlSystem project.

Open the faultTolerantControlSystem module and select a requirement. Get the module ID for the requirement. Update the link destinations to point to the faultTolerantControlSystem module in the new project.

newModuleID = rmidoors.getCurrentObj;
oldModuleID = "00000160";
count = updateDocUri(myLinkSet,oldModuleID,newModuleID)
count = 235

Open the FuelSys Design Description module and select a requirement. Get the module ID for the requirement. Update the link destinations to point to the FuelSys Design Description module in the new project.

newModuleID = rmidoors.getCurrentObj;
oldModuleID = "00000161";
count = updateDocUri(myLinkSet,oldModuleID,newModuleID)
count = 6

Open the FuelSys Requirements Specification module and select a requirement. Get the module ID for the requirement. Update the link destinations to point to the FuelSys Requirements Specification module in the new project.

newModuleID = rmidoors.getCurrentObj;
oldModuleID = "00000141";
count = updateDocUri(myLinkSet,oldModuleID,newModuleID)
count = 1

Get and Set Link Label Template

Get the current label template for links to requirements in IBM DOORS.

currentTemplate = rmi("getDoorsLabelTemplate")
currentTemplate = 
'%M:%h'

Set the template to display the module name and the object heading, separated by a colon.

customTemplate = "%M:%h";
tf = rmi("setDoorsLabelTemplate",customTemplate)
tf = logical
   0

Confirm that you updated the link label template.

currentTemplate = rmi("getDoorsLabelTemplate")
currentTemplate = 
'%M:%h'

Update Link Labels

Get the link label for requirement number 27 in the FuelSys Requirements Specification module based on the current template.

doorsReqID = "27";
newModuleID = "00000101";
label = rmi("doorsLabel",newModuleID,doorsReqID)
label = 
'FuelSys Requirements Specification:Normal Mode of Operation'

Load the slvnvdemo_fuelsys_doorsreq model, then update the link labels for the outgoing links from the model to requirements in IBM DOORS.

model = "slvnvdemo_fuelsys_doorsreq";
load_system(model);
numUpdatedLinks = rmi("updateDoorsLabels",model)
slvnvdemo_fuelsys_doorsreq/fuel rate controller/throttle  (Inport):
    changing "1.1.1.1  Throttle Sensor" to "FuelSys Design Description:Throttle Sensor"

slvnvdemo_fuelsys_doorsreq/fuel rate controller/MAP  (Inport):
    changing "1.1.1.2  Manifold Absolute Pressure Sensor " to "FuelSys Design Description:Manifold Absolute Pressure Sensor"

slvnvdemo_fuelsys_doorsreq/fuel rate controller/Airflow calculation  (SubSystem):
    changing "1.2.1  Mass airflow estimation " to "FuelSys Design Description:Mass airflow estimation"

slvnvdemo_fuelsys_doorsreq/.../Sensor correction and Fault Redundancy/MAP Estimate  (SubSystem):
    changing "1.3.1.3  Manifold pressure failure mode " to "FuelSys Design Description:Manifold pressure failure mode"

slvnvdemo_fuelsys_doorsreq/.../Sensor correction and Fault Redundancy/Speed Estimate  (SubSystem):
    changing "2.2.6 	Speed Sensor Failure" to "FuelSys Requirements Specification:Speed Sensor Failure"

slvnvdemo_fuelsys_doorsreq/.../control logic/Rich_Mixture (State):
    changing "1.3.1.2  Enriched mixture usage " to "FuelSys Design Description:Enriched mixture usage"

slvnvdemo_fuelsys_doorsreq/.../control logic/[speed==0 & press < zero_thresh]/ Fail.INC (Transition):
    changing "1.3.1.4  Speed sensor failure detection " to "FuelSys Design Description:Speed sensor failure detection"
numUpdatedLinks = 7

This example shows how to interactively check links for validity.

Note

You can only run this example on Windows® platforms.

Open the Link and Navigate to Requirements in Excel from Simulink blocks example.

openExample(['slrequirements/' ...
    'LinkRequirementsInExcelToSimulinkBlocksExample'])

Open the slvnvdemo_FuelSys_TestScenarios Microsoft Excel document.

doc = which("slvnvdemo_FuelSys_TestScenarios.xlsx");
winopen(doc);

Check the links to the document for validity. Follow the prompts in the Command Window.

validationProblems = rmi("checkDoc")
Please choose target document type:
1 - Microsoft Word document
2 - Microsoft Excel document
3 - DOORS module
[1,2,3]? 2
Microsoft Excel document to check: (current)
Checking 'C:/Users/jdoe/MATLAB/slrequirements-ex78700367/slvnvdemo_FuelSys_TestScenarios.xlsx' (Y/n) ? y
Reading "C:/Users/jdoe/MATLAB/slrequirements-ex78700367/slvnvdemo_FuelSys_TestScenarios.xlsx" ...
found 2 links

validationProblems =

     1

Open the slvnvdemo_FuelSys_TestScenarios Microsoft® Excel® document.

doc = which("slvnvdemo_FuelSys_TestScenarios.xlsx");
winopen(doc);

Check the links for validity.

validationProblems = rmi("checkDoc",doc)
Reading "C:/Users/jdoe/MATLAB/slrequirements-ex78700367/slvnvdemo_FuelSys_TestScenarios.xlsx" ...
found 2 links
validationProblems = 1

Open the ShortestPath example.

openProject("ShortestPath");

Check the links from the shortest_path MATLAB® code file for consistency.

artifactToCheck = "shortest_path.m";
consistencyProblems = rmi("check",artifactToCheck)
consistencyProblems = 4×1

     0
     0
    11
     0

Input Arguments

collapse all

Artifact to check link consistency for, specified as a string scalar or a character vector that contains the file name of the artifact. The artifact can be a Simulink data dictionary file or a MATLAB code file.

Example: "shortest_path.m"

Artifact to generate traceability report for, specified as a string scalar or a character vector that contains the file name of the artifact. The artifact can be a MATLAB code file, a Simulink model, a Simulink data dictionary file, or a Simulink Test™ test file. If you specify a Simulink model, do not include the SLX extension.

Example: "crs_controller"

Example: "shortest_path.m"

Label template for links to IBM DOORS requirements, specified as a string scalar or character vector.

Use these format specifiers to define the link label template:

Template Format Specifier

Information from IBM DOORS

%hObject heading
%tObject text
%pModule prefix
%nObject absolute number
%mModule ID
%PProject name
%MModule name
%UDOORS URL
%<ATTRIBUTE_NAME>Other DOORS attribute you specify

Example: "%h:%t"

Third-party requirements document name, specified as a string scalar or character vector that defines the name of a Microsoft Word or Microsoft Excel document or an IBM DOORS module ID.

IBM DOORS requirement ID, specified as a string scalar or character vector.

Example: "27"

Globally unique identifier for the model or model element, specified as a string scalar or character vector. Only REQ files use globally unique identifiers.

Example: "GIDa_56a78985_b045_4313_a3f6_10be3c4f06df"

Data Types: char

Simulink model name, specified as a string scalar or character vector that defines a model name, or a double that defines a model handle. If you specify the model name, do not include the SLX file extension.

Example: "crs_controller"

IBM DOORS module ID, specified as a string scalar or character vector.

Example: "00000081"

Simulink or Stateflow model or model element, specified as a string scalar or character vector that defines a model name or block path, or a double that defines a model or block handle.

Example: "crs_controller/enbl"

Example: 164.0762

Data Types: double | char | string

Custom document interface for direct linking to requirements in third-party applications that Requirements Toolbox does not provide built-in support for, specified as the name of a function that defines the custom document interface. For more information, see Define Custom Document Interface for Direct Linking to Requirements.

Example: rmi register customInterface

IBM DOORS synchronization settings, specified as a structure with these fields:

  • surrogatePath — Path to the surrogate module in the DOORS project, specified as a character vector.

  • detailLevel — Setting that specifies which Simulink model elements to include in the surrogate module, specified as a double.

  • doorsToSl — Setting to copy unmatched links from the IBM DOORS surrogate module to the Simulink model, specified as a double.

  • slToDoors — Setting to copy unmatched links from the Simulink model to the IBM DOORS surrogate module, specified as a double.

  • purgeSimulink — Setting to remove unmatched links in the Simulink model, specified as a double.

  • purgeDoors — Setting to remove unmatched links in the IBM DOORS surrogate module, specified as a double.

  • saveModel — Setting to save the Simulink model after synchronization, specified as a double.

  • saveSurrogate — Setting to save the IBM DOORS surrogate module after synchronization, specified as a double.

You can return the current synchronization settings by executing this code:

syncSettings = rmi("doorsSync",model,"settings")

Output Arguments

collapse all

Numeric handles of blocks, returned as a double array.

Code comments for linked requirements from the model or model element, returned as a character vector.

Number of consistency problems with links from artifacts, returned as a double array. The rows in the double array contain the number of links:

  1. Whose destination artifact is missing

  2. Whose destination is missing

  3. Whose description does not match the text of the linked requirement

  4. That use a path type that is not consistent with the user's path preference

Current IBM DOORS synchronization settings, returned as a structure with these fields:

  • surrogatePath — Path to the surrogate module in the DOORS project, returned as a character vector.

  • detailLevel — Setting that specifies which Simulink model elements to include in the surrogate module, returned as a double.

  • doorsToSl — Setting to copy unmatched links from the IBM DOORS surrogate module to the Simulink model, returned as a double.

  • slToDoors — Setting to copy unmatched links from the Simulink model to the IBM DOORS surrogate module, returned as a double.

  • purgeSimulink — Setting to remove unmatched links in the Simulink model, returned as a double.

  • purgeDoors — Setting to remove unmatched links in the IBM DOORS surrogate module, returned as a double.

  • saveModel — Setting to save the Simulink model after synchronization, returned as a double.

  • saveSurrogate — Setting to save the IBM DOORS surrogate module after synchronization, returned as a double.

Current link label template for links to requirements in IBM DOORS, returned as a character vector.

Example: '%h'

Link destination descriptions, returned as a cell array of character vectors.

Example: {'#68: Maximum Target Speed'}

Globally unique identifier for the model or model element, returned as a character vector. Only REQ files use globally unique identifiers.

Example: 'GIDa_56a78985_b045_4313_a3f6_10be3c4f06df'

Numeric handle of the block or model, returned as a double.

Whether or not the model element belongs to Stateflow chart, returned as a logical array.

Label for links to requirements in IBM DOORS, returned as a character vector. The label corresponds to the description field of the link destination structure.

Destinations that the model or block links to, returned as a structure or structure array that contains these fields:

  • doc — Path to the document that contains the link destination, returned as a character vector.

  • id — ID for the link destination, returned as a character vector. When the link destination is a requirement in an external document, character vectors that contain special characters combined with text or numbers identify the requirements:

    First CharacterIdentifier DescriptionExample

    ?

    Identify the requirement by specifying search text. The first instance of the text in the document identifies the requirement.

    '?Requirement 1'

    @

    Identify the requirement by specifying a named item, such as a bookmark in Microsoft Word.

    '@my_req'

    #

    Identify the requirement by specifying a page number or item number.

    '#21'

    >

    Identify the requirement by specifying an item number or line number.

    '>3156'

    $

    Identify the requirement by specifying a cell address in a Microsoft Excel spreadsheet.

    '$A2:C5'

  • linked — Indicator for whether the link is included in traceability reports, returned as a logical. When linked is 1, the link is included in traceability reports.

  • description — Link description, returned as a character array.

  • keywords — Link keywords, returned as a character array.

  • reqsys — Document interface name, returned as a character array. The document interface name corresponds to the artifact type that contains the link destination.

Model hierarchy indices, returned as a double array.

Simulink or Stateflow model or model element name, returned as a character vector.

Example: 'enbl'

Simulink or Stateflow model or model element type, returned as a character vector.

Example: 'Inport'

Number of outgoing links for the model element, returned as a double.

Number of screenshots added to or updated in the surrogate module, returned as a double.

Simulink identifiers, returned as a cell array.

Internal HTTP and HTTPS server status, returned as a structure with these fields:

  • httpPort — HTTP port number, returned as a double. If the HTTP port number is 0, the service is not active.

  • httpsPort — HTTPS port number, returned as a double.

Number of validation problems with links from external documents, returned as a double.

Alternatives

  • The getSimulinkBlockHandle (Simulink) function returns numeric handles for blocks and does not require the globally unique identifier that is required by this syntax:

    handle = rmi("guidLookup",model,guid)

  • To generate a report for requirement sets, you can use the slreq.generateReport function. For more information, see Report Requirements Information. This report is an alternative to the traceability report generated by rmi("report",artifactToReport) and rmi projectReport.

Version History

Introduced in R2006b

expand all