Skip to content

bess-solutions/open-bess-edge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

295 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

🔋 BESSAI Edge Gateway

Industrial-grade open-source edge gateway for secure, AI-optimized Battery Energy Storage System (BESS) management.

Self-evolving arbitrage intelligence · IEC 62443 · IEC 61850 · IEEE 2030.5 · NTSyCS Chile

License Python CI Codecov Docker OpenSSF Scorecard IEC 62443 NTSyCS BESSAI-SPEC BEP Process Tests Version Security

Documentation · Quick Start · Discord · BEP Proposals · Roadmap


What is BESSAI Edge Gateway?

BESSAI is a production-ready edge computing platform that sits between your Battery Energy Storage System hardware and cloud infrastructure. It handles:

  • Real-time telemetry collection from inverters and BMS (Modbus TCP, IEC 61850, IEEE 2030.5)
  • AI-powered dispatch decisions via a DRL arbitrage agent (ONNX inference, no cloud required)
  • Autonomous self-improvement via BESSAIEvolve — an AlphaEvolve-inspired weekly evolution loop
  • Safety enforcement with IEC 62443 SL-1 compliant guardrails
  • Multi-cloud publishing to GCP Pub/Sub, MQTT, OpenTelemetry

Reference deployment: 200kWh / 100kW Huawei SUN2000 BESS, Santiago Chile — arbitraging the Chilean SEN spot market (CMg) in production since 2025.


🏗️ Architecture

graph TB
    subgraph Hardware["⚡ BESS Hardware"]
        INV[Inverter<br/>Huawei · SMA · Victron · BYD · Tesla]
        BMS[BMS / Battery Pack]
    end

    subgraph Edge["🖥️ Edge Gateway (BESSAI)"]
        DRV[Protocol Drivers<br/>Modbus TCP · IEC 61850 · IEEE 2030.5]
        SG[SafetyGuard<br/>IEC 62443 SL-1]
        AI[AI Engine]
        subgraph AI["🤖 AI Engine"]
            IDS[AI-IDS<br/>IsolationForest]
            DRL[DRL Agent<br/>PPO ONNX]
            EVO[BESSAIEvolve<br/>Weekly μ+λ Evolution]
        end
        TEL[Telemetry Layer<br/>Prometheus · OpenTelemetry · MQTT]
    end

    subgraph Cloud["☁️ Cloud"]
        GCP[GCP Pub/Sub]
        PROM[Prometheus + Grafana]
        OT[Cloud Trace]
    end

    subgraph Market["📈 Market"]
        CMG[CEN Chile CMg API<br/>Real-time spot price]
    end

    INV -->|Modbus TCP| DRV
    BMS -->|RS485 / TCP| DRV
    DRV --> SG
    SG --> AI
    CMG -->|30-day history| EVO
    AI --> TEL
    TEL --> GCP
    TEL --> PROM
    TEL --> OT
Loading

📊 Data Flow

sequenceDiagram
    participant HW as BESS Hardware
    participant DRV as Driver
    participant SG as SafetyGuard
    participant DRL as DRL Agent (ONNX)
    participant MKT as CMg Market
    participant PUB as Publishers

    HW->>DRV: Poll telemetry (5s)
    DRV->>SG: BatteryState {soc, temp, power}
    SG-->>DRL: ✅ Safe to dispatch
    MKT-->>DRL: CMg price forecast
    DRL->>SG: Proposed setpoint p_pu ∈ [-1, 1]
    SG->>SG: Validate SOC bounds + thermal limits
    alt safe
        SG->>HW: Write power setpoint
    else violation
        SG->>HW: Hold (0 kW)
        SG->>PUB: safety_violation alert
    end
    SG->>PUB: Telemetry + metrics
    PUB->>PUB: Prometheus / GCP / MQTT / OTel
Loading

🔌 Hardware Registry

