Skip to main content

Real-time quantum computing interface for power systems optimization

Project description

QuantumGridOS

Python License Documentation

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


Download files

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

Source Distribution

quantumgridos-0.1.8.tar.gz (68.0 kB view details)

Uploaded Source

Built Distribution

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

quantumgridos-0.1.8-py3-none-any.whl (46.9 kB view details)

Uploaded Python 3

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

Hashes for quantumgridos-0.1.8.tar.gz
Algorithm Hash digest
SHA256 47545ec458d7eea1f344f070f87e999250de8dfe061507e6e56b098166ef6942
MD5 289c1394a41fccffe43cb0760ff8ddf4
BLAKE2b-256 3dc43eb335aa257cebae6a9157408108c0b4cb89bb556ea5c80599d591ce5915

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantumgridos-0.1.8.tar.gz:

Publisher: python-publish.yml on saralsystems/quantumgridos

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

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

Hashes for quantumgridos-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 82d97aa4050dec3b1d37e6cbce861f66f4fe69a61884d2bf7257fd6206c39958
MD5 1b95c7d7a390806b0a434c23b280877d
BLAKE2b-256 1670dc508c8bd86b64a2ce6b01668e65803980f040c04070b0ed7a06af63f92f

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantumgridos-0.1.8-py3-none-any.whl:

Publisher: python-publish.yml on saralsystems/quantumgridos

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