This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Notebooks · lib/power/matpower_ref

The power flow against MATPOWER's own solution

MATPOWER's test suite solves its 9-bus case t_case9_pf (lib/t/t_case9_pf.m, bus 3 renumbered 30) and stores the result in lib/t/soln9_pf.mat (AC) and soln9_dcpf.mat (DC), in the MATPOWER repository (commit 80b6e16, 2026-10-12; BSD-3-Clause, see lib/power/cases/LICENSE-MATPOWER). The numbers below are those files' result columns, read with scipy.io.loadmat and printed with every digit.

Newton's method and the DC solve agree with MATPOWER to rounding. The fast-decoupled method converges to the same equations at the same tolerance (mismatch below 10−8 per unit) along a different path, so it is held to that tolerance: about 10−6 MVAr and 10−7 degrees here.

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

This program declares a record type (Expected), and records run only in compiled C for now, so the Run buttons here are off. Open it in the workbench and use its C tab to compile it.

Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.

[1]lines 18–110