Contenuto principale

Half Gauge

Display input value on semicircular scale

  • Half Gauge block

Libraries:
Simulink / Dashboard

Description

The Half Gauge block displays the connected signal on a semicircular scale during simulation. You can use the Half Gauge block with other Dashboard blocks to build an interactive dashboard of controls and indicators for your model. The Half Gauge block provides an indication of the instantaneous value of the connected signal throughout simulation. You can modify the range of the Half Gauge block to fit your data. You can also customize the appearance of the Half Gauge block to provide more information about your signal. For example, you can color-code in-specification and out-of-specification ranges.

Note

The gauge needle indicates when the connected signal value falls outside the scale range by dipping to a set point below the minimum or above the maximum of the scale. The set point is unrelated to the signal value.

Connect Dashboard Blocks

Dashboard blocks do not use ports to connect to model elements. To connect a dashboard block, use connect mode. To enter connect mode on an unconnected block, pause on the block you want to connect and click the Connect button . To enter connect mode on a connected block, select the block, pause on the ellipsis that appears (…), and in the action menu that expands, click the Connect button.

To connect a display block to a signal in your model or change the connection of a display block, enter connect mode. Select the signal line to which you want to connect. From the list that appears, select the signal to which you want to connect. Then, pause on the dashboard block and click the Done Connecting button . To see the dashboard block display the value of the connected block, run the simulation.

For more information about connecting dashboard blocks, see Connect Dashboard Blocks to Simulink Model.

You can also connect dashboard blocks to a Stateflow® chart. For more information, see Connect Dashboard Blocks to Stateflow (Stateflow).

This animation shows how to connect the Half Gauge block to your model.

An unconnected Half Gauge block connects to the signal that a Sine Wave block sends to a Display block.

Examples

expand all

You can use a Half Gauge block to display a connected signal on a semicircular scale during simulation. For example, in the model halfGaugeSine, a Half Gauge block is connected to a sine wave signal named sinSig.

Simulate the model. During simulation, the Half Gauge block displays the value of the sinSig signal.

Animation of the halfGaugeSine model during simulation

Extended Examples

Limitations

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

  • You cannot use the Connection table in the Block Parameters dialog box 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 model elements 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.

  • During simulation, you cannot connect a dashboard block to Stateflow chart data or state activity.

  • You cannot programmatically connect a dashboard block to Stateflow chart data or state activity.

  • Some signals do not have data available during simulation due to block reduction or optimization for accelerator mode simulations. To view such a signal using a dashboard block, mark the signal for logging.

Parameters

expand all

Signal

This block is a display block — a block that displays a signal value. Connect the block to the signal you want to display.

Dashboard blocks do not use ports to connect to model elements. To connect a dashboard block, use connect mode, the Simulink® Toolstrip, or the Connection table in the Block Parameters dialog box. For information, see Connect Dashboard Blocks to Simulink Model.

To connect to a signal using Connection table:

  1. Select the block.

  2. In the Property Inspector, on the Parameters tab, click Connect or Change.

  3. Select the signal line to whose signal you want to connect.

  4. In the table that appears, select the signal.

  5. Click Apply.

You can also connect dashboard blocks to a Stateflow chart. For more information, see Connect Dashboard Blocks to Stateflow (Stateflow).

Programmatic Use

You can programmatically connect a display block to a signal. Define a Simulink.HMI.SignalSpecification object that represents the signal. Then, set the value of the Binding parameter to the object. To set the value of the Binding parameter, use the set_param function.

For example, suppose the model named vdp contains a Circular Gauge block named myGauge and a signal named x1. To connect the block to the signal, use this code.

blockPath = "vdp/myGauge";
signalPath = "vdp/x1";

myObj = Simulink.HMI.SignalSpecification;
myObj.BlockPath = Simulink.BlockPath(signalPath);

set_param(blockPath,Binding=myObj)
Parameter: Binding
Values: Simulink.HMI.SignalSpecification object

Example: set_param(gcb,Binding=myObj)

