Contenuto principale

Variable Viewer

View variable initialization results for Simscape models

Description

The Variable Viewer app checks the initial conditions for the model and displays whether the initial variables meet their targets. The app displays the variable priority and target values, where specified, and the final start values for all the initial variables. The app also displays whether the solver successfully met the specified targets. You must run the model or click the Update button to view the results.

To configure the table columns, see Configure the Variable Viewer. By default, the table contains these columns:

NameDescription
Status

Initialization status of each variable. The icon indicates the status:

  • Green circle — Indicates that the target is satisfied or has no initialization priority.

  • Yellow triangle — Indicates a low-priority variable with an unsatisfied target.

  • Red square — Indicates a high-priority variable with an unsatisfied target.

  • Red cross — Indicates a variable that the solver could not initialize.

  • Gray rectangle — Indicates that the initialization status is not available. This status appears if the model fails to initialize. For more information, see Configure the Variable Viewer.

PriorityVariable initialization priority. You specify this value in the block dialog box or the underlying component file.
TargetInitial target value for a variable.
StartThe initial value of the variable computed by the solver.
UnitThe variable base unit, common for all the values. Simscape™ unit manager automatically converts values as needed. For example, if you specify the Initial Target parameter in the block dialog box as 20 and the Unit as mm, the Variable Viewer displays the Target as 0.2 and Unit as m.

The Variable Viewer toolbar buttons perform these actions:

Flat button

Displays a flat view that minimizes the number of rows in the table. In flat view, the rows for the parent nodes are not visible, the table contains only one row per variable, and the Name column includes the path to the variable in the model. If the Variable Viewer app is in flat view, you cannot expand or collapse nodes. This is the default view.

Tree button

Displays the data in a tree view. In the tree view, the variable nodes appear in groups under the parent port, block, and subsystem nodes. The app initially collapses all nodes. You can expand them individually or expand all nodes by using the Expand All button.

Expand All button

Expands all nodes in the tree view. To enable this button, select the Tree button.

Collapse All button

Collapses all nodes in the tree view. To enable this button, select the Tree button.

Update button

Recomputes the initial conditions for the model and refreshes the values in the viewer. Use this button after adjusting the block parameter values, changing variable priorities and targets, or updating the block diagram. If the data in the Variable Viewer app is out of sync with the model, the Update button displays a warning symbol Update button with warning. For more information, see Configure the Variable Viewer.

In Fast Restart mode, the Update button is disabled.

Apply Filters dropdown button

Applies filters. For more information, see Configure the Variable Viewer.

Clear Filters button

Clears all the filtering options. For more information, see Configure the Variable Viewer.

Basic button

Displays only the Status, Priority, Target, Start, and Unit columns in the Variable Viewer app table.

Advanced button

Displays all the views of the Variable Viewer app table. Use this to troubleshoot your model. For more information, see Configure the Variable Viewer.

Show Columns dropdown button

Configures which columns to display.

Save button

Saves the current Variable Viewer app configuration. When you reopen the app, it loads the saved configuration. For more information, see Configure the Variable Viewer.

Variable Viewer app window

Open the Variable Viewer App

To open the Variable Viewer app, in Simulink, on the Debug tab, click Simscape > Variable Viewer.

Examples

expand all

This example shows how to view the initialization variables for the Permanent Magnet DC Motor example.

  1. Open and simulate the model.

    openExample("simscape/PermanentMagnetDCMotorExample")
    mdl = "PermanentMagnetDCMotor";
    sim(mdl)

  2. To open the Variable Viewer app, in Simulink, on the Debug tab, click Simscape > Variable Viewer.

    Variable Viewer window showing green status for all variables in the PermanentMagnetDCMotor example

This example shows how to highlight the block in the block diagram that corresponds to a variable in the app.

  1. Open the model from the Permanent Magnet DC Motor example.

    openExample("simscape/PermanentMagnetDCMotorExample")
  2. Open the Variable Viewer app. In the model window, on the Debug tab, click Simscape > Variable Viewer.

  3. Click the Update button.

  4. Click Tree to display the results in tree view. Expand DC Motor and right-click Friction.

Related Examples

Version History

Introduced in R2014a