EtherNet/IP Driver
dc3-driver-ethernet-ipconnects EtherNet/IP (CIP) PLCs to IoT DC3——targeting tags, it periodically reads PLC tag values and supports commands that write values to tags.
EtherNet/IP is an industrial Ethernet protocol that carries CIP (Common Industrial Protocol), used mainly with Rockwell Allen-Bradley PLCs (such as ControlLogix / CompactLogix). Unlike register-addressed protocols like Modbus, CIP is addressed by tag name: variables in the PLC have names (e.g. Motor_Speed), and the driver reads/writes them by name through the CIP Data Table Read/Write services, with no need to deal with physical addresses.
This driver acts as an EtherNet/IP client, connecting to the PLC over a raw TCP socket (default port 44818) and reading/writing data using the tag name configured on each Point.
Work in progress (skeleton)
This driver is a protocol skeleton: the CIP session setup (RegisterSession / ForwardOpen) and the encapsulation frame are still placeholders, the source method bodies carry TODO markers, and health() only inspects the cached socket connection state rather than performing a real protocol probe. Treat it as a starting template, not a production-ready driver.
- Driver name / code:
EtherNet/IP Driver/EthernetIpDriver - Type:
DRIVER_CLIENT(actively connects to the PLC)
Driver Configuration (device-level driver-attribute)
When onboarding an EtherNet/IP PLC, fill in these attributes on the device:
| Attribute | code | Type | Default | Description |
|---|---|---|---|---|
| Host | host | STRING | localhost | PLC host address |
| Port | port | INT | 44818 | EtherNet/IP TCP port (standard 44818) |
| Slot | slot | INT | 0 | PLC backplane slot |
| Timeout | timeout | INT | 5000 | Request timeout (milliseconds) |
Point Configuration (point-attribute)
On each collected Point, fill in:
| Attribute | code | Type | Default | Description |
|---|---|---|---|---|
| Tag Name | tagName | STRING | (empty) | CIP tag name, e.g. Motor_Speed |
| Tag Type | tagType | STRING | DINT | Tag data type: BOOL / SINT / INT / DINT / REAL / STRING |
| Element Count | elementCount | INT | 1 | Number of elements to read (for array tags); not consumed by the current implementation — the element count in the read request is hardcoded to 1 |
Tag Type decides how bytes are decoded
The driver parses the raw bytes returned by the PLC into the matching type according to tagType: BOOL 1 byte, SINT 1 byte, INT 2 bytes, DINT 4-byte integer, REAL 4-byte float, STRING ASCII text. tagType must match the actual type of that tag in the PLC, otherwise parsing fails. The Point's own data type (Point pointTypeFlag) should match it.
Write Command Configuration (command-attribute)
Writable points also need this on the write command:
| Attribute | code | Type | Default | Description |
|---|---|---|---|---|
| Send Command | sendCommand | STRING | ${value} | Write-value template rendered from the command argument; encoded on write according to the Point's tagType. Not consumed by the current implementation — writes take the value passed in the command directly and do not go through this template |
Collection and Health
- Collection cycle: default cron
0/30 * * * * ?(reads once every 30 seconds). - Custom schedule:
schedule.customis enabled (cron0/5 * * * * ?), but the currentschedule()method body is empty and performs no custom logic. - Health / online: device health check default cron
0/15 * * * * ?, lease timeout45 seconds——see Device for the online-state mechanism.
Minimal Onboarding Example
To onboard an Allen-Bradley PLC at IP 192.168.1.20:44818, slot 0:
- Create a device with
EtherNet/IP Driver, and set the driver attributeshost=192.168.1.20,port=44818,slot=0,timeout=5000. - Add a speed Point (
pointTypeFlag=INT,READ_ONLY) to the Profile bound to the device, and set the point attributestagName=Motor_Speed,tagType=DINT,elementCount=1. - Start the driver, and within 30 seconds the collected value appears in PointValue.
Common Pitfalls
tagName is the PLC tag name, not an address
CIP is addressed by name. tagName must match the variable name defined in the PLC program verbatim (case-sensitive). A wrong name fails the read rather than reading a wrong address——this differs from Modbus offset: a wrong Modbus offset silently reads a different register, whereas a non-existent CIP tag name errors out directly.
tagType must match the PLC tag's real type
The driver does not auto-detect the PLC tag type; it decodes bytes strictly according to the tagType you set. Configuring a REAL (float) tag as DINT parses the float's bytes as an integer, yielding a meaningless large number. Confirm the actual type of each tag in the PLC project before onboarding.
Further Reading
- Driver — the general driver model and registration mechanism
- Attributes and Config — the three-layer origin of attributes like
host/tagName - Device Onboarding — a complete onboarding flow
- Modbus TCP Driver — register-addressed Modbus