graph LR
    subgraph Inverters
        HW[Huawei SUN2000<br/>✅ Production]
        SMA[SMA Sunny Tripower<br/>✅ Tested]
        VIC[Victron MultiPlus<br/>✅ Tested]
        FRO[Fronius Symo<br/>✅ Tested]
        SE[SolarEdge StorEdge<br/>✅ Tested]
    end
    subgraph Batteries
        BYD[BYD Battery Box<br/>✅ Tested]
        TES[Tesla Powerwall<br/>✅ Tested]
    end
    subgraph Pending["🔵 Roadmap (BEP-0202)"]
        ABB[ABB PCS100]
        SCH[Schneider Conext]
        GE[GE Grid Solutions]
    end
    DRIV[BESSAI Protocol Drivers]
    HW & SMA & VIC & FRO & SE & BYD & TES -->|Modbus TCP| DRIV
Loading

📸 Visuals

Note to contributors: the screenshots/GIFs below are placeholders. We welcome PRs that add real captures.
See docs/CONTRIBUTING_MEDIA.md for recording guidelines.

# What to capture Tool Priority
1 docker compose up boot sequence — all services healthy asciinema 🔴 High
2 Grafana dashboard: SOC curve + CMg price overlay Screen recording → GIF 🔴 High
3 make simulate running with live telemetry output asciinema 🟡 Medium
4 BESSAIEvolve GitHub Actions run + auto-PR creation Screenshot 🟡 Medium
5 Raspberry Pi 4 running BESSAI (htop + make health) Photo + terminal 🟢 Nice
6 IEEE 2030.5 DERControl endpoint responding to curl asciinema 🟢 Nice

🤝 Para Early Adopters

¿Quieres desplegar BESSAI en una instalación real?

Quiero... Recurso
🗺️ Elegir mi camino de adopción ADOPTER_HUB.md
⚡ Demo en 5 min (sin hardware) tutorials/quickstart_5min.md
📅 Roadmap Día 0 → Producción ONBOARDING_7DAYS.md
❓ FAQ técnica (hw, mercados, licencia) FAQ.md
🛡️ Programa Early Adopters (soporte prioritario) early_adopters.md
🆘 Soporte durante el onboarding Abrir issue

⚡ Quick Start

0. Setup interactivo (recomendado)

git clone https://github.com/bess-solutions/open-bess-edge.git
cd open-bess-edge
bash scripts/setup.sh   # 5 preguntas → genera config/.env listo

1. Local (Python)

make dev                  # instala dependencias + pre-commit hooks
bash scripts/setup.sh     # genera config/.env
make simulate             # arranca con simulador integrado
make health               # verifica que todo está activo

2. Docker Compose (recommended)

git clone https://github.com/bess-solutions/open-bess-edge.git
cd open-bess-edge
bash scripts/setup.sh     # genera config/.env con parámetros de tu sitio
docker compose -f infrastructure/docker/docker-compose.yml --profile simulator --profile monitoring up -d

Grafana → http://localhost:3000 (credenciales: ver GF_SECURITY_ADMIN_PASSWORD en config/.env)
Metrics → http://localhost:8000/metrics
Health → http://localhost:8000/health

3. Raspberry Pi 4 / 5

# On the Pi (arm64):
docker pull ghcr.io/bess-solutions/open-bess-edge:latest
docker run -d \
  --name bessai \
  --env-file .env \
  -p 8000:8000 \
  ghcr.io/bess-solutions/open-bess-edge:latest

Full Raspberry Pi guide: docs/quickstart_rpi.md

4. Dev Container (VS Code / GitHub Codespaces)

Open in VS Code → Reopen in Container — all dependencies, pre-commit hooks, and the simulator start automatically.


✨ Features

