Main Content

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. To open a model of a permanent magnet DC motor, enter:

    openExample('simscape/PermanentMagnetDCMotorExample')

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

  3. Click the Update Model button. The main window now displays the current model statistics.

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

  5. Select DC Motor.Intertia.w, and click the Highlight Block button in the toolstrip.

  6. Double-click the highlighted block.

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

See Also

Related Examples

More About