Skip to main content

Power system analysis you can read, audit, and trust.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

VectorGrid

VectorGrid

Power system analysis you can read, audit, and trust.

Website · Documentation · Privacy


VectorGrid is a Python library for power system analysis. It ships a Newton-Raphson power flow solver and IEC 60909 short-circuit analysis, with optimal power flow and more on the way.

Every matrix assembly, every iteration, every convergence check is readable code — not a black box. Built on NumPy and SciPy. No wrappers around legacy Fortran. No opaque binaries.

Installation

pip install vectorgrid

Requires Python 3.10+.

Quick Start

from vectorgrid import Network

net = Network(sb_mva=100, f_hz=50)

# Create buses
b1 = net.add_bus(vr_kv=110.0)
b2 = net.add_bus(vr_kv=20.0)

# Add a transformer
net.add_transformer_2w(bus_1=b1, bus_2=b2, sr_mva=40, vk_percent=12.0,
                       pcu_kw=50, pfe_kw=30, j0_percent=0.1)

# External grid (slack bus)
net.add_external_grid(bus=b1, v_percent=102, sk_max_mva=2000, rx_ratio=0.1)

# Load
net.add_load(bus=b2, p_mw=20, q_mvar=10)

# Run power flow
results = net.run_power_flow(method="nr", tolerance=1e-8, max_iterations=30)

print(results["converged"])
print(results["buses"])
print(results["lines"])

# Short-circuit analysis
from vectorgrid import ShortCircuit

sc = ShortCircuit(net)

# IEC 60909 — all-bus sweep
sc_results = sc.run_iec60909(fault_type='3ph', case='max')
print(sc_results["buses"])

# IEC 60909 — single bus, detailed
sc_detail = sc.run_iec60909(fault_type='lg', case='max', fault_bus=b2)
print(sc_detail["fault"])

# Superposition method
sc_super = sc.run_superposition(fault_type='3ph', fault_bus=b2)
print(sc_super["fault"])

Features

Power Flow (v0.1)

  • Newton-Raphson — full Jacobian with sparse direct solver
  • Decoupled Newton-Raphson — P-theta / Q-V separation with LU factorization
  • Voltage-dependent load models (constant power, ZIP, exponential)
  • Transformer tap changers and phase shifters
  • Configurable convergence tolerance and iteration limits

Short-Circuit Analysis (v0.2)

  • IEC 60909 — standards-based calculation for equipment rating (Ik'', ip, Ib, Ith)
  • Superposition method — physically accurate fault analysis using pre-fault power flow
  • Three-phase, line-to-ground, line-to-line, and line-to-line-to-ground faults
  • Voltage correction factors, generator/transformer correction factors (KG, KS)
  • All-bus sweep or single-bus detailed analysis
  • Sequence-domain modeling (positive, negative, zero) with transformer vector group handling

Coming Soon

  • Optimal Power Flow — generation dispatch, voltage setpoints, and reactive power optimization
  • Hosting Capacity Analysis — assess grid capacity for solar, wind, storage, and EV chargers
  • Volt/VAR Optimization — optimal placement and sizing of reactive compensation
  • Network Reconfiguration — topology optimization to minimize losses

Why VectorGrid?

Power system engineers routinely make decisions worth millions of dollars based on simulation results from tools they cannot inspect. VectorGrid takes a different approach:

  • Read the solver. Every line of the Newton-Raphson implementation, Jacobian assembly, and admittance matrix construction is source code you can open, read, and understand.
  • Validate the math. Compare results against IEEE test cases, pandapower, or hand calculations. The test suite does this systematically.
  • Use it freely. Research, education, internal engineering work — no restrictions. Build scripts, automate studies, integrate into your workflows.

Dependencies

No other runtime dependencies.

License

VectorGrid is source-available under the Business Source License 1.1.

  • Free to use for research, education, and internal engineering work
  • Cannot be used to build a competing commercial power system analysis product
  • Converts to Apache License 2.0 on May 7, 2030

For commercial licensing inquiries, contact info@vectorgrid.me.

Links

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

vectorgrid-0.2.0.tar.gz (36.8 kB view details)

Uploaded Source

Built Distribution

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

vectorgrid-0.2.0-py3-none-any.whl (41.1 kB view details)

Uploaded Python 3

File details

Details for the file vectorgrid-0.2.0.tar.gz.

File metadata

  • Download URL: vectorgrid-0.2.0.tar.gz
  • Upload date:
  • Size: 36.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for vectorgrid-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9ed449a520ed952e0a8c75f05fa61231aacdeeeec2b8c30102cfbf98fda52405
MD5 d8276d72643f0d05477a29abbea5f075
BLAKE2b-256 0209fd35110ce066cc1d8362b93c2ad04381234919208e73458fd8c9d92dd0ae

See more details on using hashes here.

File details

Details for the file vectorgrid-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: vectorgrid-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 41.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for vectorgrid-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7a2782fda425f490f414ea735874a3129c10dc182d398494ebf8975c59252af
MD5 c5f4cc4c20deffa355cb0cbc262f2efc
BLAKE2b-256 a00fbe9078555d9eef0adcf94b02e1c7b839b56b698bd3b2e02c6685f9fc3b7d

See more details on using hashes here.

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