Access Block Variables Using Statistics Viewer

This example shows how you can use the Sources section of the Statistics Viewer to access a block variable of interest, to verify (or change) its initialization priority and target value.

  1. Open the Permanent Magnet DC Motor example model.

  2. To view model statistics, in the top menu bar of the model window, select Analysis > Simscape > Statistics Viewer.

    The Simscape Statistics window opens, displaying the name of the model and an overview of the models statistics in a collapsed state.

  3. Expand the Number of variables node, then Number of continuous variables (retained), and then click Number of differential variables.

    You can see that, after variable elimination, the model contains three continuous differential variables, and the Sources section of the Statistics Viewer lists these three variables. 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.

    • The Value column contains the name of the variable, as it would appear in the Variables tab of the block dialog box.

  4. Click the first link in the Source column. The full path indicates that the source variable w belongs to the Inertia block in the DC Motor subsystem of the top-level example model, therefore the DC Motor subsystem opens and the corresponding block is highlighted in the block diagram, as shown in the following figure.

  5. Double-click the highlighted block.

  6. In the block dialog box, click the Variables tab.

    According to the Value column in the Statistics Viewer, the name of the variable in the block dialog box is Rotational velocity. The dialog box shows that this variable has high initialization priority and a target value of 0 rad/s. You can modify the priority and value, if needed, and then open the Variable Viewer to see the model initialization results.

Related Examples

More About

Was this topic helpful?