Main Content

Lamp

Display color that reflects signal value on lamp

  • Lamp block

Libraries:
Simulink / Dashboard

Description

The Lamp block displays a color that indicates the value of the connected signal. To configure the Lamp block to provide the information you need during simulation, specify one or more states, which pair a signal value with a color for the Lamp block to display. You can use the Lamp block with other Dashboard blocks to build an interactive dashboard of controls and indicators for your model.

Lamp Icons

You can change the appearance of the Lamp block by selecting one of the built-in icons or uploading your own custom icon. The built-in icons include basic shapes, automotive indicator lamps, and wireless icons. You can change the icon for a Lamp block by using the Icon parameter or by using the block tab in the toolstrip. The Dashboard library also includes libraries that have a preconfigured version of the Lamp block for each icon. For complete details, see Icon.

Lamp Icon drop-down menu showing basic shape icons, automotive indicator lamps, wireless icons, and the option to choose a custom icon

If you want to customize the appearance of the Lamp block beyond the ability to select an icon, consider designing your own indicator lamp using the Lamp block in the Customizable Blocks library.

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 Lamp block to your model.

An unconnected Lamp block connects to the signal that a Ramp block sends to a Terminator block.

Examples

expand all

You can use the Lamp block to indicate the value of a connected signal. For example, the model lampStep contains a Step block that changes value from 0 to 1 at time 3. The output signal StepSig from the Step block is connected to a Lamp block.

The Block Parameter dialog box for the Lamp block

Simulate the model. When StepSig has a value of 0, the lamp is green. When StepSig has a value of 1, the lamp is blue.

Animation of the lampStep 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

Dashboard blocks do not use ports to connect to model elements. To connect dashboard blocks to parameter values in your model, use connect mode, the Simulink® Toolstrip, or the Connection table in the Block Parameters dialog box. For information about connect mode and how to connect using the toolstrip, see Connect Dashboard Blocks to Simulink Model.

To connect a display block or change the connection of a display block using the Connection table:

  1. Select the block.

  2. To connect the block, in the Property Inspector, on the Parameters tab, click Connect. To change the connection of the block, click Change instead.

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

  4. In the table, select the signal to which you want to connect.

  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

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

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

  • State — Connected signal value that causes the Lamp block to display the specified color.

  • Color — Lamp color when the connected signal 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 connected signal 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 that contain these fields:

  • Value — Scalar double signal value that causes the Lamp block to display the specified color indication.

  • Color1-by-3 [r g b] vector with values between 0 and 1 that specifies the color for the Lamp block 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]

Use an icon to configure the appearance of the Lamp block in the model. You can choose from built-in shape, automotive, and wireless icons, or you can upload your own custom SVG file as an icon.

To view icon options, on the Icon tab, select an Icon Type. To use your own SVG file as the block icon, select Custom as the Icon Type and upload the SVG file. The state colors for the Lamp block can apply to these SVG elements:

  • altGlyph

  • circle

  • ellipse

  • path

  • polygon

  • rect

  • text

  • textPath

  • tref

  • tspan

Shape Icons

IconBasic Shapes Library Block NameProgrammatic Use Value

Lamp icon: a solid gray circle

LampDefault

Circle icon: a solid black circle

CircleCircle

Hexagon icon: a solid hexagon

HexagonHexagon

Pentagon icon: a solid pentagon

PentagonPentagon

Rectangle icon: a solid rectangle

RectangleRectangle

Square icon: a solid square

SquareSquare

Triangle icon: a solid triangle

TriangleTriangle

Check1 icon: a check mark

Check1Check1

Check2 icon: a check mark with slightly curved lines

Check2Check2

Check3 icon: the outline of a check mark

Check3Check3

Check4 icon: a check mark with a divot along its outline

Check4Check4

Ex1 icon: a cross mark

Ex1Ex1

Ex2 icon: a cross mark with one curved line

Ex2Ex2

Ex3 icon: the outline of a cross mark

Ex3Ex3

Ex4 icon: a cross mark with a divot along the outline

Ex4Ex4

Face icon: the outline of a face with a closed mouth in a straight line

FaceFace

Frown1 icon: the outline of a face with an open downturned mouth

Frown1Frown1

Frown2 icon: the outline of a face with a closed downturned mouth

Frown2Frown2

Smile1 icon: the outline of a face with an open upturned mouth

Smile1Smile1

Smile2 icon: the outline of a face with a closed upturned mouth

Smile2Smile2

Solid Face icon: a solid face with a closed mouth in a straight line

Solid FaceSolidFace

Solid Frown1 icon: a solid face with an open downturned mouth

Solid Frown1SolidFrown1

Solid Frown2 icon: a closed downturned mouth

Solid Frown2SolidFrown2

Solid Smile1 icon: a solid face with an open upturned mouth

Solid Smile1SolidSmile1

Solid Smile2 icon: a solid face with a closed upturned mouth

Solid Smile2SolidSmile2

Automotive Icons

IconAutomotive Indicator Lamps Library Block NameProgrammatic Use Value

Adaptive Cruise Control icon: a speedometer with an arrow pointing to a tick mark and the silhouette of a car in the background

Adaptive Cruise ControlAdaptiveCruiseControl

