MATLAB SIMULINK VERIFICATION AND VALIDATION - S Podręcznik Użytkownika Strona 565

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 674
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 564
Create a Function for Checking Multiple Systems in Parallel
23-7
Create a Function for Checking Multiple Systems in Parallel
If you have a Parallel Computing Toolbox license and a multicore host machine, you can
create the following function to check multiple systems in parallel:
1
Create the run_configuration function as described in “Create a Function for
Checking Multiple Systems” on page 23-4.
2
Save the function as run_fast_configuration.m.
3
In the Editor, change the name of the function to run_fast_configuration.
4
Add another input to the run_fast_configuration function so that the inputs are
now:
SysList, numParallel
5
In the ModelAdvisor.run function, set 'ParallelMode' to 'On' . When you use
ModelAdvisor.run with ‘ParallelMode’ set to ‘On’, MATLAB automatically
creates a parallel pool.
SysResultObjArray = ModelAdvisor.run(SysList,'Configuration',fileName,...
'ParallelMode','On');
The function should now look like this:
function [fail, warn] = run_fast_configuration(SysList, numParallel)
%RUN_FAST_CONFIGURATION Check systems in parallel with Model Advisor
% Check systems given as input in parallel on the number of cores
% specified as input. Return number of warnings and failures.
fileName = 'slvnvdemo_mdladv_config.mat';
fail=0;
warn=0;
SysResultObjArray = ModelAdvisor.run(SysList,'Configuration',fileName,...
'ParallelMode','On');
for i=1:length(SysResultObjArray)
fail = fail + SysResultObjArray{i}.numFail;
warn = warn + SysResultObjArray{i}.numWarn;
end
end
6
Save the function.
7
Test the function. In the MATLAB Command Window, create a list of systems:
SysList={'sldemo_auto_climatecontrol/Heater Control',...
'sldemo_auto_climatecontrol/AC Control', 'rtwdemo_iec61508'};
Przeglądanie stron 564
1 2 ... 560 561 562 563 564 565 566 567 568 569 570 ... 673 674

Komentarze do niniejszej Instrukcji

Brak uwag