Lamp

Display color reflecting input value

  • Library:
  • Simulink / Dashboard

Description

The Lamp block displays a color indicating the value of the input signal. You can use the Lamp block with other Dashboard blocks to build an interactive dashboard of controls and indicators for your model. You can specify pairs of input values and colors to provide the information you want during simulation.

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: []

States match a display color to the value of the connected variable or parameter. Each state consists of a State and a Color.

  • State — Connected variable or parameter value that causes the Lamp block to display the specified color indication.

  • Color — Lamp color when the connected variable or parameter value matches the corresponding State value. You can select from a palette of standard colors or specify a custom color with RGB values.

The [undefined] state specifies the color of the Lamp block when the input value does not match any of the values specified in the States table. Click the + button to add another state.

Programmatic Use

To programmatically specify the State and Color parameter values for a Lamp block, use an array of structures containing the fields:

  • Value — Scalar double value corresponding to the state.

  • Color1-by-3 [r g b] vector with values between 0 and 1 specifying the color for the Lamp to display.

lampState1.Value = 1;
lampstate1.Color = [0 0 1];
lampState2.Value = 2;
lampState2.Color = [1 0 0];
lampStates = [lampState1 lampState2];
Block Parameter: StateColors
Type: structure array
Default: structure

The ColorDefault parameter specifies the color for the Lamp block when the value of the connected signal does not match any of the specified state values. Specify the ColorDefault parameter as a 1-by-3 [r g b] vector with values between 0 and 1.

Block Parameter: ColorDefault
Type: [r g b] vector
Default: [0.7529 0.7529 0.7529]

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 R2015a