🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

ac-branch-pi-model

by @wu-uk

AC branch pi-model power flow equations (P/Q and |S|) with transformer tap ratio and phase shift, matching `acopf-math-model.md` and MATPOWER branch fields....

Versionv0.1.0
πŸ’‘ Examples

  • Use scripts/branch_flows.py to compute per-unit branch flows.
  • Treat the results as power leaving the β€œfrom” bus and power leaving the β€œto” bus (i.e., compute both directions explicitly).
  • Example:

    import json
    import numpy as np

    from scripts.branch_flows import compute_branch_flows_pu, build_bus_id_to_idx

    data = json.load(open("/root/network.json")) baseMVA = float(data["baseMVA"]) buses = np.array(data["bus"], dtype=float) branches = np.array(data["branch"], dtype=float)

    bus_id_to_idx = build_bus_id_to_idx(buses)

    Vm = buses[:, 7] # initial guess VM Va = np.deg2rad(buses[:, 8]) # initial guess VA

    br = branches[0] P_ij, Q_ij, P_ji, Q_ji = compute_branch_flows_pu(Vm, Va, br, bus_id_to_idx)

    S_ij_MVA = (P_ij2 + Q_ij2) ** 0.5 * baseMVA S_ji_MVA = (P_ji2 + Q_ji2) ** 0.5 * baseMVA print(S_ij_MVA, S_ji_MVA)

    View on ClawHub
    TERMINAL
    clawhub install energy-ac-optimal-power-flow-ac-branch-pi-model

    πŸ§ͺ Use this skill with your agent

    Most visitors already have an agent. Pick your environment, install or copy the workflow, then run the smoke-test prompt above.

    πŸ” Can't find the right skill?

    Search 60,000+ AI agent skills β€” free, no login needed.

    Search Skills β†’