> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Allen-Bradley Route

> Connect to Rockwell Automation Allen-Bradley PLCs including ControlLogix, CompactLogix, and MicroLogix

## Allen-Bradley Overview

The `ALLEN_BRADLEY` route enables communication with Rockwell Automation PLCs using native protocols. It supports ControlLogix, CompactLogix, PLC5, SLC500, Micro800, and MicroLogix families with TAG-based addressing and bidirectional communication.

<Tip>
  Allen-Bradley PLCs use tag-based programming. Access PLC tags directly by their symbolic names for the most intuitive configuration.
</Tip>

<Warning>
  The Allen-Bradley route is on beta testing. It is planned for a future release.
</Warning>

## Basic Syntax

```lot theme={null}
DEFINE ROUTE AllenBradleyPLC WITH TYPE ALLEN_BRADLEY
    ADD ALLEN_BRADLEY_CONFIG
        WITH IP "192.168.1.100"
        WITH DEVICE_FAMILY 0
        WITH SLOT 0
    ADD MAPPING ProcessData
        WITH EVERY 500 MILLISECONDS
        ADD TAG Temperature
            WITH ADDRESS "MainProgram:Temperature"
            WITH DATA_TYPE "REAL"
            WITH SOURCE_TOPIC "plc/temperature"
```

***

## Supported Device Families

| Device Family     | Parameter Value | Description                    |
| ----------------- | --------------- | ------------------------------ |
| ControlLogix      | `0`             | ControlLogix 5000 series       |
| PLC5              | `1`             | PLC/5 processors               |
| SLC500            | `2`             | SLC 500 processors             |
| ControlLogix PLC5 | `3`             | PLC5 emulation on ControlLogix |
| Micro800          | `4`             | Micro800 series                |
| MicroLogix        | `5`             | MicroLogix 1100/1400           |
| Omron             | `6`             | Omron NJ/NX (CIP compatible)   |

<Note>
  ControlLogix (0) is the most common setting for modern Allen-Bradley systems including CompactLogix and ControlLogix PLCs.
</Note>

***

## Connection Configuration

### ALLEN\_BRADLEY\_CONFIG Parameters

<ParamField path="IP" type="string" required>
  PLC IP address.
</ParamField>

<ParamField path="DEVICE_FAMILY" type="integer">
  Device family type (0-6, see table above). Default: 0 (ControlLogix).
</ParamField>

<ParamField path="PORT" type="integer">
  Communication port. Default: 44818.
</ParamField>

<ParamField path="SLOT" type="integer">
  CPU slot number in chassis. Default: 0.
</ParamField>

<ParamField path="PATH" type="string">
  Routing path for accessing PLCs through network infrastructure. Format: `port,slot` pairs separated by commas.
</ParamField>

<ParamField path="TIMEOUT" type="integer">
  Connection timeout in milliseconds. Default: 5000.
</ParamField>

### Connection Examples

<Tabs>
  <Tab title="ControlLogix/CompactLogix">
    Direct connection to ControlLogix or CompactLogix:

    ```lot theme={null}
    ADD ALLEN_BRADLEY_CONFIG
        WITH IP "192.168.1.100"
        WITH DEVICE_FAMILY 0
        WITH SLOT 0
        WITH TIMEOUT 5000
    ```
  </Tab>

  <Tab title="MicroLogix">
    Connection to MicroLogix 1100/1400:

    ```lot theme={null}
    ADD ALLEN_BRADLEY_CONFIG
        WITH IP "192.168.1.50"
        WITH DEVICE_FAMILY 5
        WITH TIMEOUT 5000
    ```
  </Tab>

  <Tab title="Through Backplane">
    Access PLC in slot 2 through Ethernet module in slot 0:

    ```lot theme={null}
    ADD ALLEN_BRADLEY_CONFIG
        WITH IP "192.168.1.100"
        WITH DEVICE_FAMILY 0
        WITH PATH "1,2"
        WITH TIMEOUT 5000
    ```
  </Tab>

  <Tab title="Multi-Hop Routing">
    Route through multiple network bridges:

    ```lot theme={null}
    ADD ALLEN_BRADLEY_CONFIG
        WITH IP "192.168.1.100"
        WITH DEVICE_FAMILY 0
        WITH PATH "1,0,2,192.168.2.50,1,0"
        WITH TIMEOUT 10000
    ```

    <Note>
      Multi-hop paths: `port,slot,port,IP,port,slot` where each segment navigates through chassis and networks.
    </Note>
  </Tab>
