Skip to content

Commit

Permalink
fixes demo notebook
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Biasuzzi <christian.biasuzzi@soft.it>
  • Loading branch information
CBiasuzzi committed Sep 4, 2024
1 parent 23c37e9 commit 7f4b3cd
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions examples/demo_mapviewer_features.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,16 @@
"four_substations_network.create_dangling_lines(id='d1', voltage_level_id='S4VL1', node=1, p0=10, q0=3, r=0, x=5, g=0, b=1e-6)\n",
"four_substations_network.create_dangling_lines(id='d2', voltage_level_id='S5VL1', bus_id='S5VL1B1', p0=10, q0=3, r=0, x=5, g=0, b=1e-6)\n",
"four_substations_network.create_tie_lines(id='t1', dangling_line1_id='d1', dangling_line2_id='d2')\n",
"voltage_levels = four_substations_network.get_voltage_levels()\n",
"voltage_levels['name']=voltage_levels.index\n",
"coords = pd.DataFrame(\n",
" [\n",
" [voltage_levels.loc[voltage_levels[\"name\"] == \"S1VL1\", \"substation_id\"].iloc[0], 2.9653506942899255, 46.648820589226624],\n",
" [voltage_levels.loc[voltage_levels[\"name\"] == \"S2VL1\", \"substation_id\"].iloc[0], 4.4868965299190675, 45.224159481986970],\n",
" [voltage_levels.loc[voltage_levels[\"name\"] == \"S3VL1\", \"substation_id\"].iloc[0], 2.4022589283484335, 44.090773206380350],\n",
" [voltage_levels.loc[voltage_levels[\"name\"] == \"S4VL1\", \"substation_id\"].iloc[0], 6.0803264207747825, 44.279779791063575],\n",
" [voltage_levels.loc[voltage_levels[\"name\"] == \"S5VL1\", \"substation_id\"].iloc[0], 7.4221621183374900, 44.279779791063575]\n",
" ], columns=[\"id\", \"longitude\", \"latitude\"]\n",
").set_index(\"id\")\n",
"\n",
"four_substations_network.remove_extensions('substationPosition', four_substations_network.get_extensions('substationPosition').index)\n",
"four_substations_network.create_extensions('substationPosition', coords[[\"latitude\", \"longitude\"]])\n",
" ['S1', 2.9653506942899255, 46.648820589226624],\n",
" ['S2', 4.4868965299190675, 45.224159481986970],\n",
" ['S3', 2.4022589283484335, 44.090773206380350],\n",
" ['S4', 6.0803264207747825, 44.279779791063575],\n",
" ['S5', 7.4221621183374900, 44.279779791063575]\n",
" ], columns=['id', 'longitude', 'latitude']\n",
").set_index('id')\n",
"four_substations_network.create_extensions('substationPosition', coords[['latitude', 'longitude']])\n",
"\n",
"network_map3=NetworkMapWidget(four_substations_network)\n",
"display(network_map3)"
Expand Down

0 comments on commit 7f4b3cd

Please sign in to comment.