---
url: /howto/improving-analysis-results-for-simulink.md
---

# How to Improve Analysis Results for Simulink

The storage format of `.slx` models differs from what users see when they open the models in the Matlab IDE.
Also, Simulink models sometimes refer to non-model files which are relevant for the analysis.

Due to these idiosyncrasies, there are some common pitfalls that new users of Teamscale have to be aware of when configuring a Simulink project.
This article describes how you avoid those pitfalls.
For an overview of all Simulink features in Teamscale, see [Teamscale for Simulink and Stateflow](../analyzing-simulink-models/).

\[\[toc]]

## Analyzing all Relevant Files

The Simulink analyses implemented in Teamscale mainly focus on Simulink models (`.slx` files).
However, Simulink models can refer to other files like Data Dictionaries (`.sldd` files).
Also, Simulink projects often contain MATLAB source-code files (`.m`).

To ensure that Teamscale has access to these files, make sure that they are matched by the `Included file names` option value in your project's connector configuration.
An example option value would be `**.mdl, **.slx, **.sldd, **.m` (`.mdl` is an old format for storing Simulink models and was deprecated in 2012).

If you include MATLAB source files (`.m`), please also enable the language `Matlab` in your analysis profile.

## Configuring Block Types in Simulink Analyses

The Simulink analysis in Teamscale is exclusively based on the information encoded in the analyzed files (`.slx`, `.sldd`).
For some Simulink block types, this information deviates from the information shown in the MATLAB UI (e.g., block-type names).
To configure Simulink analyses correctly, you have to use the block-type names encoded in the `.slx` files, not the MATLAB-UI names.

For example, our analysis *Prohibited Simulink standard blocks inside controllers* reports blocks of certain types if they are used in Simulink models.
The block types that will be reported can be configured with the analysis-profile option *prohibited block types*, which accepts a list of block-type names and already contains a useful default list.
The block-type names that are given in this option are matched against the "internal" block-types given in the `.slx` files, not against the "UI" block names shown in the MATLAB IDE.

For example, the block of (internal) type `Sum` is sometimes shown as `Add` type in MATLAB.
Similarly, the internal type `MultiPortSwitch` may be shown as `Index Vector` and `DataStoreWrite` is shown as `Data Store Write`.
To determine the internal type name for a given block, you can consult the [MATLAB documentation](https://de.mathworks.com/help/simulink/slref/block-specific-parameters.html).
This documentation page contains the UI names and the corresponding internal names in parentheses (e.g., `Zero-Pole (ZeroPole)`) for many standard block types.

### Configuring Source Types of Reference Blocks

Some block types offered in the Simulink library browser are actually links to Subsystems implemented in the Simulink standard library.
For example, the block type `Transfer Fcn First Order` is implemented in `simulink/Discrete/Transfer Fcn First Order`.
When you instantiate this block in a model, MATLAB actually adds a block of type `Reference` which has a property `SourceType` with value `First Order Transfer Fcn`.

Several Teamscale analysis options allow to specify such source types in addition to normal block types (this is documented in the corresponding option descriptions).
For example, the option *Visually clear block types* of our check *Check the display attributes of block names* lists the `Compare To Zero` source type (in the default configuration).
When the analysis encounters a block of type `Reference` it tries to match the block's `SourceType` property against the listed types (instead of the string `Reference`).
