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.
To open a model of a permanent magnet DC motor, enter:
openExample('simscape/PermanentMagnetDCMotorExample')
To view model statistics, in the model window, on the Debug tab, click Simscape > Statistics Viewer.
The Statistics Viewer tool opens but does not contain data, and the Update Model button in the toolbar of the viewer window displays a caution symbol.
Click the Update Model button. The main window now displays the current model statistics.
To access information about the differential variables in the model, click Variables and then select Differential variables in the Categories pane.
The Categories pane shows three differential variables. The Variables pane shows:
The full path to the variable, starting from the top-level model.
The name of the variable, as it would appear in the Initial Targets section of the block dialog box.
Select
DC Motor.Intertia.w
, and click the Highlight Block button in the toolstrip.Double-click the highlighted block.
In the block dialog box, expand the Initial Targets section.
Select the Rotational velocity parameter and change its value, which sets the initial target of the variable,
DC Motor.Intertia.w
.