|
147 | 147 | "\n", |
148 | 148 | "1. Use the PowerGridModelInterface to calculate power flow\n", |
149 | 149 | "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" |
151 | 155 | ] |
152 | 156 | }, |
153 | 157 | { |
|
157 | 161 | "metadata": {}, |
158 | 162 | "outputs": [], |
159 | 163 | "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", |
163 | 164 | "def check_for_capacity_issues(grid: Grid) -> LineArray:\n", |
164 | 165 | " \"\"\"Check for capacity issues on the grid.\n", |
165 | 166 | " Return the lines that with capacity issues.\n", |
166 | 167 | " \"\"\"\n", |
167 | 168 | "\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": [ |
170 | 179 | "# %load solutions/advanced_3_check_for_capacity_issues.py" |
171 | 180 | ] |
172 | 181 | }, |
|
199 | 208 | "\n", |
200 | 209 | "\n", |
201 | 210 | "\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", |
203 | 212 | "Goal: Place a second substation near the overloaded path. In the next steps we will use this substation to relieve overloaded cables.\n", |
204 | 213 | "\n", |
205 | 214 | "You’ll:\n", |
|
220 | 229 | "def build_new_substation(grid: Grid, location: tuple[float, float]) -> NodeArray:\n", |
221 | 230 | " \"\"\"Build a new substation at the given location.\n", |
222 | 231 | " 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": [ |
225 | 242 | "# %load solutions/advanced_4_build_new_substation.py" |
226 | 243 | ] |
227 | 244 | }, |
|
234 | 251 | "Goal: Identify the best way to connect the new substation to the overloaded routes.\n", |
235 | 252 | "\n", |
236 | 253 | "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", |
238 | 255 | "- 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" |
240 | 261 | ] |
241 | 262 | }, |
242 | 263 | { |
|
246 | 267 | "metadata": {}, |
247 | 268 | "outputs": [], |
248 | 269 | "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", |
252 | 270 | "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": [ |
255 | 281 | "# %load solutions/advanced_5_1_get_all_congested_routes.py" |
256 | 282 | ] |
257 | 283 | }, |
|
275 | 301 | " This should be the geographically closest node to the new substation.\n", |
276 | 302 | " \"\"\"\n", |
277 | 303 | " # 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": [ |
280 | 314 | "# %load solutions/advanced_5_2_find_connection_point.py" |
281 | 315 | ] |
282 | 316 | }, |
|
287 | 321 | "source": [ |
288 | 322 | "Finally we build a function that creates a new line between the connection point and the new substation.\n", |
289 | 323 | "\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." |
291 | 327 | ] |
292 | 328 | }, |
293 | 329 | { |
|
297 | 333 | "metadata": {}, |
298 | 334 | "outputs": [], |
299 | 335 | "source": [ |
300 | | - "# Hint: in the introduction you learned how to add a LineArray to the grid\n", |
301 | | - "\n", |
302 | 336 | "def connect_to_route(grid: Grid, connection_point: NodeArray, new_substation: NodeArray) -> None:\n", |
303 | 337 | " \"\"\"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": [ |
306 | 348 | "# %load solutions/advanced_5_3_connect_to_route.py" |
307 | 349 | ] |
308 | 350 | }, |
|
349 | 391 | " # Move the Open Point (NOP) upstream\n", |
350 | 392 | " ...\n", |
351 | 393 | " \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": [ |
354 | 404 | "# %load solutions/advanced_6_optimize_route_transfer.py" |
355 | 405 | ] |
356 | 406 | }, |
|
423 | 473 | "metadata": {}, |
424 | 474 | "outputs": [], |
425 | 475 | "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)`*" |
427 | 485 | ] |
428 | 486 | }, |
429 | 487 | { |
|
444 | 502 | ], |
445 | 503 | "metadata": { |
446 | 504 | "kernelspec": { |
447 | | - "display_name": ".venv", |
| 505 | + "display_name": "Python 3 (ipykernel)", |
448 | 506 | "language": "python", |
449 | 507 | "name": "python3" |
450 | 508 | }, |
|
458 | 516 | "name": "python", |
459 | 517 | "nbconvert_exporter": "python", |
460 | 518 | "pygments_lexer": "ipython3", |
461 | | - "version": "3.12.6" |
| 519 | + "version": "3.13.2" |
462 | 520 | } |
463 | 521 | }, |
464 | 522 | "nbformat": 4, |
|
0 commit comments