Skip to content

Commit fcc39aa

Browse files
Merge pull request #32 from PowerGridModel/feature/power-grid-model-ds-workshop
Power grid model ds workshop
2 parents 158d18c + 1a8eab8 commit fcc39aa

31 files changed

+1444
-0
lines changed

power-grid-model-ds/advanced.ipynb

Lines changed: 524 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
2+
3+
SPDX-License-Identifier: MPL-2.0

power-grid-model-ds/data/lines.csv

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
id,from_node,to_node,from_status,to_status,i_from,r1,x1,c1,tan1,i_n
2+
301,101,1,1,1,0,0.04172331553871052,0.052980486528544264,0.0,0.0,210.28427536474146
3+
302,1,2,1,1,0,0.15725110380730004,0.022290287012795527,0.0,0.0,105.94268839245518
4+
303,2,3,1,1,0,0.15725110380730004,0.022290287012795527,0.0,0.0,105.94268839245518
5+
304,3,4,1,1,0,0.025752163570459393,0.017975680453095257,0.0,0.0,252.81330598432984
6+
305,4,5,1,1,0,0.184580749945473,0.05679935115815177,0.0,0.0,308.29168286950096
7+
306,5,6,1,1,0,0.09247280056072502,0.04061706379498719,0.0,0.0,146.12039826984656
8+
307,6,7,1,1,0,0.09247280056072502,0.04061706379498719,0.0,0.0,146.12039826984656
9+
308,7,101,1,0,0,0.13774802878276293,0.023316760013206598,0.0,0.0,435.44293210319637
10+
309,101,8,1,1,0,0.13774802878276293,0.023316760013206598,0.0,0.0,435.44293210319637
11+
310,8,9,1,1,0,0.03155099592582141,0.1684585911623038,0.0,0.0,386.9416504130695
12+
311,9,10,1,1,0,0.38045029098187605,0.0063983451879243095,0.0,0.0,595.6252329736612
13+
312,10,11,1,1,0,0.38045029098187605,0.0063983451879243095,0.0,0.0,595.6252329736612
14+
313,11,12,1,0,0,0.2711350129219581,0.0239320695659479,0.0,0.0,109.56302502830336
15+
314,12,13,1,1,0,0.7512185900820556,0.016025736292976843,0.0,0.0,320.73771673448846
16+
315,13,14,1,1,0,0.2332922408038184,0.010579215551474988,0.0,0.0,221.24699130886745
17+
316,14,15,1,1,0,0.2884431875887676,0.016206534923606564,0.0,0.0,305.34636498186455
18+
317,15,16,1,1,0,0.06893013265387658,0.002501770712404082,0.0,0.0,129.78347503297758
19+
318,16,101,1,1,0,0.17466926178911735,0.04197366431254047,0.0,0.0,223.462291908927
20+
319,101,17,1,1,0,0.0014230825354318865,0.005366123634368465,0.0,0.0,143.19692487769424
21+
320,17,18,1,1,0,0.05535894789343593,0.015888270665417342,0.0,0.0,348.82546139151896
22+
321,18,19,1,1,0,1.1336902294005273,0.0034372075909574274,0.0,0.0,109.4472896415015
23+
322,19,20,1,1,0,0.02756399437186089,0.001442850824658642,0.0,0.0,315.15332070790726
24+
323,20,21,1,1,0,0.15000233423633422,0.012783549273682825,0.0,0.0,505.6064937043503
25+
324,21,101,1,0,0,0.4527663172740473,0.010942584326900677,0.0,0.0,235.29434874845845
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
2+
3+
SPDX-License-Identifier: MPL-2.0

power-grid-model-ds/data/loads.csv

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
id,node,p_specified,q_specified
2+
201,1,75559.96424922015,2119.7561886191743
3+
202,2,3897910.78949213034,-8632.07774532976
4+
203,3,95478.41471359684,18229.00620748075
5+
204,4,-63249.17346947564,-712.0333973476627
6+
205,5,-64900.69141993268,14743.624463381835
7+
206,6,348049.77201387816,36026.00482909736
8+
207,7,21984.741221515593,24426.02990667891
9+
208,8,-67789.02445002584,32094.560258638798
10+
209,9,194810.9302324328,4783.500971894942
11+
210,10,-65128.11331122106,-4447.890651114186
12+
211,11,143731.66910079535,5949.794993746957
13+
212,12,224756.36715177132,39976.29538075794
14+
213,13,80358.3966250818,22745.972387370846
15+
214,14,313227.5266984018,23551.04963072692
16+
215,15,234550.7662600798,19216.914424467115
17+
216,16,293012.8372641854,-9912.346527315487
18+
217,17,386582.49982988625,-2654.9452654344077
19+
218,18,-68922.11726350724,13959.630269749312
20+
219,19,329471.2892289656,-5256.568898739658
21+
220,20,3828501.06297316383,27023.499817300326
22+
221,21,55155.355929427635,37523.58862659218
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
2+
3+
SPDX-License-Identifier: MPL-2.0