</Tabs>

***

## Tag Addressing

Allen-Bradley uses symbolic tag names. The address format depends on the tag scope:

| Scope         | Format            | Example               |
| ------------- | ----------------- | --------------------- |
| Controller    | `TagName`         | `Temperature`         |
| Program       | `Program:TagName` | `MainProgram:Counter` |
| Array element | `TagName[index]`  | `Temperatures[0]`     |
| UDT member    | `TagName.Member`  | `Motor1.Speed`        |

***

## Data Types

| Data Type          | Logix Type | Size     | Description                               |
| ------------------ | ---------- | -------- | ----------------------------------------- |
| `BOOL`             | BOOL       | 1 bit    | Boolean value                             |
| `BYTE`             | BYTE       | 8 bits   | Unsigned 8-bit                            |
| `SINT`             | SINT       | 8 bits   | Signed 8-bit integer                      |
| `USINT`            | USINT      | 8 bits   | Unsigned 8-bit integer                    |
| `INT`              | INT        | 16 bits  | Signed 16-bit integer                     |
| `UINT` / `WORD`    | UINT       | 16 bits  | Unsigned 16-bit integer                   |
| `DINT`             | DINT       | 32 bits  | Signed 32-bit integer                     |
| `UDINT` / `DWORD`  | UDINT      | 32 bits  | Unsigned 32-bit integer                   |
| `LINT`             | LINT       | 64 bits  | Signed 64-bit integer                     |
| `ULINT` / `LWORD`  | ULINT      | 64 bits  | Unsigned 64-bit integer                   |
| `REAL` / `FLOAT`   | REAL       | 32 bits  | 32-bit floating point                     |
| `LREAL` / `DOUBLE` | LREAL      | 64 bits  | 64-bit floating point                     |
| `CHAR`             | CHAR       | 8 bits   | Single character                          |
| `WCHAR`            | WCHAR      | 16 bits  | Wide character                            |
| `TIME`             | TIME       | 32 bits  | Time duration                             |
| `DATE`             | DATE       | 16 bits  | Date value                                |
| `TOD`              | TOD        | 32 bits  | Time of day                               |
| `STRING`           | STRING     | Variable | ASCII string (configurable `STRING_SIZE`) |

***

## TAG Configuration

### Complete TAG Example

```lot theme={null}
ADD TAG MotorSpeed
    WITH ADDRESS "Motor1.ActualSpeed"
    WITH ADDRESS_TYPE "SYMBOL"
    WITH DATA_TYPE "REAL"
    WITH SOURCE_TOPIC "plc/motor1/speed"
    WITH SCALING 1
    WITH OFFSET 0
    WITH UNIT "RPM"
    WITH DECIMAL_PLACES 2
    WITH MIN_VALUE 0
    WITH MAX_VALUE 3600
    WITH DEADBAND 10
    WITH PUBLISH_MODE "JSON"
    WITH WRITABLE "false"
    WITH DESCRIPTION "Motor 1 actual speed in RPM"
```

### TAG Parameters

<AccordionGroup>
  <Accordion title="Address Configuration">
    <ParamField path="ADDRESS" type="string" required>
      Tag name in PLC (e.g., `MainProgram:Temperature`, `Motor1.Speed`, `Temperatures[0]`).
    </ParamField>

    <ParamField path="ADDRESS_TYPE" type="string">
      Address type: `SYMBOL` (default) or `PATH`.
    </ParamField>

    <ParamField path="DATA_TYPE" type="string" required>
      Logix data type: `BOOL`, `SINT`, `INT`, `DINT`, `LINT`, `USINT`, `UINT`, `UDINT`, `ULINT`, `REAL`, `LREAL`, `STRING`.
    </ParamField>
  </Accordion>

  <Accordion title="Value Transformation">
    <ParamField path="SCALING" type="double">
      Multiplier for value transformation. Default: 1.0.
    </ParamField>

    <ParamField path="OFFSET" type="double">
      Offset added after scaling. Default: 0.0.
    </ParamField>

    <ParamField path="DECIMAL_PLACES" type="integer">
      Decimal places in output. Default: 2.
    </ParamField>
  </Accordion>

  <Accordion title="Filtering">
    <ParamField path="MIN_VALUE" type="double">
      Minimum allowed value.
    </ParamField>

    <ParamField path="MAX_VALUE" type="double">
      Maximum allowed value.
    </ParamField>

    <ParamField path="DEADBAND" type="double">
      Minimum change to trigger publish. Default: 0.0.
    </ParamField>
  </Accordion>

  <Accordion title="Publishing">
    <ParamField path="SOURCE_TOPIC" type="string" required>
      Topic where PLC values are published. Subscribe here to receive sensor data.
    </ParamField>

    <ParamField path="DESTINATION_TOPIC" type="string">
      Topic to send write commands. Publish a value here to write it to the PLC.
    </ParamField>

    <ParamField path="PUBLISH_MODE" type="string">
      Output format: `VALUE_ONLY` or `JSON`. Default: VALUE\_ONLY.
    </ParamField>

    <ParamField path="UNIT" type="string">
      Engineering unit for documentation.
    </ParamField>

    <ParamField path="DESCRIPTION" type="string">
      Human-readable description.
    </ParamField>
  </Accordion>

  <Accordion title="Write Configuration">
    <ParamField path="WRITABLE" type="boolean">
      Allow writing to this tag. Default: false.
    </ParamField>
  </Accordion>
