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.
Open the Permanent Magnet DC Motor example model.
To view model statistics, in the model window, on the Debug tab, click 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.
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.
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 Initial Targets section of the block dialog box.
Click the first link in the Source column. The full path indicates that the source variable
wbelongs 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.
Double-click the highlighted block.
In the block dialog box, open the Initial Targets section.
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.