Main Content

Troubleshoot Missing Tasks, Artifacts, and Dependencies

When you use CI/CD Automation for Simulink Check, the support package creates a digital thread to capture the attributes and unique identifiers of certain artifacts in your project. The digital thread is a set of metadata information about artifacts in a project, artifact structures, and the traceability relationships between artifacts. The Process Advisor app and build system monitor and analyze the digital thread to identify artifacts, detect changes to project files, generate task iterations, and identify outdated task results. The digital thread is cached in a database stored in derived > artifacts.dmr in the project. The digital thread only tracks changes to specific types of artifacts. For information on supported artifact types, see Valid Artifact Types.

Artifact Issues

Before you begin troubleshooting Process Advisor or the build system:

  • Check if your artifacts are saved in the project. Project references are supported starting in R2023a. You can use files outside your project as inputs to tasks, but the files appear as Untracked because you cannot track changes to files outside the project. If you make a change to an untracked file, the build system does not mark the task as outdated.

  • Artifacts are on the MATLAB® search path before you open the Process Advisor app.

  • You used the Process Advisor app or build system to run your tasks and to collect task results.

  • Artifacts are not saved to a prohibited output folder. Prohibited output folders include the simulation cache, project resources folder, and .SimulinkProject.

  • You have a compiler configured. You should use the same compiler that you use in the target development environment. If you only have the MinGW® compiler installed on your system, the mex command automatically chooses MinGW.

  • Make sure your tests are testing a model or an atomic subsystem, Stateflow® chart, MATLAB function, or subsystem reference.

Project Analysis Issues

At the bottom of the Process Advisor app is a Project Analysis Issues pane. After Process Advisor analyzes the project, the Project Analysis Issues shows errors or warnings that the artifact analysis generated.

Mouse pointing to Project Analysis Issues in bottom left corner of Process Advisor

  1. Investigate project analysis issues in the project by clicking on Project Analysis Issues.

    • An error indicates that Process Advisor might not have been able to properly analyze artifacts, trace artifacts, or identify outdated results, so the information shown by Process Advisor might be incomplete.

    • A warning indicates that Process Advisor does not support that specific artifact, modeling construct, or relationship.

  2. Fix the issues listed in the Project Analysis Issues pane to make sure the app can fully analyze the project, generate the expected task iterations, and detect outdated results.

    When there are issues with an artifact, check that the artifact does not use the following unsupported modeling constructs. The digital thread does a static analysis of your project. Certain modeling constructs dynamically add unsaved information or ambiguous relationships. The digital thread does not detect these changes in the project and the changes do not cause related task results to become outdated.

    Affected ArtifactUnsupported Construct
    LibraryLibrary forwarding table
    Self-modifiable masks
    ModelSaved in release R2012a or earlier
    Model loading callbacks
    Model shadowing
    Test caseMATLAB-based Simulink® test
    Test fileTest-file level callbacks
    Test suiteTest-suite level callbacks

    Note

    To test libraries with Process Advisor, specify function interfaces for each of your library blocks and use the library-based code generation workflow. For more information, see Library-Based Code Generation for Reusable Library Subsystems (Embedded Coder).

    Make sure you only use the library blocks in the model context that you verified. When you test the model, you can use coverage filters to exclude the library blocks that you already tested.

  3. Click the refresh button in the pane to refresh the list of project analysis issues.

    Mouse pointing to refresh button in Project Analysis Issues pane

  4. If you want to filter out certain types of issues, you can get the project settings, padv.ProjectSettings.get(), and add issue IDs to the FilteredDigitalThreadMessages property value.

    To get a list of the issue messages and issue IDs, use the function getArtifactIssues.

    metric_engine = metric.Engine();
    issues = getArtifactIssues(metric_engine)
    issuesMessages = issues.IssueMessage
    issueIDs = issues.IssueId
    Suppose that you want to filter out the issue message associated with the issue ID "alm:artifact_service:CannotResolveElement". You can use the method addFilteredDigitalThreadMessages to add the issue message to the list of filtered messages:
    ps = padv.ProjectSettings.get();
    ps.addFilteredDigitalThreadMessages(...
    "alm:artifact_service:CannotResolveElement");
    For more information, see padv.ProjectSettings.

Limitations on Incremental Build

There are changes that incremental build does not detect. Tasks depending on those changes will remain up-to-date and will not execute with Run All. If incremental build does not detect changes to a file that a task depends on, the file is an undetected dependency. For example, if you have a model that uses a referenced global workspace variable and you make a change to the variable, the task results associated with the model will not become outdated.

The table in this section lists the known untracked dependencies.

  • The Artifact column lists the artifacts with known untracked dependencies.

  • The Undetected Dependency column lists the files that incremental build does not detect changes to. Changes to these files do not cause tasks associated with the artifact to become outdated.

ArtifactUndetected Dependency
ModelModel callbacks
Referenced global workspace variables
Global enumeration definitions
Externally-saved model workspace variables (if auto-initialized)
Data or functions referenced in masks or callbacks inside the model
Known dependencies specified in the model reference rebuild options of a configuration set
Simulation inputs and simulation outputs specified in model configuration sets
Signal Editor scenarios
C code referenced in C Caller blocks
Code inside SIL (software-in-the-loop) blocks
Files associated with S-Functions
Code replacement libraries
Custom code

