DEV Community

JhonLiu
JhonLiu

Posted on

How One Open-Source IoT Platform Unified China Largest Oil Field — 928 Gateways, 114K Sensors, 600x Faster

How One Open-Source IoT Platform Unified China's Largest Oil Field — 928 Gateways, 114K Sensors, 600× Faster

Daqing Oil Field produces 30 million tons of crude annually. When they needed to modernize their sensor network, they chose an open-source platform built by a 10-person team. Here's the story.


The Scale of the Problem

Daqing Oil Field spans 6,000 square kilometers — roughly the size of Delaware. It has:

  • 16 oil extraction plants
  • 928 industrial gateways (mostly Modbus RTU/TCP and a proprietary CNPC protocol called A11)
  • 114,809 sensor points measuring pressure, temperature, flow rate, vibration, and 20 other parameters
  • 30+ years of accumulated legacy equipment

When we first visited in 2020, the data infrastructure looked like this:

Field Operator checks gauge → writes value on clipboard
  → enters into Excel at end of shift
  → supervisor reviews next morning
  → alarm triggered 4 hours after anomaly occurred
Enter fullscreen mode Exit fullscreen mode

Collection frequency: every 10 minutes on a good day. End-to-end latency: 15-30 minutes. False alarm rate: over 20%. Storage: data older than 10 days was purged.

An oil pump failure caught 4 hours late costs $50,000-200,000 in lost production.

The Approach: Protocol-First

We didn't try to replace the gateways. Instead, we built protocol adapters that spoke their language:

Siemens S7-1200 (Modbus TCP)  ──┐
ABB AC500 (Modbus RTU)         ──┤
A11 CNPC Gateways (proprietary) ──┼──→ DGIOT Unified Pipeline
OPC UA Servers (newer units)   ──┤
Manual Input (legacy gauges)   ──┘
Enter fullscreen mode Exit fullscreen mode

Each protocol adapter is an Erlang gen_statem process. A single gateway's Modbus connection is one lightweight process consuming ~2KB of memory. 928 gateways = <2MB RAM for the entire protocol layer.

The A11 Protocol Challenge

The hardest part was A11 — a proprietary CNPC protocol with almost no documentation. We had to reverse-engineer it from packet captures and conversations with retired engineers. The protocol uses a unique 4-byte magic number (0x6A6A5A5A) and variable-length frames with custom CRC. It took three weeks of on-site work, but once we cracked it, we could talk to 60% of Daqing's legacy gateways natively.

The Architecture in Production

928 Gateways
    │  Modbus RTU/TCP, A11 CNPC, OPC UA
    ↓
DGIOT Edge (Runs on existing gateway hardware)
    │  Protocol adaptation + stream computation + 7-day offline buffer
    ↓
MQTT Broker (EMQX) — 1M+ msg/sec
    │
    ├──→ TDengine (time-series, 10:1 compression, 652M data points)
    ├──→ Parse Server (device metadata, auth, tenant isolation)
    └──→ Stream Engine (15 algorithms, real-time alerting)
    │
    ↓
Vue 3 Dashboard (operator view, maintenance view, director view)
Enter fullscreen mode Exit fullscreen mode

The Results

Metric Before After Improvement
Collection frequency 10 min 1 sec 600×
End-to-end latency 15-30 min <3 sec 600×
Storage retention 10 days 2 years 73×
False alarm rate 22% 4.7% 4.7× better
Gateways managed 1 per system 928 unified
Protocols supported 3 15 at Daqing, 300+ globally
Uptime ~95% 99.9999%

The Real Impact

$2.3 million saved in the first year — not from license fees (DGIOT is free), but from:

  • Reduced downtime: Pumps caught at first sign of bearing wear, not after failure
  • Eliminated manual rounds: Operators stopped driving 2 hours to check a gauge
  • Optimized maintenance: Predictive instead of scheduled — 40% fewer truck rolls

Why Open Source Won

Daqing initially wanted a commercial SCADA system. Three vendors quoted:

  • Vendor A: $1.2M license + $200K/year maintenance
  • Vendor B: $850K + $180K/year
  • Vendor C: $3M for a "full digital transformation"

All three required replacing the existing gateways — a $15M hardware project. DGIOT ran on the existing hardware. The software was free. The only cost was integration and training.

When the project lead asked "What if your company goes out of business?", we pointed to the GitHub repo: "The code is Apache 2.0. It outlives us."

That closed the deal.

Lessons for Industrial IoT Founders

  1. Don't compete on features. Compete on protocols. Every protocol you support removes a reason to say no.

  2. Open source is a trust mechanism for hardware companies. They've been burned by vendor lock-in. Apache 2.0 is the ultimate guarantee.

  3. Edge computing is non-negotiable. Oil fields have terrible connectivity. Your platform must work offline for days.

  4. The hard part isn't the tech — it's the protocol reverse-engineering. Budget 2-4 weeks per proprietary protocol. It's worth it.

  5. Pricing: free software, paid integration. The software is open source. The 3-week on-site integration, training, and custom protocol work is what you charge for.


DGIOT is open source (Apache 2.0) at github.com/dgiot/dgiot. The Daqing deployment has been running in production since 2021.

Liu Shouxin is the founder of DGIOT. He previously architected IoT platforms at EMQ, Huawei, and TCL.

Top comments (0)