padv.builtin.task.RunModelStandards Class
Namespace: padv.builtin.task
Superclasses: padv.Task
Task for checking modeling standards with Model Advisor
Description
This class requires CI/CD Automation for Simulink Check.
The padv.builtin.task.RunModelStandards
class provides a task that can
check your models for modeling conditions and configuration settings that cause inaccurate or
inefficient simulation of the system that the model represents by using the Model
Advisor app. Running model standards checking can also help you verify compliance with
industry standards and guidelines.
You can add the task to your process model by using the
method addTask
. After you add the task to your process model, you can run the
task from the Process Advisor app or by using the function
runprocess
. You can configure this task to specify which model
standards the task runs. For example, you can specify a Model Advisor configuration
file or list of check identifiers to include in the Model Advisor analysis. If you
do not specify which model standards to run, the task runs a subset of high-integrity systems
checks by default.
To view the source code for this built-in task, in the MATLAB® Command Window, enter:
open padv.builtin.task.RunModelStandards
The padv.builtin.task.RunModelStandards
class is a handle
class.
Creation
Description
creates a task for checking modeling standards using Model Advisor.task
= padv.builtin.task.RunModelStandards()
sets certain properties using one or more name-value arguments. For example, task
= padv.builtin.task.RunModelStandards(Name=Value
)task
= padv.builtin.task.RunModelStandards(Name = "MyModelAdvisorTask")
creates a
task with the specified name.
You can use this syntax to set property values for InputQueries
,
Name
, IterationQuery
,
InputDependencyQuery
, Licenses
,
LaunchToolAction
, and LaunchToolText
.
The padv.builtin.task.RunModelStandards
class also has other properties, but you cannot set
those properties during task creation.
Properties
The RunModelStandards
class inherits properties from padv.Task
. The properties listed in
Specialized Inherited Properties are padv.Task
properties that the RunModelStandards
task overrides.
The task also has properties for specifying Model Advisor Options for running Model Advisor
checks by using ModelAdvisor.run
.
Name
— Unique identifier for task in process
"padv.builtin.task.RunModelStandards"
(default) | string
Unique identifier for task in process, specified as a string.
Example: "MyModelAdvisorTask"
Data Types: string
Title
— Human-readable name that appears in Process Advisor app
"Check Modeling Standards"
(default) | string
Human-readable name that appears in Process Advisor app, specified as a string.
Example: "My Model Advisor Task"
Data Types: string
DescriptionText
— Task description
"This task uses the Model Advisor to check your models for
modeling conditions and configuration settings."
(default) | string
Task description, specified as a string.
When you point to a task in Process Advisor and click the information icon, the tooltip shows the task description.
Example: "This task uses the Model Advisor to check your models for modeling
conditions and configuration settings."
Data Types: string
DescriptionCSH
— Path to task documentation
path to RunModelStandards
documentation (default) | string
Path to task documentation, specified as a string.
When you point to a task in Process Advisor, click the ellipsis (...), and click Help, Process Advisor opens the task documentation.
Example: fullfile(pwd,"taskHelpFiles","myTaskDocumentation.pdf")
Data Types: string
RequiredIterationArtifactType
— Artifact type that task can run on
"sl_model_file"
(default) | ...
Type of artifact, specified as one or more of the values listed in this table. To specify multiple values, use an array.
Category | Artifact Type | Description |
---|---|---|
MATLAB | "m_class" | MATLAB class |
"m_file" | MATLAB file | |
"m_func" | MATLAB function | |
"m_method" | MATLAB class method | |
"m_property" | MATLAB class property | |
Model Advisor | "ma_config_file" | Model Advisor configuration file |
"ma_justification_file" | Model Advisor justification file | |
Process Advisor | "padv_dep_artifacts" | Related artifacts that current artifact depends on |
"padv_output_file" | Process Advisor output file | |
Project | "project" | Current project file |
Requirements | "mwreq_file" | Requirement file (since R2024b) |
"mwreq_item" | Requirement (since R2024b) | |
| Requirement (for R2024a and earlier) | |
"sl_req_file" | Requirement file (for R2024a and earlier) | |
"sl_req_table" | Requirements Table | |
Stateflow® | "sf_chart" | Stateflow chart |
"sf_graphical_fcn" | Stateflow graphical function | |
"sf_group" | Stateflow group | |
"sf_state" | Stateflow state | |
"sf_state_transition_chart" | Stateflow state transition chart | |
"sf_truth_table" | Stateflow truth table | |
Simulink® | "sl_block_diagram" | Block diagram |
"sl_data_dictionary_file" | Data dictionary file | |
"sl_embedded_matlab_fcn" | MATLAB function | |
"sl_block_diagram" | Block diagram | |
"sl_library_file" | Library file | |
"sl_model_file" | Simulink model file | |
"sl_protected_model_file" | Protected Simulink model file | |
"sl_subsystem" | Subsystem | |
"sl_subsystem_file" | Subsystem file | |
System Composer™ | "zc_block_diagram" | System Composer architecture |
"zc_component" | System Composer architecture component | |
"zc_file" | System Composer architecture file | |
Tests | "harness_info_file" | Harness info file |
"sl_harness_block_diagram" | Harness block diagram | |
"sl_harness_file" | Test harness file | |
"sl_test_case" | Simulink Test™ case | |
"sl_test_case_result" | Simulink Test case result | |
"sl_test_file" | Simulink Test file | |
"sl_test_iteration" | Simulink Test iteration | |
"sl_test_iteration_result" | Simulink Test iteration result | |
"sl_test_report_file" | Simulink Test result report | |
"sl_test_result_file" | Simulink Test result file | |
"sl_test_resultset" | Simulink Test result set | |
"sl_test_seq" | Test Sequence | |
"sl_test_suite" | Simulink Test suite | |
"sl_test_suite_result" | Simulink Test suite result |
Example: "sl_model_file"
Example: ["sl_model_file "zc_file"]
IterationQuery
— Find artifacts that task iterates over
padv.builtin.query.FindModels
(default) | padv.Query
object | name of padv.Query
object
Query that finds the artifacts that the task iterates over, specified as a
padv.Query
object or the name of a padv.Query
object. When you specify IterationQuery
, the task runs one time
for each artifact returned by the query. In the Process
Advisor app, the artifacts returned by IterationQuery
appear under task title.
For more information about task iterations, see Overview of Process Model.
InputDependencyQuery
— Finds artifact dependencies for task inputs
padv.Query
object | name of padv.Query
object
Query that finds artifact dependencies for task inputs, specified as a
padv.Query
object or the name of a padv.Query
object.
The build system runs the query specified by
InputDependencyQuery
to find the dependencies for the task
inputs, since those dependencies can impact if task results are up-to-date.
For more information about task inputs, see Overview of Process Model.
Example: padv.builtin.query.GetDependentArtifacts
LaunchToolAction
— Function that launches tool
@launchToolAction
(default) | function handle
Function that launches a tool, specified as the function handle.
When you point to a task in the Process Advisor app, you can click the ellipsis (...) to see more options. For built-in tasks, you have the option to launch a tool associated with the task.
For the task RunModelStandards
, you can launch the Model
Advisor app.
Data Types: function_handle
LaunchToolText
— Description of action that LaunchToolAction
property performs
"Open Model Advisor"
(default) | string
Description of the action that the LaunchToolAction
property
performs, specified as a string.
Data Types: string
InputQueries
— Inputs to task
padv.Query
object | name of padv.Query
object | array of padv.Query
objects
Inputs to the task, specified as:
a
padv.Query
objectthe name of
padv.Query
objectan array of
padv.Query
objectsan array of names of
padv.Query
objects
By default, the task RunModelStandards
gets the current model that
the task is iterating over by using the built-in query
padv.builtin.query.GetIterationArtifact
.
OutputDirectory
— Location for standard task outputs
fullfile('$DEFAULTOUTPUTDIR$','$ITERATIONARTIFACT$','model_standards')
(default) | string
Location for standard task outputs, specified as a string.
The built-in tasks use tokens, like $DEFAULTOUTPUTDIR$
, as
placeholders for dynamic path resolution during run-time. For more information, see
Dynamically Resolve Paths with Tokens.
Data Types: string
CheckIDList
— List of unique identifiers for Model Advisor checks
missing
(default) | string
List of unique identifiers for Model Advisor checks, specified as string.
Note
If you specify CheckIDList
and add a Model
Advisor configuration file as an input for the task, the task runs
Model Advisor using the Model Advisor configuration file and
ignores the list of check IDs.
Example: ["mathworks.jmaab.db_0032","mathworks.jmaab.jc_0281"]
Data Types: string
DisplayResults
— Report display setting for Model Advisor
"Summary"
(default) | "Details"
| "None"
Report display setting for Model Advisor, specified as either:
"Summary"
— Display summary of the system results in the Command Window"Details"
— Display a summary of the system results and the pass and fail results for each check on each system"None"
— Do not display information in the Command Window
Example: "Details"
ExtensiveAnalysis
— Extensive analysis setting for Model Advisor
"on"
(default) | "off"
Extensive analysis setting for Model Advisor, specified as either:
"off"
— Model Advisor only runs checks in your configuration that do not trigger extensive analysis"on"
— Model Advisor runs each check in your Model Advisor configuration file, including checks that trigger extensive analysis with tools like Simulink Design Verifier™
Example: "off"
Force
— Delete existing Model Advisor reports without prompts
"on"
(default) | "off"
Delete existing Model Advisor reports without prompts, specified as either:
"off"
— Prompt you before removing existingmodeladvisor/
folders.system
"on"
— Automatically removes existingmodeladvisor/
folderssystem
Example: "off"
ParallelMode
— Parallel execution setting for Model Advisor
"off"
(default) | "on"
Parallel execution setting for Model Advisor, specified as either:
"off"
— Model Advisor does not run in parallel."on"
— If you have a Parallel Computing Toolbox™ license and a multicore machine, Model Advisor can run on multiple systems in parallel. When you specifyParallelMode
as"on"
, MATLAB automatically creates a parallel pool.
Example: "on"
ReportFormat
— Format of generated report
"html"
(default) | "docx"
Format of the generated report, specified as either:
"html"
— HTML format"docx"
— Microsoft® Word document format
Example: "docx"
ReportName
— Prefix for Model Advisor report file name
"$ITERATIONARTIFACT$_ModelAdvisor"
(default) | string
Prefix for the Model Advisor report file name, specified as a string. By
default, an underscore and the model name,
"_
, are appended to the
report file name.modelName
"
The built-in tasks use tokens, like $ITERATIONARTIFACT$
, as
placeholders for dynamic path resolution during run-time. For more information, see
Dynamically Resolve Paths with Tokens.
Data Types: string
ReportPath
— Folder for generated report
fullfile('$DEFAULTOUTPUTDIR$', '$ITERATIONARTIFACT$',
'model_standards')
(default) | string
Folder for the generated report, specified as a string.
Data Types: string
ShowExclusions
— Exclusion display setting for report
"on"
(default) | "off"
Exclusion display setting for the report, specified as either:
"off"
— Report does not list Model Advisor check exclusions"on"
— Report lists Model Advisor check exclusions
Example: "off"
TempDir
— Temporary working folder for Model Advisor
"off"
(default) | "on"
Temporary working folder for Model Advisor, specified as either:
"off"
— Run Model Advisor in the current working folder"on"
— Run Model Advisor from a temporary working folder. You can use this to avoid concurrency issues when running using a parallel pool.
Example: "on"
Methods
Specialized Public Methods
This class overrides the following inherited methods.
run | Check modeling standards using Model Advisor Note You do not need to manually invoke this method. When you run a task using
the Process Advisor app or the
The function taskResult = run(obj, input) ... end |
dryRun |
Dry run the task to validate task inputs and generate
representative task outputs without actually running the task. The function taskResult = dryRun(obj, input) ... end |
launchToolAction | Launch the Model Advisor app. Process Advisor uses this method when you open the tool associated with a task. |
Examples
Add Model Advisor Task to Process
Add a task that can check modeling standards using Model Advisor.
Open the process model for your project. If you do not have a process model, open the Process Advisor app to automatically create a process model.
In the process model file, add the RunModelStandards
task to your
process model by using the addTask
method. By default, the
RunModelStandards
task runs a subset of high-integrity systems
checks.
maTask = pm.addTask(padv.builtin.task.RunModelStandards);
You can reconfigure the task behavior by using the task properties. For example, to specify a different location for the Model Advisor report:
% Change Report path maTask.ReportPath = fullfile(... "$DEFAULTOUTPUTDIR$","$ITERATIONARTIFACT$","model_standards_results");
Specify Model Advisor Configuration File
By default, the RunModelStandards
task runs a subset
of high-integrity checks. If you want the task to run the Model Advisor checks
specified by the Model Advisor configuration file, you can add the
configuration file as an input to the task.
In the process model, you find the Model Advisor configuration file by
using the built-in query padv.builtin.query.FindFileWithAddress
and
then specify that query as the input query by using the
addInputQueries
function. For example, suppose you have a
Model Advisor configuration file called
sampleChecks.json
in a folder called
tools
:
maTask = pm.addTask(padv.builtin.task.RunModelStandards); % Specify which Model Advisor configuration to run maTask.addInputQueries(padv.builtin.query.FindFileWithAddress( ... Type = "ma_config_file",... Path = fullfile("tools","sampleChecks.json")));
In this code for addInputQueries
:
The first argument,
"ma_config_file"
, specifies that the file is a Model Advisor configuration file.The second argument specifies the path to the Model Advisor configuration file. In this example, the configuration file is a file,
sampleChecks.json
, in thetools
folder in the project.
Note
If you provide both a list of check IDs (CheckIDList
) and a
Model Advisor configuration file for the task, the task runs Model Advisor using the
Model Advisor configuration file and ignores the list of check IDs.
Specify Model Advisor Justification File
Starting in R2023a, if you want the RunModelStandards
task to use your Model Advisor justification files when checking modeling
standards, you can reconfigure the task to add the justification files as inputs.
In your process model, add the built-in query
padv.builtin.query.FindMAJustificationFileForModel
as an input
query for the task and specify the folder, JustificationFolder
, that
contains the justification files. For example, if your justification files are in the
directory Justifications/ModelAdvisor
relative to your project root,
add those justification files as inputs to the task by using the function
addInputQueries
.
maTask = pm.addTask(padv.builtin.task.RunModelStandards()); % Find and use justification files maTask.addInputQueries(... padv.builtin.query.FindMAJustificationFileForModel(... JustificationFolder=fullfile("Justifications","ModelAdvisor")));
The justification file appears as an input in the I/O column in Process Advisor.
Create and Configure Multiple Instances of Model Advisor Task
You can add multiple instances of a task to your
process model to run different task configurations. For example, you can have one instance
of the built-in task padv.builtin.task.RunModelStandards
that runs a
specific Model Advisor configuration for a subset of models and another Model Advisor
configuration for other models.
In your process model, to create multiple instances of a task, you need to specify
unique values for the Name
properties of each task instance. By
default, the task name is the name of the task class.
% Tasks need unique names maTaskA = pm.addTask(padv.builtin.task.RunModelStandards(... Name = "maTaskA")); maTaskB = pm.addTask(padv.builtin.task.RunModelStandards(... Name = "maTaskB"));
If you need to reconfigure the tasks, you can specify values for the other task properties. For example, you can specify which models the task runs on, which Model Advisor configuration file the task uses, and where the reports generate.
% Can specify unique title for task that appears in Process Advisor maTaskA.Title = "Check Modeling Standards - A"; maTaskB.Title = "Check Modeling Standards - B"; % Can specify different Model Advisor configurations maTaskA.addInputQueries(padv.builtin.query.FindFileWithAddress( ... Type="ma_config_file", Path=fullfile("configs","configA.json"))); maTaskB.addInputQueries(padv.builtin.query.FindFileWithAddress( ... Type="ma_config_file", Path=fullfile("configs","configB.json"))); % Can run on different sets of models maTaskA.IterationQuery = padv.builtin.query.FindModels(... IncludePath = "control"); maTaskB.IterationQuery = padv.builtin.query.FindModelsWithLabel(... "ProjectLabelCategory","ProjectLabel"); % Specify unique locations for Model Advisor reports maTaskA.ReportPath = fullfile( ... defaultResultPath,"model_standards_A_results"); maTaskB.ReportPath = fullfile( ... defaultResultPath,"model_standards_B_results");
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)