AGENT SKILL

power-flow-data

Load MATPOWER-format network data from `network.json` efficiently (including reserves) and do quick sanity checks; set up a virtualenv if required packages are missing.

License 许可
Apache-2.0
最近更新
2026-11-14
Stars
★ 0
Forks
1

01 前言 Front Matter

name
power-flow-data
description
Load MATPOWER-format network data from `network.json` efficiently (including reserves) and do quick sanity checks; set up a virtualenv if required packages are missing.

03 SKILL.md 正文

Steps

  1. Confirm the input snapshot exists at ./network.json.
  2. If imports fail due to an externally managed environment, create and use a local virtualenv:
    python3 -m venv .venv
    source .venv/bin/activate
    python -m pip install -U pip
    pip install numpy cvxpy clarabel
    
  3. Load the JSON with Python (avoid line-by-line shell inspection for large files):
    import json, numpy as np
    with open("network.json") as f:
        data = json.load(f)
    baseMVA = float(data["baseMVA"])
    buses = np.array(data["bus"])
    gens = np.array(data["gen"])
    branches = np.array(data["branch"])
    gencost = np.array(data["gencost"])
    reserve_capacity = np.array(data["reserve_capacity"])
    reserve_requirement = float(data["reserve_requirement"])
    
  4. Print quick sanity checks (counts/shapes and reserve requirement):
    print(buses.shape, gens.shape, branches.shape, gencost.shape)
    print("reserve_requirement:", reserve_requirement)
    

Expected Result

All MATPOWER arrays and reserve fields loaded into NumPy with correct dimensions, ready for DC-OPF and dual-based pricing.

04 同仓库更多 Skills