Logix
Logix
Logix is the tag-based addressing style used by Allen-Bradley/Rockwell ControlLogix, CompactLogix and similar controllers that speak CIP (Common Industrial Protocol) over EtherNet/IP.
This page covers the logix driver code, which is registered by the same eip module and shares its Java tag class - see EtherNet/IP for the generic CIP symbolic-addressing page that documents the same tag syntax.
Supported Operations
| Name | Value | Description |
|---|---|---|
read | Go and Java. Reads one or more tags, or a selection of an array tag. | |
write | Go and Java. Writes one or more tags, or a selection of an array tag. | |
subscribe | Java only, polling-emulated. EtherNet/IP has no push mechanism here, so a subscription is a periodic read underneath, not a device-initiated notification. | |
discover | Go only. Device discovery is available separately through the discovery API, not through browse. The Java LogixDriver does not implement discovery. |
Connection String
Logix has the following connection string format:
logix:tcp://{ip-address}:{port}?{options}tcp is the only supported transport. The port and options are optional. An example connection string would look like:
logix:tcp://127.0.0.1:44818?communication-path=[1,1]Connection String Options
Name
Type
Default Value
Required
Description
Name
Logix CIP
Code
logix
Maven Dependency
<dependency>
<groupId>org.apache.plc4x</groupId>
<artifactId>plc4j-driver-eip</artifactId>
<version>1.0.0</version>
</dependency>Default Transport
tcp
Supported Transports
tcp
Config options:
big-endian
BOOLEAN
true
Configure if the connection should be set to transport data in Big-Endian format, or not.
connection-serial-number
INT
0
Connection serial number to use in Forward_Open. CIP wants this unique per connection, so the default of 0 means 'pick a random one per connection'. Set it explicitly only when the exchange has to be reproducible, e.g. in recorded tests.
Since: 1.0.0
force-unconnected-operation
BOOLEAN
false
Forces the driver to use unconnected requests.
Since: 0.13.0
request-timeout-ms
INT
10000
Default timeout for all types of requests.
communication-path
STRING
The communication path allows for connection routing across multiple backplanes. It uses a common format found in Logix controllers.
It consists of pairs of values, each pair begins with either 1 (Backplane) or 2 (Ethernet), followed by a slot in the case of a backplane address, or if using Ethernet an ip address. e.g. [1,4,2,192.168.0.1,1,1] - Routes to the 4th slot in the first rack, which is an Ethernet module, it then connects to the address 192.168.0.1, then finds the module in slot 1.
Transport config options:
tcp
tcp.connect-timeout-ms
INT
5000
Connection timeout in milliseconds.
tcp.read-timeout-ms
INT
0
Socket read timeout in milliseconds. 0 means no timeout.
tcp.write-timeout-ms
INT
0
Socket write timeout in milliseconds. 0 means no timeout.
tcp.no-delay
BOOLEAN
true
Enable TCP_NODELAY (disable Nagle’s algorithm).
tcp.keep-alive
BOOLEAN
false
Enable SO_KEEPALIVE.
tcp.send-buffer-size
INT
81920
Send buffer size in bytes. 0 uses system default.
tcp.receive-buffer-size
INT
81920
Receive buffer size in bytes. 0 uses system default.
tcp.local-address
STRING
Local address to bind to (optional). If not set, uses default.
tcp.local-port
INT
0
Local port to bind to (optional). 0 uses ephemeral port.
Tag Addresses
Addressing is implemented in Go and Java. See the protocol support matrix for what each implementation does.
General Format
To read and write data to a PLC4X device, the Logix driver uses symbolic segments. This is used to refer to objects through their symbolic names. This makes reading data a lot easier, as you do not need to specify the Datatype for reading.
{tagname}
{tagname}:{DataType}
{tagname}[{selection}]
{tagname}[{selection}]:{DataType}| Name | Description |
|---|---|
| Tagname | symbolic name of the data. May optionally be prefixed with %. |
| Selection (optional) | which elements of an array to read - a single index or an inclusive range. It follows the tag name, before the data type. See Addressing arrays. |
| DataType (optional) | the data type of the value. Defaults to DINT when omitted, so for anything that is not a 32-bit integer it should be given explicitly - also when reading. |
The selection comes before the data type, and a range says how many elements are read. Reading four DINTs starting at index 0 is myArray[0..3]:DINT. |
|---|
A CIP array index travels in a MemberID, whose instance field is a uint 8, so a selection cannot start past index 255. A range may run beyond it - the request carries a start and a count - but it cannot begin there. |
|---|
The Java driver’s tag name does not require a leading % - rate:DINT parses in Java. The Go driver’s address pattern requires the tag name to start with %, so the same address is rejected there. This page documents the Java syntax; consult the Go driver’s own source for what it accepts. |
|---|
Data Types
These are the data types the driver can encode and decode:
| To store | Use this data type |
|---|---|
| Bit | BOOL |
| 8-bit bit string | BYTE |
| 16-bit bit string | WORD |
| 32-bit bit string | DWORD |
| 64-bit bit string | LWORD |
| 8-bit integer | SINT |
| 16-bit integer | INT |
| 32-bit integer | DINT |
| 64-bit integer | LINT |
| 8-bit unsigned integer | USINT |
| 16-bit unsigned integer | UINT |
| 32-bit unsigned integer | UDINT |
| 64-bit unsigned integer | ULINT |
| 32-bit float | REAL |
| 64-bit float | LREAL |
| Character string | STRING |
The unsigned and bit string types cover their full range, so a UDINT or DWORD is returned in the range 0 to 4294967295 and a ULINT or LWORD in the range 0 to 18446744073709551615. Their signed counterparts are unchanged: a DINT of 0xFFFFFFFF still reads as -1. |
|---|
Other CIP data types are accepted by the address parser but are not encoded or decoded by the driver; reading such a tag results in a response code of INTERNAL_ERROR rather than a value. |
|---|
Examples
| Address | Meaning |
|---|---|
myTag | a single element of myTag, decoded as DINT |
myTag:REAL | a single element of myTag, decoded as REAL |
myTag[0..3] | four elements of myTag, decoded as DINT |
myArray[3]:DINT | element 3 of myArray |
myArray[0..3]:DINT | elements 0 to 3 of myArray, returned as a list |
%myTag:REAL | a single element of myTag, decoded as REAL - the % prefix is optional |
Table 1. Examples
评论
登录后参与评论
KnowForge