Main Content

Reduce Polyspace Analysis Time by Ignoring Specific Referenced Models

If your model has a large and deep model reference hierarchy, analyzing each model in the hierarchy can result in a lengthy Polyspace® analysis. To reduce the time needed for a Polyspace analysis, you can choose to ignore specific models in the hierarchy. When you ignore a referenced model, Polyspace assumes that:

  • The functions originating from the ignored model are stubbed.

  • The variables originating from the ignored model are full range.

These assumptions allow Polyspace to reduce the time required to complete an analysis. You can ignore a specific referenced model when running Polyspace during the modeling process. At the end of the modeling process, perform an integration analysis that analyzes the entire reference hierarchy.

Prerequisites

To ignore specific referenced models in your model reference hierarchy:

  • Use Embedded Coder® to generate code from your Simulink® models. This feature is not available if you use a different code generator.

  • Link your Polyspace and MATLAB® installations. See Integrate Polyspace with MATLAB and Simulink.

Specify Referenced Models to Ignore

You can specify which models you want to ignore either interactively using the Simulink Editor or programmatically.

Specify Referenced Models Using Simulink Editor

If you run Polyspace interactively from the Simulink Editor:

  1. From the Simulink Editor, open the Configuration Parameters dialog box.

  2. In the Polyspace tab, expand the Model reference section.

  3. In the field Model reference verification depth, select 1, 2, 3, or All.

  4. Select Ignore model references and then enter the names of the models you want to ignore.

  5. Select OK to close the Configuration Parameters window.

See Ignore model references.

Specify Referenced Models Programmatically

If you run your Polyspace analysis programmatically:

  1. Specify the list of models to ignore in the field ModelRefIgnoreList of a pslinkoptions object. The list is a cell containing strings where each string is a referenced model that you want to ignore.

    mdlName = 'Top_model' ;
    load_system(mdlName);
    mdlOp = pslinkoptions(mdlName);
    % Specify referenced model that you want to ignore
    mdlOp.ModelRefIgnoreList = { "modelRef1", "modelRef2" };
    mdlOp.EnableModelRefIgnoreList = true;
    

  2. Run a Polyspace analysis either by using the pslinkrun function or the polyspace.Project class.

    • If you use the pslinkrun function, enter this code.

      % Generate code
      slbuild(mdlName);
      % Run Polyspace analysis using the options object
      [polyspaceFolder, resultsFolder] = pslinkrun(mdlName,mdlOp);

    • If you use the polyspace.Project class, enter this code.

      % Generate code
      slbuild(mdlName);
      % Run Polyspace analysis using the options object
      psprjCfg = polyspace.ModelLinkOptions(mdlName,mdlOp);
      psprjCfg.ResultsDir = 'newResfolder';
      proj = polyspace.Project;
      proj.Configuration = psprjCfg;
      cpStatus = proj.run('codeProver');

See Ignore model references.

Tips

  • When you analyze only the top model, Polyspace does not analyze the referenced models and ignoring a specific referenced model has no impact.

  • If you specify the model reference verification depth of a Polyspace analysis, the scope of the analysis is defined by the specified depth and the list of ignored models in the hierarchy. Consider a Polyspace analysis that you configure to analyze referenced models up to the third level of the model hierarchy. If you ignore any models within these three levels, Polyspace ignores the models. If you ignore models outside of the three levels of the model hierarchy, then the scope of the analysis does not change because the ignored models are already outside the analysis scope.

  • The functions originating from the ignored referenced model are stubbed. The variables originating from the references models are assumed to be full range. The loss of information about the functions and variables allow Polyspace to reduce the analysis time, and can result in an increase in orange checks.

Related Topics