← Back to Skills Marketplace
wu-uk

dc-power-flow

by wu-uk · GitHub ↗ · v0.1.0 · MIT-0
cross-platform ✓ Security Clean
114
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install grid-dispatch-operator-dc-power-flow
Description
DC power flow analysis for power systems. Use when computing power flows using DC approximation, building susceptance matrices, calculating line flows and lo...
README (SKILL.md)

DC Power Flow

DC power flow is a linearized approximation of AC power flow, suitable for economic dispatch and contingency analysis.

DC Approximations

  1. Lossless lines - Ignore resistance (R ≈ 0)
  2. Flat voltage - All bus voltages = 1.0 pu
  3. Small angles - sin(θ) ≈ θ, cos(θ) ≈ 1

Result: Power flow depends only on bus angles (θ) and line reactances (X).

Bus Number Mapping

Power system bus numbers may not be contiguous (e.g., case300 has non-sequential bus IDs). Always create a mapping from bus numbers to 0-indexed array positions:

# Create mapping: bus_number -> 0-indexed position
bus_num_to_idx = {int(buses[i, 0]): i for i in range(n_bus)}

# Use mapping for branch endpoints
f = bus_num_to_idx[int(br[0])]  # NOT br[0] - 1
t = bus_num_to_idx[int(br[1])]

Susceptance Matrix (B)

Build from branch reactances using bus number mapping:

# Run: scripts/build_b_matrix.py
# Or inline:
bus_num_to_idx = {int(buses[i, 0]): i for i in range(n_bus)}
B = np.zeros((n_bus, n_bus))

for br in branches:
    f = bus_num_to_idx[int(br[0])]  # Map bus number to index
    t = bus_num_to_idx[int(br[1])]
    x = br[3]  # Reactance
    if x != 0:
        b = 1.0 / x
        B[f, f] += b
        B[t, t] += b
        B[f, t] -= b
        B[t, f] -= b

Power Balance Equation

At each bus: Pg - Pd = B[i, :] @ θ

Where:

  • Pg = generation at bus (pu)
  • Pd = load at bus (pu)
  • θ = vector of bus angles (radians)

Slack Bus

One bus must have θ = 0 as reference. Find slack bus (type=3):

slack_idx = None
for i in range(n_bus):
    if buses[i, 1] == 3:
        slack_idx = i
        break
constraints.append(theta[slack_idx] == 0)

Line Flow Calculation

Flow on branch from bus f to bus t (use bus number mapping):

f = bus_num_to_idx[int(br[0])]
t = bus_num_to_idx[int(br[1])]
b = 1.0 / br[3]  # Susceptance = 1/X
flow_pu = b * (theta[f] - theta[t])
flow_MW = flow_pu * baseMVA

Line Loading Percentage

loading_pct = abs(flow_MW) / rating_MW * 100

Where rating_MW = branch[5] (RATE_A column).

Branch Susceptances for Constraints

Store susceptances when building constraints:

branch_susceptances = []
for br in branches:
    x = br[3]
    b = 1.0 / x if x != 0 else 0
    branch_susceptances.append(b)

Line Flow Limits (for OPF)

Enforce thermal limits as linear constraints:

# |flow| \x3C= rating  →  -rating \x3C= flow \x3C= rating
flow = b * (theta[f] - theta[t]) * baseMVA
constraints.append(flow \x3C= rate)
constraints.append(flow >= -rate)
Usage Guidance
This skill appears coherent for DC power flow calculations. Before running: ensure you have Python and numpy available, validate that your input network JSON contains numeric fields in the expected MATPOWER-like layout (from_bus, to_bus, r, x, b, rateA, ...), and run the script on trusted input (it reads and prints local JSON data). The package does not attempt network access or request credentials, but because there's no install manifest you should run it in an environment you control (e.g., a virtualenv or container) if you have standard operational safety policies.
Capability Analysis
Type: OpenClaw Skill Name: grid-dispatch-operator-dc-power-flow Version: 0.1.0 The skill bundle provides legitimate tools and instructions for DC power flow analysis in power systems. The Python script (scripts/build_b_matrix.py) and the agent instructions (SKILL.md) correctly implement standard electrical engineering calculations using numpy, with no evidence of malicious intent, data exfiltration, or unauthorized execution.
Capability Assessment
Purpose & Capability
The SKILL.md and the included scripts are focused on DC power flow analysis, building B matrices, computing line flows, and related constraints. Required inputs (branch and bus arrays, baseMVA) match the described functionality. There are no extraneous credentials, binaries, or config paths requested that would be unrelated to power-flow analysis.
Instruction Scope
Runtime instructions stay within the stated domain: map bus numbers, build the susceptance matrix, compute power balance and line flows, and enforce limits. The SKILL.md directs running scripts/build_b_matrix.py on a local network JSON file and does not instruct reading unrelated files, environment variables, or contacting external endpoints.
Install Mechanism
This is instruction-only (no install spec). The shipped Python script uses numpy and assumes a Python runtime; the skill does not declare these dependencies. This is not a security concern, but users must ensure an appropriate Python+numpy environment is available before running the script.
Credentials
The skill requires no environment variables, secrets, or config paths. All inputs are explicit function arguments or a local JSON file. There are no requests for unrelated credentials or sensitive system access.
Persistence & Privilege
The skill does not request persistent installation, does not set always:true, and does not modify other skills or system-wide settings. It is user-invocable and can run when invoked, which is appropriate for its purpose.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install grid-dispatch-operator-dc-power-flow
  3. After installation, invoke the skill by name or use /grid-dispatch-operator-dc-power-flow
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.1.0
Bulk publish from all-task-skills-dedup
Metadata
Slug grid-dispatch-operator-dc-power-flow
Version 0.1.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is dc-power-flow?

DC power flow analysis for power systems. Use when computing power flows using DC approximation, building susceptance matrices, calculating line flows and lo... It is an AI Agent Skill for Claude Code / OpenClaw, with 114 downloads so far.

How do I install dc-power-flow?

Run "/install grid-dispatch-operator-dc-power-flow" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is dc-power-flow free?

Yes, dc-power-flow is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does dc-power-flow support?

dc-power-flow is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created dc-power-flow?

It is built and maintained by wu-uk (@wu-uk); the current version is v0.1.0.

💬 Comments