メインコンテンツ

Lamp

ランプでの信号値を反映した色の表示

  • Lamp block

ライブラリ:
Simulink / Dashboard

説明

Lamp ブロックは、接続している信号の値を示す色を表示します。シミュレーション中に必要な情報を示すように Lamp ブロックを設定するには、信号値と Lamp ブロックが表示する色を組み合わせた 1 つ以上の状態を指定します。Lamp ブロックをその他の Dashboard ブロックと共に使用し、モデル用にコントロールおよびインジケーターの対話型のダッシュボードを作成できます。

ランプ アイコン

いずれか 1 つの組み込みアイコンを選択するか、独自のカスタム アイコンをアップロードすることで、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 ブロックを接続するには、接続モードを使用します。接続されていないブロックで接続モードに切り替えるには、接続するブロックをポイントし、[接続] ボタン をクリックします。接続されているブロックで接続モードに切り替えるには、ブロックを選択すると表示される省略記号 (…) をポイントし、展開されるアクション メニューで [接続] ボタンをクリックします。

Display ブロックをモデル内の信号に接続したり Display ブロックの接続を変更したりするには、接続モードに切り替えます。接続する信号線を選択します。表示されるリストから、接続する信号を選択します。次に、Dashboard ブロックをポイントし、[接続完了] ボタン をクリックします。接続されたブロックの値を Dashboard ブロックに表示するには、シミュレーションを実行します。

Dashboard ブロックの接続の詳細については、Connect Dashboard Blocks to Simulink Modelを参照してください。

Dashboard ブロックは Stateflow® チャートにも接続できます。詳細については、Dashboard ブロックと Stateflow との接続 (Stateflow)を参照してください。

次のアニメーションは、Lamp ブロックをモデルに接続する方法を示しています。

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

すべて展開する

Lamp ブロックを使用して、接続されている信号の値を示すことができます。たとえば、モデル lampStep には、時間 3 に値を 0 から 1 に変更する Step ブロックが含まれています。Step ブロックからの出力信号 StepSig が Lamp ブロックに接続されています。

The Block Parameter dialog box for the Lamp block

モデルのシミュレーションを実行します。StepSig の値が 0 の場合、ランプは緑色になります。StepSig の値が 1 の場合、ランプは青色になります。

Animation of the lampStep model during simulation

拡張例

制限

  • Dashboard Scope ブロックおよび Display ブロックを除き、Dashboard ブロックは実数のスカラー信号にのみ接続できます。

  • コメントアウトされたブロックには、[ブロック パラメーター] ダイアログ ボックスの [接続] テーブルを使用して Dashboard ブロックを接続することはできません。コメント化されたブロックに接続モードを使用して Dashboard ブロックを接続した場合、ブロックのコメントを解除するまでは Dashboard ブロックに接続された値が表示されません。

  • Dashboard ブロックは参照モデル内のモデル要素には接続できません。

  • モデルの階層構造をシミュレーションすると、参照モデル内の Dashboard ブロックで更新は実行されません。

  • Dashboard ブロックは、ラピッド アクセラレータ シミュレーションをサポートしていません。

  • シミュレーション中に Stateflow のチャート データやステート アクティビティに Dashboard ブロックを接続することはできません。

  • プログラムで Stateflow のチャート データやステート アクティビティに Dashboard ブロックを接続することはできません。

  • アクセラレータ モード シミュレーションのためのブロックの削減または最適化により、一部の信号にはシミュレーションで使用できるデータが含まれないことがあります。Dashboard ブロックを使用してこのような信号を表示するには、信号をログ記録用にマークします。

パラメーター

すべて展開する

このブロックは、信号の値を表示するブロックである、Display ブロックです。表示する信号にブロックを接続します。

Dashboard ブロックはモデル要素への接続に端子を使用しません。Dashboard ブロックを接続するには、接続モード、Simulink® ツールストリップ、または [ブロック パラメーター] ダイアログ ボックスの [接続] テーブルを使用します。詳細については、Connect Dashboard Blocks to Simulink Modelを参照してください。

[接続] テーブルを使用して信号に接続する手順は以下のとおりです。

  1. ブロックを選択します。

  2. プロパティ インスペクターの [パラメーター] タブで、[接続] または [変更] をクリックします。

  3. 接続先となる信号の信号線を選択します。

  4. 表示されたテーブルで、信号を選択します。

  5. [適用] をクリックします。

Dashboard ブロックは Stateflow チャートにも接続できます。詳細については、Dashboard ブロックと Stateflow との接続 (Stateflow)を参照してください。

プログラムでの使用

プログラムで Display ブロックを信号に接続できます。信号を表す Simulink.HMI.SignalSpecification オブジェクトを定義します。次に、Binding パラメーターの値をオブジェクトに設定します。Binding パラメーターの値を設定するには、set_param 関数を使用します。