</AccordionGroup>

***

## Event-Based Operations

For on-demand Allen-Bradley operations (not polling), use the EVENT syntax. Publish a message to SOURCE\_TOPIC to trigger the operation; the route executes it and publishes the result to DESTINATION\_TOPIC.

### Supported Operations

| Operation | Description                | Query Parameters                 |
| --------- | -------------------------- | -------------------------------- |
| `READ`    | Read a tag value on demand | `variable`, `data_type`          |
| `WRITE`   | Write a value to a tag     | `variable`, `data_type`, `value` |

### Query Parameters

| Parameter   | Description                             | Example                              |
| ----------- | --------------------------------------- | ------------------------------------ |
| `operation` | Operation type: `READ` or `WRITE`       | `READ`                               |
| `variable`  | Tag name (controller or program scoped) | `MainProgram:Counter`, `Temperature` |
| `data_type` | Logix data type                         | `DINT`, `REAL`, `BOOL`, `STRING`     |
| `value`     | Value to write (WRITE only)             | `42`, `75.0`, `true`                 |

### Read Example

Read a program-scoped counter on demand:

```lot theme={null}
ADD EVENT ReadOnDemand
    WITH SOURCE_TOPIC "ab/commands/read"
    WITH DESTINATION_TOPIC "ab/responses/read"
    WITH QUERY "{operation: READ, variable: MainProgram:Counter, data_type: DINT}"
```

### Write Example

Write a REAL setpoint on demand:

```lot theme={null}
ADD EVENT WriteSetpoint
    WITH SOURCE_TOPIC "ab/commands/write"
    WITH DESTINATION_TOPIC "ab/responses/write"
    WITH QUERY "{operation: WRITE, variable: TIC100.SP, data_type: REAL, value: 150.0}"
```

***

## Complete Examples

