QuantumGridOS
QuantumGridOS is a Python library for connecting power systems data to quantum computers.
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.
Metadata
Release files for quantumgridos 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| quantumgridos-0.1.9.tar.gz | 97.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| quantumgridos-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 170.5 kB
Release files / quantumgridos-0.1.9.tar.gz
| Download URL | quantumgridos-0.1.9.tar.gz |
|---|---|
| Size | 97.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3bf5f14da4f255655d1f9205f77ca54c6c0abdbb9c8501414425b50a5bed72df
|
|
BLAKE2b-256 checksum How to use checksums |
a26a1609e6590af5118781430ee71a08e181fc168a7e00e0f6c9c925f4da9cc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.
Transparency logRelease files / quantumgridos-0.1.9-py3-none-any.whl
| Download URL | quantumgridos-0.1.9-py3-none-any.whl |
|---|---|
| Size | 73.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5d465e46ca706c88d251a439c09d10823e1d8efc1e19dac9d43e76f138c4d04
|
|
BLAKE2b-256 checksum How to use checksums |
c9b8db039fb3848678c91d966cd6f46f676bc3395ad633cbedf946b7ee6ee36f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.
Transparency logSecurity for quantumgridos 0.1.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for quantumgridos-0.1.9.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.