> For the complete documentation index, see [llms.txt](https://docs.voltmasters.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.voltmasters.io/device-integrations/energy-meters/generic-plc.md).

# Generic PLC

Some installations do not expose their energy meter directly. The meter is read by a **PLC**, over whatever protocol that PLC happens to speak, and the PLC republishes the measurements on Modbus TCP.

The Generic PLC integration is for exactly that case: instead of supporting one more meter brand, our EMS reads a fixed, standardised block of Modbus holding registers that the PLC fills in. Any meter can be brought into the platform this way, as long as the PLC presents it in this layout.

{% hint style="info" %}
This integration requires **EMS controller version 0.0.320 or later**.
{% endhint %}

{% hint style="warning" %}
This is a monitoring-only integration. The EMS reads measurements from the PLC and cannot control anything through it.
{% endhint %}

### What the PLC has to provide

* **Modbus TCP** on the network the EMS controller can reach.
* A block of **holding registers** in the layout below.
* **Integer values only**, with the fixed scale factors below. No floats.
* **Big-endian** 32-bit values, high word first.

### Register layout

Every offset is relative to a **base register** you configure per device. That makes it possible to publish several meters from one PLC on the same slave ID: give each meter its own base register.

| Offset | Value             | Type | Unit in the register    | Scale           |
| ------ | ----------------- | ---- | ----------------------- | --------------- |
| 0      | Status            | u16  | 0 = offline, 1 = online |                 |
| 1      | Active power      | i32  | W                       | x 0.001 to kW   |
| 3      | Reactive power    | i32  | VAr                     | x 0.001 to kVAr |
| 5      | Voltage L1        | u16  | 0.1 V                   | x 0.1 to V      |
| 6      | Voltage L2        | u16  | 0.1 V                   | x 0.1 to V      |
| 7      | Voltage L3        | u16  | 0.1 V                   | x 0.1 to V      |
| 8      | Current L1        | i32  | mA                      | x 0.001 to A    |
| 10     | Current L2        | i32  | mA                      | x 0.001 to A    |
| 12     | Current L3        | i32  | mA                      | x 0.001 to A    |
| 14     | Power factor L1   | i16  | x 1000                  | x 0.001         |
| 15     | Power factor L2   | i16  | x 1000                  | x 0.001         |
| 16     | Power factor L3   | i16  | x 1000                  | x 0.001         |
| 17     | Total consumption | u32  | Wh                      | x 0.001 to kWh  |
| 19     | Total production  | u32  | Wh                      | x 0.001 to kWh  |

Active power is signed: positive is import, negative is export.

### Adding the meter to the EMS

Add an energy meter with brand **Generic** and model **PLC**, pointing at the PLC's IP address, port and slave ID. Then set:

| Setting                       | What to enter                                                                                                                 |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **Modbus base register**      | The first register of this meter's block. Defaults to **0**. With several meters on one PLC, give each its own base register. |
| **Modbus heartbeat register** | Optional. The register holding a counter that the PLC increments periodically.                                                |

### Heartbeat monitoring

The heartbeat register is optional but recommended. A PLC whose application has frozen keeps answering Modbus with the last values it wrote, so the meter looks healthy while its data quietly goes stale.

When you configure a heartbeat register, the EMS watches that counter. If it stops changing for more than **30 seconds**, the device is flagged so you can see the PLC application is no longer running.

### EMS functionality

With the current integration, our EMS enables:

* Monitoring of active and reactive power, per-phase voltage, current and power factor
* Monitoring of total imported and exported energy
* Use of the meter as a grid connection meter or as a submeter, like any other supported meter
* PLC availability and heartbeat monitoring

Additional functionality may be added over time as integration capabilities evolve.


---

# 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.voltmasters.io/device-integrations/energy-meters/generic-plc.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.
