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())
solution = solver.solve()
tcp.send(solution.to_scada_format())
Low-Inertia Counterfactual Search
import quantumgridos as qgo
# Built-in Braket-scale demo case inspired by the GB 9 Aug 2019 disturbance.
study = qgo.create_low_inertia_study()
# QuantumGridOS builds a QUBO candidate-search layer, then validates every
# candidate with reduced frequency-security physics.
result = qgo.solve_low_inertia_counterfactual(
study,
solvers=("exact", "annealing", "qaoa"),
top_k=24,
qaoa_layers=1,
)
print(result.best.portfolio.selected_labels)
print(result.best.metrics["nadir_hz"])
print(result.best.metrics["max_abs_rocof_hz_s"])
Use this API for low-inertia studies where quantum or quantum-inspired solvers search over approved binary grid/DER settings such as synchronous commitment, BESS fast-frequency response, grid-forming mode, DER ride-through package, and pre-event export reduction. Classical physics validation remains authoritative.
For publication screening, enable the native two-area dynamic-label surrogate:
result = qgo.solve_low_inertia_counterfactual(
study,
solvers=("exact", "annealing"),
dynamic_labels=True,
)
label = qgo.label_low_inertia_dynamics(study, bits=result.best.portfolio.bitstring)
print(label.metrics["max_relative_angle_rad"])
print(label.metrics["min_electromechanical_damping_ratio"])
The dynamic labeler adds inter-area angle, area-frequency split, and small-signal damping checks. It is a reproducible reduced electromechanical screen, not a replacement for RMS/EMT validation.
Public handoff links and CUDA execution requirements are available directly from the package:
import quantumgridos as qgo
catalog = qgo.get_low_inertia_public_data_catalog()
print(catalog["s3_public_handoff_bundle"]["s3_uri"])
print(catalog["public_sources"]["neso_august_2019_frequency"])
The July 2026 handoff bundle is stored at:
- S3 URI:
s3://qgo-low-inertia-public-data-20260706-654777652612/public/low_inertia_quantum_public_handoff_20260706.zip - SHA256:
534e4c6b01845f3ac9e48d4fb3f4b0104db025b2f4f6db833eef26ed65bc3fc2 - Approximate size: 91 MB
The object currently requires a presigned HTTPS URL. Do not commit expiring S3 signed URLs to source control; share them out-of-band or generate a fresh one from the owning AWS account. CUDA/cuOpt comparisons should use the same package-variable schema as the CPU and Qiskit solvers and report end-to-end wall-clock time.
Quantum Power Flow
import quantumgridos as qgo
# Load network from CSV
net = qgo.create_network("examples/test_case_4bus", type='csv')
# Run Quantum Newton-Raphson (HHL Fast Mode)
success, x, history, circuit = qgo.run_quantum_nr(net, method='hhl_fast')
if success:
print("Converged! Voltage Angles:", net.buses['v_ang'].values)
# Optional: Visualize the circuit
# from quantumgridos.utils.visualizer import draw_circuit
# draw_circuit(circuit)
๐๏ธ 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.9.tar.gz.
File metadata
- Download URL: quantumgridos-0.1.9.tar.gz
- Upload date:
- Size: 97.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bf5f14da4f255655d1f9205f77ca54c6c0abdbb9c8501414425b50a5bed72df
|
|
| MD5 |
f3205961f6c9e0e57f577814332e2684
|
|
| BLAKE2b-256 |
a26a1609e6590af5118781430ee71a08e181fc168a7e00e0f6c9c925f4da9cc7
|
Provenance
The following attestation bundles were made for quantumgridos-0.1.9.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.9.tar.gz -
Subject digest:
3bf5f14da4f255655d1f9205f77ca54c6c0abdbb9c8501414425b50a5bed72df - Sigstore transparency entry: 2083849600
- Sigstore integration time:
-
Permalink:
saralsystems/quantumgridos@48f74ec0619459b76027d3b9dc01cc759e31eaf6 -
Branch / Tag:
refs/tags/v0.1.9 - Owner: https://github.com/saralsystems
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@48f74ec0619459b76027d3b9dc01cc759e31eaf6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file quantumgridos-0.1.9-py3-none-any.whl.
File metadata
- Download URL: quantumgridos-0.1.9-py3-none-any.whl
- Upload date:
- Size: 73.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5d465e46ca706c88d251a439c09d10823e1d8efc1e19dac9d43e76f138c4d04
|
|
| MD5 |
4cc57d83ffde89f81afd79f5f9df7fed
|
|
| BLAKE2b-256 |
c9b8db039fb3848678c91d966cd6f46f676bc3395ad633cbedf946b7ee6ee36f
|
Provenance
The following attestation bundles were made for quantumgridos-0.1.9-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.9-py3-none-any.whl -
Subject digest:
f5d465e46ca706c88d251a439c09d10823e1d8efc1e19dac9d43e76f138c4d04 - Sigstore transparency entry: 2083849616
- Sigstore integration time:
-
Permalink:
saralsystems/quantumgridos@48f74ec0619459b76027d3b9dc01cc759e31eaf6 -
Branch / Tag:
refs/tags/v0.1.9 - Owner: https://github.com/saralsystems
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@48f74ec0619459b76027d3b9dc01cc759e31eaf6 -
Trigger Event:
push
-
Statement type: