Fuse high-frequency PLC telemetry with live MES work orders — every bolt torqued, every firmware flashed, every VIN correlated in real time. Then predict the defect before the car leaves the station.
Traditional factory software passes data sequentially up a rigid hierarchy. By the time a torque anomaly reaches an enterprise dashboard, it has lost its link to the specific VIN being built.
Edge telemetry and MES state live in separate systems. Root-cause analysis becomes a forensic nightmare.
Quality issues surface after the vehicle leaves the station — expensive rework and recall risk.
Edge and MES publish to a shared event stream. Correlation joins them in memory — enriched telemetry in milliseconds, not minutes.
Every PLC reading is a point in time. Every MES update is a slow-moving fact. Aegis performs an in-memory join before data touches the database.
{
"station_id": "5",
"torque": 43.21,
"timestamp": 1714234567890
}
{
"station_id": "5",
"torque": 43.21,
"timestamp": 1714234567890,
"vin": "1HGBH41JXMN100005",
"firmware": "v2.1.4"
}
When anomaly score exceeds threshold, a DefectAlert publishes to NATS and streams to the dashboard via SSE:
{
"station_id": "5", "anomaly_score": 0.97,
"trigger_torque_nm": 61.8, "timestamp": 1714234567890
}
Edge, MES, correlation, inference, and API layers communicate exclusively through NATS JetStream — independent durable consumers, no coupling.
Deterministic PLC mock at up to 1 kHz. Publishes torque samples to JetStream.
5 enricher goroutines · stream–table join · 500-row batch writer to ClickHouse.
Hot-swap ONNX scorer under RWMutex. Fail-open — never stops the line.
End-to-end path from raw sensor sample to live dashboard alert — all under a second in dev, sub-second at scale.
"Show every torque reading > 50 Nm for VINs built with firmware v2.1.4 that later reported a steering defect."
One ClickHouse SELECT — because enrichment happened at ingest time.
Durable at-least-once delivery with low ops overhead. Independent consumers for correlation and inference advance at their own pace — no coupling.
| Layer | Technology | Role |
|---|---|---|
| Edge | Rust · Tokio · async-nats | PLC mock → JetStream, graceful SIGINT |
| Broker | NATS JetStream | AEGIS stream on aegis.> · 24h retention |
| MES | Go · pgx/v5 · PostgreSQL 16 | Work order CRUD + state publisher |
| Core | Go · sync.RWMutex · ClickHouse 24 | Stream–table join · OLAP storage |
| ML | Go inference + Python training | ONNX hot-swap · z-score in dev |
| API | Go · GraphQL · SSE · gRPC | Polyglot gateway on :8081 / :9090 |
| UI | React 18 · TypeScript 5 · Vite | MES snapshot · live SSE alerts |
Supervisors need varying detail — no over-fetching on telemetry queries.
Legacy Level-4 MES systems ingest state via JSON-over-HTTP.
One-direction server→browser. No WebSocket complexity for defect streams.
Inference runs continuously on live telemetry. A nightly Python job retrains from ClickHouse labels and exports ONNX to S3 — zero-downtime hot-swap every 5 minutes.
The ML model is experimental. A scoring bug must never stop the assembly line. NATS ack happens before scoring — errors are logged, production continues.
Protobuf binary encoding for 1,000-metric batches — smaller and faster than JSON arrays over HTTP.
"What was happening to VIN 1HGBH41JXMN100042 — physically and in software — at 09:22:47?
And did Foresight see it coming?"