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/ybus

The bus admittance matrix

A network of n buses joined by branches is summarized by the n by n bus admittance matrix Y: the bus current injections are I = Y V. Each branch is a pi section (series admittance ys = 1/(r + jx), total charging susceptance b split between its ends) behind an ideal transformer of complex ratio t = tap e^(j shift) at the from end, so its two-port admittances are

yff = (ys + jb/2) / |t|^2     yft = -ys / conj(t)
ytf = -ys / t                 ytt = ys + jb/2

and it adds yff at (f, f), yft at (f, t), ytf at (t, f) and ytt at (t, t). A bus shunt Gs + jBs (MW and MVAr consumed at 1 per unit voltage) adds (Gs + jBs) / baseMVA on the diagonal. These are the branch model and the assembly of MATPOWER's makeYbus (MATPOWER manual, section 3.2); a tap ratio of 0 means 1, a line rather than a transformer.

Y is stored in compressed sparse column form with complex values. Each branch's four admittances are kept too, for the branch flows.

The fast-decoupled method needs two real matrices made the same way from a simplified network (MATPOWER's makeB, the XB version): B' with no bus shunts, no line charging, unit tap ratios and no resistance, B'' with no phase shifts. make_ybus takes those simplifications as flags.

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 (Ybus), 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 29–200