This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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, but it does not contain any data. If you open a model, and then open the Statistics Viewer before running the simulation, the statistics data is not available. The Refresh button in the toolbar of the viewer window 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.

  3. Click the Refresh button. The Simscape Statistics window now displays an overview of the models statistics in a collapsed state. The status at the bottom of the window displays the timestamp of its last update.

  4. 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.

  5. 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.

  6. Double-click the highlighted block.

  7. 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?