Modify Default Process Model to Fit Your Process
With the CI/CD Automation for Simulink Check support package, you can define a consistent process for your team by using a process model file. When your team has a standard process for local prequalification and CI builds, you can efficiently enforce guidelines and make collaboration easier. This example shows how to reconfigure the default process model to create a consistent, repeatable process that you can deploy to your team. In this example, you take the default process model and modify the tasks and queries to fit your requirements.
For more information about the process model, see Overview of Process Model.
Open Project
Open a project that contains your files. If you do not already have a project, you can create a project as shown in Create Projects.
Create Process Model
You can create a process model for your project by using either the:
Process Advisor app — When you open Process Advisor on a project that does not have a process model, the app automatically copies the default process model into the project.
createprocess
function — You can use this function to access the different process model templates, including a template for the default process model.
Inspect Default Process Model
Inspect the default process model by opening the Process Advisor app and clicking the Edit button .
The default process model has four main sections that you can edit to fit your development and verification workflow:
In the following diagram, the letters A, B, C, and D indicate the location of those sections in the default process model.
Section A — Add or Remove Built-In Tasks
The default process model adds several built-in tasks to the process, including tasks for
collecting metrics and running checks with Model Advisor. You can add or
remove these built-in tasks from your process by setting the variable associated
with a built-in task to true
or false
in your
process model. For example, to have your process include the built-in task for
generating Simulink® model comparisons, edit the process model to set
includeModelComparisonTask
to
true
.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Include/Exclude Tasks in processmodel %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% includeModelMaintainabilityMetricTask = true; includeModelTestingMetricTask = true; includeModelStandardsTask = true; includeDesignErrorDetectionTask = false; includeFindClones = true; includeModelComparisonTask = true; includeSDDTask = true; includeSimulinkWebViewTask = true; includeTestsPerTestCaseTask = true; includeMergeTestResultsTask = true; includeGenerateCodeTask = true; includeAnalyzeModelCode = true && exist('polyspaceroot','file'); includeProveCodeQuality = true && (~isempty(ver('pscodeprover')) || ~isempty(ver('pscodeproverserver'))); includeCodeInspection = false; includeGenerateRequirementsReport = false;
Each variable is associated with a task in the default process model.
Variable in Default Process Model | Task Title | Built-In Task |
---|---|---|
includeModelMaintainabilityMetricTask | Collect Model Maintainability Metrics | padv.builtin.task.CollectMetrics |
includeModelTestingMetricTask | Collect Model Testing Metrics | padv.builtin.task.CollectMetrics |
includeModelStandardsTask | Check Modeling Standards | padv.builtin.task.RunModelStandards |
includeDesignErrorDetectionTask | Detect Design Errors | padv.builtin.task.DetectDesignErrors |
includeFindClones | Find Clones | padv.builtin.task.FindClones |
includeModelComparisonTask | Generate Model Comparison | padv.builtin.task.GenerateModelComparison |
includeSDDTask | Generate SDD Report | padv.builtin.task.GenerateSDDReport |
includeSimulinkWebViewTask | Generate Simulink Web View | padv.builtin.task.GenerateSimulinkWebView |
includeTestsPerTestCaseTask | Run Tests | padv.builtin.task.RunTestsPerTestCase |
includeMergeTestResultsTask | Merge Test Results | padv.builtin.task.MergeTestResults |
includeGenerateCodeTask | Generate Code | padv.builtin.task.GenerateCode |
includeAnalyzeModelCode | Check Coding Standards | padv.builtin.task.AnalyzeModelCode |
includeProveCodeQuality | Prove Code Quality | padv.builtin.task.AnalyzeModelCode |
includeCodeInspection | Inspect Code | padv.builtin.task.RunCodeInspection |
includeGenerateRequirementsReport | Generate requirements report | padv.builtin.task.GenerateRequirementsReport |
The tasks that you add in the process model appear in the Tasks column in Process Advisor. In addition to the built-in tasks, you can also add custom tasks to your process model. For more information, see Add Tasks to Process.
Section B — Modify Behavior of Built-In Tasks
The built-in tasks have default behaviors, but you can modify how a task performs its action by reconfiguring the task object in the process model. For example, the built-in task padv.builtin.task.RunModelStandards
has a property ReportPath
that specifies where the task saves the output Model Advisor report. By default, the RunModelStandards
task saves the report in a subfolder named model_standards
. The default process model reconfigures the task object, maTask
, to have the task save the Model Advisor report in a subfolder named model_standards_results
instead. You can modify other task behaviors by setting other task object property values. For example, to have the task generate the Model Advisor report as a Microsoft® Word document instead of HTML, set ReportFormat
to "docx"
.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Register Tasks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Checking model standards on a model if includeModelStandardsTask maTask = pm.addTask(padv.builtin.task.RunModelStandards()); maTask.ReportPath = fullfile( ... defaultResultPath,'model_standards_results'); maTask.ReportFormat = "docx"; end ...
When you run the task in Process Advisor, the task performs its action using the behaviors that you specified in the process model. You can view the results in the I/O column of Process Advisor. To see other examples of how you can reconfigure tasks, inspect the default process model and see Reconfigure Task Behavior.
Section C — Specify Dependencies Between Tasks
Typically in your development and verification workflow, you have tasks that need inputs or results from other tasks in order to run successfully. In the process model, you specify these dependencies by using the dependsOn
method on the task object.
For example, the default process model adds the built-in tasks Generate Code and Check Coding Standards to the process. Since you need to generate the code before you can analyze it, the default process model specifies that if your process model contains both the code generation and code analysis tasks, then the code analysis task object, psbfTask
, needs to depend on the code generation task object codegenTask
.
%% Set Task Dependencies if includeGenerateCodeTask && includeAnalyzeModelCode psbfTask.dependsOn(codegenTask); end
If you open Process Advisor and point to the run button for the Check Coding Standards task, Process Advisor highlights dependency on the Generate Code task. If you try to run the Check Coding Standards task, the build system automatically runs the Generate Code task first. For more information, see Define Task Relationships.
Section D — Specify Preferred Task Execution Order
Often there are tasks in your development and verification workflow that you want to run in a specific order, even though the tasks do not depend on each other. To specify a preferred task execution order for tasks that do not depend on each other, you can use the runsAfter
method on the task object.
For example, the default process model specifies that the modeling standards task (maTask
) should run after the Simulink web view task (slwebTask
). The modeling standards task does not depend on information from the Simulink web view task in order to run, but that is the preferred execution order for the tasks in this particular process.
%% Set Task Run-Order if includeModelStandardsTask && includeSimulinkWebViewTask maTask.runsAfter(slwebTask); end
In Process Advisor, the Check Modeling Standards task appears after the Generate Simulink Web View task in the Tasks column. For more information on task ordering, see Define Task Relationships.