Skip to main content

GridOS — Open Energy Operating System: vendor-neutral middleware for Distributed Energy Resources.

Project description

GridOS — Open Energy Operating System

License: MIT Python 3.10+ PyPI version PyPI downloads Docker Image CI FastAPI Code style: ruff

GridOS is a vendor-neutral, open-source middleware platform that unifies Distributed Energy Resources (DERs) — solar inverters, batteries, EV chargers, smart loads — behind a single, standards-based API. It provides real-time telemetry ingestion, digital-twin simulation, ML-driven forecasting, and optimal energy dispatch, enabling utilities, aggregators, and microgrid operators to accelerate the energy transition.


Key Features

Capability Description
Multi-Protocol Adapters Modbus TCP/RTU, MQTT, DNP3, IEC 61850, OPC-UA — connect any DER out of the box.
Common Information Model Pydantic models aligned with IEC 61968/61850 for interoperable data exchange.
Time-Series Storage Pluggable backends for InfluxDB 2.x and TimescaleDB with async I/O.
Digital Twin Engine Physics-based component models (bus, line, transformer, PV, battery, EV charger) with simplified power-flow simulation.
ML Forecasting LSTM-based load and solar forecasting plus Isolation Forest anomaly detection.
MILP Optimization Mixed-Integer Linear Programming scheduler for optimal battery dispatch and demand response.
REST + WebSocket API FastAPI-powered endpoints with live telemetry streaming via WebSockets.
Edge Support SQLite-based store-and-forward cache for intermittent connectivity.
Cloud-Native Deployment Docker Compose, Kubernetes manifests, and GitHub Actions CI/CD included.

Architecture Overview

┌──────────────────────────────────────────────────────────┐
│                      GridOS Platform                     │
│                                                          │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌─────────┐ │
│  │ Modbus   │  │  MQTT    │  │  DNP3    │  │ IEC61850│ │
│  │ Adapter  │  │ Adapter  │  │ Adapter  │  │ Adapter │ │
│  └────┬─────┘  └────┬─────┘  └────┬─────┘  └────┬────┘ │
│       │              │              │              │      │
│       └──────────────┼──────────────┼──────────────┘      │
│                      ▼                                    │
│              ┌───────────────┐                            │
│              │  CIM Models   │                            │
│              │  (Pydantic)   │                            │
│              └───────┬───────┘                            │
│                      │                                    │
│         ┌────────────┼────────────┐                       │
│         ▼            ▼            ▼                       │
│  ┌────────────┐ ┌──────────┐ ┌──────────────┐            │
│  │ Time-Series│ │ Digital  │ │ Optimization │            │
│  │  Storage   │ │  Twin    │ │  (MILP)      │            │
│  └────────────┘ │  Engine  │ └──────────────┘            │
│                 └──────────┘                              │
│                      │                                    │
│              ┌───────┴───────┐                            │
│              │  FastAPI +    │                            │
│              │  WebSocket    │                            │
│              └───────────────┘                            │
└──────────────────────────────────────────────────────────┘

Installation

Option 1: Install from PyPI (Recommended)

pip install gridos

With optional dependencies:

# Machine learning (LSTM forecasting, anomaly detection)
pip install gridos[ml]

# Protocol adapters (Modbus, MQTT, OPC-UA)
pip install gridos[adapters]

# Storage backends (InfluxDB, TimescaleDB)
pip install gridos[storage]

# Everything
pip install gridos[ml,adapters,storage]

Option 2: Run with Docker

docker pull ghcr.io/iceccarelli/gridos:latest
docker run -p 8000:8000 ghcr.io/iceccarelli/gridos:latest

The API is now available at http://localhost:8000/docs.

Option 3: Run with Docker Compose (Full Stack)

git clone https://github.com/iceccarelli/GridOS.git
cd GridOS
docker-compose up -d

This starts GridOS alongside InfluxDB, TimescaleDB, and Grafana.

Option 4: Install from Source

git clone https://github.com/iceccarelli/GridOS.git
cd GridOS

python -m venv .venv
source .venv/bin/activate

# Install with dev dependencies
pip install -e ".[dev]"

Quick Start

Configuration

# Copy the example environment file
cp .env.example .env

# Edit .env with your settings (storage URLs, broker addresses, etc.)

Run the API Server

uvicorn gridos.main:app --host 0.0.0.0 --port 8000 --reload

The interactive API documentation is available at http://localhost:8000/docs.


Project Structure

GridOS/
├── src/gridos/           # Core Python package
│   ├── models/           # Pydantic CIM models
│   ├── adapters/         # Protocol adapters (Modbus, MQTT, DNP3, …)
│   ├── storage/          # Time-series backends (InfluxDB, TimescaleDB)
│   ├── digital_twin/     # Simulation engine + ML modules
│   ├── optimization/     # MILP scheduler and dispatch
│   ├── api/              # FastAPI routes and WebSocket manager
│   ├── edge/             # Edge caching (SQLite store-and-forward)
│   ├── security/         # API key + JWT authentication
│   └── utils/            # Logging, metrics, and shared utilities
├── tests/                # Pytest test suite (70 tests)
├── notebooks/            # Jupyter demo notebooks
├── data/                 # Sample datasets
├── docs/                 # Architecture, API reference, developer guide
├── k8s/                  # Kubernetes manifests
├── scripts/              # Utility and demo scripts
└── requirements/         # Dependency files (base, ml, dev, prod)

Running Tests

pytest tests/ -v --cov=gridos --cov-report=term-missing

Notebooks

Explore the interactive Jupyter notebooks in notebooks/:

  1. Data Ingestion Demo — Connect adapters and ingest telemetry.
  2. Digital Twin Simulation — Build a grid model and run power-flow.
  3. Forecasting with ML — Train an LSTM on solar generation data.
  4. Optimization Scheduler — Solve optimal battery dispatch with MILP.
  5. API Client — Interact with the REST API programmatically.

Contributing

We welcome contributions from the community. Please read CONTRIBUTING.md for guidelines on how to get started.


Security

If you discover a security vulnerability, please follow the responsible disclosure process described in SECURITY.md.


License

GridOS is released under the MIT License.


Acknowledgements

GridOS builds on the shoulders of outstanding open-source projects including FastAPI, Pydantic, PuLP, scikit-learn, InfluxDB, TimescaleDB, and many others. We are grateful to the energy systems research community for the standards and models that inform this work.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gridos-0.1.0.tar.gz (63.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gridos-0.1.0-py3-none-any.whl (78.1 kB view details)

Uploaded Python 3

File details

Details for the file gridos-0.1.0.tar.gz.

File metadata

  • Download URL: gridos-0.1.0.tar.gz
  • Upload date:
  • Size: 63.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gridos-0.1.0.tar.gz
Algorithm Hash digest
SHA256 60084ca9c462acd91ee6ad3e123ce42bae3bf8ac62fca78b2820fa570ea1fcd8
MD5 ab35861ab5f27e87882c5d34417eacfd
BLAKE2b-256 5577a35947a47618abab6c8f593183dcfc60f0a48deed2c6bc258660265876c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for gridos-0.1.0.tar.gz:

Publisher: publish-pypi.yml on iceccarelli/GridOS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gridos-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gridos-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 78.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gridos-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2da539cf37382d909f486d1983f5aa6db3a5713cc3128ce8c654a8a78dfdd5e4
MD5 12d0e5fa5214a5b697253465bd474c5e
BLAKE2b-256 2ed80eb65b8f5f8b58fa3536eaef965e41b496a5d2183695e872141e8614d769

See more details on using hashes here.

Provenance

The following attestation bundles were made for gridos-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on iceccarelli/GridOS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page