Feature Description BEP
Multi-protocol drivers Modbus TCP, IEC 61850, IEEE 2030.5 / SEP 2.0 BEP-0100
Hardware profiles 7 certified profiles (Huawei, SMA, Victron, BYD, Tesla…)
SafetyGuard SOC/thermal/power bounds — blocks unsafe commands
AI-IDS Real-time anomaly detection (IsolationForest + z-score)
DRL Arbitrage Agent PPO + 8 CEN ONNX models — <0.1ms, no cloud required BEP-0200
BESSAIEvolve AlphaEvolve-inspired weekly self-improvement loop BEP-0303
VPP Fleet Manager Multi-site VPP: FleetOrchestrator + DRL per-site BEP-0500
SENMarketFeed Live CEN prices: DuckDB → HTTP → Duck Curve fallback (TTL 15min) BEP-0500
FL Coordinator Federated Learning FedAvg (capacity-weighted), L2 convergence BEP-0600
HVDC Scheduler Inter-regional DC power flow arbitrage (500MW, 1.8% losses) BEP-0700
CMg Live Feed Real-time Chilean SEN spot price ingestion BEP-0302
Explainable AI (XAI) SHAP-based decision explanations BEP-0301
OpenTelemetry Distributed traces + metrics to GCP / Datadog / Grafana
Global Market Adapters CAISO · ERCOT · ENTSO-E · SEN · COES · XM · CENACE
Multi-arch Docker amd64 + arm64 (Raspberry Pi 4/5 native)
IEC 62443 SL-1/2 Full control mapping — SL-2 compliant

🛡️ Compliance

Standard Status Evidence
IEC 62443 SL-1 ✅ Compliant iec62443_mapping.md
IEC 62443 SL-2 ✅ Compliant SL2SecurityGate — RBAC + HMAC-SHA256
NTSyCS Cap. 4.2 ✅ GAP-001 Ramp rate ≤10%/min (SafetyGuard)
NTSyCS Cap. 4.3 ✅ GAP-002 PFR droop < 2s (FrequencyResponseAgent)
NTSyCS Cap. 4.4 ✅ GAP-011 Q/V droop (ReactiveController)
NTSyCS Cap. 6.1 ✅ GAP-003 mTLS telemetría CEN (CENPublisher)
NTSyCS Cap. 6.2 ✅ GAP-004 SCADA IEC 60870-5-104 (IEC104Driver)
NTCSE ✅ GAP-010 THD/Flicker gate (PowerQualityMonitor)
Decreto 88/2023 ✅ GAP-007 Anti-arbitrage PMGD (PMGDComplianceEngine)
Ley 21.185 ✅ GAP-008 CER para CNE (ERNCRegistry)
Ley 21.663/2024 CSIRT ≤3h (SecurityNotifier)
IEEE 2030.5 / SEP 2.0 ✅ 10 endpoints BEP-0100
Apache 2.0 SPDX ✅ All source files LICENSE

🗺️ Roadmap

Status What Version
✅ Done IEC 62443 SL-1/2 · OpenSSF · BEPs 0100–0303 · BESSAIEvolve v1 v2.10.0–v2.12.0
✅ Done 8 CEN DRL ONNX models · PPO trainer · Global Market Adapters (CAISO, ERCOT, ENTSO-E) v2.14.0
✅ Done VPP Fleet Manager (BEP-0500) · SENMarketFeed CEN live · Multi-site ONNX DRL dispatch v2.15.0
✅ Done FL Coordinator (BEP-0600) · FedAvg capacity-weighted · L2 convergence · 799 CI tests v2.16.0
✅ Done HVDC Scheduler (BEP-0700) · DC power flow · 500MW · inter-regional price arbitrage v2.16.0
🔵 Planned Flower (flwr) integration for FL · gRPC + mTLS FL protocol v2.17.0
🔵 Planned VPP HTTP real dispatch (mTLS SiteProxy) · HVDC TSO integration v2.18.0
🔵 Planned P2P Energy Trading · LCA Engine · Carbon Dashboard 2027

See full roadmap: docs/ROADMAP.md


🧬 BESSAIEvolve — Self-Improving AI

BESSAI autonomously improves its arbitrage policy every week using an evolutionary algorithm inspired by AlphaEvolve (DeepMind, 2025):

Every Monday 00:00 UTC:
  1. Fetch **39 months / 111,100 datapoints** of real CMg price data (4 SEN nodes — CEN Chile API + DuckDB)
  2. Generate 10 policy candidates (Gaussian mutation)
  3. Evaluate each in a 8,640-step sandbox (30 days × 288 timesteps)
  4. Select parents via tournament → produce next generation
  5. Repeat for 5 generations → if best > +5% + 0 safety violations
  6. Open a PR automatically for human approval

→ Full explanation: docs/BESSAI_EVOLVE.md · Spec: BEP-0303


📦 Project Structure

open-bess-edge/                      ← PUBLIC (Apache 2.0)
├── src/core/
│   ├── safety_guard.py          # IEC 62443 SL-1/2 SOC/thermal guardrail
│   ├── compliance_stack.py      # 11 GAPs NTSyCS
│   ├── vpp_fleet_manager.py     # BEP-0500: VPP multi-site + ONNX DRL dispatch
│   ├── sen_market_feed.py       # BEP-0500 P2: CEN live price (DuckDB → duck-curve)
│   ├── fl_coordinator.py        # BEP-0600: Federated Learning FedAvg coordinator
│   ├── hvdc_scheduler.py        # BEP-0700: HVDC inter-regional DC power flow
│   ├── market_adapter.py        # 7 global markets (SEN, CAISO, ERCOT, ENTSO-E…)
│   └── ...                      # SafetyGuard, AI-IDS, BESSAIEvolve, XAI…
├── tests/               # 799 tests (pytest) · 0 failures · CI/CD
├── docs/bep/            # BEP-0001 → BEP-0700 (10 proposals)
├── docs/compliance/     # IEC 62443, NTSyCS, IEEE 2030.5
├── .github/workflows/   # CI/CD + weekly BESSAIEvolve
├── infrastructure/      # Terraform GCP (18 resources)
└── CHANGELOG.md

bess-solutions/bessai-core           ← PRIVATE (Proprietary)
├── src/agents/          # 16 AI modules (MARL, MILP, DRL, evolution)
├── src/interfaces/      # fl_client.py, fl_server.py (Federated Learning)
└── models/              # dispatch_policy.onnx (trained PPO)

🤝 Contributing

Contributions are welcome. BESSAI follows the BEP process for significant changes.

git checkout -b feature/my-feature
make test           # must pass before PR
make lint           # ruff + mypy + bandit
git commit -m "feat(scope): clear description"
gh pr create

🌐 Community

Channel Purpose
Discord Real-time chat, support, showcase
GitHub Discussions RFCs, design decisions, Q&A
GitHub Issues Bugs and feature requests

📄 License

Apache 2.0 — see LICENSE.
SPDX headers in all source files. Third-party attributions in NOTICE.


🇨🇱 Versión en Español

BESSAI Edge Gateway — Descripción en Español

Gateway industrial de código abierto para gestión segura y optimizada de activos BESS.

BESSAI es una plataforma de computación en el borde (edge) que conecta tu sistema de almacenamiento de energía (BESS) con la infraestructura cloud. Sus capacidades principales:

  • Drivers industriales: Modbus TCP, IEC 61850, IEEE 2030.5 / SEP 2.0
  • IA en el borde: Agente DRL (PPO) para arbitraje en el mercado spot chileno (CMg)
  • Auto-mejora: BESSAIEvolve — bucle evolutivo semanal inspirado en AlphaEvolve (DeepMind)
  • Seguridad industria: SafetyGuard compatible IEC 62443 SL-1 + NTSyCS CEN Chile
  • Observabilidad: Prometheus, Grafana, OpenTelemetry, GCP Pub/Sub

Despliegue de referencia: BESS 200kWh / 100kW Huawei SUN2000, Santiago de Chile — en producción desde 2025.

Inicio rápido

git clone https://github.com/bess-solutions/open-bess-edge.git
cd open-bess-edge
make dev
make simulate

Documentación

Comunidad

About

BESSAI Edge Gateway — Industrial BESS management via Modbus TCP, GCP Pub/Sub & OpenTelemetry

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors