If you’d like to follow along, you can download our example zip file. It contains all the example files used throughout the manual.

Simulink viewer

The simulink viewer has three panes.

  • Model tree (Upper-left)
    • Displays the entire model hierarchy.
  • Element 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 and edited. Editing and merging of eml has more information.

Script viewer

Toolbar legend

Action Icon Key Description
Save Save [Ctrl S] Saves this file.
File status File status [Ctrl Shift S] Opens the file status for this file.
Expand all Expand all [Ctrl =] Expands all collapsed elements in the model tree.
Collapse all Collapse all [Ctrl -] Collapses all elements in the model tree.
Zoom in Zoom in [=] Zooms in.
Zoom out Zoom out [-] Zooms out.
Zoom 1:1 Zoom 1:1 [0] Sets the zoom to 1:1.
Zoom fit Zoom fit [-] Sets the zoom so that the view contents fill (but but do not exceed) the size of the view.
Reload Refresh [F5] Reloads the folder.
Config Config [F12] Opens the config dialog.

Config

The Simulink viewer does not have any properties in its config. The Simulink differ, however, has several (see below).

Simulink differ

The Simulink differ has four panes

  • Model diff (Upper-left)
    • Displays a diff of the model hierarchies.
  • Element diff (Lower-left)
    • Shows a diff of the properties for whichever pair of elements (blocks, wires, states, etc.) is currently selected. Some elements, such as the root model element, have a complex hierarchy of properties.
  • Property diff (Lower-right)
    • Shows a character-by-character diff of the currently selected property (the property which was clicked in the element diff).
  • Graphic diff (Right)
    • Graphically presents the diff of the currently open system, state chart, or script.

The colors in all of the views correspond to the following color scheme (the same scheme used in the folder differ).

  • Green means the elements are the same.
  • Red means the elements are different.
  • Blue means the elements exist on only one side (they were added).
    • Grey indicates that these elements are beyond the edge of the diff. Usually they are the children of Blue elements.
  • Orange represents elements which are the same at this level, but contain children with Blue or Red elements.

Simulink differ

In the screenshot below, the “BurnerOff” state is selected. Looking at the element diff, we can see that some properties have an ignore icon next to them. This means that these properties are ignored when determining whether an element should be colored red or green. Many properties (such as “subviewer”) are related to arbitrarily generated identifiers which can change without affecting the actual model behavior. By default, these arbitrary identifiers are ignored.

Simulink 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.

Simulink differ

If we add “position” to the list of ignored Stateflow properties, “BurnerOff” instantly turns green (in the screenshot below, it is green in the model diff but still magenta in the graphic diff because the current selection is always colored magenta in Stateflow). Now that we’re ignoring “position”, several other states have also turned green. This helps us to focus our attention on the more important differences - an “OvenNominal” and “OvenFailed” state were added, and the “calc_equilibrium” function was changed.

Simulink differ

Embedded matlab scripts and model callback scripts are diffed and merged using a special version of the text differ. For more information, see the editing and merging of eml section.

Simulink differ

Toolbar legend

Action Icon Key Description
Save Save [Ctrl S] Saves these files.
File status File status [Ctrl Shift S] Opens the file status for these files.
Expand all Expand all [Ctrl =] Expands all elements up to the edge of the diff.
Expand all deep Expand all [Ctrl Shift =] Expands all elements, even those which were beyond the extent of the diff (grey elements).
Collapse all Collapse all [Ctrl -] Collapses all elements.
Hide identical Hide identical [Ctrl H] Hides all green elements.
First conflict First conflict [Ctrl Shift ↑] Navigates to the first conflict.
Previous conflict Previous conflict [Ctrl ↑] Navigates to the previous conflict.
Next conflict Next conflict [Ctrl ↓] Navigates to the next conflict.
Last conflict Last conflict [Ctrl Shift ↓] Navigates to the last conflict.
Diff report Report Opens the Diff Report dialog.
Toggle diff colors ToggleDiffColors [C] Toggles whether the graphical diff is highlighted based on its diff status, or its actual colors.
Toggle split SplitVertical / SplitHorizontal [S] Toggles whether the diagrams are shown left/right or top/bottom.
Zoom in Zoom in [=] Zooms in.
Zoom out Zoom out [-] Zooms out.
Zoom 1:1 Zoom 1:1 [0] Sets the zoom to 1:1.
Zoom fit Zoom fit [-] Sets the zoom so that the view contents fill (but but do not exceed) the size of the view.
Reload Refresh [F5] Reloads the folder.
Config Config [F12] Opens the config dialog.

Config

Simulink differ

On the left side of the config are the Simulink properties, and on the right side are the Stateflow properties. The bottom section allows you to specify filtering for specific kinds of BlockType.

The Ignored properties lists are used for filtering unimportant changes from the diff (e.g. Simulink-internal IDs, window-sizes on last save, perhaps colors and positions, etc). If an element has changed, but all of its changes are marked as ignored, then the element will be colored green.

If Mark lines with same name and topology as green is checked, it means that lines will not be colored red just because they were moved or rerouted. A line will only become red if it connects to a different block. The Mark transitions with same name and topology as green option behaves in the same way.

Only match blocks if types match exactly behaves as described. Imagine that you replaced a gain block with a bias block. If this option is checked, DiffPlug will indicate that the gain block was removed, and the bias block was added. If this option is not checked, DiffPlug will indicate that the gain block was changed into a bias block.