Simscape Model Statistics

Viewing Simscape™ model statistics is a good way to evaluate the model prior to simulation. Model statistics provide feedback on the model complexity, so that you can make informed choices about whether you want to simulate the model in its current configuration or make changes to it. This approach helps you achieve the desired simulation performance and goals.

Unlike other derived data (such as data logging or simulation statistics), which is generated during simulation, model statistics is compile-time data that is generated before the model is simulated. When you generate model statistics, the model must be in a compilable state, that is, it must satisfy the requirements described in Model Validation.

Use model statistics as part of the iterative model building process. For example, after you make a change to the model, you can view model statistics to answer the following questions:

  • Did the change increase the number of variables?

  • Does the model have redundant constraints or have I resolved them?

  • How many potential zero-crossing signals does the model have?

  • Is the circuit high-index, and therefore hard to solve? Did my change have any effect on the index?

The Statistics Viewer analysis tool is available for models containing Simscape blocks and blocks from add-on products. Depending on the types of blocks in the model, the analysis can produce any or all of the following statistics categories:

  • 1-D Physical System — This node represents aggregate statistics generated from all physical networks that are associated with blocks from Simscape, Simscape Driveline™, Simscape Fluids™, and Simscape Electrical™ (except the Specialized Power Systems) libraries.

  • 3-D Multibody System — This node represents aggregate statistics generated from all physical networks that are associated with blocks from the Simscape Multibody™ library.

  • 1-D/3-D Interface — This node lists the connections between the two types of physical networks. It appears only for models that connect blocks from the Simscape Multibody library to Simscape blocks, or blocks from other add-on products.

Each statistic is generated separately from each topologically distinct physical network of these blocks and then aggregated to appear as a single statistic in the Statistics Viewer.

The Sources section of the Statistics Viewer window lists variable sources for the selected statistic:

  • If you select a connection under the 1-D/3-D Interface statistic category, the Sources section lists the source and destination for this connection, with links to relevant blocks.

  • If you select a statistic with a nonzero value under the 1-D Physical System category, the Sources section lists all the variables that fall under this statistic.

    For each variable, the Source column contains the full path to the variable, starting from the top-level model, with a link to the relevant block. If you click the link in the Source column, the corresponding block is highlighted in the block diagram. The Value column contains the name of the variable, as it would appear in the Variables tab of the block dialog box.

Updating the Statistics Viewer

Opening the Statistics Viewer does not trigger an automatic block diagram update. For complex models, a diagram update can last several minutes, and unnecessary diagram updates could lead to loss of productivity.

When you open the Statistics Viewer, it gets populated with the data from the last simulation or diagram update. You have to update the data explicitly by clicking the Refresh button ().

The status at the bottom of the viewer window displays the timestamp of its last update. If you have modified the model since the viewer has last been updated, the Refresh button displays a warning symbol (), and the timestamp at the bottom of the viewer window turns red to indicate that the data in the viewer might not reflect the latest model changes.

If you open a model, and then open the Statistics Viewer before simulating the model, then the viewer does not contain any data. The Refresh button displays a warning symbol (yellow triangle), and a message at the top of the viewer window tells you to click the Refresh button to populate the viewer with data.

Related Examples

More About