メインコンテンツまでスキップ

EtherNet/IP (Logix) ドライバ

概要

CIP (Common Industrial Protocol) ベースの EtherNet/IP。主に Allen-Bradley / Rockwell ControlLogix / CompactLogix PLC と通信します。

項目
opc_typeEIP
実装クラスplantpulse.driver.protocol.eip.EIP_34_Driver
ライブラリdigitalpetri/ethernet-ip (CipClient + GetAttributeListService)
read✅ (attribute list raw bytes → String)
write❌ (別途 service 呼び出しが必要)
セキュリティなし
PLC4j との違い

他の PLC ドライバと異なり、PLC4j ではなく digitalpetri/ethernet-ip を直接使用します (PLC4jProtocolDriver ではなく BaseProtocolDriver を継承)。 PLC4j の plc4j-driver-eip も lib に含まれていますが、本クラスでは使用しません。


OPC 登録フォーム

フィールド意味
opc_agent_ipPLC IP192.168.0.90
opc_agent_portEIP ポート44818
timecycleポーリング周期 (ms)1000
options.backplanebackplane 番号1 (default)
options.local-slotCPU slot 番号0 (default)

内部 timeout は 2 秒固定 (Duration.ofSeconds(2))。


タグ plc_address 形式

EIP の raw read は CIP class / instance / attribute 座標で動作します。Edge では plc_address フィールドに <class>,<instance>,<attribute> 形式 (10進または16進) で入力します。

表記意味
0x6B,1,1Symbol class 0x6B, instance 1, attribute 1
0x6C,1,1Template class
0x01,1,7Identity object の Product Name
シンボリックタグ (Tag1.Member)

Logix で一般的なシンボリックタグの read (MyController:Tag1) は別途 service (Read Tag Service) を 使用する必要があり、本ドライバは raw GetAttributeListService のみを使用します。シンボリック read が必要な場合は PLC4j EIP ドライバへの切り替え、または後続実装が必要です。


data_type / format マッピング

data_typeformat備考
String(empty)応答 raw bytes をそのまま String として蓄積
Integer / Float / …(empty)後処理でキャスト。現ドライバは raw bytes → String

後処理 (PLCValueFomula / Sparkplug DataTypeMapper) で data_type にキャストします。


よくあるエラーと対処

メッセージ / 症状原因対処
Connection timeoutポート 44818 が遮断、EIP が未稼働RSLogix / Studio5000 で EtherNet/IP module を有効化
Forward Open failurerack/slot の不一致options.backplane / options.local-slot を修正
Class/Instance not foundclass / instance ID が不正Studio5000 の Tag Browser または wireshark で応答を確認
値が壊れて見えるbyte をそのまま String 変換している後処理で 4-byte little-endian として解釈する fomula を適用

curl 登録例

curl -X POST http://<edge-host>/api/v1/opc \
-H "Content-Type: application/json" \
-d '{
"opc_id": "OPC_EIP_LOGIX",
"opc_type": "EIP",
"opc_name": "Logix L83E",
"opc_agent_ip": "192.168.0.90",
"opc_agent_port": "44818",
"site_id": "SITE_00001",
"auto_collect": true,
"timecycle": 1000,
"options": {
"backplane": "1",
"local-slot": "0"
},
"tag_list": [
{
"tag_id": "OPC_EIP_LOGIX_TAG_00001",
"tag_name": "ProductName",
"plc_address": "0x01,1,7",
"data_type": "String"
}
]
}'

サンプル集 (データタイプ別)

EIP raw read は <class>,<instance>,<attribute> 座標(10進または 0x 接頭の16進) の raw bytes を String として蓄積します。後処理で data_type / fomula にキャストします。

CIP 座標形式

plc_address意味
0x01,1,1Identity → Vendor ID
0x01,1,2Identity → Device Type
0x01,1,7Identity → Product Name (String)
0x6B,1,1Symbol Class (Logix tag list) instance 1 attribute 1
0x6C,1,1Template Class
0x6C,2,1Template Class instance 2
0x73,1,1Connection Manager

データタイプ別マッピング

data_typeformatplc_address備考
String(empty)0x01,1,7Product name (raw bytes をそのまま String)
Integer(empty)0x01,1,1Vendor ID。raw bytes → fomula で little-endian 解釈
Integer(empty)0x01,1,2Device Type
Boolean(empty)0x01,1,8Status word (bit 抽出は後処理)
Float(empty)<class>,<inst>,<attr>4-byte raw 応答 → 後処理
現ドライバの制限

EIP_34_DriverGetAttributeListService のみを呼び出します。シンボリックタグ (MyController:Tag1.Member) の read が必要な場合は、ControlLogix Read Tag Service を使用する別途実装が必要です。PLC4j EIP が lib に含まれているため、後続での切り替えが可能です。

Formula の活用

用途data_typefomula備考
整数 raw 補正Integer${VALUE}*1無変換パススルー用
16-bit 2値の結合Integer${TAG_HI}*65536+${VALUE}hi/lo 2 つの attribute を合成
単位変換Float${VALUE}*0.1raw 整数のスケーリング

curl 総合例

curl -X POST http://<edge-host>/api/v1/opc \
-H "Content-Type: application/json" \
-d '{
"opc_id": "OPC_EIP_FULL",
"opc_type": "EIP",
"opc_name": "Logix Full",
"opc_agent_ip": "192.168.0.90",
"opc_agent_port": "44818",
"site_id": "SITE_00001",
"auto_collect": true,
"timecycle": 1000,
"options": { "backplane": "1", "local-slot": "0" },
"tag_list": [
{"tag_id":"OPC_EIP_FULL_T01", "tag_name":"VendorId", "plc_address":"0x01,1,1", "data_type":"Integer"},
{"tag_id":"OPC_EIP_FULL_T02", "tag_name":"DeviceType", "plc_address":"0x01,1,2", "data_type":"Integer"},
{"tag_id":"OPC_EIP_FULL_T03", "tag_name":"ProductName","plc_address":"0x01,1,7", "data_type":"String"},
{"tag_id":"OPC_EIP_FULL_T04", "tag_name":"Status", "plc_address":"0x01,1,5", "data_type":"Integer"}
]
}'