Skip to content

Commit bbd71ca

Browse files
committed
Update generation perturbation implementation and docs
1 parent 84d415d commit bbd71ca

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

docs/components/param_handler.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ This module provides utilities for handling and manipulating configuration param
1818

1919
::: gridfm_datakit.utils.param_handler.get_load_scenario_generator
2020

21-
### `initialize_generator`
21+
### `initialize_topology_generator`
2222

23-
::: gridfm_datakit.utils.param_handler.initialize_generator
23+
::: gridfm_datakit.utils.param_handler.initialize_topology_generator
24+
25+
### `initialize_generation_generator`
26+
27+
::: gridfm_datakit.utils.param_handler.initialize_generation_generator
2428

2529
## Classes
2630

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ This library is brought to you by the GridFM team to generate power flow data to
3535
</tr>
3636
</thead>
3737
<tbody>
38-
<tr><td>Generator Profile</td><td>✅</td><td>❌</td><td>❌</td><td>✅</td><td>✅</td><td>✅</td><td>❌</td><td></td></tr>
38+
<tr><td>Generator Profile</td><td>✅</td><td>❌</td><td>❌</td><td>✅</td><td>✅</td><td>✅</td><td>❌</td><td></td></tr>
3939
<tr><td>N-1</td><td>❌</td><td>✅</td><td>❌</td><td>❌</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td></tr>
4040
<tr><td>&gt; 1000 Buses</td><td>❌</td><td>✅</td><td>✅</td><td>❌</td><td>❌</td><td>✅</td><td>✅</td><td>✅</td></tr>
4141
<tr><td>N-k, k &gt; 1</td><td>❌</td><td>❌</td><td>❌</td><td>❌</td><td>❌</td><td>❌</td><td>❌</td><td>✅</td></tr>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Generation Perturbations
2+
3+
## Overview
4+
Generation perturbations introduce random changes to the cost functions of generator elements (PV nodes) in the Panda Power `poly_cost` table. The effect of this is that the cost of operating generators in the grid changes across examples, which allows them to be utilised differently when executing optimal power flow. As aresult, examples produced will have more diverse generator setpoints which is beneficial for training ML models to improve generalisation. Generation perturbation is applied to the existing topology perturbations.
5+
6+
The module provides three options for generation perturbation strategies:
7+
8+
- `NoGenPerturbationGenerator` yields the original example produced by the topology perturbation generator without any additional changes in generation cost.
9+
10+
- `PermuteGenCostGenerator` randomly permutes the rows of generator cost coefficients in the `poly_cost` table across and among generator elements.
11+
12+
- `PerturbGenCostGenerator` applies a scaling factor to all generator cost coefficients in the `poly_cost` table. The scaling factor is sampled from a uniform distribution with a range given by `[max(0, 1-sigma), 1+sigma)`, where `sigma` is a user-defined adjustable parameter.

gridfm_datakit/perturbations/generator_perturbation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ def __init__(self, base_net: pp.pandapowerNet, sigma: float) -> None:
113113
self.base_net = base_net
114114
self.num_gens = len(base_net.poly_cost)
115115
self.perturb_cols = self.base_net.poly_cost.columns[2:]
116-
self.lower = 1 - sigma
117-
self.upper = 1 + sigma
116+
self.lower = np.max([0.0, 1.0 - sigma])
117+
self.upper = 1.0 + sigma
118118
self.sample_size = [self.num_gens, len(self.perturb_cols)]
119119

120120
def generate(
@@ -128,7 +128,7 @@ def generate(
128128
sigma: A constant that specifies the range from which to draw
129129
samples from a uniform distribution to be used as a scaling
130130
factor for cost coefficient perturbations. The range is
131-
set as [1-sigma, 1+sigma]
131+
set as [max([0,1-sigma]), 1+sigma)
132132
133133
Yields:
134134
A topology scenario with cost coeffiecients in the poly_cost

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ nav:
1010
- Network: manual/network.md
1111
- Load Scenarios: manual/load_scenarios.md
1212
- Topology Perturbations: manual/topology_perturbations.md
13+
- Generation Perturbations: manual/generation_perturbations.md
1314
- Outputs: manual/outputs.md
1415
- Components:
1516
- Network: components/network.md

0 commit comments

Comments
 (0)