Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
path: .

- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@59db25f34e16620e48ab4bb9e4a5dce155cb5432
uses: sonarsource/sonarqube-scan-action@7006c4492b2e0ee0f816d36501671557c97f5995
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd

- name: License Header Check
uses: B1NARY-GR0UP/nwa@de997f652a66feac9b4dc819bdf80671985b50d0
uses: B1NARY-GR0UP/nwa@3e1823c61ba2818a156c77b4eedc7905d6a8557c
with:
version: latest # (optional) version of nwa to use; default: latest
cmd: check # (optional) command to execute; options: `check`, `add`, `update`, `remove`; default: check
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.15.14
rev: v0.15.17
hooks:
# Run the linter.
- id: ruff
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"python.testing.pytestArgs": [
"tests"
"tests", "-n", "auto"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/astral-sh/uv:0.11.16@sha256:440fd6477af86a2f1b38080c539f1672cd22acb1b1a47e321dba5158ab08864d AS uv
FROM ghcr.io/astral-sh/uv:0.11.21@sha256:ff07b86af50d4d9391d9daf4ff89ce427bc544f9aae87057e69a1cc0aa369946 AS uv

FROM python:3.13.6-bullseye@sha256:f58f33e0563f2ba81c7afe6259cd912f0c33413da93c75cc3a70a941c17afa8c

Expand Down
32 changes: 32 additions & 0 deletions docs/dc_plus/injection_outage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Injection Outage

`non_voltage_regulating_injection_outage_dx` computes one-step AC state updates for a batch of injection outages around the N-0 operating point.

The Jacobian is kept fixed. Each outage only contributes an active and reactive power mismatch at the affected bus, and the batched update is evaluated with the base inverse Jacobian.

$$
\Delta X = - M J^{-T}
$$

where `J` is the base-case Jacobian and `M` is the batch of outage mismatch vectors in Jacobian ordering.

## Batch API

The function expects a 2D outage array with shape `(n_contingencies, n_outages)`.

- Each row is one contingency.
- A row may contain multiple outage indices.
- Negative entries are ignored and can be used as padding.
- The return value has shape `(n_contingencies, n_eq)`.

## Scope

This update is intended for non-voltage-regulating injections such as loads and other fixed-power injections.

## Generator Behavior

The function can also be applied to voltage-regulating generator outages, but this is only an approximation. A voltage-regulating generator outage should normally trigger a PV to PQ bus-type change. The current implementation does not model that switch, so it does not capture the resulting voltage drop at the regulated bus.

## HVDC

- HVDC converter outages should be outaged in pairs. DC+ models the HVDC line as a pair of generator + load injections, one at each terminal.
16 changes: 11 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ requires-python = ">=3.11,<3.12"


dependencies = [
"pydantic>=2.13.4,<3.0.0",
"pydantic>=2.8.2,<3.0.0",
"pandapower>=3.0.0,<4.0.0",
"pypowsybl>=1.14.0",
"numpydantic>=1.6.4,<2.0.0",
"pypowsybl-jupyter>=1.3.0",
"matplotlib>=3.10.8",
"jax>=0.10.0",
"jax-dataclasses (>=1.6.2,<2.0.0)"
"jax (>=0.4.30)",
"jax-dataclasses (>=1.6.2,<2.0.0)",
"equinox>=0.13.8",
]

license = "MPL-2.0"
Expand Down Expand Up @@ -83,9 +84,14 @@ doc = [
"mkdocs-material>=9.6.8",
"mkdocs-autorefs>=1.4.2",
"mkdocs-material-extensions>=1.3.1",
"mkdocs-include-markdown-plugin>=7.1.6",
"mkdocs-include-markdown-plugin>=7.3.0",
"mkdocs-techdocs-core >=1.5.4",
"mkdocstrings[python]>=1.0.4",
"mkdocstrings[python]>=0.30.0",
]
devgpu =[
"jax[cuda12]==0.6.2",
"tensorflow>=2.20.0,<3.0.0",
"tensorboard>=2.20.0,<3.0.0"
]

# TOOLS
Expand Down
19 changes: 19 additions & 0 deletions src/dc_plus/example_grids/pypowsbl/example_grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,25 @@ def basic_node_breaker_network_powsybl() -> pypowsybl.network.Network:
pypowsybl.network.create_metrix_tutorial_six_buses_network, # HVDC
]

POWSYBL_NETWORKS_SHORT_LIST = [
pypowsybl.network.create_ieee9,
pypowsybl.network.create_ieee14,
pypowsybl.network.create_ieee30,
pypowsybl.network.create_ieee57,
pypowsybl.network.create_micro_grid_nl_network,
basic_node_breaker_network_powsybl,
create_complex_grid_battery_hvdc_svc_3w_trafo,
]

POWSYBL_NETWORKS_IEEE = [
pypowsybl.network.create_ieee9,
pypowsybl.network.create_ieee14,
pypowsybl.network.create_ieee30,
pypowsybl.network.create_ieee57,
pypowsybl.network.create_ieee118,
pypowsybl.network.create_ieee300,
]

# TODO: check this network and add to POWSYBL_NETWORKS if possible (currently fails)
POWSYBL_NETWORKS_NOT_IMPLEMENTED = [
pypowsybl.network.create_micro_grid_be_network,
Expand Down
Loading