Simulink Verification and Validation
Historically, when linking requirements documents to Simulink objects, link information is stored with the model file. Model files are therefore modified every time you add, modify, or delete links to requirements documents. An alternative is to store link information in a separate file. Extra care is, of course, required to keep track of the separate files, but it becomes possible to manage requirements links while keeping Simulink model's timestamp and version number intact.
|On this page…|
Loading RMI data from /mathworks/devel/bat/BR2014bd/build/matlab/toolbox/slvnv/rmidemos/powerwin_reqs/slvnvdemo_powerwindowOffice.req
The default file name for saving requirements links data is ModelName|.req|. If the file is not present in the model folder, the model is assumed to have no links to requirements, as you can verify by highlighting the modelhighlighting the model.
rmidata.default('external'); rmi('highlightModel', 'slvnvdemo_powerwindowController');
You create and manage links in exactly same way you do with internal storage. For the purpose of this example, please open the PowerWindowSpecification.docxPowerWindowSpecification.docx document that is used for this example, select the text passenger input consists of a vector with three elementspassenger input consists of a vector with three elements, right-click the corresponding Mux blockMux block, and click Requirements Traceability > Link to Selection in Word.
If the model is still highlighted, the Mux block highlights to indicate associated requirements data. Note that the title bar does not indicate unsaved changes. New link information is stored separately from the model.
testReqLink = rmi('createEmpty'); testReqLink.description = 'testReqLink'; testReqLink.doc = 'powerwin_reqs\PowerWindowSpecification.docx'; testReqLink.id = '?passenger input consists of a vector with three elements'; rmi('set', 'slvnvdemo_powerwindowController/Mux4', testReqLink);
While working with a model that stores RMI data externally, changes to requirement links are saved when you:
Save or Save As the Simulink model, even if the title bar does not indicate unsaved changes.
Close the model. You will be prompted to save links changes if any.
Use Save links or Save links as shortcuts near the top of Requirements Traceability submenu.
Close the modelClose the model. You will be prompted about the link that you just created. You may save the links file with the default ModelName|.req| name in the model directory, or choose a different file name and/or location.
When you open a model, RMI will try to load requirements links data from the recently used location for this model. You may also select Requirements Traceability > Load links to choose a different .req file. This allows to use several sets of links with the same model, for example, links to design change descriptions that are different from links to original design specifications.
Reopen the modelReopen the model, select Requirements Traceability > Load links to open a file browser and point to slvnvdemo_powerwindowRequirements.req in the toolbox/slvnv/rmidemos/powerwin_reqs foldertoolbox/slvnv/rmidemos/powerwin_reqs folder.
Highlight requirements in the modelHighlight requirements in the model to confirm that an alternative set of links is now associated with the model. You can navigate and modify these links in the same way you would work with embedded (in-model) links.
open_system('slvnvdemo_powerwindowController'); otherReqFile = fullfile(matlabroot, 'toolbox', 'slvnv', 'rmidemos', 'powerwin_reqs', 'slvnvdemo_powerwindowRequirements.req'); rmidata.map('slvnvdemo_powerwindowController', otherReqFile); rmi('highlightModel', 'slvnvdemo_powerwindowController');
Loading RMI data from /mathworks/devel/bat/BR2014bd/build/matlab/toolbox/slvnv/rmidemos/powerwin_reqs/slvnvdemo_powerwindowOffice.req Mapping /mathworks/devel/bat/BR2014bd/build/matlab/toolbox/slvnv/rmidemos/slvnvdemo_powerwindowController.slx to /mathworks/devel/bat/BR2014bd/build/matlab/toolbox/slvnv/rmidemos/powerwin_reqs/slvnvdemo_powerwindowRequirements.req Loading RMI data from /mathworks/devel/bat/BR2014bd/build/matlab/toolbox/slvnv/rmidemos/powerwin_reqs/slvnvdemo_powerwindowRequirements.req
A model with existing embedded requirements links can convert to external storage. References to documents get stripped from the model file and stored in a new .req file. To try this out:
Select Analysis > Requirements Traceability > Move to file to open a file browser.
Choose a file name for the new external .req file and click OK. Model is resaved with no embedded links and a new .req file is created. Note the "Saving data to ..." message in the command window.
Your ability to use and manage links in this model now depend on the external file.
Points to keep in mind before you move internally stored links to an external file:
You will need to carry an extra .req file along with the model file.
Non-default file name and location associations are stored in user preferences. If you move or rename the .req file outside MATLAB, you will have to manually point RMI to the new location when the model is reopened.
When one user has configured a non-default location or name for the .req file associated with the model, other RMI users will need to manually select Load links when they open the model. The specified location will persist in each user's preferences and does not need to change unless files are moved or renamed again.
open_system('slvnvdemo_fuelsys_officereq') save_system('slvnvdemo_fuelsys_officereq', 'fuelsys_officereq_copy'); rmidata.export('fuelsys_officereq_copy'); rmi('highlightModel', 'fuelsys_officereq_copy');
Saving RMI data to /tmp/BR2014bd_145981_71764/tpd55e313c_0c00_4ea3_8845_b98292572dc2/fuelsys_officereq_copy.req
To embed RMI data with the Simulink model, so that all information is in one place and you do not need to track extra files, select Requirements Traceability > Copy to model. The model is modified and left dirty. You will have to explicitly Save the changes. The external .req file still exists, but it is NOT read when you reopen the model that now has embedded RMI data. You can try this out with the slvnvdemo_powerwindowController modelslvnvdemo_powerwindowController model.
The model file is not writeable, but you can save the model with a new name. The new model has RMI data embedded and does not depend on external .req files.
Points to keep in mind before you embed RMI data with the model file:
Every change to RMI links will modify the model file.
You will not be able to switch between different sets of links: only one set of RMI links can be embedded in model file.
close_system('slvnvdemo_powerwindowController', 0); % close demo model, discard changes tmpfilepath = fullfile(matlabroot, 'toolbox', 'slvnv', 'rmidemos', 'slvnvdemo_powerwindowController.mdl'); rmidata.map(tmpfilepath, 'clear'); % forget mdl-to-req mappings tmpfilepath = strrep(tmpfilepath, '.mdl', '.req'); if exist(tmpfilepath, 'file') == 2, delete(tmpfilepath); end % delete .req file we just saved close_system('fuelsys_officereq_copy', 0); tmpfilepath = which('fuelsys_officereq_copy'); if ~isempty(tmpfilepath) delete(tmpfilepath); % delete tmp .mdl or .slx we just created rmidata.map(tmpfilepath, 'clear'); % forget mdl-to-req mappings tmpfilepath = strrep(tmpfilepath, '.slx', '.req'); if exist(tmpfilepath, 'file') == 2, delete(tmpfilepath); end % delete .req file we just saved end clear tmpfilepath; rmidemo_callback('dlgkill', 'Highlight Objects with Requirements'); % close popup if still open
Nothing to clear for /mathworks/devel/bat/BR2014bd/build/matlab/toolbox/slvnv/rmidemos/slvnvdemo_powerwindowController.mdl Nothing to clear for /tmp/BR2014bd_145981_71764/tpd55e313c_0c00_4ea3_8845_b98292572dc2/fuelsys_officereq_copy.slx