Main Content

Best Practices for Process Model Authoring

With the CI/CD Automation for Simulink Check support package, you can define a development and verification process for your team by using a process model. When you define your process model, consider the following process modeling best practices that you can use to maintain your process model, handle dependencies, and improve process model loading times.

Keep Process Model File in Project Root

By default, the build system automatically creates a process model file in the root folder of the project. If possible, keep your process model file the in root folder of the project so that the build system can detect changes to the file and mark tasks as outdated.

Make Sure Only One Process Model File on Path

To avoid unexpected behavior, make sure only one processmodel file is on the path. You can instruct the build system to detect when there are multiple process model files on the path. For more information, see the property DetectMultipleProcessModels for padv.ProjectSettings.

Review Untracked Dependencies

Handling Untracked Dependencies

If you make a change to an untracked input or output file, Process Advisor and the build system do not mark the task as outdated. Make sure that task inputs or outputs that appear as Untracked do not need to be tracked to maintain the task status and result information that you need for your project.

By default, the build system generates a warning for untracked I/O files. To change build system behavior when there are untracked I/O files, you can specify the project setting Untracked dependency behavior as either:

  • "Allow" — Do not generate warnings or errors for untracked I/O files.

  • "Warn" — Generate a warning if a task has untracked I/O files. In Process Advisor, the I/O column shows a warning icon .

  • "Error" — Generate an error if a task has untracked I/O files.

For more information, see Specify Settings for Process Advisor and Build System.

Share Queries Across Tasks

You can improve Process Advisor load times by sharing query instances across your process model. If multiple tasks in the process model use the same iteration query, you can update your code to share a single query object instance across these tasks. For example, if multiple tasks use FindModels as an iteration query, you can create a FindModels object and use that object as the iteration query for those tasks:

FunctionalityUse This Instead
    
taskA = pm.addTask("taskA",...
    IterationQuery = padv.builtin.query.FindModels);
taskB = pm.addTask("taskB",...
    IterationQuery = padv.builtin.query.FindModels);
sharedModelsQuery = padv.builtin.query.FindModels(...
    Name="SharedModelsQuery");
taskA = pm.addTask("taskA",...
    IterationQuery = sharedModelsQuery);
taskB = pm.addTask("taskB",...
    IterationQuery = sharedModelsQuery);

Parent Queries

A query can use the results of another query by specifying that query as a parent. For example, the built-in query padv.builtin.query.FindModelsWithTestCases uses the built-in query padv.builtin.query.FindModels as a parent query to initially find the models in the project and then the built-in query padv.builtin.query.FindModelsWithTestCases itself finds the test cases associated with those models.

You can specify a parent query for the following built-in queries by using the Parent name-value argument:

  • padv.builtin.query.FindCodeForModel

  • padv.builtin.query.FindMAJustificationFileForModel

  • padv.builtin.query.FindModelsWithTestCases

  • padv.builtin.query.FindRequirementsForModel

  • padv.builtin.query.FindTestCasesForModel

For example, multiple built-in queries use the built-in query padv.builtin.query.FindModels as a parent query. For iteration queries, the build system runs the parent query first to find the initial set of artifacts that the child query can run on. You can use the Query argument to specify a shared parent query.

    findModels = padv.builtin.query.FindModels(Name="ModelsQuery");
    findModelsWithTests = padv.builtin.query.FindModelsWithTestCases(...
        Name = "ModelsWithTests",...
        Parent = findModels);
    findTestsForModel = padv.builtin.query.FindTestCasesForModel(...
        Name = "TestsForModel",...
        Parent = findModels);
    pm.addQuery(findModels);
    pm.addQuery(findModelsWithTests);
    pm.addQuery(findTestsForModel);

Related Topics