Main

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 set the block parameter value programmatically, use the set_param function.

Specify the value of the Limits parameter as a vector of the form [min,int,max].

  • min is the Minimum tick mark value of the scale.

  • int is the Tick Interval of the scale. To use the auto value for the Tick Interval, leave the Tick Interval position in the vector empty, or specify -1.

  • max is the Maximum tick mark value of the scale.

Parameter: Limits
Values: [0 -1 100] (default) | [min,int,max]

Example: set_param(gcb,Limits=[-50 -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 set the block parameter value programmatically, use the set_param function.

Specify the value of the Limits parameter as a vector of the form [min,int,max].

  • min is the Minimum tick mark value of the scale.

  • int is the Tick Interval of the scale. To use the auto value for the Tick Interval, leave the Tick Interval position in the vector empty, or specify -1.

  • max is the Maximum tick mark value of the scale.

Parameter: Limits
Values: [0 -1 100] (default) | [min,int,max]

Example: set_param(gcb,Limits=[0 -1 50])

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 set the block parameter value programmatically, use the set_param function.

Specify the value of the Limits parameter as a vector of the form [min,int,max].

  • min is the Minimum tick mark value of the scale.

  • int is the Tick Interval of the scale. To use the auto value for the Tick Interval, leave the Tick Interval position in the vector empty, or specify -1.

  • max is the Maximum tick mark value of the scale.

Parameter: Limits
Values: [0 -1 100] (default) | [min,int,max]

Example: set_param(gcb,Limits=[0 5 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 set the block parameter value programmatically, use the set_param function.

Specify the value of the ScaleColors parameter as an array of structures, one structure for each color range you want to define. Each structure has these fields:

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

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

  • Color1-by-3 [r g b] vector with values between 0 and 1

For example, this code specifies colors for two value ranges. From 0 to 50, the code adds a blue scale color, and from 50 to 100, the code adds a green scale color.

range1.Min = 0;
range1.Max = 50;
range1.Color = [0 0 1];
range2.Min = 50;
range2.Max = 100;
range2.Color = [0 1 0];
scaleRanges = [range1 range2];

set_param(gcb,ScaleColors=scaleRanges)
Parameter: ScaleColors
Values: N-by-1 struct array, where N is the number of color ranges and each struct has the fields Min, Max, and Color

Example: set_param(gcb,ScaleColors=scaleRanges)

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

To set the block parameter value programmatically, use the set_param function.

Parameter: LabelPosition
Values: 'Top' (default) | "Top" | "Bottom" | "Hide"

Example: set_param(gcb,LabelPosition="Bottom")

Gauge scale direction.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: ScaleDirection
Values: 'Clockwise' (default) | "Clockwise" | "Counterclockwise"

Example: set_param(gcb,ScaleDirection="Counterclockwise")

Format

Block background opacity, specified as a scalar value between 0 and 1. When the specified value is 1, the background is fully opaque.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: Opacity
Values: '1' (default) | scalar with values between 0 and 1 formatted as string or character vector

Example: set_param(gcb,Opacity="0.5")

Block foreground color, excluding the text. The Foreground Color applies to the scale and the block name. You can select a color from a palette of standard colors or specify a custom color. To specify the color for the block text, use the Font Color.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: ForegroundColor
Values: [r g b] vector with values between 0 and 1 formatted as a string or character vector

Example: set_param(gcb,ForegroundColor="[1 0 1]")

Block background color. You can select a color from a palette of standard colors or specify a custom color.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: BackgroundColor
Values: [r g b] vector with values between 0 and 1 formatted as a string or character vector

Example: set_param(gcb,BackgroundColor="[1 0 1]")

Block font color. The Font Color applies to the tick labels on the scale. You can select a color from a palette of standard colors or specify a custom color.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: FontColor
Values: [r g b] vector with values between 0 and 1

Example: set_param(gcb,FontColor=[1 0 1])

Block Characteristics

Data Types

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

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

expand all

Version History

Introduced in R2015a

expand all