Perform Impact Analysis

About Impact Analysis

In Simulink® Project, use impact analysis to find the impact of changing particular files. You can investigate dependencies visually to explore the structure of your project. You can also analyze selected or modified files to find their required files and the files they impact. Visualize changes and dependencies in the Impact graph.

Impact analysis can show you how a change will impact other files before you make the change. For example:

  • 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. This can help you identify design and test files that need modifications and help you find the tests you need to run.

After performing impact analysis, you can:

  • Label or open the files

  • Export the results to a workspace variable

  • Export the results to batch processing

  • Save the graph as an image file

  • Save the impact results to a .graphml file that you can reload in Simulink Project

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.

For an example showing how to perform file-level impact analysis to find and run the tests impacted by modified files, see Perform Impact Analysis with a Simulink Project.

Perform Dependency Analysis

To investigate dependencies visually, first perform a dependency analysis on your project.

  1. In the Project tree, click Dependency Analysis.

  2. Include all files.

  3. If you want to include linked requirements, select Options > Find Requirements Documents. However, finding requirements documents can be time consuming. See Find Requirements Documents in a Project.

  4. If you want to analyze the dependencies of external toolboxes, select Options > Analyze External Toolboxes.

  5. Click Analyze.

  6. Click Impact in the Project tree under Dependency Analysis.

    The graph displays the structure of all analyzed dependencies in the project. Some project files might not be visible in the graph, because they are not detectable dependencies of the analyzed files.

After you analyze dependencies in the project one time, the project performs incremental updates when you click Analyze again.

However, if you update external toolboxes and want to discover dependency changes in them, you must turn off the option Options > Perform Incremental Updates and select Options > Analyze External Toolboxes.

Analyze the Impact of Selected Files

After performing dependency analysis, to find the impact of particular files, select the Impact view and use the controls in the Impact Analysis section of the Impact tab.

  1. Use the search and filter controls to modify the graph before selecting files.

  2. Select files to analyze using one of these methods:

    • Click the graph or a legend.

      For example, select all model files to analyze by clicking Simulink Model in the File Type legend. Change the legend using the Group By menu, for example to show modified files or particular labels.

    • On the Impact tab, in the Impact Analysis section, choose files to analyze using the Select menu: Modified Files, Problem Files, or External Files.

  3. On the Impact tab, in the Impact Analysis section, select Find and then 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.

  4. To investigate which blocks have dependencies, expand the files in the graph. On the Impact tab, in the View section, select Expand All.

    The Impact graph expands the dependent files so you can see which subsystems have dependencies. You can view dependent blocks, models and libraries.

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

      Tip   You can also expand or collapse files individually in the graph by clicking the arrows next to the block names.

  5. To investigate modified files, you can right-click to select Compare to Ancestor or Compare to Revision. See Review Changes.

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

Explore Impact Graph

These are some of the actions you can take to investigate the structure of your project in the graph.

To highlight or select files by type, labels, or status:

  • On the Impact tab, in the View section, use the Group By control to highlight graph items by file type, problem type, project status, source control status, and other options. For example, if your project is under source control, select Group By > SVN (or Git) to show modified files.

  • Click a legend item to select files. For example, select Group By > File Type. In the File Type legend, click Simulink Model to select all the model files. Selected files display a blue box.

  • Select Group By, and then select a category of labels to use for highlighting. For example, select Group By > Review to see which files have labels in the Review category, such as To Review.

    The Review legend appears and files in the graph are colored to indicate the labels on each file.

To perform file operations:

  • Hover over a file to read the file name in the tooltip at any zoom level. Double-click to open the file. You can expand or collapse files in the graph by clicking the arrows next to the file names. You can 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, Add Label, or Remove from Project.

    You can perform file operations on multiple files. To select multiple files, press Shift and drag the mouse to enclose the files. Hold down Ctrl to multiselect and add to any existing selection. Press F to fit the view to the currently selected files.

  • You can take actions to resolve problems in the Impact graph in the same way as in the Dependencies table. For example, right-click to Add to Project or Add External File.

To change the graph layout and view:

  • To try different graph layouts and change zoom, use the controls on the Impact tab, in the View and Layout sections.

  • Your graph layout is saved with the project. You can also save and reload graph layouts. See Save, Open, and Compare Dependency Analysis Results.

Export Impact Results

To export impact analysis results, on the Impact tab, in the Impact Analysis section, use the Export controls, or use the Export context menu on selected files.

Select Files to Export

To export all the files in the current view, ensure no files are selected. (Click the graph background to clear the selection on all files.) Click Export to display Files in view: number of files.

Select a subset of files in the graph to export. Click Export to see how many files are selected: Selected files: number of files.

Export Files

  • Select Export + Save to Workspace. This action exports the selected file paths to a variable.

  • Select Export + Send to Batch Job to switch to the Batch Job view with the files selected for batch job processing.

Export Graph to Image File

To export the impact graph to an image file to share or archive, you can either:

  • Save an image file. On the Impact tab, in the File section, select Save As > Save As Image.

  • Copy the image to the clipboard using the keyboard. You can paste the clipboard contents into other documents.

Export Reloadable Results

To export the impact results to a .graphml file that you can reload in Simulink Project, see Save, Open, and Compare Dependency Analysis Results.

Related Examples

Was this topic helpful?