System Composer™ profiles or stereotypes

Test case

MATLAB code in:

  • Pre-load, post-load, clean-up, and assessment callbacks

  • Custom criteria

External configurations
MATLAB test files

If possible, use a Simulink Data Dictionary file instead of referenced global workspace variables or global enumeration definitions. The digital thread tracks changes to data dictionaries.

If you do not want the build system or the Process Advisor app to run incremental builds, you can disable incremental builds for a project. For more information, see Specify Settings for Process Advisor and Build System. You can also force up-to-date tasks to execute by using one of these approaches:

  • In the Process Advisor app, either point to a task and click the run button or click Run All > Force Run All.

  • For the runprocess function, specify Force as true.

Other Limitations

There are known limitations in the Process Advisor app and build system:

  • Process Advisor only shows results for tasks that you ran using Process Advisor and the build system.

  • If a top model and at least one referenced model have unsaved changes, the Process Advisor is unable to save the top model and generates the error: The following files were not able to be saved: <Path to top model>

  • For the Check Coding Standards task, if you specify PsAccessEnable as true, make sure you also specify values for the other Polyspace® Access™ Configuration Options. For information, see Upload Results to Polyspace Access.

    If you do not specify the other required configuration options, the task returns an error: Task 'padv.builtin.task.AnalyzeModelCode' threw unhandled exception 'Invalid argument at position 2. Value must not be empty.

  • Before you use the pipeline generator, make sure that all of the products used by your pipeline are licensed and installed. If a product is not licensed or installed, the pipeline generator returns an error message: Error using + Not enough input arguments. Error in padv.pipeline.internal.gitlab.PipelineGenerator/createGitlabYMLContent (line 166) gitlabPipelineFullPath = obj.GitlabOptions.PipelineDirRelPath + '###' + gitlabPipeline.Name;.

  • Your task results can unexpectedly become outdated if you use one of the following queries as an input query and specify non-empty values for IncludeLabel, ExcludeLabel, IncludePath, or ExcludePath:

    • padv.builtin.query.FindCodeForModel

    • padv.builtin.query.FindDesignModels

    • padv.builtin.query.FindRequirementsForModel

    • padv.builtin.query.FindTestCasesForModel

    • padv.builtin.query.FindTopModels

    • padv.builtin.query.FindUnits

    If you see this behavior, consider using a different query, like padv.builtin.query.FindArtifacts, instead.

Resolve Path Issues

If an artifact is not on the MATLAB search path, add the artifact to your project, then close and re-open the project. When you re-open the project, the MATLAB search path reflects the updated search path.

Handling Invalid Dependencies

Suppose you have one subprocess that contains your code generation tasks and another subprocess that contains your code analysis tasks.

spCodeGen = pm.addSubprocess("Code Generation Tasks");
spCodeAnalysis = pm.addSubprocess("Code Analysis Tasks");

Your code analysis tasks need access to the generated code, but the tasks themselves cannot directly depend on the code generation task because that relationship would cross the subprocess boundary.

Diagram showing unsupported relationship between a code generation task and a code inspection task in different subprocesses

If you try to have a code analysis task in one subprocess depend on a code generation task in another subprocess, Process Advisor generates an error like: Invalid dependency between Task 'padv.builtin.task.RunCodeInspection' and 'padv.builtin.task.GenerateCode'. Make sure 'padv.builtin.task.GenerateCode' exists in the current process and that the dependency does not cross any subprocess boundaries.

To pass the generated code from your code generation subprocess to your code analysis subprocess, you can:

  • Update code analysis tasks, like RunCodeInspection, to find and use the generated model code as an input to the task using the built-in query padv.builtin.query.FindCodeForModel

  • Specify that the code analysis subprocess depends on the code generation subprocess

% Update code analysis tasks to find
% and use model code as an input to the task
slciTask = spCodeAnalysis.addTask(...
    padv.builtin.task.RunCodeInspection(...
    InputQueries=padv.builtin.query.FindCodeForModel));

% Code Analysis Subprocess depends on Code Generation Subprocess
spCodeAnalysis.dependsOn(spCodeGen);

Diagram showing the supported relationship between the code generation subprocess and the code analysis subprocess

Analyze Project from Scratch

If you experience unexpected project analysis issues, you can clear the current project analysis and analyze your project from scratch by calling the function padv.util.forceReanalyzeProject:

padv.util.forceReanalyzeProject()
The function forces a reanalysis of the current project by creating backups of the existing artifact database (artifacts.dmr), clearing the existing project analysis, and reanalyzing the project. The function also logs project analysis events, which can help with troubleshooting persistent project analysis issues. Note that when you run the function, the function closes and reopens the project.

For more information, see the utility function padv.util.forceReanalyzeProject.

Note

You should only use the function padv.util.forceReanalyzeProject when there are unexpected project analysis issues. When you clear the existing project analysis file, you might permanently lose important information, including the UUIDs that the digital thread assigned to artifacts in your project. Reanalyzing a project might take some time to complete. The artifacts.dmr file might be used by other project users and if you use other tools that use the digital thread, you might need to re-run the metrics in those tools.

For general task and result cleanup, use runprocess instead. The runprocess function has name-value arguments, Clean and DeleteOutputs, that you can use to clean task results and delete task outputs. For information, see runprocess.

See Also

| |

Related Topics