Real-time quantum computing interface for power systems optimization
Project description
QuantumGridOS
QuantumGridOS is a Python library for connecting power systems data to quantum computers.
[!IMPORTANT] This library currently supports Python 3.8 to 3.11. Python 3.12+ is not yet supported.
It enables solving power system optimization problems using quantum algorithms (QAOA, VQE) with minimal latency TCP/IP data exchange.
๐ Features
- Real-time TCP/IP streaming for power systems data exchange
- Quantum algorithm support: QAOA, VQE, Grover's
- Power system optimizations: Unit commitment, MaxCut, OPF, State estimation
- Low-latency architecture with async I/O and buffer management
- Hardware agnostic: Works with IBM Quantum, IonQ, Rigetti, simulators
- Extensive examples and documentation
๐ฆ Installation
pip install quantumgridos
For development:
git clone https://github.com/saralsystems/quantumgridos.git
cd quantumgridos
pip install -e .[dev]
๐ฏ Quick Start
Basic MaxCut for Power Network Partitioning
import quantumgridos as qgo
# Initialize quantum-power interface
interface = qgo.QuantumPowerInterface(
quantum_backend='qiskit_aer',
tcp_host='localhost',
tcp_port=5000
)
# Define power network
network = qgo.PowerNetwork.from_ieee_case(14) # IEEE 14-bus
# Create MaxCut optimizer for network partitioning
optimizer = qgo.MaxCutOptimizer(
network=network,
algorithm='qaoa',
layers=3
)
# Start real-time processing
async def process_stream():
async for data in interface.tcp_stream():
# Solve partitioning problem
result = await optimizer.solve_async(data)
# Send result back to power system
await interface.send_result(result)
# Run
import asyncio
asyncio.run(process_stream())
Unit Commitment Example
import quantumgridos as qgo
# Configure unit commitment problem
uc_problem = qgo.UnitCommitment(
generators=[
{'name': 'G1', 'pmin': 50, 'pmax': 200, 'cost': 1000},
{'name': 'G2', 'pmin': 20, 'pmax': 100, 'cost': 1500}
],
demand_forecast=[150, 180, 200, 170],
time_periods=4
)
# Setup quantum solver
solver = qgo.QuantumSolver(
problem=uc_problem,
backend='ibmq_qasm_simulator',
algorithm='vqe',
optimizer='cobyla'
)
# Solve with TCP streaming
with qgo.TCPInterface(port=5000) as tcp:
for demand_update in tcp.stream():
uc_problem.update_demand(demand_update)
solution = solver.solve()
tcp.send(solution.to_scada_format())
๐๏ธ Architecture
QuantumGridOS/
โโโ Core Modules
โ โโโ quantum_interface.py # Quantum backend abstraction
โ โโโ tcp_handler.py # High-performance TCP/IP
โ โโโ data_encoder.py # Power data โ Qubits
โ โโโ time_sync.py # Clock synchronization
โโโ Algorithms
โ โโโ qaoa.py # QAOA implementation
โ โโโ vqe.py # VQE implementation
โ โโโ grover.py # Grover's algorithm
โโโ Power Systems
โ โโโ network.py # Power network modeling
โ โโโ optimizations/
โ โ โโโ unit_commitment.py
โ โ โโโ opf.py # Optimal Power Flow
โ โ โโโ state_estimation.py
โ โ โโโ maxcut.py
โ โโโ converters.py # IEEE/MATPOWER formats
โโโ Utils
โโโ benchmarks.py
โโโ visualization.py
๐ Benchmarks
| Problem Type | Network Size | Classical (ms) | Quantum (ms) | Speedup |
|---|---|---|---|---|
| MaxCut | IEEE 14-bus | 120 | 45 | 2.67x |
| Unit Commitment | 10 units | 340 | 180 | 1.89x |
| State Estimation | 30-bus | 250 | 110 | 2.27x |
๐ TCP/IP Protocol
QuantumGridOS uses optimized binary protocol for minimal latency:
# Message format
{
'timestamp': int64, # Unix timestamp in microseconds
'msg_type': uint8, # 0: data, 1: control, 2: result
'data': {
'bus_voltages': float32[],
'line_flows': float32[],
'generator_status': bool[]
}
}
๐ Documentation
Full documentation available at saralsystems.github.io/quantumgridos
๐งช Testing
# Run all tests
pytest tests/
# Run with coverage
pytest --cov=quantumgridos tests/
# Run benchmarks
python -m quantumgridos.benchmark
๐ค Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
All contributors must sign a Contributor License Agreement (CLA) before their contributions can be merged. See CLA.md for individual contributors and CLA-CORPORATE.md for corporate contributors.
๐ License
Apache License 2.0 - see LICENSE file.
๐ Citation
If you use QuantumGridOS in research, please cite:
@software{quantumgridos,
title = {QuantumGridOS: Real-time Quantum-Power Systems Interface},
author = {Saral Systems},
year = {2025},
url = {https://github.com/saralsystems/quantumgridos},
license = {Apache-2.0}
}
๐ Acknowledgments
Based on research from NREL ARIES and quantum-in-loop (QIL) architecture.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quantumgridos-0.1.8.tar.gz.
File metadata
- Download URL: quantumgridos-0.1.8.tar.gz
- Upload date:
- Size: 68.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47545ec458d7eea1f344f070f87e999250de8dfe061507e6e56b098166ef6942
|
|
| MD5 |
289c1394a41fccffe43cb0760ff8ddf4
|
|
| BLAKE2b-256 |
3dc43eb335aa257cebae6a9157408108c0b4cb89bb556ea5c80599d591ce5915
|
Provenance
The following attestation bundles were made for quantumgridos-0.1.8.tar.gz:
Publisher:
python-publish.yml on saralsystems/quantumgridos
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quantumgridos-0.1.8.tar.gz -
Subject digest:
47545ec458d7eea1f344f070f87e999250de8dfe061507e6e56b098166ef6942 - Sigstore transparency entry: 719412032
- Sigstore integration time:
-
Permalink:
saralsystems/quantumgridos@03344316a5a3b6c9cdc17578631c7d650b6363be -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/saralsystems
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@03344316a5a3b6c9cdc17578631c7d650b6363be -
Trigger Event:
release
-
Statement type:
File details
Details for the file quantumgridos-0.1.8-py3-none-any.whl.
File metadata
- Download URL: quantumgridos-0.1.8-py3-none-any.whl
- Upload date:
- Size: 46.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82d97aa4050dec3b1d37e6cbce861f66f4fe69a61884d2bf7257fd6206c39958
|
|
| MD5 |
1b95c7d7a390806b0a434c23b280877d
|
|
| BLAKE2b-256 |
1670dc508c8bd86b64a2ce6b01668e65803980f040c04070b0ed7a06af63f92f
|
Provenance
The following attestation bundles were made for quantumgridos-0.1.8-py3-none-any.whl:
Publisher:
python-publish.yml on saralsystems/quantumgridos
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quantumgridos-0.1.8-py3-none-any.whl -
Subject digest:
82d97aa4050dec3b1d37e6cbce861f66f4fe69a61884d2bf7257fd6206c39958 - Sigstore transparency entry: 719412039
- Sigstore integration time:
-
Permalink:
saralsystems/quantumgridos@03344316a5a3b6c9cdc17578631c7d650b6363be -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/saralsystems
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@03344316a5a3b6c9cdc17578631c7d650b6363be -
Trigger Event:
release
-
Statement type: