tpt-relay
RustOpen-source, memory-safe substation automation and SCADA platform written in Rust. Implements IEC 61850, DNP3, and Modbus TCP for grid protection, real-time load/frequency control, and self-healing fault response — built toward NERC CIP compliance as a low-cost alternative to proprietary systems.
Languages
TPT Relay
Open-source, memory-safe substation automation system. © TPT Solutions. Dual-licensed under MIT OR Apache-2.0.
TPT Relay is a NERC CIP–targeted substation automation system written in Rust. It implements the protocol stack (IEC 61850, DNP3, Modbus TCP), real-time control loops (LFC/AGC), and protective relay logic (overcurrent, undervoltage, differential) needed to monitor and protect distribution/subtransmission grids.
⚠️ Safety & Compliance Guardrail
Do not connect this software to live grid equipment, real breakers, or production substations until NERC CIP certification (Phase 4) and an independent third-party safety review have both passed. All development through Phase 3 targets simulation and non-live bench hardware only.
This guardrail is repeated in CONTRIBUTING.md so every contributor sees it.
Status
| Phase | Scope | Status |
|---|---|---|
| 0 | Project foundation (workspace, licensing, CI, ADRs) | ✅ In progress |
| 1 | Protocol stack (IEC 61850 / DNP3 / Modbus) | ✅ Core models implemented |
| 2 | Real-time control & protection logic | ✅ Algorithms + <20 ms trip proof |
| 3 | Hardware-in-the-Loop (bench rig) | 🔶 Bench rig + HIL abstraction implemented; on-device run TODO |
| 4 | NERC CIP certification & market readiness | 🔶 Doc package + audit trail implemented; safety review is a gate |
Workspace layout
crates/
common Shared primitives: measurements, quality, timestamps, safe transport
iec61850 IEC 61850 — GOOSE messaging + SCL/ICD config parsing
dnp3 DNP3 — master + outstation link/application model
modbus Modbus TCP — MBAP + PDU codec for legacy devices
protection Protective relay algorithms (overcurrent / undervoltage / differential)
control LFC / AGC loops + determinism/timing harness
sim Simulated devices, grid topology & self-healing, deterministic harness
Building & testing
cargo build --workspace
cargo test --workspace
cargo clippy --all-targets --workspace
cargo fmt --all --check
Trip-latency proof
The protective-relay trip budget (<20 ms) is measured, not assumed:
cargo bench --bench trip_latency
The TimingHarness records per-sample cost; the benchmark asserts the steady-state
mean stays within budget. On a typical host the full overcurrent + undervoltage +
differential evaluation runs in tens of nanoseconds per sample.
Architecture
See docs/adr/ for Architecture Decision Records:
Documentation & compliance
- IEC 61850 conformance plan
- Fuzzing & property-based testing
- TPT Fulcrum integration contract
- Phase 3 hardware-in-the-Loop
- NERC CIP package, audit trail & safety gate
Licensing
Every source file carries an SPDX header
(SPDX-License-Identifier: MIT OR Apache-2.0) and is © TPT Solutions. See
LICENSE-MIT and LICENSE-APACHE.
Contributing
See CONTRIBUTING.md. By contributing you agree to license your work under MIT OR Apache-2.0.
Security
See SECURITY.md for vulnerability reporting and the supply-chain
review policy (SBOM, cargo audit, vendoring).
Code of Conduct
This project follows the Code of Conduct.