Skip to content

Commit bb3c6ed

Browse files
committed
Apply changes from feedback
1 parent 76babd9 commit bb3c6ed

File tree

2 files changed

+88
-30
lines changed

2 files changed

+88
-30
lines changed

power-grid-model-ds/advanced.ipynb

Lines changed: 86 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@
147147
"\n",
148148
"1. Use the PowerGridModelInterface to calculate power flow\n",
149149
"2. Update the Grid object with the calculated values\n",
150-
"3. Return the lines (LineArray) that are overloaded"
150+
"3. Return the lines (LineArray) that are overloaded\n",
151+
"\n",
152+
"**💡 Hint**: You can use the `is_overloaded` property of the `MyLineArray` class to check for overloaded lines.\n",
153+
"\n",
154+
"**💡 Hint**: https://power-grid-model-ds.readthedocs.io/en/stable/quick_start.html#performing-power-flow-calculations"
151155
]
152156
},
153157
{
@@ -157,16 +161,21 @@
157161
"metadata": {},
158162
"outputs": [],
159163
"source": [
160-
"# Hint: You can use the `is_overloaded` property of the `MyLineArray` class to check for overloaded lines.\n",
161-
"# Hint: https://power-grid-model-ds.readthedocs.io/en/stable/quick_start.html#performing-power-flow-calculations\n",
162-
"\n",
163164
"def check_for_capacity_issues(grid: Grid) -> LineArray:\n",
164165
" \"\"\"Check for capacity issues on the grid.\n",
165166
" Return the lines that with capacity issues.\n",
166167
" \"\"\"\n",
167168
"\n",
168-
"print(check_for_capacity_issues(grid))\n",
169-
"\n",
169+
"print(check_for_capacity_issues(grid))"
170+
]
171+
},
172+
{
173+
"cell_type": "code",
174+
"execution_count": null,
175+
"id": "18973302-105f-42c3-9ffd-1408b90aeb10",
176+
"metadata": {},
177+
"outputs": [],
178+
"source": [
170179
"# %load solutions/advanced_3_check_for_capacity_issues.py"
171180
]
172181
},
@@ -199,7 +208,7 @@
199208
"\n",
200209
"![input_network_with_overload.png](input_network_with_overload.png)\n",
201210
"\n",
202-
"We found out the north west part of the area is overloaded.\n",
211+
"We found out the north-east part of the area is overloaded.\n",
203212
"Goal: Place a second substation near the overloaded path. In the next steps we will use this substation to relieve overloaded cables.\n",
204213
"\n",
205214
"You’ll:\n",
@@ -220,8 +229,16 @@
220229
"def build_new_substation(grid: Grid, location: tuple[float, float]) -> NodeArray:\n",
221230
" \"\"\"Build a new substation at the given location.\n",
222231
" Return the new substation.\n",
223-
" \"\"\"\n",
224-
"\n",
232+
" \"\"\""
233+
]
234+
},
235+
{
236+
"cell_type": "code",
237+
"execution_count": null,
238+
"id": "bff1e30f-5dd3-4774-977b-5707322a8f59",
239+
"metadata": {},
240+
"outputs": [],
241+
"source": [
225242
"# %load solutions/advanced_4_build_new_substation.py"
226243
]
227244
},
@@ -234,9 +251,13 @@
234251
"Goal: Identify the best way to connect the new substation to the overloaded routes.\n",
235252
"\n",
236253
"You’ll:\n",
237-
"- Compute which routes (/feeders) are overloaded to see where we need to invervene.\n",
254+
"- Compute which routes (/feeders) are overloaded to see where we need to intervene.\n",
238255
"- Find which node on an overloaded route is geographically closed to the new substation.\n",
239-
"- Create a new cable to connect the closest node to the new substation."
256+
"- Create a new cable to connect the closest node to the new substation.\n",
257+
"\n",
258+
"**💡 Hint**: The lines have been extended with extra properties in Step 1\n",
259+
"\n",
260+
"**💡 Hint**: The arrays in the grid have a filter option, https://power-grid-model-ds.readthedocs.io/en/stable/examples/model/array_examples.html#using-filters"
240261
]
241262
},
242263
{
@@ -246,12 +267,17 @@
246267
"metadata": {},
247268
"outputs": [],
248269
"source": [
249-
"# Hint: The lines have been extended with extra properties in Step 1\n",
250-
"# Hint: The arrays in the grid have a filter option, https://power-grid-model-ds.readthedocs.io/en/stable/examples/model/array_examples.html#using-filters\n",
251-
"\n",
252270
"def get_all_congested_routes(grid: Grid) -> list[NodeArray]:\n",
253-
" \"\"\"Get all nodes on routes that contain an overloaded line.\"\"\"\n",
254-
"\n",
271+
" \"\"\"Get all nodes on routes that contain an overloaded line.\"\"\""
272+
]
273+
},
274+
{
275+
"cell_type": "code",
276+
"execution_count": null,
277+
"id": "dc494d36-5ee7-401c-8a3b-59e701777f8d",
278+
"metadata": {},
279+
"outputs": [],
280+
"source": [
255281
"# %load solutions/advanced_5_1_get_all_congested_routes.py"
256282
]
257283
},
@@ -275,8 +301,16 @@
275301
" This should be the geographically closest node to the new substation.\n",
276302
" \"\"\"\n",
277303
" # Calculate the distance of each node in the route to the new_substation\n",
278-
" # Return the closest one\n",
279-
"\n",
304+
" # Return the closest one"
305+
]
306+
},
307+
{
308+
"cell_type": "code",
309+
"execution_count": null,
310+
"id": "8ce16108-4580-4c32-9e18-60239144ae4f",
311+
"metadata": {},
312+
"outputs": [],
313+
"source": [
280314
"# %load solutions/advanced_5_2_find_connection_point.py"
281315
]
282316
},
@@ -287,7 +321,9 @@
287321
"source": [
288322
"Finally we build a function that creates a new line between the connection point and the new substation.\n",
289323
"\n",
290-
"❗ IMPORTANT ❗ The new line should first be created with an open connection; we will optimize the location of the line opening in the next step."
324+
"❗ **IMPORTANT** ❗ The new line should first be created with an open connection; we will optimize the location of the line opening in the next step.\n",
325+
"\n",
326+
"**💡 Hint**: In the introduction you learned how to add a LineArray to the grid."
291327
]
292328
},
293329
{
@@ -297,12 +333,18 @@
297333
"metadata": {},
298334
"outputs": [],
299335
"source": [
300-
"# Hint: in the introduction you learned how to add a LineArray to the grid\n",
301-
"\n",
302336
"def connect_to_route(grid: Grid, connection_point: NodeArray, new_substation: NodeArray) -> None:\n",
303337
" \"\"\"Connect the new substation node to the connection point.\n",
304-
" \"\"\"\n",
305-
"\n",
338+
" \"\"\""
339+
]
340+
},
341+
{
342+
"cell_type": "code",
343+
"execution_count": null,
344+
"id": "e711bc3c-a09c-4454-b3a5-be4bf15fa077",
345+
"metadata": {},
346+
"outputs": [],
347+
"source": [
306348
"# %load solutions/advanced_5_3_connect_to_route.py"
307349
]
308350
},
@@ -349,8 +391,16 @@
349391
" # Move the Open Point (NOP) upstream\n",
350392
" ...\n",
351393
" \n",
352-
" grid.set_feeder_ids()\n",
353-
"\n",
394+
" grid.set_feeder_ids()"
395+
]
396+
},
397+
{
398+
"cell_type": "code",
399+
"execution_count": null,
400+
"id": "471b9ff0-43ca-432c-9ce9-71fc06d95b86",
401+
"metadata": {},
402+
"outputs": [],
403+
"source": [
354404
"# %load solutions/advanced_6_optimize_route_transfer.py"
355405
]
356406
},
@@ -423,7 +473,15 @@
423473
"metadata": {},
424474
"outputs": [],
425475
"source": [
426-
"visualize(grid)"
476+
"visualize(grid) "
477+
]
478+
},
479+
{
480+
"cell_type": "markdown",
481+
"id": "a2532f9d-60a9-4fcb-ac23-af6bd3ba47a2",
482+
"metadata": {},
483+
"source": [
484+
"*Note: Jupyter notebook only supports one visualizer instance at a time. You might need to restart the kernel and re-run some cells for this final visualizer to work properly. If you do, make sure to not run earlier cells that contain `visualize(grid)`*"
427485
]
428486
},
429487
{
@@ -444,7 +502,7 @@
444502
],
445503
"metadata": {
446504
"kernelspec": {
447-
"display_name": ".venv",
505+
"display_name": "Python 3 (ipykernel)",
448506
"language": "python",
449507
"name": "python3"
450508
},
@@ -458,7 +516,7 @@
458516
"name": "python",
459517
"nbconvert_exporter": "python",
460518
"pygments_lexer": "ipython3",
461-
"version": "3.12.6"
519+
"version": "3.13.2"
462520
}
463521
},
464522
"nbformat": 4,

power-grid-model-ds/introduction.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@
9797
"\n",
9898
"**⚙️ Assignment**: Create a new grid class that uses the extended arrays.\n",
9999
"\n",
100-
"**💡 Hint 1**: https://power-grid-model-ds.readthedocs.io/en/stable/examples/model/grid_extensions_examples.html#adding-the-new-arrays-to-the-grid\n",
100+
"**💡 Hint**: https://power-grid-model-ds.readthedocs.io/en/stable/examples/model/grid_extensions_examples.html#adding-the-new-arrays-to-the-grid\n",
101101
"\n",
102-
"**💡 Hint 2**: Make sure to add the `@dataclass` decorator to your grid."
102+
"**💡 Hint**: Make sure to add the `@dataclass` decorator to your grid."
103103
]
104104
},
105105
{

0 commit comments

Comments
 (0)