# Communication flow - from controller to information in Omnimes

## **Communication Flow - From PLC to Information in OmniMES**

The **OmniMES** system is designed to operate in industrial environments where data originates from various machines, production lines, and peripheral devices. A key design principle is **complete independence from specific equipment manufacturers** - provided that the data is ultimately exposed in the **MQTT Sparkplug B** standard.

 ![](https://docs.omnimes.com/api/files.get?sig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJ1cGxvYWRzL2RmMTUxNTFiLThmMzItNDVkNi1iZjE4LTZmZmZhNjg4ZGIwNy9iNWQ0ZmVkZC04MjQ2LTRkZDktYjE1Ny0zNjQ0MDdlZjNjZDcvaW1hZ2UucG5nIiwidHlwZSI6ImF0dGFjaG1lbnQiLCJpYXQiOjE3OTU0MzA3MDAsImV4cCI6MTc5NTUxNzEwMH0.MYcF9J19V_bnysq1uyFBMcajM4KUsH9AkWfbCj9T1dI " =1338x586")


---

### 1. **PLC (Programmable Logic Controller)** - source of production data

PLCs (e.g., Fatek, Siemens, Allen-Bradley, WAGO) are responsible for directly controlling machines. They collect data such as:

* current cycle status (production / downtime / failure),
* production counters,
* cycle durations,
* analog values (e.g., temperature, pressure),
* diagnostic signals.

This data is available within the PLC as registers, flags, or variables (e.g., `M123.0`, `DB20.DBD12`, `Tag1`, etc.).


---

### 2. **Communication Gateway** - transforming data to MQTT Sparkplug B

The gateway (hardware or software) connects to the PLC using industrial protocols:

* **Modbus RTU/TCP**
* **OPC UA**
* **S7 Communication**
* **EtherNet/IP**, etc.

The gathered data is:

* **read cyclically** (e.g., every 1 second),
* **mapped to Sparkplug B metrics** (`metric.name`, `metric.value`, `metric.datatype`),
* **encapsulated into an MQTT Sparkplug B message** (according to *birth message* or *data message* structure),
* and **published to the MQTT broker** under the appropriate topic (e.g., `spBv1.0/Line1/Device1/DBIRTH`).


---

### 3. **MQTT Broker (e.g., EMQX, Mosquitto)** - data distribution hub

The broker acts as the central communication node. Its responsibilities include:

* maintaining sessions for publishers (gateways) and subscribers (OmniMES),
* queuing and transmitting messages in real time,
* managing connection statuses (e.g., automatically notifying about lost device connectivity via *DEATH* messages).

OmniMES subscribes to specific broker topics and receives data as soon as it is published.


---

### 4. **OmniMES System** - analysis, processing, and visualization

OmniMES receives MQTT Sparkplug B data and performs several operations:

#### *Decoding and validation*

* Interpreting metrics from Sparkplug B messages.
* Validating data types, units, and sources.

#### *Buffering and storing to database*

* Data is stored in **PostgreSQL + TimescaleDB** (a time-series database, TSDB), with appropriate timestamps.
* The system may apply aggregation, throttling, or duplicate filtering.

#### *Analysis and business logic*

* Calculating KPIs (OEE, MTBF, performance).
* Detecting anomalies, downtimes, and failures.
* Triggering alerts or automated actions.

#### *Visualization and reporting*

* Converting data into charts, dashboards, and PDF reports.
* Supporting scheduling, shift-based comparisons, CSV/Excel exports.

---

**Documents**

- [OmniPlatform](https://docs.omnimes.com/s/cb8b19e0-ec6d-4e1a-8690-b0ddd67ad1cd/doc/omniplatform-7z9SIECi68)
- [Omnienergy](https://docs.omnimes.com/s/cb8b19e0-ec6d-4e1a-8690-b0ddd67ad1cd/doc/omnienergy-56aRDgnYFZ)
- [Omnimes](https://docs.omnimes.com/s/cb8b19e0-ec6d-4e1a-8690-b0ddd67ad1cd/doc/omnimes-eGDa0U5cyr)
- [FAQ](https://docs.omnimes.com/s/cb8b19e0-ec6d-4e1a-8690-b0ddd67ad1cd/doc/faq-IFQjCNYt1Q)
- [Cybersecurity & Compliance (CRA)](https://docs.omnimes.com/s/cb8b19e0-ec6d-4e1a-8690-b0ddd67ad1cd/doc/cybersecurity-compliance-cra-pPJBcC6sBf)