AGENT SKILL

pypsa

Guides PyPSA power-system network modeling, data I/O, optimization, power flow, statistics, plotting, clustering, and troubleshooting workflows.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
pypsa
license
MIT
metadata
{ "disco-role": "operating" }
description
Guides PyPSA power-system network modeling, data I/O, optimization, power flow, statistics, plotting, clustering, and troubleshooting workflows.
disable-model-invocation
true

02 资源文件 7

03 SKILL.md 正文

PyPSA repo skill

Use this skill when a task asks about PyPSA (Python for Power Systems Analysis) as a Python package for power-system or energy-system network modeling, optimization, simulation, data exchange, result analysis, plotting, or troubleshooting.

First checks

  • PyPSA is primarily a Python API package; there is no package-level console script to route through.
  • Start from import pypsa and pypsa.Network() unless the task is specifically about loading an existing network file.
  • Base PyPSA covers network modeling, CSV/netCDF I/O, HiGHS optimization, power flow, statistics, and no-geomap plotting.
  • Optional extras are feature-specific: HDF5, Excel, cloud paths, Cartopy, Gurobi, scikit-learn spatial clustering, TSAM temporal segmentation, and external converters.
  • If the current repository or package version may differ from this skill, read repository provenance.

Install and environment

Read install and environment guidance before changing dependencies, selecting solvers, or relying on optional extras.

Minimal import check:

import pypsa
n = pypsa.Network()
n.add("Carrier", "AC")
n.add("Bus", "bus", carrier="AC")

Bundled helpers:

Route by task

Build or fix a network model

Use network-modeling for:

  • pypsa.Network, n.add, n.remove, snapshots, investment periods, and stochastic scenarios.
  • Component tables, time-varying attributes, standard line/transformer types, carrier rows, and schema/default lookup.
  • Old/new Components API migration, pypsa.options, n.consistency_check, n.sanitize, n.copy, and n.equals.

Load, save, or repair network data

Use network-io-data for:

  • Network(import_name=...), CSV folders, netCDF, HDF5, Excel, URLs, and cloud object storage.
  • Data layout, snapshots/time-series file alignment, metadata/CRS, round-trip validation, example cache behavior.
  • PYPOWER and pandapower import converters and optional I/O dependency failures.

Optimize, solve, or run power flow

Use optimization-powerflow for:

  • n.optimize, create_model, solve_model, extra_functionality, custom Linopy constraints, and solver options.
  • Capacity expansion, dispatch, storage, unit commitment, global constraints, stochastic or multi-investment planning, MGA, rolling horizon, piecewise curves, and transmission losses.
  • n.lpf, n.pf, optimize-then-nonlinear-power-flow validation, solver failures, infeasibility, and convergence triage.

Analyze, plot, compare, or cluster results

Use analysis-visualization for:

  • n.statistics / n.stats, metric filters, groupers, time aggregation, and custom groupers.
  • Static and interactive statistics plots, network maps, n.plot.map, n.plot.iplot, and n.plot.explore.
  • NetworkCollection scenario comparison and temporal/spatial clustering, including optional Cartopy, scikit-learn, and TSAM behavior.

Shared references

  • Package overview maps public APIs, concepts, optional extras, and sub-skill ownership.
  • Install and environment guidance explains Python versions, solver defaults, extras, environment variables, options, offline use, and headless plotting.
  • Troubleshooting is the cross-cutting triage map for install/import, schema, solver, power-flow, plotting, clustering, and optional dependency failures.
  • Repository provenance records the source commit, package version, evidence paths, and refresh triggers.
  • Routing metadata is structured metadata for managed repo-skills-router import.

Core operating loop

  1. Decide whether the network should be built in code or loaded from a file; route to modeling or I/O.
  2. Validate carriers, buses, component names, snapshots, time-series shapes, and optional API settings before solving.
  3. For optimization, start with solver_name="highs", explicit include_objective_constant, and a small horizon before scaling.
  4. For power flow, run a linear flow first when nonlinear convergence is uncertain.
  5. Analyze solved outputs with statistics and plots; on unsolved networks, prefer input-side metrics such as installed capacity.
  6. When optional features fail, install only the feature-specific extra or use the documented base fallback.

Do not

  • Do not tell future agents to open or run original PyPSA repository docs, tests, notebooks, examples, or scripts; this generated skill bundles the reusable guidance and smoke helpers needed for operation.
  • Do not install all optional extras or dev/docs dependencies unless the task explicitly needs them.
  • Do not treat a CPU import as proof that optional Cartopy, Gurobi, cloud, Excel, HDF5, scikit-learn, TSAM, pandapower, or PYPOWER workflows are installed.
  • Do not run large notebooks, network downloads, cloud operations, or commercial-solver IIS checks without explicit task need and credentials/license availability.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351