Main Content

Lamp

Display color reflecting input value

  • Library:
  • Simulink / Dashboard

  • Lamp block

Description

The Lamp block displays a color to indicate 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.

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.

Connect Dashboard Blocks

Dashboard blocks do not use ports to connect to model elements. 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. 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, select a dashboard block to connect. Then on the block tab, click Connect. 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, on the block tab, click Done Connecting.

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 for the Dashboard Scope block and the Display block, dashboard blocks can only connect to real scalar signals.

  • The toolstrip does not support blocks that are inside a panel.

  • You cannot use the Connection table in the block dialog 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.

  • You cannot connect a dashboard block to data or activity in Stateflow® during simulation.

  • Some signals are removed by optimization and are not available during accelerator mode simulations. To view such a signal 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: []

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]

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

LampDefault

Check1Check1

Check2Check2

Check3Check3

Check4Check4

CircleCircle

Ex1Ex1

Ex2Ex2

Ex3Ex3

Ex4Ex4

FaceFace

Frown1Frown1

Frown2Frown2

HexagonHexagon

PentagonPentagon

RectangleRectangle

Smile1Smile2

Smile2Smile2

Solid FaceSolidFace

Solid Frown1SolidFrown1

Solid Frown2SolidFrown2

Solid Smile1SolidSmile1

Solid Smile2SolidSmile2

SquareSquare

TriangleTriangle

Automotive Icons

IconAutomotive Indicator Lamps Library Block NameProgrammatic Use Value

Adaptive Cruise ControlAdaptiveCruiseControl

Adaptive Cruise Control FailureAdaptiveCruiseControlFailure

Antilock Brake SystemAntilockBrakeSystem

BatteryBattery

Check EngineCheckEngine

Check Engine2CheckEngine2

Cruise ControlCruiseControl

Eco ModeEcoMode

Electronic StabilityElectronicStability

EngineEngine

Engine Coolant TempEngineCoolantTemp

Engine FailureEngine Failure

Engine HeatingEngineHeating

Engine OilEngineOil

Exterior Bulb FailureExteriorBulbFailure

Front Fog LightFrontFogLight

FuelFuel

HazardsHazards

Headlamp LevelingHeadlampLeveling

High BeamsHigh Beams

Hill Descent ControlHillDescentControl

Lighting SwitchLightingSwitch

Low BeamsLowBeams

Parking AssistanceParkingAssistance

Rear Fog LightRearFogLight

Side LightsSideLights

Stability ControlStability Control

Stability Control OffStabilityControlOff

Tire MonitorTireMonitor

Traction ControlTractionControl

Traction Control OffTractionControlOff

Traction Control FailureTractionControlFailure

Turn Signal LeftTurnSignalLeft

Turn Signal RightTurnSignalRight

Wireless Icons

IconWireless Icons Library Block NameProgrammatic Use Value

NetworkNetwork

Network No SignalNetworkNoSignal

Network TransmissionNetworkTransmission

Network3GNetwork3G

Network4GNetwork4G

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.

Programmatic Use

Block Parameter: Icon
Type: 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 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

Introduced in R2015a