Adaptive Cruise Control Failure icon: a speedometer with an exclamation mark next to it and the silhouette of a car in the background

Adaptive Cruise Control FailureAdaptiveCruiseControlFailure

Anti-Lock Brake System icon: a circle labeled "ABS" in a set of parentheses

Antilock Brake SystemAntilockBrakeSystem

Battery icon: the outline of a battery with a plus symbol on the positive pole, and a negative symbol on the negative pole

BatteryBattery

Check Engine icon: the outline of an engine labeled "Check Engine"

Check EngineCheckEngine

Check Engine2 icon: the outline of an engine with the silhouette of a lightning rod on it and the word "CHECK" underneath it

Check Engine2CheckEngine2

Cruise Control icon: a speedometer with an arrow pointing to one of the tick marks

Cruise ControlCruiseControl

Eco Mode icon: a solid leaf shape labeled "ECO"

Eco ModeEcoMode

Electronic Stability icon: a circle labeled "ESP" in a set of parentheses

Electronic StabilityElectronicStability

Engine icon: the silhouette of an engine

EngineEngine

Engine Coolant Temp icon: a thermometer with waves in the background

Engine Coolant TempEngineCoolantTemp

Engine Failure icon: the silhouette of an engine with an exclamation mark on it

Engine FailureEngineFailure

Engine Heating icon: the silhouette of an engine with three wavy arrows pointing upwards on it

Engine HeatingEngineHeating

Engine Oil icon: the silhouette of an oil can

Engine OilEngineOil

Exterior Bulb Failure icon: the silhouette of a glowing light bulb with an exclamation mark on it

Exterior Bulb FailureExteriorBulbFailure

Front Fog Light icon: the outline of a fog light lamp emitting rays of light to the left that are depicted as diagonal lines on top of a wavy vertical line that represents the fog

Front Fog LightFrontFogLight

Fuel icon: the silhouette of a gas pump with an arrow pointing left on it

FuelFuel

Hazards icon: the outline of a warning triangle

HazardsHazards

Headlamp Leveling icon: the outline of a lamp emitting rays of light with an arrow pointing clockwise above them and an arrow pointing counterclockwise below them

Headlamp LevelingHeadlampLeveling

High Beams icon: the outline of a lamp emitting horizontal rays of light

High BeamsHighBeams

Hill Descent Control icon: the outline of a car driving down a slope

Hill Descent ControlHillDescentControl

Lighting Switch icon: the silhouette of a glowing light bulb

Lighting SwitchLightingSwitch

High Beams icon: the outline of a lamp emitting rays of light that run diagonally downward

Low BeamsLowBeams

Parking Assistance icon: the letter "P" next to a solid triangle, and the "P" emits a detection signal represented as three curved lines aimed at the triangle

Parking AssistanceParkingAssistance

Rear Fog Light icon: the outline of a fog light lamp emitting rays of light to the right that are depicted as horizontal lines on top of a wavy vertical line that represents the fog

Rear Fog LightRearFogLight

Side Lights icon: the outline two lamps emitting rays of light to the left and right

Side LightsSideLights

Stability Control icon: the silhouette of a car with wavy lines behind it

Stability ControlStabilityControl

Stability Control Off icon: the silhouette of a car with wavy lines behind it and the word "OFF" underneath

Stability Control OffStabilityControlOff

Tire Monitor icon: the outline of the cross-section of a tire with an exclamation mark on it

Tire MonitorTireMonitor

Traction Control icon: the outline of the cross-section of a tire with the label "TC"

Traction ControlTractionControl

Traction Control Off icon: the outline of the cross-section of a tire with the label "TC" and a diagonal slash through the whole image

Traction Control OffTractionControlOff

Traction Control Failure icon: the outline of the cross-section of a tire with the label "TC" and an exclamation mark next to it

Traction Control FailureTractionControlFailure

Turn Signal Left icon: a solid arrow pointing left

Turn Signal LeftTurnSignalLeft

Turn Signal Right icon: a solid arrow pointing right

Turn Signal RightTurnSignalRight

Wireless Icons

IconIcon NameProgrammatic Use Value

Network icon: the wireless internet connection icon

NetworkNetwork

Network No Signal icon: the wireless internet connection icon grayed out,with a crossed-out circle next to it

Network No SignalNetworkNoSignal

Network Transmission icon: a wireless internet tower

Network TransmissionNetworkTransmission

Network3G icon: the wireless internet connection icon with "3G" next to it

Network3GNetwork3G

Network4G icon: the wireless internet connection icon with "4G" next to it

Network4GNetwork4G

Network5G icon: the wireless internet connection icon with "4G" next to it

Network5GNetwork5G

Tips

  • You can change the icon for a Lamp block using the block tab in the toolstrip.

  • The Dashboard library has libraries with a preconfigured Lamp block for each icon.

  • If you want to customize the appearance of the Lamp block beyond the ability to select an icon, consider designing your own indicator lamp using the Lamp block in the Customizable Blocks library.

Programmatic Use

Block Parameter: Icon
Type: string | character vector
Default: 'Default'

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 opacity, specified as a scalar value between 0 and 1.

Example: 0.5

Programmatic Use

Block Parameter: Opacity
Type: scalar
Default: 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

Version History

Introduced in R2015a