Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

Lamp

显示反映信号灯上信号值的颜色

  • Lamp block

库:
Simulink / Dashboard

描述

Lamp 模块会显示一种颜色,用来指示其所连接的信号的值。要配置 Lamp 模块以提供仿真期间所需的信息,请指定一个或多个状态,这些状态将信号值与要显示的 Lamp 模块的颜色配对。您可以将 Lamp 模块与其他 Dashboard 模块结合使用,为您的模型构建包含各种控件和指示器的交互式控制板。

信号灯图标

您可以通过选择一个内置图标或上传您自己的自定义图标来更改 Lamp 模块的外观。内置图标包括基本形状、汽车指示灯和无线图标。您可以使用图标参数或使用工具条中的模块选项卡来更改 Lamp 模块的图标。Dashboard 库还包含为每个图标提供预配置的 Lamp 模块版本的库。有关完整的详细信息,请参阅图标

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

如果您要自定义 Lamp 模块的外观(该外观无法通过选择图标来实现),请考虑使用 Customizable Blocks 库中的 Lamp 模块来设计您自己的指示灯。

连接 Dashboard 模块

Dashboard 模块不使用端口来连接到模型元素。要将 Dashboard 模块连接到模型中的信号,请使用连接模式。连接模式有助于在模型中连接 Dashboard 模块,尤其是需要一次连接多个模块时。要连接单个 Dashboard 模块,还可以使用模块对话框中的连接表。

提示

您可以在普通和加速模式仿真期间修改 Dashboard 模块连接。

要进入连接模式,请在画布中选择要连接的 Dashboard 模块。在 Simulink® 工具条上,会出现以所选模块的类型命名的选项卡。在模块选项卡上,点击连接。在连接模式下,当您选择一个或多个信号或模块时,会出现可用于连接的信号的列表。从列表中选择信号以连接到所选 Dashboard 模块。要连接另一个 Dashboard 模块,请在要连接的模块上悬停并点击其上方的连接按钮。然后,在模型中选择一个或多个信号和模块,并选择要连接的信号。

A Gauge block is in connect mode. To the right of the Gauge block is a Sine Wave block that connects to a Gain block that connects to an Outport block. To the right of the Outport block is the list of signals available for connection.

完成模型中 Dashboard 模块的连接后,在模块选项卡上,点击完成连接

提示

您可以使用具有 ShowInitialText 模块参数的 set_param 函数隐藏在未连接的模块上显示的消息。当您连接模块时,消息也会消失。

限制

  • 除了 Dashboard Scope 模块和 Display 模块之外,Dashboard 模块只能连接到实数标量信号。

  • 工具条不支持面板内的模块。

  • 您不能在模块对话框中使用连接表将 Dashboard 模块连接到已注释掉的模块。使用连接模式将 Dashboard 模块连接到带注释的模块时,Dashboard 模块在您取消注释模块之前不会显示连接的值。

  • Dashboard 模块无法连接到引用模型中的模型元素。

  • 在仿真模型层次结构时,引用模型内的 Dashboard 模块不会更新。

  • Dashboard 模块不支持快速加速仿真。

  • 在仿真期间,无法将 Dashboard 模块连接到 Stateflow® 中的状态活动或图数据。

  • 无法以编程方式将 Dashboard 模块连接到 Stateflow 中的状态活动或图数据。

  • 由于加速模式仿真的模块简化或优化,一些信号在仿真期间没有可用的数据。要使用 Dashboard 模块查看此类信号,请标记信号以进行记录。

参数

全部展开

使用连接表选择要连接到模块的信号。要将模块连接到信号,请执行下列步骤:

  1. 在包含一个或多个信号的模型中进行选择。

  2. 在表中,选择要连接的信号。

  3. 点击应用

提示

在仿真期间,可以将 Dashboard 模块连接到模型中的信号。

编程用法

模块参数Binding
类型:Simulink.HMI.SignalSpecification
默认值:[]

状态将显示颜色与连接的信号值的相匹配。每个状态由状态颜色组成。

  • 状态 - 使 Lamp 模块显示指定颜色的已连接信号值。

  • 颜色 - 当连接的信号值与对应的状态值匹配时信号灯的颜色。您可以从标准颜色调色板中选择,也可以使用 RGB 值指定自定义颜色。

[undefined] 状态指定当连接的信号值与状态表中指定的任何值都不匹配时,Lamp 模块的颜色。点击 + 按钮可添加另一个状态。

编程用法

要以编程方式为 Lamp 模块指定 StateColor 参数值,请使用包含以下字段的结构体数组:

  • Value - 导致 Lamp 模块显示指定颜色指示的标量 double 信号值。

  • Color - 1×3 [r g b] 向量,其值介于 01 之间,指定要显示的 Lamp 模块的颜色。

lampState1.Value = 1;
lampState1.Color = [0 0 1];
lampState2.Value = 2;
lampState2.Color = [1 0 0];
lampStates = [lampState1 lampState2];
模块参数StateColors
类型:结构体数组
默认值:结构体

ColorDefault 参数指定当所连接信号的值与任何指定的状态值都不匹配时,Lamp 模块的颜色。将 ColorDefault 参数指定为 1×3 [r g b] 向量,其值介于 01 之间。

模块参数ColorDefault
类型:[r g b] 向量
默认值[0.7529 0.7529 0.7529]

使用一个图标来配置模型中 Lamp 模块的外观。您可以从内置形状、汽车图标和无线图标中进行选择,也可以上传您自己的自定义 SVG 文件作为图标。

要查看图标选项,请在图标选项卡上选择图标类型。要使用您自己的 SVG 文件作为模块图标,请选择自定义作为图标类型并上传 SVG 文件。Lamp 模块的状态颜色可以应用于下列 SVG 元素:

  • altGlyph

  • circle

  • ellipse

  • path

  • polygon

  • rect

  • text

  • textPath

  • tref

  • tspan

形状图标

图标基本形状库模块名称编程使用的值

Lamp icon: a solid gray circle

LampDefault

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

Circle icon: a solid black circle

CircleCircle

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

Hexagon icon: a solid hexagon

HexagonHexagon

Pentagon icon: a solid pentagon

PentagonPentagon

Rectangle icon: a solid rectangle

RectangleRectangle

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

Square icon: a solid square

SquareSquare

Triangle icon: a solid triangle

TriangleTriangle

汽车图标

图标汽车指示灯库模块名称编程使用的值

Adaptive Cruise Control icon: a speedometer with an arrow pointing to a tickmark 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

Antilock 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 tickmarks

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

无线图标

图标图标名称编程使用的值

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

提示

  • 您可以使用工具条中的模块选项卡更改 Lamp 模块的图标。

  • Dashboard 库包含为每个图标提供预配置 Lamp 模块的库。

  • 如果您要自定义 Lamp 模块的外观(该外观无法通过选择图标来实现),请考虑使用 Customizable Blocks 库中的 Lamp 模块来设计您自己的指示灯。

编程用法

模块参数Icon
类型:字符串 | 字符向量
默认值:'Default'

模块标签的位置。当模块连接到模型中的元素时,标签是所连接的元素的名称。

编程用法

模块参数LabelPosition
类型:字符向量
'Top' | 'Bottom' | 'Hide'
默认值'Top'

模块不透明度,指定为 0 到 1 之间的标量值。

示例: 0.5

编程用法

模块参数:Opacity
类型:标量
默认值: 1

模块特性

数据类型

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

直接馈通

多维信号

可变大小信号

过零检测

扩展功能

版本历史记录

在 R2015a 中推出