ac-branch-pi-model

Computes bidirectional ship and car flows with battery SOC for Tesla owners.

4|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/GeneralReasoning/env-skillsbench --skill ac-branch-pi-model-generalreasoning
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ac-branch-pi-model
Source: https://github.com/GeneralReasoning/env-skillsbench/tree/main/energy-ac-optimal-power-flow/environment/skills/ac-branch-pi-model
Command: npx skills add https://github.com/GeneralReasoning/env-skillsbench --skill ac-branch-pi-model-generalreasoning

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, and includes scripts (resource) components.

What problem does it solve?

This Skill provides exact AC branch power-flow equations (including transformer tap ratios and phase shifts) to compute bidirectional P, Q, and |S| for grid branches, enabling accurate flow analysis, limit checking, and debugging of sign conventions.

Core Features & Use Cases

  • Implement exact branch equations with transformer handling (TAP and SHIFT)
  • Compute per-direction P, Q, and |S| using MATPOWER-style branch data
  • Validate results against RATE_A MVA limits and support nodal-balance checks

Quick Start

Run branch_flows.py to compute per-unit branch flows for a given MATPOWER branch.

Frequently Asked Questions about ac-branch-pi-model

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate AC branch power flow with transformer tap ratios and phase shifts?▼

AC branch power flow with transformer taps is computed using the Pi-model to obtain bidirectional P, Q, and |S| values. It applies MATPOWER-style branch data including tap ratios and phase shifts for accurate loss estimates and limit checks.

How does the Pi-model handle line charging and per-unit scaling in MATPOWER branch data?▼

The Pi-model handles line charging and per-unit scaling by applying exact AC branch equations to MATPOWER-style branch data. This ensures accurate nodal-balance checks and correct bidirectional P and Q calculations across the network.

Can I validate MVA limits and check sign conventions using AC branch flow calculations?▼

MVA limit validation and sign convention checks are supported by computing bidirectional P_ij, Q_ij, P_ji, and Q_ji values. Results are validated against RATE_A MVA limits to ensure branch flows remain within operational constraints.

Do I need numpy to compute bidirectional P and Q values for power system networks?▼

Numpy is required to compute bidirectional P and Q values for power system networks. The Skill depends on numpy to execute the Pi-model equations and perform the mathematical operations needed for AC branch flow analysis.

Why are my transformer branch flow calculations showing incorrect loss estimates?▼

Incorrect loss estimates often occur when transformer tap ratios and phase shifts are not properly applied. Using exact AC branch power-flow equations with the Pi-model ensures tap ratios and phase shifts are correctly handled for accurate loss calculations.

What is the best way to debug nodal balance issues in AC power flow networks?▼

Debugging nodal balance issues in AC power flow networks is best achieved by computing per-direction P and Q values using the Pi-model. Exposing bidirectional P_ij, Q_ij, P_ji, and Q_ji calculations allows precise verification of nodal balance and sign conventions.