<Tabs>
  <Tab title="Basic Tag Reading">
    Read controller-scoped tags:

    ```lot theme={null}
    DEFINE ROUTE ControlLogixBasic WITH TYPE ALLEN_BRADLEY
        ADD ALLEN_BRADLEY_CONFIG
            WITH IP "192.168.1.100"
            WITH DEVICE_FAMILY 0
            WITH SLOT 0
        ADD MAPPING ProcessTags
            WITH EVERY 500 MILLISECONDS
            ADD TAG Temperature
                WITH ADDRESS "Temperature"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "plc/temperature"
                WITH UNIT "°F"
            ADD TAG Pressure
                WITH ADDRESS "Pressure"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "plc/pressure"
                WITH UNIT "PSI"
            ADD TAG Running
                WITH ADDRESS "SystemRunning"
                WITH DATA_TYPE "BOOL"
                WITH SOURCE_TOPIC "plc/running"
    ```
  </Tab>

  <Tab title="Program-Scoped Tags">
    Access tags within specific programs:

    ```lot theme={null}
    DEFINE ROUTE ProgramTags WITH TYPE ALLEN_BRADLEY
        ADD ALLEN_BRADLEY_CONFIG
            WITH IP "192.168.1.100"
            WITH DEVICE_FAMILY 0
            WITH SLOT 0
        ADD MAPPING MainProgramTags
            WITH EVERY 500 MILLISECONDS
            ADD TAG Counter
                WITH ADDRESS "MainProgram:ProductionCounter"
                WITH DATA_TYPE "DINT"
                WITH SOURCE_TOPIC "plc/production/count"
            ADD TAG CycleTime
                WITH ADDRESS "MainProgram:CycleTimeMs"
                WITH DATA_TYPE "DINT"
                WITH SOURCE_TOPIC "plc/production/cycletime"
                WITH UNIT "ms"
            ADD TAG BatchNumber
                WITH ADDRESS "MainProgram:CurrentBatch"
                WITH DATA_TYPE "STRING"
                WITH SOURCE_TOPIC "plc/production/batch"
    ```
  </Tab>

  <Tab title="UDT Members">
    Access User Defined Type (UDT) members:

    ```lot theme={null}
    DEFINE ROUTE MotorControl WITH TYPE ALLEN_BRADLEY
        ADD ALLEN_BRADLEY_CONFIG
            WITH IP "192.168.1.100"
            WITH DEVICE_FAMILY 0
            WITH SLOT 0
        ADD MAPPING Motor1Data
            WITH EVERY 200 MILLISECONDS
            ADD TAG Speed
                WITH ADDRESS "Motor1.ActualSpeed"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "motor1/speed"
                WITH UNIT "RPM"
            ADD TAG Current
                WITH ADDRESS "Motor1.Current"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "motor1/current"
                WITH UNIT "A"
            ADD TAG Running
                WITH ADDRESS "Motor1.Running"
                WITH DATA_TYPE "BOOL"
                WITH SOURCE_TOPIC "motor1/running"
            ADD TAG Faulted
                WITH ADDRESS "Motor1.Faulted"
                WITH DATA_TYPE "BOOL"
                WITH SOURCE_TOPIC "motor1/faulted"
            ADD TAG SpeedCommand
                WITH ADDRESS "Motor1.SpeedCmd"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "motor1/speed/cmd"
                WITH WRITABLE "true"
                WITH DESTINATION_TOPIC "motor1/speed/set"
    ```
  </Tab>

  <Tab title="Array Access">
    Read array elements:

    ```lot theme={null}
    DEFINE ROUTE ArrayData WITH TYPE ALLEN_BRADLEY
        ADD ALLEN_BRADLEY_CONFIG
            WITH IP "192.168.1.100"
            WITH DEVICE_FAMILY 0
            WITH SLOT 0
        ADD MAPPING SensorArrays
            WITH EVERY 1 SECOND
            ADD TAG Temp0
                WITH ADDRESS "Temperatures[0]"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "sensors/temp/0"
            ADD TAG Temp1
                WITH ADDRESS "Temperatures[1]"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "sensors/temp/1"
            ADD TAG Temp2
                WITH ADDRESS "Temperatures[2]"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "sensors/temp/2"
            ADD TAG Status0
                WITH ADDRESS "StatusBits[0]"
                WITH DATA_TYPE "BOOL"
                WITH SOURCE_TOPIC "status/bit/0"
    ```
  </Tab>

  <Tab title="Bidirectional Control">
    Read values and write setpoints:

    ```lot theme={null}
    DEFINE ROUTE ControlLoop WITH TYPE ALLEN_BRADLEY
        ADD ALLEN_BRADLEY_CONFIG
            WITH IP "192.168.1.100"
            WITH DEVICE_FAMILY 0
            WITH SLOT 0
        ADD MAPPING TempControl
            WITH EVERY 200 MILLISECONDS
            ADD TAG PV
                WITH ADDRESS "TIC100.PV"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "control/tic100/pv"
                WITH UNIT "°F"
                WITH PUBLISH_MODE "JSON"
            ADD TAG SP
                WITH ADDRESS "TIC100.SP"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "control/tic100/sp"
                WITH UNIT "°F"
                WITH WRITABLE "true"
                WITH DESTINATION_TOPIC "control/tic100/sp/set"
                WITH MIN_VALUE 32
                WITH MAX_VALUE 212
            ADD TAG Output
                WITH ADDRESS "TIC100.OUT"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "control/tic100/output"
                WITH UNIT "%"
            ADD TAG Auto
                WITH ADDRESS "TIC100.Auto"
                WITH DATA_TYPE "BOOL"
                WITH SOURCE_TOPIC "control/tic100/auto"
                WITH WRITABLE "true"
                WITH DESTINATION_TOPIC "control/tic100/auto/set"
    ```
  </Tab>

  <Tab title="CompactLogix">
    CompactLogix typically in slot 0:

    ```lot theme={null}
    DEFINE ROUTE CompactLogix WITH TYPE ALLEN_BRADLEY
        ADD ALLEN_BRADLEY_CONFIG
            WITH IP "192.168.1.50"
            WITH DEVICE_FAMILY 0
            WITH SLOT 0
            WITH TIMEOUT 5000
        ADD MAPPING IOData
            WITH EVERY 100 MILLISECONDS
            ADD TAG DigitalInputs
                WITH ADDRESS "Local:1:I.Data"
                WITH DATA_TYPE "DINT"
                WITH SOURCE_TOPIC "compactlogix/di"
            ADD TAG DigitalOutputs
                WITH ADDRESS "Local:2:O.Data"
                WITH DATA_TYPE "DINT"
                WITH SOURCE_TOPIC "compactlogix/do"
                WITH WRITABLE "true"
                WITH DESTINATION_TOPIC "compactlogix/do/set"
    ```
  </Tab>

  <Tab title="Combined (Cyclic + On-Demand)">
    Continuous monitoring with on-demand read and write events in the same route:

    ```lot theme={null}
    DEFINE ROUTE FullABSetup WITH TYPE ALLEN_BRADLEY
        ADD ALLEN_BRADLEY_CONFIG
            WITH IP "192.168.1.100"
            WITH DEVICE_FAMILY 0
            WITH SLOT 0
        
        ADD MAPPING ProcessTags
            WITH EVERY 500 MILLISECONDS
            ADD TAG Temperature
                WITH ADDRESS "Temperature"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "plc/temperature"
                WITH UNIT "°F"
            ADD TAG Pressure
                WITH ADDRESS "Pressure"
                WITH DATA_TYPE "REAL"
                WITH SOURCE_TOPIC "plc/pressure"
                WITH UNIT "PSI"
        
        ADD EVENT ReadTag
            WITH SOURCE_TOPIC "ab/commands/read"
            WITH DESTINATION_TOPIC "ab/responses/read"
            WITH QUERY "{operation: READ, variable: MainProgram:ProductionCounter, data_type: DINT}"
        
        ADD EVENT WriteSetpoint
            WITH SOURCE_TOPIC "ab/commands/write"
            WITH DESTINATION_TOPIC "ab/responses/write"
            WITH QUERY "{operation: WRITE, variable: TIC100.SP, data_type: REAL, value: 0}"
    ```

    The MAPPING continuously reads temperature and pressure. To trigger an on-demand counter read, publish any message to `ab/commands/read`. To write a setpoint, publish to `ab/commands/write`.
  </Tab>
