Horizontal Gauge

Display signal value on horizontal, customizable gauge during simulation

  • Library:
  • Simulink / Dashboard

Description

The Horizontal Gauge block displays the value of the connected signal on a linear gauge that you can customize to look like a gauge in a real system.

The Horizontal Gauge block displays the instantaneous value of the connected signal throughout simulation. You can modify the range and tick values on the Horizontal Gauge block to fit your data. Use the Horizontal Gauge block with other dashboard blocks to build an interactive dashboard of controls and indicators for your model.

Customize the Horizontal Gauge Block

When you add a Horizontal Gauge block to your model, the block is preconfigured with a default design. You can use the block with the default design, or you can customize the appearance of the block. To customize the block, pause on the block and click the Edit Custom Block button that appears above the block.

In the custom block edit mode, a toolbar that you can use to customize the block appears above the selected custom block. In the left section of the toolbar, you can specify a custom image to use for the background and needle, and you can modify the orientation of the block. In the middle section, you select a component of the scale. You can independently modify the color and transparency for the scale, the tick labels, and the value bar. Use the right section of the toolbar to specify the transparency and color for the selected scale component.

While in the custom block edit mode, you can also resize and reposition the scale and needle as desired.

When you finish editing the gauge, click the Exit button in the upper-right of the canvas to exit the custom block edit mode.

Connecting Dashboard Blocks

Dashboard blocks do not use ports to connect to signals. To connect dashboard blocks to signals in your model, use connect mode. Connect mode facilitates the process of connecting dashboard blocks in your model, especially when you want to connect multiple blocks at once. If you only want to connect a single dashboard block, you can also use the Connection table in the block dialog box.

Tip

You can modify dashboard block connections during normal and accelerator mode simulations.

To enter connect mode, pause on an unconnected dashboard block and click the Connect button that appears above the block.

In connect mode, when you select one or more signals or blocks, a list of signals that are available for connection appears. Select a signal from the list to connect to the selected dashboard block. To connect another dashboard block, pause on the block you want to connect and click the Connect button above it. Then, select one or more signals and blocks in the model and choose a signal to connect.

When you finish connecting the dashboard blocks in your model, click the Exit button in the upper-right of the canvas.

Tip

You can hide the message shown on unconnected blocks using the set_param function with the ShowInitialText block parameter. The message also disappears when you connect the block.

Limitations

  • Except the Dashboard Scope block and the Display block, dashboard blocks can only connect to real scalar signals.

  • You cannot use the Connection table to connect a dashboard block to a block that is commented out. When you connect a dashboard block to a commented block using connect mode, the dashboard block does not display the connected value until the you uncomment the block.

  • Dashboard blocks cannot connect to signals inside referenced models.

  • When you simulate a model hierarchy, dashboard blocks inside referenced models do not update.

  • Dashboard blocks do not support rapid accelerator simulation.

  • Some signals are not available during accelerator mode simulations. To view these signals using a dashboard block, mark the signal for logging.

Parameters

expand all

Use the connection table to select the signal to connect to the block. To connect the block to a signal:

  1. Make a selection in the model that includes one or more signals.

  2. In the table, select the signal you want to connect.

  3. Click Apply.

Tip

You can connect dashboard blocks to signals in the model during simulation.

Programmatic Use

Block Parameter: Binding
Type: Simulink.HMI.SignalSpecification
Default: []

Finite, real, double, scalar value specifying the minimum tick mark value for the scale. The minimum must be less than the value of the Maximum parameter.

Programmatic Use

To programmatically set the Minimum parameter, use a 1-by-3 vector containing values for the Minimum, Tick Interval, and Maximum parameters, in that order. To use the auto value for the Tick Interval, leave the Tick Interval position in the vector empty or specify -1.

Block Parameter: Limits
Type: 1x3 vector
Default: [0 -1 100]

Finite, real, double, scalar value specifying the maximum tick mark value for the scale. The maximum must be greater than the value of the Minimum parameter.

Programmatic Use

To programmatically set the Maximum parameter, use a 1-by-3 vector containing values for the Minimum, Tick Interval, and Maximum parameters, in that order. To use the auto value for the Tick Interval, leave the Tick Interval position in the vector empty or specify -1.

Block Parameter: Limits
Type: 1x3 vector
Default: [0 -1 100]

Finite, real, positive, whole, scalar value specifying the interval of major tick marks on the scale. When set to auto, the block automatically adjusts the tick interval based on the values of the Maximum and Minimum parameters.

Programmatic Use

To programmatically set the Tick Interval parameter, use a 1-by-3 vector containing values for the Minimum, Tick Interval, and Maximum parameters, in that order. To use the auto value for the Tick Interval, leave the Tick Interval position in the vector empty or specify -1.

Block Parameter: Limits
Type: 1x3 vector
Default: [0 -1 100]

Color specifications for value ranges on the scale. Press the + button to add a scale color. For each color added, specify the minimum and maximum values of the range in which you want to display that color.

Programmatic Use

To programmatically specify the Scale Colors parameter, use an array of structures with the fields:

  • Min — Minimum value for the color range on the scale

  • Max — Maximum value for the color range on the scale

  • Color1-by-3 vector of double values between 0 and 1 that specify the color for the range in the form [r g b]

Include a structure in the array for each scale range for which you want to specify a color.

range1.Min = 0;
range1.Max = 10;
range1.Color = [0 0 1];
range2.Min = 10;
range2.Max = 15;
range2.Color = [0 1 0];
scaleRanges = [range1 range2];
Block Parameter: ScaleColors
Type: structure array
Default: 0x1 struct array

Whether to maintain the block aspect ratio when resizing the block and when you specify a new background image.

Position of the block label. When the block is connected to an element in the model, the label is the name of the connected element.

Programmatic Use

Block Parameter: LabelPosition
Type: character vector
Values: 'Top' | 'Bottom' | 'Hide'
Default: 'Top'

Block Characteristics

Data Types

Boolean | double | enumerated | fixed point | integer | single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

Introduced in R2020a