> For the complete documentation index, see [llms.txt](https://docs.cybus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cybus.io/2-4-2/guides/machine-connectivity/robots-sensors-shop-floor-devices/connecting-a-siemens-sentron-pac3200-power-meter.md).

# Connecting a Siemens SENTRON PAC3200 Power Meter

This guide shows you how to read energy measurements from a Siemens SENTRON PAC3200 power monitoring device with the Connectware [Modbus/TCP connector](/2-4-2/connectors/shop-floor-connectors/modbus-tcp.md) and map them into an ISA-95 style MQTT topic hierarchy. The measurements collected here (voltage, current, power, power factor, frequency, and energy counters) are the typical input for energy monitoring dashboards and ISO 50001 energy management reporting. In more detail, the following topics are covered:

* Enabling Modbus/TCP on the SENTRON PAC3200
* Identifying the Modbus registers of the measured variables and energy counters
* Decoding the Float and Double values with the correct `dataType`
* Creating the [service commissioning file](/2-4-2/data-flows/service-commissioning-files.md)
* Mapping the measurements into an ISA-95 style MQTT topic hierarchy
* Verifying data in the [Data Explorer](/2-4-2/monitoring/data-explorer.md)

This guide focuses on the PAC3200 specifics. For a general introduction to the Modbus/TCP connector, including function codes and write operations, see [Connecting & Integrating a Modbus/TCP Server](/2-4-2/guides/machine-connectivity/gateways-generic-protocols/connecting-and-integrating-a-modbus-tcp-server.md).

A complete example file is available at the end of this guide.

## Prerequisites

To follow this guide, you will need the following:

* A running instance of Cybus Connectware.
* A Siemens SENTRON PAC3200 that is reachable over Ethernet from Connectware. The closely related SENTRON PAC4200 uses the same register offsets for all values in this guide, so the example works for both devices.
* Access to the [Admin UI](/2-4-2/access/admin-ui.md) with sufficient [user permissions](/2-4-2/access/user-management.md).
* Basic knowledge of MQTT and the Connectware [services](/2-4-2/data-flows/services.md) concept (for example, [service commissioning files](/2-4-2/data-flows/service-commissioning-files.md), [connections](/2-4-2/data-flows/service-commissioning-files/resources/cybus-connection.md), and [endpoints](/2-4-2/data-flows/service-commissioning-files/resources/cybus-endpoint.md)).

## Enabling Modbus/TCP on the Device

The PAC3200 ships with the Siemens SEAbus TCP protocol enabled on its Ethernet port, not Modbus/TCP. Before Connectware can connect, switch the protocol on the device:

1. On the device, press **F4** and go to **SETTINGS > COMMUNICATION**.
2. Check the entries **IP ADDRESS**, **SUBNET**, and **GATEWAY**, and set them to values that make the device reachable from Connectware.
3. Change the **PROTOCOL** entry from **SEAbus TCP** to **MODBUS TCP**.
4. Confirm the restart prompt. The settings become effective after the restart.

The device then accepts Modbus/TCP connections on port 502. Connectware addresses the meter by its IP address; the default unit ID 1 of the Connectware Modbus connection works for a PAC3200 that is connected directly over its Ethernet port. If you reach the meter through a Modbus gateway instead, set the `unitId` connection property to the address of the meter behind the gateway.

## Identifying the Modbus Registers

The PAC3200 provides all measured variables as holding registers that you can read with function code 3 (`0x03`) or 4 (`0x04`). The complete register table is in the [SENTRON PAC3200 system manual](https://support.industry.siemens.com/cs/ww/en/view/26504150), chapter "Ethernet port", table "Available measured variables". The following registers are used in this guide:

| Offset | Number of registers | Name                          | Format | Unit |
| -----: | ------------------: | ----------------------------- | ------ | ---- |
|      1 |                   2 | Voltage V a-n (L1-N)          | Float  | V    |
|     13 |                   2 | Current a (L1)                | Float  | A    |
|     55 |                   2 | Frequency                     | Float  | Hz   |
|     63 |                   2 | Total Apparent Power          | Float  | VA   |
|     65 |                   2 | Total Active Power            | Float  | W    |
|     67 |                   2 | Total Reactive Power          | Float  | var  |
|     69 |                   2 | Total Power Factor            | Float  | -    |
|    801 |                   4 | Active Energy Import Tariff 1 | Double | Wh   |
|    809 |                   4 | Active Energy Export Tariff 1 | Double | Wh   |

Siemens labels the phases a, b, and c, which correspond to L1, L2, and L3. The registers of the remaining phases follow the same pattern: voltages L2-N and L3-N are at offsets 3 and 5, currents L2 and L3 at offsets 15 and 17. The energy counters for tariff 2 and the reactive energy counters continue in steps of four registers after offset 801.

{% hint style="warning" %}
Read each value at its exact start offset and with its exact register count. The PAC3200 returns a Modbus error code if a read starts in the middle of a multi-register value.
{% endhint %}

### Decoding Float and Double Values

Modbus registers are 16 bits long, so one measured value spans several registers. The PAC3200 transmits multi-register values in standard Modbus big-endian order, with the most significant register first. This maps directly to the Connectware [Modbus data types](/2-4-2/connectors/shop-floor-connectors/modbus-tcp.md#supported-data-types):

* **Float** values (IEEE 754, 32-bit) span two registers: set `length: 2` and `dataType: floatBE`.
* **Double** values (IEEE 754, 64-bit) span four registers: set `length: 4` and `dataType: doubleBE`.

With the `dataType` property set, Connectware decodes the registers and publishes a plain JSON number. Without it, you receive a raw buffer that you would have to parse yourself. For all available data types, see [Modbus/TCP Endpoint Properties](/2-4-2/connectors/shop-floor-connectors/modbus-tcp/modbusendpoint.md).

## Writing the Service Commissioning File

The service commissioning file contains all connection and mapping details. Do not worry about copying the snippets together into one file, the complete example file is available at the end of this guide.

### Description and Metadata

These sections contain general information about the service commissioning file. Only the metadata name is required.

{% code lineNumbers="true" %}

```yaml
description: >
  Service commissioning file that reads energy measurements from a Siemens
  SENTRON PAC3200 power meter over Modbus/TCP and maps them into an ISA-95
  style MQTT topic hierarchy (Example)

metadata:
  name: Siemens SENTRON PAC3200 Example
  provider: cybus
  homepage: https://www.cybus.io
  version: 1.0.0
```

{% endcode %}

### Parameters and Definitions

We define the network address of the meter as parameters, so you can set them when you install the service. The default Modbus/TCP port is 502.

The MQTT topics in this guide follow an ISA-95 style equipment hierarchy with an `energy` branch (`<enterprise>/<site>/<area>/<line>/energy`). We define the prefix once in the `definitions` section and reuse it in every mapping with `!sub`.

{% code lineNumbers="true" %}

```yaml
parameters:
  pac3200Host:
    description: Hostname or IP address of the SENTRON PAC3200
    type: string
    default: 192.168.1.100

  pac3200Port:
    description: Modbus/TCP port of the SENTRON PAC3200
    type: integer
    default: 502

definitions:
  MQTT_TOPIC_PREFIX: enterprise/hamburg/assembly/line-1/energy
```

{% endcode %}

### Cybus::Connection

The connection resource establishes the Modbus/TCP connection to the meter. The `connectionStrategy` object controls how Connectware retries failed connection attempts with increasing delays. For all connection properties, including `unitId`, see [Modbus/TCP Connection Properties](/2-4-2/connectors/shop-floor-connectors/modbus-tcp/modbusconnection.md).

{% code lineNumbers="true" %}

```yaml
resources:
  pac3200Connection:
    type: Cybus::Connection
    properties:
      protocol: Modbus
      targetState: connected
      connection:
        host: !ref pac3200Host
        port: !ref pac3200Port
        connectionStrategy:
          initialDelay: 1000
          maxDelay: 30000
          incrementFactor: 2
```

{% endcode %}

### Cybus::Endpoint

Each endpoint polls one measured variable. The `address` and `length` values come directly from the register table: the offset becomes `address`, the number of registers becomes `length`. The instantaneous measurements are polled every two seconds.

{% code lineNumbers="true" %}

```yaml
voltageL1:
  type: Cybus::Endpoint
  properties:
    protocol: Modbus
    connection: !ref pac3200Connection
    subscribe:
      fc: 3
      address: 1
      length: 2
      dataType: floatBE
      interval: 2000

currentL1:
  type: Cybus::Endpoint
  properties:
    protocol: Modbus
    connection: !ref pac3200Connection
    subscribe:
      fc: 3
      address: 13
      length: 2
      dataType: floatBE
      interval: 2000

frequency:
  type: Cybus::Endpoint
  properties:
    protocol: Modbus
    connection: !ref pac3200Connection
    subscribe:
      fc: 3
      address: 55
      length: 2
      dataType: floatBE
      interval: 2000

totalApparentPower:
  type: Cybus::Endpoint
  properties:
    protocol: Modbus
    connection: !ref pac3200Connection
    subscribe:
      fc: 3
      address: 63
      length: 2
      dataType: floatBE
      interval: 2000

totalActivePower:
  type: Cybus::Endpoint
  properties:
    protocol: Modbus
    connection: !ref pac3200Connection
    subscribe:
      fc: 3
      address: 65
      length: 2
      dataType: floatBE
      interval: 2000

totalReactivePower:
  type: Cybus::Endpoint
  properties:
    protocol: Modbus
    connection: !ref pac3200Connection
    subscribe:
      fc: 3
      address: 67
      length: 2
      dataType: floatBE
      interval: 2000

totalPowerFactor:
  type: Cybus::Endpoint
  properties:
    protocol: Modbus
    connection: !ref pac3200Connection
    subscribe:
      fc: 3
      address: 69
      length: 2
      dataType: floatBE
      interval: 2000
```

{% endcode %}

The energy counters are Double values across four registers, and they change slowly. A longer poll interval of ten seconds is sufficient for energy monitoring and reduces the load on the meter.

{% code lineNumbers="true" %}

```yaml
activeEnergyImport:
  type: Cybus::Endpoint
  properties:
    protocol: Modbus
    connection: !ref pac3200Connection
    subscribe:
      fc: 3
      address: 801
      length: 4
      dataType: doubleBE
      interval: 10000

activeEnergyExport:
  type: Cybus::Endpoint
  properties:
    protocol: Modbus
    connection: !ref pac3200Connection
    subscribe:
      fc: 3
      address: 809
      length: 4
      dataType: doubleBE
      interval: 10000
```

{% endcode %}

{% hint style="info" %}
If you poll many endpoints, enable [batch read processing](/2-4-2/connectors/shop-floor-connectors/modbus-tcp.md#batch-read-processing) on the connection. Connectware then combines reads of neighboring registers, such as the power values at offsets 63 to 69, into a single request.
{% endhint %}

### Cybus::Mapping

The mapping publishes each endpoint on a topic of the ISA-95 hierarchy.

{% code lineNumbers="true" %}

```yaml
mapping:
  type: Cybus::Mapping
  properties:
    mappings:
      - subscribe:
          endpoint: !ref voltageL1
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/voltage/l1-n'
      - subscribe:
          endpoint: !ref currentL1
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/current/l1'
      - subscribe:
          endpoint: !ref frequency
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/frequency'
      - subscribe:
          endpoint: !ref totalApparentPower
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/power/apparent'
      - subscribe:
          endpoint: !ref totalActivePower
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/power/active'
      - subscribe:
          endpoint: !ref totalReactivePower
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/power/reactive'
      - subscribe:
          endpoint: !ref totalPowerFactor
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/power-factor'
      - subscribe:
          endpoint: !ref activeEnergyImport
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/energy/active-import'
      - subscribe:
          endpoint: !ref activeEnergyExport
        publish:
          topic: !sub '${MQTT_TOPIC_PREFIX}/energy/active-export'
```

{% endcode %}

With this mapping, the total active power of the line is published on the topic `enterprise/hamburg/assembly/line-1/energy/power/active`, and every other measurement follows the same pattern.

## Installing the Service Commissioning File

1. Install the service commissioning file. See [Installing Services](/2-4-2/data-flows/services/managing/installing.md).
2. Enable the service. See [Enabling Services](/2-4-2/data-flows/services/managing/enabling.md).

**Result:** The service is enabled. Connectware establishes the Modbus/TCP connection to the PAC3200 and polls the configured registers.

## Verifying the Data

Open the [Data Explorer](/2-4-2/monitoring/data-explorer.md) and subscribe to `enterprise/hamburg/assembly/line-1/energy/#`. Each topic carries a JSON object with the keys `timestamp` and `value`, where the value is the decoded measurement:

{% code lineNumbers="true" %}

```json
{
  "timestamp": 1784194200354,
  "value": 8462.75
}
```

{% endcode %}

A few plausibility checks for the first readings:

* The voltage on `voltage/l1-n` matches your grid, for example around 230 V in Europe.
* The frequency is between 45 and 65 Hz, typically 50 or 60 Hz.
* The active energy import counter matches the counter reading on the device display and only increases over time.

If the connection does not reach the **Connected** state, verify that the device protocol is set to **MODBUS TCP** and that port 502 is reachable from Connectware. If values arrive but look implausible (for example, extremely large or near-zero numbers), the register decoding does not match: check that `address`, `length`, and `dataType` correspond to one row of the register table, and that reads do not start in the middle of a multi-register value.

## Service Commissioning File Example

{% file src="/files/zc0zJ5aKlxUTVPeophzQ" %}

{% code title="sentron-pac3200-example.yml" lineNumbers="true" expandable="true" %}

```yaml
---
# ----------------------------------------------------------------------------
# Service Commissioning File
# ----------------------------------------------------------------------------
# Copyright: Cybus GmbH
# Contact: support@cybus.io
# ----------------------------------------------------------------------------
# Connecting a Siemens SENTRON PAC3200 Power Meter (Example)
# ----------------------------------------------------------------------------

description: >
  Service commissioning file that reads energy measurements from a Siemens
  SENTRON PAC3200 power meter over Modbus/TCP and maps them into an ISA-95
  style MQTT topic hierarchy (Example)

metadata:
  name: Siemens SENTRON PAC3200 Example
  provider: cybus
  homepage: https://www.cybus.io
  version: 1.0.0

parameters:
  pac3200Host:
    description: Hostname or IP address of the SENTRON PAC3200
    type: string
    default: 192.168.1.100

  pac3200Port:
    description: Modbus/TCP port of the SENTRON PAC3200
    type: integer
    default: 502

definitions:
  # ISA-95 style topic prefix: <enterprise>/<site>/<area>/<line>/energy
  MQTT_TOPIC_PREFIX: enterprise/hamburg/assembly/line-1/energy

resources:
  # Connection to the SENTRON PAC3200 (Modbus/TCP over the Ethernet port)
  pac3200Connection:
    type: Cybus::Connection
    properties:
      protocol: Modbus
      targetState: connected
      connection:
        host: !ref pac3200Host
        port: !ref pac3200Port
        connectionStrategy:
          initialDelay: 1000
          maxDelay: 30000
          incrementFactor: 2

  # Instantaneous measured variables: Float format, two registers each,
  # decoded with floatBE (IEEE 754, big-endian register order).
  # Offsets from the SENTRON PAC3200 system manual, table "Available
  # measured variables" (function codes 0x03 and 0x04).
  voltageL1:
    type: Cybus::Endpoint
    properties:
      protocol: Modbus
      connection: !ref pac3200Connection
      subscribe:
        fc: 3
        address: 1
        length: 2
        dataType: floatBE
        interval: 2000

  currentL1:
    type: Cybus::Endpoint
    properties:
      protocol: Modbus
      connection: !ref pac3200Connection
      subscribe:
        fc: 3
        address: 13
        length: 2
        dataType: floatBE
        interval: 2000

  frequency:
    type: Cybus::Endpoint
    properties:
      protocol: Modbus
      connection: !ref pac3200Connection
      subscribe:
        fc: 3
        address: 55
        length: 2
        dataType: floatBE
        interval: 2000

  totalApparentPower:
    type: Cybus::Endpoint
    properties:
      protocol: Modbus
      connection: !ref pac3200Connection
      subscribe:
        fc: 3
        address: 63
        length: 2
        dataType: floatBE
        interval: 2000

  totalActivePower:
    type: Cybus::Endpoint
    properties:
      protocol: Modbus
      connection: !ref pac3200Connection
      subscribe:
        fc: 3
        address: 65
        length: 2
        dataType: floatBE
        interval: 2000

  totalReactivePower:
    type: Cybus::Endpoint
    properties:
      protocol: Modbus
      connection: !ref pac3200Connection
      subscribe:
        fc: 3
        address: 67
        length: 2
        dataType: floatBE
        interval: 2000

  totalPowerFactor:
    type: Cybus::Endpoint
    properties:
      protocol: Modbus
      connection: !ref pac3200Connection
      subscribe:
        fc: 3
        address: 69
        length: 2
        dataType: floatBE
        interval: 2000

  # Energy counters: Double format, four registers each, decoded with
  # doubleBE (IEEE 754 double precision, big-endian register order).
  # Counters change slowly, so a longer poll interval is sufficient.
  activeEnergyImport:
    type: Cybus::Endpoint
    properties:
      protocol: Modbus
      connection: !ref pac3200Connection
      subscribe:
        fc: 3
        address: 801
        length: 4
        dataType: doubleBE
        interval: 10000

  activeEnergyExport:
    type: Cybus::Endpoint
    properties:
      protocol: Modbus
      connection: !ref pac3200Connection
      subscribe:
        fc: 3
        address: 809
        length: 4
        dataType: doubleBE
        interval: 10000

  mapping:
    type: Cybus::Mapping
    properties:
      mappings:
        - subscribe:
            endpoint: !ref voltageL1
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/voltage/l1-n'
        - subscribe:
            endpoint: !ref currentL1
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/current/l1'
        - subscribe:
            endpoint: !ref frequency
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/frequency'
        - subscribe:
            endpoint: !ref totalApparentPower
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/power/apparent'
        - subscribe:
            endpoint: !ref totalActivePower
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/power/active'
        - subscribe:
            endpoint: !ref totalReactivePower
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/power/reactive'
        - subscribe:
            endpoint: !ref totalPowerFactor
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/power-factor'
        - subscribe:
            endpoint: !ref activeEnergyImport
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/energy/active-import'
        - subscribe:
            endpoint: !ref activeEnergyExport
          publish:
            topic: !sub '${MQTT_TOPIC_PREFIX}/energy/active-export'
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cybus.io/2-4-2/guides/machine-connectivity/robots-sensors-shop-floor-devices/connecting-a-siemens-sentron-pac3200-power-meter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