たとえば、vdp という名前のモデルに、myGauge という名前の Circular Gauge ブロックと x1 という名前の信号が含まれているとします。ブロックを信号に接続するには、次のコードを使用します。

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

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

set_param(blockPath,Binding=myObj)
パラメーター: Binding
値: Simulink.HMI.SignalSpecification object

例: set_param(gcb,Binding=myObj)

各状態では [値][色] がペアになっています。

  • — 接続された信号の値

  • — 接続された信号が該当する値をもつ場合に Lamp ブロックで表示する色

状態を追加するには、[+] ボタンをクリックします。状態を削除するには、[状態] テーブルで状態の行を選択し、[X] ボタンをクリックします。

状態の値を編集するには、[値] 列で値をクリックし、値を削除してから、新しい値を入力します。色を編集するには、[色] 列で色をクリックし、新しい色を選択します。標準色のパレットから選択するか、RGB 値でカスタムの色を指定できます。

[undefined] の状態は、接続している信号の値が [状態] テーブルで指定されたどの値にも一致しない場合の Lamp ブロックの色を指定します。

プログラムでの使用

ブロック パラメーターの値をプログラムで設定するには、set_param 関数を使用します。

StateColors パラメーターの値を構造体の配列として指定します。ここで、各構造体は状態を表します。各構造体には次のフィールドが含まれます。

  • Value — 信号値

  • Color — 接続された信号が該当する値をもつ場合に Lamp ブロックで表示する色

たとえば、現在選択されている Lamp ブロックに 2 つの状態を含めるとします。最初の状態では、接続されている信号の値が 0 の場合、ブロックで青色を表示します。2 番目の状態では、接続されている信号の値が 2 の場合、ブロックで赤色を表示します。これらの状態を実装するには、以下のコードを使用します。

state1.Value = 1;
state1.Color = [0 0 1];
state2.Value = 2;
state2.Color = [1 0 0];
myStates = [state1 state2];

set_param(gcb,StateColors=myStates)
パラメーター: StateColors
値: N-by-1 struct array, where N is the number of states and each struct has the fields Value and Color

例: set_param(gcb,StateColors=myStates)

ColorDefault パラメーターは、接続している信号の値が指定された状態のどの値にも一致しない場合の Lamp ブロックの色を指定します。

パラメーター: ColorDefault
値: [0.7529 0.7529 0.7529] (既定値) | [r g b] vector with values between 0 and 1

例: set_param(gcb,ColorDefault=[1 0 1])

アイコンを使用して、モデル内での Lamp ブロックの外観を設定します。形状、自動車関連、ワイヤレスの組み込みアイコンから選択できます。または、独自のカスタム SVG ファイルをアイコンとしてアップロードできます。

アイコン オプションを表示するには、[アイコン] タブで [Icon Type] を選択します。独自の SVG ファイルをブロック アイコンとして使用するには、[カスタム][Icon Type] として選択し、SVG ファイルをアップロードします。Lamp ブロックの状態を示す色は次の SVG 要素に適用できます。

  • altGlyph

  • circle

  • ellipse

  • path

  • polygon

  • rect

  • text

  • textPath

  • tref

  • tspan

形状アイコン

アイコン基本形状のライブラリ ブロック名プログラムで使用する値

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

自動車関連アイコン

アイコン自動車関連のインジケーター ランプのライブラリ ブロック名プログラムで使用する値

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

ワイヤレス アイコン

アイコンアイコン名プログラムで使用する値

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 ブロックを使用して独自のインジケーター ランプを設計することを検討してください。

プログラムでの使用

ブロック パラメーターの値をプログラムで設定するには、set_param 関数を使用します。

パラメーター: Icon
値: 'Default' (既定値) | icon name formatted as string or character vector

例: set_param(gcb,Icon="NetworkTransmission")

ブロック ラベルの位置。ブロックがモデル内の要素に接続されている場合、ラベルは接続された要素の名前です。

プログラムでの使用

ブロック パラメーターの値をプログラムで設定するには、set_param 関数を使用します。

パラメーター: LabelPosition
値: 'Top' (既定値) | "Top" | "Bottom" | "Hide"

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

ブロックの不透明度。0 ~ 1 のスカラー値として指定します。

プログラムでの使用

ブロック パラメーターの値をプログラムで設定するには、関数 set_param を使用します。

パラメーター: Opacity
値: '1' (既定値) | scalar with values between 0 and 1 formatted as string or character vector

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

ブロックの特性

データ型

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

直達

いいえ

多次元信号

いいえ

可変サイズの信号

いいえ

ゼロクロッシング検出

いいえ

拡張機能

すべて展開する

バージョン履歴

R2015a で導入

すべて展開する