Sparlectra.jl

Power-system analysis in Julia: AC and DC power flow, WLS state estimation, IEC 60909 short circuit, scenarios and N-1 contingency, import and export in various formats.

Documentation Version License: Apache-2.0 Julia Open in Colab SBOM: SPDX

Nothing in Sparlectra is a black box. The rectangular Newton-Raphson solver exposes model construction, Jacobian assembly, PV/PQ switching and convergence at runtime; a DC power flow and the analytic APSLF backend (AnalyticLoadFlow.jl) are available alongside it. State estimation reports observability and bad data, short-circuit sweeps and SE diagnostics use the Takahashi selected inverse. Every run is deterministic and configuration-driven, results are machine-readable. This suits grid studies as well as solver development and teaching.

The full capability list is in the feature matrix.


Try it in your browser

No installation required, the workshop notebooks run on Google Colab:

NotebookOpen
Tour, basic: first network, model editing, Q-limits, slack types, OLTC and Q(U) controlOpen in Colab
Tour, advanced: remote voltage control, HVDC link, state estimation, FACTS incl. UPFC, N-1, threaded sweepsOpen in Colab
Transformer control: parallel units, master/slave groups, CGMES RegulatingControlOpen in Colab
CGMES: anatomy of a delivery, bus-branch and node-breaker import, SV validation, export round tripOpen in Colab
Slack types and short circuit: ideal, external grid, distributed slack, IEC 60909-0 currentsOpen in Colab
Distributed slack: participation weights, normalization, fallbackOpen in Colab
Transformer taps: OLTC, PST, X(α) characteristic, 3WT star equivalentOpen in Colab
FACTS flow control: TCSC to UPFCOpen in Colab
Scenarios and N-1 screeningOpen in Colab
State estimation: measurement sets, observability, WLS, bad dataOpen in Colab

The notebooks are generated from docs/lit/ and are also part of the documentation.


Installation

As a Julia package:

using Pkg
Pkg.add("Sparlectra")

Web UI: one-line install

Installs Julia if missing, downloads the latest tagged release into Sparlectra/ in the current directory, and starts the Web UI.

Linux/macOS:

curl -fsSL https://raw.githubusercontent.com/Welthulk/Sparlectra.jl/main/tools/install_webui.sh | sh

Windows (PowerShell):

iwr -useb https://raw.githubusercontent.com/Welthulk/Sparlectra.jl/main/tools/install_webui.bat -OutFile install_webui.bat; .\install_webui.bat

[!IMPORTANT] This downloads and runs a script. If you prefer to read it first: install_webui.sh, install_webui.bat.

Re-running the command updates an existing copy (the old one is kept as Sparlectra.old). From a checkout, ./start_webui.sh or start_webui.bat starts the Web UI directly. Environment variables for unattended installs and all other options: Web UI documentation.

Startup time

[!IMPORTANT] Julia compiles on first use, so the first run in a fresh process is slow. The installer offers to build a sysimage once (10 to 20 minutes); afterwards using Sparlectra returns at once. How to build and use it in your own scripts: integration guide.

SBOM

Every release ships an SPDX SBOM as a release asset: Sparlectra.spdx.json. julia tools/generate_sbom.jl builds one locally.


Quick start

run_sparlectra runs the whole chain: import, configuration, control loops, solve, report. ensure_casefile downloads case14.m if it is not present locally.

using Sparlectra

case_path = ensure_casefile("case14.m")

result = run_sparlectra(
    casefile = basename(case_path),
    path = dirname(case_path),
)

println(result.outcome)
println(result.iterations)
println(result.final_mismatch)

An ENTSO-E CGMES delivery: diagnose, import, solve, compare with the delivered SV profile:

using Sparlectra

summary = summarizeCGMES(path = ["grid.zip", "boundary.zip"])
result  = importCGMES(path = ["grid.zip", "boundary.zip"])
runpf!(result.net, 30, 1e-8, 0)

cmp = compareWithSV(result)
@show cmp.max_dvm

Embedding Sparlectra in your own tooling (scripts, sysimage, API): integration guide.


Local Web UI

Case management, run history and results in the browser. Cases can be taken from the local cache, uploaded (MATPOWER, DTF, CGMES ZIP) or fetched by name.

Sparlectra Web UI: case, settings, run and result

Documentation

Full documentation: https://welthulk.github.io/Sparlectra.jl/


Contributing

Bug reports, test networks and import edge cases (CGMES, MATPOWER, DTF) are welcome. Questions: Discussions. Please read CONTRIBUTING.md and CODEOFCONDUCT.md first.

Citing

@software{sparlectra_jl,
  title  = {Sparlectra.jl: A Power-Flow and State-Estimation Framework in Julia},
  author = {Schmitz, Udo},
  year   = {2026},
  url    = {https://github.com/Welthulk/Sparlectra.jl}
}

License

Apache License 2.0, see LICENSE.