power-grid-model-ds/data/nodes.csv

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
id,u_rated,node_type,x,y
2+
1,10500.0,0,0,200
3+
2,10500.0,0,0,400
4+
3,10500.0,0,0,600
5+
4,10500.0,0,0,800
6+
5,10500.0,0,-200,800
7+
6,10500.0,0,-400,600
8+
7,10500.0,0,-400,400
9+
8,10500.0,0,-200,0
10+
9,10500.0,0,-400,0
11+
10,10500.0,0,-600,0
12+
11,10500.0,0,-600,-200
13+
12,10500.0,0,-600,-400
14+
13,10500.0,0,-400,-400
15+
14,10500.0,0,-200,-400
16+
15,10500.0,0,0,-400
17+
16,10500.0,0,0,-200
18+
17,10500.0,0,200,0
19+
18,10500.0,0,400,0
20+
19,10500.0,0,600,200
21+
20,10500.0,0,400,200
22+
21,10500.0,0,200,200
23+
101,10500.0,1,0,0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
2+
3+
SPDX-License-Identifier: MPL-2.0

power-grid-model-ds/helper.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
2+
#
3+
# SPDX-License-Identifier: MPL-2.0
4+
5+
import pandas as pd
6+
from power_grid_model_ds.arrays import SymLoadArray, SourceArray
7+
8+
def load_dummy_grid(grid_class):
9+
nodes_csv = pd.read_csv("data/nodes.csv")
10+
loads_csv = pd.read_csv("data/loads.csv")
11+
lines_csv = pd.read_csv("data/lines.csv")
12+
13+
grid = grid_class.empty()
14+
15+
nodes = grid.node.__class__(
16+
id=nodes_csv.id.tolist(),
17+
u_rated=nodes_csv.u_rated.tolist(),
18+
node_type=nodes_csv.node_type.tolist(),
19+
x=nodes_csv.x.tolist(),
20+
y=nodes_csv.y.tolist(),
21+
u=[-1.0] * len(nodes_csv),
22+
)
23+
loads = SymLoadArray(
24+
id=loads_csv.id.tolist(),
25+
node=loads_csv.node.tolist(),
26+
status=[1] * len(loads_csv),
27+
type=[0] * len(loads_csv),
28+
p_specified=loads_csv.p_specified.tolist(),
29+
q_specified=loads_csv.q_specified.tolist(),
30+
)
31+
lines = grid.line.__class__(
32+
id=lines_csv.id.tolist(),
33+
from_node=lines_csv.from_node.tolist(),
34+
to_node=lines_csv.to_node.tolist(),
35+
from_status=lines_csv.from_status.tolist(), # 1 means active connection from-side,
36+
to_status=lines_csv.to_status.tolist(), # 1 means active connection to-side
37+
i_n=lines_csv.i_n.tolist(), # line max current capacity (e.g., 200 A)
38+
r1=lines_csv.r1.tolist(), # line resistance
39+
x1=lines_csv.x1.tolist(), # line reactance
40+
c1=lines_csv.c1.tolist(), # line capacitance
41+
tan1=lines_csv.tan1.tolist() # line loss tangent
42+
)
43+
sources = SourceArray(
44+
id=[401],
45+
node=[101],
46+
status=[1],
47+
u_ref=[1.0],
48+
)
49+
50+
grid.append(nodes, check_max_id=False)
51+
grid.append(loads, check_max_id=False)
52+
grid.append(lines, check_max_id=False)
53+
grid.append(sources, check_max_id=False)
54+
55+
grid.set_feeder_ids()
56+
57+
return grid
89.1 KB
Loading

0 commit comments

Comments
 (0)