Model Dependency Viewer

Model Dependency Views

The Model Dependency Viewer displays a dependency view of a model. The dependency view is a graph of all the models and libraries referenced directly or indirectly by the model. You can use the dependency view to find and open referenced libraries and models. To identify and package all required files instead, see Analyze Model Dependencies.

The Model Dependency Viewer allows you to choose between the file dependency view and the model instances view.

File Dependency View

The file dependency view shows the model and library files referenced by a top model. A referenced model or library appears only once in the view even if it is referenced more than once in the model. The figure shows a dependency view. Gray blocks represent model files and blue boxes represent libraries. Arrows represent dependencies. For example, the arrows in this view indicate that the aero_guidance model references two libraries: aerospace and simulink_need_slupdate.

An arrow from a library that points to itself indicates that the library references itself. Blocks in the library reference other blocks in that same library. The example view shows that the aerospace library references itself.

A file dependency view can include a legend that identifies the model in the view and the date and time the view was created.

Model Instances View

The model instances view shows every reference to a model in a model reference hierarchy (see Model Reference) with the top model at the root of the hierarchy. If a model hierarchy references the same model more than once, the referenced model appears multiple times in the instance view, once for each reference. For example, this view indicates that the model reference hierarchy for sldemo_mdlref_depgraph contains two references to the model sldemo_mdlref_F2C.

In an instance view, boxes represent a top model and model references. Boxes representing accelerated-mode instances (see Referenced Model Simulation Modes) have filled triangles in their corners; boxes representing normal-mode instances have empty triangles in their corners. For example, the previous diagram shows that one of the references to sldemo_mdlref_F2C operates in normal mode, and the other operates in accelerated mode.

Boxes representing protected referenced models show the protected models .slxp extension. You cannot expand protected reference models.

An instance view displays information icons on instance boxes to indicate an override in simulation mode for that instance. For example, if a referenced model is configured to run in normal mode and it runs in accelerator mode, its simulation mode is overridden. This override occurs because another referenced model that runs in accelerator mode directly or indirectly references it.

Processor-in-the-Loop Mode Indicator.  An instance view appends PIL to the names of models that run in processor-in-the-loop mode (see Specify the Simulation Mode). For example, this dependency instance view indicates one instance of the referenced model ModDepViewerSub runs in processor-in-the-loop mode.

View Model File and Library Dependencies

This example shows how to use Model Dependency Viewer to view model file and library dependencies of the model. To identify and package all required files instead, see Analyze Model Dependencies.

  1. Open the model sldemo_mdlref_depgraph.

  2. To open the Model Dependency Viewer in file dependency view, select Analysis > Model Dependencies > Model Dependency Viewer > Models Only.

  3. Select the User-Defined Libraries check box. The viewer shows dependencies on user-defined libraries, if such dependencies exist.

    You can open this view directly from the Simulink Editor by selecting Analysis > Model Dependencies > Model Dependency Viewer > Models & Libraries.

  4. Select the Built-In Libraries check box to show dependencies on MathWorks® built-in libraries.

  5. To view the dependencies laid out horizontally, click Options and, under Layout, select Horizontal.

  6. Collapse the dependencies of sldemo_mdlref_outdoor_temp. Click on the box for sldemo_mdlref_outdoor_temp.

  7. Hide the dependency viewer legend. Click Options and, under Display, select the Legend check box.

  8. Click Model Instances to open the model instance view.

    You can open this view directly from the Simulink® editor by selecting Analysis > Model Dependencies > Model Dependency Viewer > Referenced Model Instances.

  9. To display full paths in the boxes representing the instances, click Options and, under Display, select the Full path check box. Each box in the instance view displays the path of the Model block corresponding to the instance. The name of the referenced model appears in parentheses.

  10. Select the box for sldemo_mdlref_heat2cost and click Highlight Box. The corresponding block in the sldemo_mdlref_depgraph model appears highlighted.

  11. In the dependency viewer, double-click the sldemo_mdlref_heat2cost box to open the model in the Simulink Editor.

Was this topic helpful?