Ilyas Ouhnine RAG · Intelligence documentaire
All work

Chemin du Roi — industrial platform

Digital twin of an anaerobic digestion plant

Five heterogeneous real-time streams, five protocols, five notions of time — unified into one platform that plant engineers make decisions on every morning.

5 → 1protocols unified · OPC UA · Modbus · MQTT · SFTP · API
Role
AI and digital twin engineer
Period
Since November 2024

Stack

  • OPC UA
  • Modbus
  • MQTT
  • SFTP
  • TimescaleDB
  • Python
  • TensorFlow
  • FastAPI
  • React
  • Grafana
  • Docker

The problem

An anaerobic digestion plant is instrumented, but its instrumentation is an archipelago: every sensor, controller and supplier arrives with its own protocol and format. The data exists; nobody can read it together.

Operators move between several interfaces, correlate in their heads, and notice drift once it is already visible in the output. Two needs: see the process state in real time, then anticipate its behaviour.

Constraints

Five heterogeneous sources, none under our control: a business API, OPC UA, Modbus, MQTT, SFTP drops.

The field is not a datacentre. Sensors drop out, networks fail, clocks drift, some values are physically absurd.

A biological process: slow dynamics, strong inertia, non-linearities, and scarce data that cannot be multiplied by running experiments.

The users are process engineers. A black-box model that contradicts their physical intuition without being able to explain itself is never adopted.

What I built

One connector per protocol, a single time model. Protocol specifics stop at the boundary; beyond it, everything is a timestamped measurement in TimescaleDB. The real work is not speaking five protocols, it is reconciling five clocks — an analyser sampling per second, a controller per minute, an SFTP file arriving overnight for the previous day.

Absence as data, not as an accident. A naive twin interpolates everything and draws a smooth continuous curve: that is a lie by omission, because the operator can no longer tell a measurement from an extrapolation. Here, measured, aggregated and missing are explicitly distinct. That is what makes an engineer accept the tool instead of going back to spreadsheets.

Hybrid mechanistic + neural modelling. An AM2 model carries the known physics of anaerobic digestion; the learned component captures the gap between that model and this particular plant. Two benefits, and the second is the real one: it learns from little data, and it stays explainable — an error reads either as model mismatch or as sensor drift, not as opacity.

Results

  • Five heterogeneous real-time streams unified into a single platform
  • Process KPIs and sensor observability used daily in operations
  • Moved from an applied research programme to a continuously running production platform

What I’d do differently

Understand the decision before building ingestion. The first instinct is to capture everything because you can. But a digital twin is only worth what it changes about an operating decision, and I hardened streams that drove none. I now start with: which decision, made by whom, how often?

A data quality layer from the start. It ended up scattered between connectors and models. Physical bounds, frozen values, clock drift — validated right after ingestion, every anomaly becomes attributable to a cause.

Got a corpus that fights back?