Simulink

Viewer

The simulink viewer has three panes.

  • Model tree (Upper-left)
    • Displays the entire model hierarchy.
  • Detail tree (Lower-left)
    • Shows the properties for whatever element (block, wire, state, etc.) is currently selected. Some elements, such as the root model element, have a complex hierarchy of properties.
  • Graphic view (Right)
    • Graphically presents the currently open system, state chart, or script.

Simulink viewer

The same interface is used for Simulink and Stateflow.

Stateflow viewer

Embedded MATLAB scripts and model callbacks can be viewed.

Embedded MATLAB

Embedded MAT-File data, such as UserData and the model workspace can be viewed as well.

Embedded MAT-File data

Sometimes, a model will have ".misc" elements. These represent model metadata that are not part of the block diagram, although they might affect its runtime behavior. Examples of ".misc" elements are configuration sets, AUTOSAR data, and logic analyzer functionality. Even though DiffPlug might not have application-specific logic for every plugin on the market, DiffPlug will always show you all of the content in the file, and DiffPlug will always show you when this content changes.

Differ

The simulink differ has three panes.

  • Model diff (Upper-left)
    • Displays a diff of the entire model hierarchy.
  • Detail diff (Lower-left)
    • Shows a diff of the properties for whatever element or pair of elements (block, wire, state, etc.) is currently selected.
  • Graphic view (Right)
    • Graphically presents the currently open system, state chart, or script.

The colors in all of the views correspond to the following color and font scheme (the same scheme used throughout DiffPlug):

  • added
  • removed
  • changed
  • identical, hidden in the tree

Simulink differ

In the screenshot below, the BurnerOff state is selected. Looking at the detail diff, we can see that subviewer has an ignore icon next to it. This means that this property is ignored when determining whether an element should be marked as a change or not. Many properties are related to arbitrarily generated identifiers which can change without affecting the actual model behavior. By default, these arbitrary identifiers are ignored.

Stateflow differ

In the case of BurnerOff, the only unignored property which has changed is position - the state's behavior has not changed. It's good to know that the state has moved, but for now we don't want to be distracted by aesthetic differences - we want to focus on substantive changes in the model's behavior. If we right-click the position property, we will get the following pop-up.

Stateflow differ

If we add position to the list of ignored Stateflow properties, BurnerOff instantly disappears from the model diff because all of its changes are ignored. All of the other states whose only change was a change in position, such as BurnerOn, have also been removed from the model diff. This helps us to focus our attention on the more important differences - an OvenNominal and OvenFailed state were removed, and the "calc_equilibrium" function was changed.

Stateflow differ

Commands

Action Icon Key
Go to parent system / chart Arrow up Esc
Toggle diff colors Toggle colors
Track in MATLAB Track in MATLAB
Toggle split Split vertical S
Undock diagrams across multiple monitors Split monitors
Zoom in Zoom in Ctrl =
Zoom out Zoom out Ctrl -
Zoom 1:1 Zoom 1:1 Ctrl 0
Zoom fit Zoom fit spacebar
Generate report Toggle colors

Diff filter config

You can see the entire filter configuration by clicking the gear button on the detail diff. See the config library section of the manual for full details on how to import, export, and share configs amongst team members.

Simulink diff config btn

The config has a list of properties to ignore for Simulink, Stateflow, and Misc elements. Additionally, there is a special section for making rules that are specific to a given blocktype. If a property starts with / (as demonstrated in the Misc section), then the rest of the property is treated as a full-featured regex.

Simulink differ

Normally, you will want to select Ignore differences matching all the criteria below. In some cases, you might want to find only those differences which match a certain criteria. In those cases, you will want to select Find differences in any of the critera below. For example, if you wanted to find only those blocks whose gain had changed, you could use this:

Simulink differ only gain changed

Compatibility

DiffPlug is fully compatible with:

  • Mathworks® MATLAB® R2009a to R2022a
  • Mathworks® Simulink®, Stateflow®, and Simscape™ in mdl and slx formats, R2009a to R2022a

For Simscape models, port positioning in DiffPlug will vary somewhat as compared to the Mathworks viewer, but connection topology and diffing is accurate.

We have limited support for models before R2009a, but we can open most models from R11 forward.