Perform Impact Analysis

About Impact Analysis

In Simulink® Project, you can use impact analysis to find out the impact of changing particular files. Investigate dependencies visually and explore the structure of your project. Analyze selected or modified files to find their required files and the files they affect. Impact analysis can show you how a change affects other files before you make the change. For example, you can:

  • Investigate the potential impact of a change in requirements by finding the design files linked to the requirements document.

  • Investigate change set impact by finding upstream and downstream dependencies of modified files before committing the changes. Finding these dependencies can help you identify design and test files that need modification, and help you find the tests you need to run.

After performing dependency analysis, you can open or label the files, export the results as workspace variables, images, or reloadable files, or send files for batch processing. Exporting the results enables further processing or archiving of impact analysis results. You can add the exported list of files to reports or artifacts that describe the impact of a change.

Run Dependency Analysis

To investigate dependencies, run a dependency analysis on your project.

  1. In the Simulink Project tree, select Dependency Analysis. If you want to analyze the dependencies of external toolboxes, select Options > Analyze External Toolboxes.

  2. Click Analyze.

    The Impact View graph displays the structure of all analyzed dependencies in the project. Project files that are not detectable dependencies of the analyzed files do not appear on the graph.

After you run the first dependency analysis of your project, clicking Analyze again produces incremental updates. If you want to analyze changes in external toolboxes, turn off the incremental update option.

After performing dependency analysis, the Impact view shows:

  • A graph of your project structure and its file dependencies, showing how files such as models, libraries, functions, data files, and source and derived files relate to each other.

  • Required products and toolboxes.

  • Relationships between source and derived files (such as .m and .p files, .slx and .slxp, .ssc and .sscp, .c and .mex files), and between C/C++ source and header files.

  • Warnings about problem files, such as missing files, files not in the project, unsaved changes, and out-of-date derived files.

For next steps:

Find Required Toolboxes

After running dependency analysis in a Simulink project, the Impact view shows the required toolboxes for the whole project or for selected files. You can see which products a new team member requires to use the project, or find which file is introducing a product dependency.

  1. After running dependency analysis, view the required products for the whole project listed in the right pane.

  2. To find which file is introducing a product dependency, hover over the product name and click Find Usages.

    The graph updates to show only the files using the selected product.

    To return to the full project view, clear the filter in the search box (e.g., Usages of "productname").

  3. To view required products of selected files, select some files by clicking the graph or a legend.

Find Dependencies of Selected Files

After a dependency analysis, to find out the impact of particular files, in the Impact View use controls in the View and Impact Analysis sections of the Dependency Analysis tab.

  1. Select files to investigate using one of these methods:

    • Select files in the graph or select groups of files by clicking the legend. For example, select all model files by clicking Simulink Model in the File Type legend. Change the legend, in the View section of the toolstrip, using the Group By menu, for example to show problem types, status, or labels.

    • To select modified files, problem files or external files, use the Select menu in the Impact Analysis section of the toolstrip.

  2. In the Impact Analysis section, select Find and then specify the range of dependencies you want to display: All Dependencies of Selection, Files Impacted by Selection, or Files Required by Selection.

    The graph shows the selected files and their file dependencies.

  3. To see the blocks that have dependencies, expand individual files in the graph by clicking the arrows next to the file names.

    The Impact graph expands the dependent file. You can see the subsystems that have dependencies. You can view dependent blocks, models, libraries, and library blocks.

    To highlight a dependent block in the model, double-click the block name in the expanded file.

    To expand all files in the graph, in the View section, click Expand All.

  4. To investigate changes in modified files, right-click and select Compare to Ancestor or Compare to Revision. See Compare Revisions.

    Tip   To reset the graph to show all analyzed dependencies in the project, on the Dependency Analysis tab, in the Impact Analysis section, select Find > All Files.

Select, Edit, and Export File Dependencies

To highlight or select groups of files:

  • Click a legend item to select all files of that type. For example, to select all model files, in the File Type legend, click Simulink Model. Selected files display a blue box.

  • To choose a legend, on the Dependency Analysis tab, in the View section, use the Group By control. Choose a category such as file type, project status, source control status, labels, project, and problem type. Files in the graph are colored to indicate the legend category on each file.

    For example:

    • If your project is under source control, to show modified files, select Group By > SVN (or Git).

    • To identify whether files are in your project or a referenced project, select Group By > Project.

To perform file operations:

  • Take actions to resolve problem files. For example, right-click a problem file and select Add to Project or Add External File. For advice on resolving problem files, see Check Dependency Results and Resolve Problems.

  • Hover over a file to read the file name in the tooltip at any zoom level. Double-click to open the file. Expand or collapse files in the graph by clicking the arrows next to the file names. View dependent blocks under an expanded file, and double-click a dependent block to highlight it in the model.

  • Right-click files in the graph to use commands such as Open, Compare, or Source Control operations.

    You can perform file operations on multiple files. To fit the view to the currently selected files, press F.

  • Export selected files using the Export menu. You can switch to the files or batch views with the files selected, or send the file paths to a workspace variable. You can also save and reload graph layouts, and save the graph as an image file, using Save As. Your graph layout is saved with the project. See Save, Open, and Compare Dependency Analysis Results.

    Alternatively, you can work with the graph information programmatically. See Automate Project Management Tasks.

Related Examples

Was this topic helpful?