</Tabs>

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Connection Failed">
    * Verify IP address is correct
    * Check DEVICE\_FAMILY matches your PLC type
    * Ensure SLOT is correct (usually 0 for CompactLogix)
    * Verify firewall allows port 44818
    * Check PLC is in Run mode
  </Accordion>

  <Accordion title="Tag Not Found">
    * Verify tag name matches exactly (case-sensitive)
    * For program-scoped tags, include program name: `MainProgram:TagName`
    * Check tag exists in PLC project
    * Ensure tag is not local to a routine
  </Accordion>

  <Accordion title="Path Errors">
    * Verify PATH format: port,slot pairs
    * Check network modules are configured correctly
    * For IP in path, use: `port,slot,port,IP,port,slot`
    * Increase TIMEOUT for multi-hop routes
  </Accordion>

  <Accordion title="Write Operations Fail">
    * Ensure WRITABLE is set to "true"
    * Verify PLC is in Remote Run mode
    * Check tag is not constant or read-only
    * Verify value is within data type range
  </Accordion>

  <Accordion title="Data Type Mismatch">
    * Verify DATA\_TYPE matches PLC tag definition
    * REAL for floating point, DINT for 32-bit integers
    * Check array vs. single value configuration
  </Accordion>
</AccordionGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="EtherNet/IP" icon="ethernet" href="./ethernetip">
    CIP explicit messaging for Allen-Bradley and compatible devices.
  </Card>

  <Card title="Industrial Overview" icon="industry" href="./overview">
    Common patterns for all industrial routes.
  </Card>
</CardGroup>
