It is possible to analyze Simulink models in TICS.

Prerequisites

For a successful Simulink integration, the following prerequisites must be met:

Setup

The following prerequisites concern the environment of the buildserver:

Analysis

The following prerequisites are necessary for a complete analysis of a project:

Basic configuration

To be able to analyze a Simulink model the language must be added in the SERVER.txt with a PREPARE step. Note that Simulink model analysis is only possible with TICSQServer, and must always include a PREPARE step.

Syntax

The following language properties have to be declared on SERVER level:

'LANGUAGES' => {
  'SIMULINK' => {
    'EXTENSIONS' => [
      'simulink',
    ],
    'RULESETS' => [
      {
        'METRIC' => 'CODINGSTANDARD',
        'NAME' => 'Simulink Coding Standard',
        'RULESDIR' => 'codingstandards/SIMULINK',
      },
      {
        'METRIC' => 'COMPILERWARNING',
        'NAME' => 'Simulink Compiler Warnings',
        'RULESDIR' => 'compilerwarnings/SIMULINK',
      },
      {
        'METRIC' => 'ABSTRACTINTERPRETATION',
        'NAME' => 'Simulink Abstract Interpretation',
        'RULESDIR' => 'abstractinterpretation/SIMULINK',
      },
    ],
    'FANOUT' => {
      'TOOL' => 'Simulink',
    },
    'TESTCOVERAGE' => {
      'TOOLS' => ['Simulink'],
    },
    'CYCLOMATICCOMPLEXITY' => {
      'TOOL' => 'Simulink',
    },
    'DEADCODE' => {
      'TOOL' => 'Simulink',
    },
    'DUPLICATEDCODE' => {
      'TOOL' => 'Simulink',
    },
  },
}

and:

'PREPAREQDB' => 'PREPAREQDB.pm',

Furthermore, it is necessary to define the 'SIMULINKSTARTMODEL' property, which contains a starting model (which is the Simulink model from which you want to start your analysis) on the PROJECTS level. This can be defined either for each branch or for an entire project, but it is necessary to provide this starting model to run a successful Simulink analysis.

'your_project_name' => {
  'TOOLS' => {
    'Simulink' => {
      'SIMULINKSTARTMODEL' => 'C:/somewhere/your_starting_model.slx',
    },
  },
}

The following needs to be included in PREPAREQDB.pm:

use TICSPrepSimulink;

sub PrepareQDB ($$$) : Private {
  my ($project, $branchdir, $branchname) = @_;

  &TICSPrepSimulink::PrepareSimulink($project, $branchdir, $branchname);
}

For more information please refer to the implementation ticket.

Additional configuration properties for Simulink analysis

The following properties can be configured in addition to the Simulink start model, in either SERVER.txt or PROJECTS.txt:

An example of the properties in use at the PROJECTS.txt level.

'your_project' => {
  'TOOLS' => {
    'Simulink' => {
      'LOOKUNDERMASKING' => 0,
      'HOOKSCRIPTSDIR' => 'C:/your_model_dir/your_scripts_dir',
      'PREPARESCRIPT' => 'C:/your_model_dir/startup.m',
      'SIMULINKSTARTMODEL' => 'C:/your_model_dir/starting_model.slx'
    },
  },
},