Custom Gauge

Display an input value on a customized gauge

  • Library:
  • Simulink / Dashboard

Description

The Custom Gauge block displays the value of the connected signal on a gauge face that you can customize to look like a gauge in a real system. For example, you could create an engine rpm gauge or fuel indicator for an automotive model.

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

Create A Custom Gauge

When you add a Custom Gauge block to your model, the block is preconfigured with a default design. You can use the preconfigured Custom Gauge block like you would other Dashboard blocks, or you can enter Custom Gauge edit mode to customize the appearance. The Edit Custom Gauge button appears above the Custom Gauge block when you pause on it.

In Custom Gauge edit mode, the customization menu appears above the block. Separate images specify the appearance of the needle and the background. You can also customize the size of the dial arc and the color and transparency of the arc and tick marks. To build from the default design, you can individually select the needle image, background image, and arc to reposition and resize each feature. If you want to start from a blank canvas, you can remove the arc with the Clear Arc button. You can remove the needle and background images by clicking the X that appears when you pause on the needle or background image buttons.

The blank canvas for the Custom Gauge block shows a circle with its center marked to help guide alignment as you build your customized gauge. You can drag the center marker to align the center of your arc with the center of the arc in your background image. To add an image for the needle or the gauge background, click the button for the type of image you want to add. Then, select the image you want to use. When you add a gauge background image, the Custom Gauge block Lock Aspect Ratio parameter is selected. You can resize the block without distorting the image. If you want to change the aspect ratio of the block after adding a gauge background image, clear the Lock Aspect Ratio parameter.

To draw the arc for your gauge, click and drag along the guide circle. As you draw the arc, crosshairs appear to assist you with aligning the start and end points of the arc. After you release the mouse, you can continue to adjust the arc position and size. The arc options on the toolbar control the appearance of the arc, tick marks, and the value arc that indicates the value of the connected signal or parameter during simulation. The slider adjusts the transparency of the selected feature, and the color wheel allows you to specify the color. You can configure the arc as fully transparent when your background image includes the representation of the gauge face you want to use.

When you finish editing the appearance of your Custom Gauge block, click the Exit button in the upper-right of the model canvas or press Esc to exit Custom Gauge 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 to make the connection.

Tip

To facilitate understanding and debugging your model, you can modify Dashboard block connections in your model during normal and accelerator mode simulations.

To enter connect mode, click the Connect button that appears above your unconnected Dashboard block when you pause on it.

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

When you finish connecting the Dashboard blocks in your model, click the Exit button in the upper-right of the canvas to exit connect mode.

Tip

You can hide the message shown on unconnected blocks using the set_param function and the ShowInitialText block parameter.

Limitations

  • 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 such signals on a Dashboard block, mark the signal for logging.

Parameters

expand all

Select the signal to connect using the Connection table. Populate the Connection table by selecting signals of interest in your model. Select the radio button next to the signal you want to display. Click Apply to connect the signal. To facilitate understanding and debugging your model, you can connect Dashboard blocks to signals in your 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 arc. The minimum must be less than the value entered for the maximum.

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 arc. The maximum must be greater than the value entered for the minimum.

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, integer, scalar value specifying the interval of major tick marks on the arc. When set to auto, the block automatically adjusts the tick interval based on the minimum and maximum values.

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 ranges on the arc. Press the + button to add a color. For each color added, specify the minimum and maximum values of the range where you want to display that color.

Programmatic Use

To programmatically specify the Scale Colors parameter, use an array of structures with 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 to specify the color for the range of the scale 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

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'

Maintain the background image aspect ratio when resizing the block. By default, when you specify a background image for the block, the Lock Aspect Ratio check box is selected.

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 R2018b