Examples
We provide a few jupyter notebooks to illustrate the use of different modules for synthetic power grid modeling.
Each notebook is also available as a self-contained Google Colab version with
package installation included — click the badge to open directly in your browser.
Transmission Grid Synthesis
The recommended starting point is the high-level synthesize() notebook, which runs the
entire pipeline in a single function call. The remaining notebooks provide step-by-step
control over individual pipeline stages.
Notebook |
Open in Colab |
|---|---|
High-Level Synthesis |
(recommended starting point) |
Synthesis with pypowsybl |
|
Topology Generation |
|
Bus Type Assignment |
|
Generation and Load Settings |
|
IEEE Test |
|
PEGASE 9241 Test |
|
RTE 7000 Test |
Here is a brief example showing how to configure the user input, and then generate, and visualize a synthetic power grid.
1 from powergrid_synth.generator import PowerGridGenerator
2 from powergrid_synth.input_configurator import InputConfigurator
3 from powergrid_synth.visualization import GridVisualizer
4
5 # 1. Configuration
6 # Define the voltage levels (Node count, Avg Degree, Diameter, Distribution Type)
7 level_specs = [
8 {'n': 50, 'avg_k': 3.5, 'diam': 10, 'dist_type': 'dgln'}, # Backbone (Log-Normal)
9 {'n': 150, 'avg_k': 2.5, 'diam': 15, 'dist_type': 'dpl'}, # Distribution (Power Law)
10 {'n': 300, 'avg_k': 2.0, 'diam': 20, 'dist_type': 'poisson'} # Local (Poisson)
11 ]
12
13 # Define connections between levels (k-stars model)
14 connection_specs = {
15 (0, 1): {'type': 'k-stars', 'c': 0.174, 'gamma': 4.15},
16 (1, 2): {'type': 'k-stars', 'c': 0.15, 'gamma': 4.15}
17 }
18
19 # 2. Generate Parameters
20 config = InputConfigurator(seed=42)
21 params = config.create_params(level_specs, connection_specs)
22
23 # 3. Generate Topology
24 gen = PowerGridGenerator(seed=42)
25 grid = gen.generate_grid(
26 degrees_by_level=params['degrees_by_level'],
27 diameters_by_level=params['diameters_by_level'],
28 transformer_degrees=params['transformer_degrees']
29 )
Distribution Grid Synthesis
Notebook |
Description |
|---|---|
Distribution Feeder Synthesis |
Schweitzer algorithm with default/custom parameters |
Distribution Synthesis from Reference Grid |
Fit parameters from a pandapower network |
Distribution Synthesis with pypowsybl |
Load CIGRE LV via CGMES, run full pipeline + one-liner |