EtherNet/IP (Logix) Treiber
Überblick
EtherNet/IP auf Basis von CIP (Common Industrial Protocol). Kommuniziert vorwiegend mit Allen-Bradley / Rockwell ControlLogix / CompactLogix PLCs.
| Position | Wert |
|---|---|
opc_type | EIP |
| Implementierungsklasse | plantpulse.driver.protocol.eip.EIP_34_Driver |
| Bibliothek | digitalpetri/ethernet-ip (CipClient + GetAttributeListService) |
| read | ✅ (attribute list raw bytes → String) |
| write | ❌ (separater Service-Aufruf erforderlich) |
| Sicherheit | keine |
Anders als die übrigen PLC-Treiber verwendet dieser Treiber nicht PLC4j, sondern direkt digitalpetri/ethernet-ip (er erbt von BaseProtocolDriver, nicht von PLC4jProtocolDriver).
Das plc4j-driver-eip von PLC4j liegt zwar ebenfalls in lib, wird von dieser Klasse aber nicht genutzt.
OPC-Registrierungsformular
| Feld | Bedeutung | Beispiel |
|---|---|---|
opc_agent_ip | PLC-IP | 192.168.0.90 |
opc_agent_port | EIP-Port | 44818 |
timecycle | Abfrageintervall (ms) | 1000 |
options.backplane | Backplane-Nummer | 1 (default) |
options.local-slot | CPU-Slot-Nummer | 0 (default) |
Das interne Timeout ist fest auf 2 Sekunden eingestellt (Duration.ofSeconds(2)).
Format von Tag plc_address
Der raw read von EIP arbeitet mit den Koordinaten CIP class / instance / attribute. Im Edge wird im Feld plc_address
das Format <class>,<instance>,<attribute> (dezimal oder hexadezimal) eingetragen.
| Notation | Bedeutung |
|---|---|
0x6B,1,1 | Symbol class 0x6B, instance 1, attribute 1 |
0x6C,1,1 | Template class |
0x01,1,7 | Product Name des Identity Object |
Tag1.Member)Der in Logix übliche Lesezugriff auf symbolische Tags (MyController:Tag1) erfordert einen separaten Service (Read Tag Service); dieser Treiber nutzt ausschließlich raw GetAttributeListService. Wird symbolisches Lesen benötigt, ist ein Wechsel auf den PLC4j-EIP-Treiber oder eine spätere Implementierung erforderlich.
Zuordnung data_type / format
data_type | format | Anmerkung |
|---|---|---|
| String | (empty) | Raw Bytes der Antwort werden unverändert als String akkumuliert |
| Integer / Float / … | (empty) | Casting in der Nachverarbeitung. Der aktuelle Treiber liefert raw bytes → String |
Das Casting nach data_type erfolgt in der Nachverarbeitung (PLCValueFomula / Sparkplug DataTypeMapper).
Häufige Fehler + Behebung
| Meldung / Symptom | Ursache | Behebung |
|---|---|---|
| Connection timeout | Port 44818 blockiert, EIP nicht aktiv | EtherNet/IP-Modul in RSLogix / Studio5000 aktivieren |
| Forward Open failure | rack/slot mismatch | options.backplane / options.local-slot korrigieren |
Class/Instance not found | falsche class-/instance-ID | Antwort im Tag Browser von Studio5000 oder mit wireshark prüfen |
| Werte erscheinen verstümmelt | Bytes werden direkt in String gewandelt | In der Nachverarbeitung eine Formel zur Interpretation als 4-Byte Little Endian anwenden |
curl-Registrierungsbeispiel
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"
}
]
}'
Beispielsammlung (nach Datentyp)
Der EIP raw read akkumuliert die raw bytes der Koordinate <class>,<instance>,<attribute> (dezimal oder hexadezimal mit Präfix 0x) als String. In der Nachverarbeitung wird nach data_type / fomula gecastet.
Format der CIP-Koordinaten
plc_address | Bedeutung |
|---|---|
0x01,1,1 | Identity → Vendor ID |
0x01,1,2 | Identity → Device Type |
0x01,1,7 | Identity → Product Name (String) |
0x6B,1,1 | Symbol Class (Logix tag list) instance 1 attribute 1 |
0x6C,1,1 | Template Class |
0x6C,2,1 | Template Class instance 2 |
0x73,1,1 | Connection Manager |
Zuordnung nach Datentyp
data_type | format | Beispiel plc_address | Anmerkung |
|---|---|---|---|
String | (empty) | 0x01,1,7 | Product name (raw bytes unverändert als String) |
Integer | (empty) | 0x01,1,1 | Vendor ID. raw bytes → Interpretation als Little Endian per Formel |
Integer | (empty) | 0x01,1,2 | Device Type |
Boolean | (empty) | 0x01,1,8 | Status word (Bit-Extraktion in der Nachverarbeitung) |
Float | (empty) | <class>,<inst>,<attr> | 4-Byte-Rohantwort → Nachverarbeitung |
EIP_34_Driver ruft ausschließlich GetAttributeListService auf. Wird der Lesezugriff auf symbolische Tags (MyController:Tag1.Member) benötigt, ist eine separate Implementierung mit dem ControlLogix Read Tag Service erforderlich. Da PLC4j EIP in lib enthalten ist, ist eine spätere Umstellung möglich.
Einsatz von Formeln
| Zweck | data_type | fomula | Anmerkung |
|---|---|---|---|
| Korrektur von Integer-Rohwerten | Integer | ${VALUE}*1 | zur unveränderten Durchleitung |
| Zwei 16-Bit-Werte kombinieren | Integer | ${TAG_HI}*65536+${VALUE} | Zusammensetzen der Attribute hi/lo |
| Einheitenumrechnung | Float | ${VALUE}*0.1 | Skalierung des Integer-Rohwerts |
Umfassendes curl-Beispiel
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"}
]
}'