www.gusucode.com > rmidemos工具箱matlab源码程序 > rmidemos/slvnvdemo_powerwindow_sllinks.m

    %% Link to Requirements Modeled in Simulink
% You can use Simulink to model your design requirements. For example, 
% you can use verification blocks to specify desired system properties 
% and model the design requirements. 
% The Requirements Management Interface (RMI) allows you to create
% navigation links between the requirements modeled in Simulink,
% the associated Simulink objects, and related test cases.
% This example shows how to use the RMI to create and view links to
% requirements modeled in Simulink.

% Copyright 2011-2012 The MathWorks, Inc.

%% Open Example Model
% Open the
% <matlab:open_system('slvnvdemo_powerwindowController') Power Window Controller model> 
% by typing the command:

open_system('slvnvdemo_powerwindowController');

%% Verification Subsystems for Power Window Controller Model
% Open the verification model, 
% <matlab:open_system('slvnvdemo_powerwindow_vs') 'Power Window Controller Temporal Property Specification'>.
% This model specifies properties and requirements of the
% |slvnvdemo_powerwindowController| model. 
% 
% Consider the following design requirements for the controller:
%
% # *Requirement 1* (Obstacle Response) - Whenever an obstacle is detected,
% the controller shall give the down command for one second. This
% requirement is modeled in
% <matlab:rmidemo_callback('locate','slvnvdemo_powerwindow_vs/Verification%20Subsystem2')
% Verification Subsystem2>.
% # *Requirement 2* (Autodown feature) - If the driver presses the down
% button for less than 1 second, the controller keeps issuing the down
% command until the end has been reached, or the driver presses the up
% button. This requirement is modeled in
% <matlab:rmidemo_callback('locate','slvnvdemo_powerwindow_vs/Verification%20Subsystem3') Verification Subsystem3>
% 
% See <matlab:showdemo('sldvdemo_powerwindow_vs_script') Design Verifier Temporal Properties example> 
% for more details.

open_system('slvnvdemo_powerwindow_vs');

%% Create RMI Link to a Simulink Object
% Create an RMI link from 
% <matlab:rmidemo_callback('locate','slvnvdemo_powerwindow_vs/Verification%20Subsystem2') Verification Subsystem2>
% to the
% <matlab:rmidemo_callback('locate_sf','slvnvdemo_powerwindowController/control:2') emergencyDown state> 
% in the |slvnvdemo_powerwindowController| model.
%
% # <matlab:open_system('slvnvdemo_powerwindowController') Open slvnvdemo_powerwindowController model>. 
% # Right-click on
% <matlab:rmidemo_callback('locate_sf','slvnvdemo_powerwindowController/control:2') emergencyDown state> 
% and select *Requirements Traceability > Select for linking with Simulink*.
% # Right-click on 
% <matlab:rmidemo_callback('locate','slvnvdemo_powerwindow_vs/Verification%20Subsystem2') Verification Subsystem2>
% and select *Requirements Traceability > Add link to selected object*.
% # Right-click the
% <matlab:rmidemo_callback('locate','slvnvdemo_powerwindow_vs/Verification%20Subsystem2')
% Verification Subsystem2>.
% The new RMI link appears at the top of *Requirements Traceability* submenu.
% # <matlab:close_system('slvnvdemo_powerwindowController',0) Close slvnvdemo_powerwindowController model>.
% # Right-click on <matlab:rmidemo_callback('locate','slvnvdemo_powerwindow_vs/Verification%20Subsystem2') Verification Subsystem2>. 
% Navigate the new link at the top of the *Requirements Traceability* submenu.
% Model opens and |emergencyDown| state is highlighted.

%% Link Simultaneously to Multiple Simulink Objects
% You can link to a multiple selection of Simulink objects. Use the |Shift| key to select all the following objects as in figure
% below.
%
% * <matlab:rmidemo_callback('locate_sf','slvnvdemo_powerwindowController/control:14') iniDriverDown>
% * <matlab:rmidemo_callback('locate_sf','slvnvdemo_powerwindowController/control:16') autoDriverDown>
% * <matlab:rmidemo_callback('locate_sf','slvnvdemo_powerwindowController/control:39') after(5,tick) transition out of iniDriverDown>
% * <matlab:rmidemo_callback('locate_sf','slvnvdemo_powerwindowController/control:40') [driver[1]] transition to autoDriverDown>
%
% <<powerwindow_chart_autoDown.jpg>>
%
% # Right-click on this group of objects, select *Requirements Traceability > Select for linking with Simulink*. 
% Be careful to not lose the selections when you right-click.
% # Right-click on 
% <matlab:rmidemo_callback('locate','slvnvdemo_powerwindow_vs/Verification%20Subsystem3') Verification Subsystem3>
% and select *Requirements Traceability > Link to 4 selected objects*.

%% Link to a Group of Simulink Objects
% 
% # Right-click on 
% <matlab:rmidemo_callback('locate','slvnvdemo_powerwindow_vs/Global%20Assumptions/Logical%20Operator8') NAND block>
% in |Global Assumptions|
% and select *Requirements Traceability > Select for linking with Simulink*.
% # Drag the mouse across 
% <matlab:rmidemo_callback('locate','slvnvdemo_powerwindowController/endstop') endstop>
% and
% <matlab:rmidemo_callback('locate','slvnvdemo_powerwindowController/obstacle') obstacle>
% inputs in |slvnvdemo_powerwindowController| to select both inputs.
% # Right-click on this group of objects and select *Add
% link to selected object*. Be careful to not lose the selection.
% # Click on the background of |slvnvdemo_powerwindowController| to clear the
% group selection. 
% # Right-click each input and select *Requirements Traceability* to display new links.
% Click the new link, confirm that 
% <matlab:rmidemo_callback('locate','slvnvdemo_powerwindow_vs/Global%20Assumptions/Logical%20Operator8') NAND>
% is highlighted.
%

%% Create Links for Navigation in Both Directions
% To create links for navigation in both directions:
%
% # <matlab:rmidemo_callback('settings',1) Open *Requirements Settings*>
% dialog box.
% # Select the Selection Linking tab.
% # Enable *Modify destination for bidirectional linking*.
%
% Now, when you create a link
% from one Simulink object to another, a corresponding "return" link is
% also created.
%
% <<settings_2way.png>>
%

%% Highlight and Report RMI Links Between Simulink Objects
% Create RMI links to Simulink objects in the same way as links to external
% documents:
%
% # In the <matlab:open_system('slvnvdemo_powerwindow_vs') slvnvdemo_powerwindow_vs model window>, 
% select *Analysis > Requirements Traceability > Highlight Model* to highlight all RMI
% links in the model, including links to Simulink objects.
% # In the <matlab:open_system('slvnvdemo_powerwindow_vs') slvnvdemo_powerwindow_vs model window>, 
% select *Analysis > Requirements Traceability > Generate Report*. 
% # In the generated report, click a hyperlink in any requirements table.
% This navigates to the corresponding object in Simulink diagram.
%
% <<powerwindow_vs_reqReport.jpg>>

%% Cleanup
% Close all open models. Do not save changes.

close_system('slvnvdemo_powerwindowController', 0);
close_system('slvnvdemo_powerwindow_vs', 0);

displayEndOfDemoMessage(mfilename)