ModelAdvisor.run

Package: ModelAdvisor

Run Model Advisor checks on systems

Syntax

SysResultObjArray = ModelAdvisor.run(SysList,CheckIDList,Name,Value)
SysResultObjArray = ModelAdvisor.run(SysList,'Configuration',FileName,Name,Value)

Description

SysResultObjArray = ModelAdvisor.run(SysList,CheckIDList,Name,Value) runs the Model Advisor on the systems provided by SysList with additional options specified by one or more optional Name,Value pair arguments. CheckIDList contains cell array of check IDs to run.

SysResultObjArray = ModelAdvisor.run(SysList,'Configuration',FileName,Name,Value) runs the Model Advisor on the systems provided by SysList. The list of checks to run is specified using a Model Advisor configuration file, specified by FileName.

Input Arguments

SysList

Cell array of systems to run.

CheckIDList

Cell array of check IDs to run. For details on how to find check IDs, see Find Model Advisor Check IDs.

CheckIDList optionally can include input parameters for specific checks using the following syntax; {'CheckID','InputParam',{'IP','IPV'}}, where IP is the input parameter name and IPV is the corresponding input parameter value. You can specify several input parameter name and value pair arguments in any order as IP1,IPV1,…,IPN,IPVN.

FileName

Name of the Model Advisor configuration file. For details on creating a configuration file, see Use the Model Advisor Configuration Editor to Customize the Model Advisor.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'DisplayResults'

Setting DisplayResults to 'Summary' displays a summary of the system results in the Command Window. Setting DisplayResults to 'Details' displays the following in the Command Window:

  • Which system the Model Advisor is checking while the run is in progress.

  • For each system, the pass and fail results of each check.

  • A summary of the system results.

Setting DisplayResults to 'None' displays no information in the Command Window.

Default: 'Summary'

'Force'

Setting Force to 'On' removes existing modeladvisor/system folders. Setting Force to 'Off' prompts you before removing existing modeladvisor/system folders.

Default: 'Off'

'ParallelMode'

Setting ParallelMode to 'On' runs the Model Advisor in parallel mode if you have a Parallel Computing Toolbox™ license and a multicore machine. The Parallel Computing Toolbox does not support 32-bit Windows® machines. Each parallel process runs checks on one model at a time. In parallel mode, load the model data from the model workspace or data dictionary. The Model Advisor in parallel mode does not support model data in the base workspace. For an example, see Create a Function for Checking Multiple Systems in Parallel.

Default: 'Off'

'TempDir'

Setting TempDir to 'On' runs the Model Advisor from a temporary working folder, to avoid concurrency issues when running using a parallel pool. For more information, see Resolving Data Concurrency Issues. Setting TempDir to 'Off' runs the Model Advisor in the current working folder.

Default: 'Off'

'ShowExclusions'

Setting ShowExclusions to 'On' lists Model Advisor check exclusions in the report. Setting ShowExclusions to 'Off' does not list Model Advisor check exclusion in the report.

Default: 'On'

Output Arguments

SysResultObjArray

Cell array of ModelAdvisor.SystemResult objects, one for each model specified in SysList. Each ModelAdvisor.SystemResult object contains an array of CheckResultObj objects. Save SysResultObjArray to review results at a later time without having to rerun the Model Advisor (see Save and Load Process for Objects).

CheckResultObj

Array of ModelAdvisor.CheckResult objects, one for each check that runs.

Examples

Runs the Model Advisor checks Check model diagnostic parameters and Check for fully defined interface on the sldemo_auto_climatecontrol/Heater Control and sldemo_auto_climatecontrol/AC Control subsystems:

% Create list of checks and models to run.
CheckIDList ={'mathworks.maab.jc_0021',...
    'mathworks.iec61508.RootLevelInports'};
SysList={'sldemo_auto_climatecontrol/Heater Control',...
    'sldemo_auto_climatecontrol/AC Control'};

% Run the Model Advisor.
SysResultObjArray = ModelAdvisor.run(SysList,CheckIDList);

Runs the Model Advisor configuration file slvnvdemo_mdladv_config.mat on the sldemo_auto_climatecontrol/Heater Control and sldemo_auto_climatecontrol/AC Control subsystems:

% Identify Model Advisor configuration file.
% Create list of models to run.
fileName = 'demoConfiguration.json';
SysList={'sldemo_auto_climatecontrol/Heater Control',...
    'sldemo_auto_climatecontrol/AC Control'};

% Run the Model Advisor.
SysResultObjArray = ModelAdvisor.run(SysList,'Configuration',fileName);

Tips

  • If you have a Parallel Computing Toolbox license and a multicore machine, Model Advisor can run on multiple systems in parallel. You can run the Model Advisor in parallel mode by using ModelAdvisor.run with 'ParallelMode' set to 'On'. By default, 'ParallelMode' is set to 'Off'. When you use ModelAdvisor.run with 'ParallelMode' set to 'On', MATLAB® automatically creates a parallel pool.

Alternatives

  • Use the Model Advisor GUI to run each system, one at a time.

  • Create a script or function using the Simulink.ModelAdvisor class to run each system, one at a time.

Extended Capabilities

Introduced in R2010b