$npx -y skills add Power-Agent/PowerSkills --skill surgeUse this skill for transmission power-system studies — AC/DC power flow, DC-OPF / AC-OPF / SCOPF, N-1 / N-2 contingency analysis, PTDF / LODF / OTDF sensitivities, NERC and AC Available Transfer Capability (ATC), SCED economic dispatch, and SCUC unit commitment. Also use for buil
| 1 | # Surge workflow |
| 2 | |
| 3 | Start by loading a network with `load_builtin_case`, `load_network`, or `create_empty_network`. Solve the base case before any advanced study — contingency, sensitivity, and OPF results are meaningless on a non-convergent base. |
| 4 | |
| 5 | ## Default tool ladder |
| 6 | 1. `load_builtin_case(name)` (e.g. `case118`), `load_network(file_path, format?)`, or `create_empty_network(...)`. |
| 7 | 2. `get_network_info()` for counts, totals, areas, zones, voltage levels. `get_topology(...)` / `get_islands()` / `find_path(...)` for connectivity reasoning. |
| 8 | 3. `run_ac_power_flow(...)` for the base operating point. `run_dc_power_flow(...)` only when a linearized study is explicitly requested. |
| 9 | 4. Sensitivities: `compute_ptdf`, `compute_lodf`, `compute_otdf` for screening and transfer analysis. |
| 10 | 5. `run_n1_branch_contingency` / `run_n1_generator_contingency` / `run_n2_branch_contingency` once the base case solves. |
| 11 | 6. `run_dc_opf` → `run_ac_opf` → `run_scopf` for optimization. Pass explicit `lp_solver` / `nlp_solver` only when the deployment requires it. |
| 12 | 7. `run_sced` (single-period) and `run_scuc` (multi-period commitment). Call `get_dispatch_request_schema()` before constructing the `request` dict. |
| 13 | 8. `compute_nerc_atc` / `compute_ac_atc` for transfer capability. Build source/sink bus lists from `list_buses` output. |
| 14 | 9. `export_tables(output_dir)` to hand CSVs back to the user. |
| 15 | |
| 16 | ## Network construction & editing |
| 17 | For synthetic cases, scenario edits (outage, dispatch change, load scaling), or mutations to a loaded case. Re-solve `run_ac_power_flow` after any material edit. |
| 18 | |
| 19 | - **Build:** `create_empty_network`, `add_bus`, `add_generator`, `add_load`, `add_line`, `add_transformer`, `add_storage`. |
| 20 | - **Edit:** `set_branch_rating`, `set_branch_in_service` (outages), `set_generator_limits`, `set_generator_in_service`. |
| 21 | - **Scale:** `scale_loads(factor, area?)`, `scale_generators(factor, area?)`. |
| 22 | - **Remove:** `remove_bus`, `remove_branch`, `remove_generator`, `remove_load`. |
| 23 | |
| 24 | ## Working rules |
| 25 | - Do not read contingency or sensitivity results from a non-convergent base case. |
| 26 | - Sensitivity tools default to `format="summary"`. Use `"sparse"` or `"full"` only when CSR or dense output is actually needed. |
| 27 | - Solver selection is a deployment question. Default to auto-detect (`"default"`); pass `"highs"` / `"ipopt"` for open-source runs, `"gurobi"` for large MIPs. See `references/SOLVER_GUIDE.md`. |
| 28 | - Call `get_dispatch_request_schema()` before building a `run_sced` / `run_scuc` request dict. |
| 29 | - Hand off RMS / transient-stability questions to ANDES, harmonic / unbalanced questions to OpenDSS. |
| 30 | |
| 31 | ## Escalation triggers |
| 32 | Map observed violations to the mitigation skill that handles them. If multiple triggers fire, escalate voltage → thermal → contingency. |
| 33 | |
| 34 | | Observation | Escalate to | |
| 35 | |---|---| |
| 36 | | Any bus `vm_pu < 0.95` or `> 1.05` | `voltage-violation-mitigation` | |
| 37 | | Any branch loading > 100% of `rate_a_mva` | `thermal-overload-mitigation` | |
| 38 | | `run_n1_*` returns ≥ 1 binding contingency | `contingency-mitigation` | |
| 39 | | `get_islands()` returns > 1 island after a contingency | `contingency-mitigation` | |
| 40 | | SCED / SCUC infeasible, reserve shortage, or LMP volatility | `operations-planning-mitigation` | |
| 41 | | `run_ac_power_flow` fails to converge on the base case | `convergence-failure-mitigation` | |
| 42 | | The study is a new generator, storage, or large-load connection at a POI | `interconnection-impact-mitigation` | |
| 43 | |
| 44 | Report the specific numbers that triggered the escalation (bus + vm_pu, branch + loading %, contingency label). Do not say "violations exist" without values. |
| 45 | |
| 46 | ## Local assets |
| 47 | - `scripts/network_analysis.py` — inspection and base PF review. |
| 48 | - `scripts/sensitivity_analysis.py` — PTDF, LODF drill-down. |
| 49 | - `scripts/contingency_analysis.py` — N-1 / N-2 summaries. |
| 50 | - `scripts/contingency_ranking.py` — N-1 → severity rank → CSV → mitigation-skill mapping. `python contingency_ranking.py <case> <out_dir>`. |
| 51 | - `scripts/opf_analysis.py` — DC / AC / SCOPF with solver-s |