diff --git a/docs/demos/connecting_new_consumer.ipynb b/docs/demos/connecting_new_consumer.ipynb index 1785656d..cde45508 100644 --- a/docs/demos/connecting_new_consumer.ipynb +++ b/docs/demos/connecting_new_consumer.ipynb @@ -15,7 +15,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -62,7 +62,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -86,7 +86,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -127,7 +127,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -152,7 +152,7 @@ " x=new_consumer.x_coor[0],\n", " y=new_consumer.y_coor[0],\n", " )\n", - " closest_node = grid.node[closest_node_idx]\n", + " closest_node = grid.node.data[closest_node_idx]\n", "\n", " grid.append(new_consumer)\n", " new_consumer_load.node = new_consumer.id\n", @@ -188,9 +188,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "AttributeError", + "evalue": "'numpy.void' object has no attribute 'x_coor'", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mAttributeError\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[5]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[43mconnect_new_consumer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mgrid\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnew_consumer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnew_consumer_load\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 2\u001b[39m update_grid(grid)\n", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[4]\u001b[39m\u001b[32m, line 28\u001b[39m, in \u001b[36mconnect_new_consumer\u001b[39m\u001b[34m(grid, new_consumer, new_consumer_load)\u001b[39m\n\u001b[32m 25\u001b[39m new_consumer_load.node = new_consumer.id\n\u001b[32m 26\u001b[39m grid.append(new_consumer_load)\n\u001b[32m---> \u001b[39m\u001b[32m28\u001b[39m dist = np.sqrt((\u001b[43mclosest_node\u001b[49m\u001b[43m.\u001b[49m\u001b[43mx_coor\u001b[49m - new_consumer.x_coor) ** \u001b[32m2\u001b[39m + (closest_node.y_coor - new_consumer.y_coor) ** \u001b[32m2\u001b[39m)\n\u001b[32m 30\u001b[39m new_line = ExtendedLineArray(\n\u001b[32m 31\u001b[39m from_node=[closest_node.id],\n\u001b[32m 32\u001b[39m to_node=[new_consumer.id],\n\u001b[32m (...)\u001b[39m\u001b[32m 39\u001b[39m i_n=[\u001b[32m200\u001b[39m],\n\u001b[32m 40\u001b[39m )\n\u001b[32m 41\u001b[39m grid.append(new_line)\n", + "\u001b[31mAttributeError\u001b[39m: 'numpy.void' object has no attribute 'x_coor'" + ] + } + ], "source": [ "connect_new_consumer(grid, new_consumer, new_consumer_load)\n", "update_grid(grid)" @@ -209,27 +222,74 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " id | u_rated | node_type | feeder_branch_id | feeder_node_id | u | x_coor | y_coor \n", + " 1 | 10500.0 | 0 | 64 | 61 | 0.0 |190.591..|391.821..\n", + " 2 | 10500.0 | 0 | 64 | 61 | 0.0 |107.276..|479.614..\n", + " 3 | 10500.0 | 0 | 63 | 61 | 0.0 |236.780..|418.712..\n", + " 4 | 10500.0 | 0 | 78 | 61 | 0.0 |399.420..|447.300..\n", + " 5 | 10500.0 | 0 | 63 | 61 | 0.0 |146.187..|177.586..\n", + " (..12 hidden rows..) \n", + " 18 | 10500.0 | 0 | 63 | 61 | 0.0 |444.001..|139.411..\n", + " 19 | 10500.0 | 0 | 78 | 61 | 0.0 |370.190..|268.868..\n", + " 20 | 10500.0 | 0 | 64 | 61 | 0.0 |306.867..|334.454..\n", + " 61 | 10500.0 | 1 | -2147483648 | -2147483648 | 0.0 |336.963..|414.615..\n", + " 93 | 10500.0 | 0 | -2147483648 | -2147483648 | 0.0 | 300.0 | 300.0 \n" + ] + } + ], "source": [ "print(grid.node)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " id | from_node | to_node | from_status | to_status | feeder_branch_id | feeder_node_id | is_feeder | r1 | x1 | c1 | tan1 | i_n | i_from \n", + " 63 | 61 | 17 | 1 | 1 | 63 | 61 | True |0.110..|0.013..| 0.0 | 0.0 |103.9613..| 0.0 \n", + " 64 | 61 | 13 | 1 | 1 | 64 | 61 | True |0.325..|0.015..| 0.0 | 0.0 |100.4538..| 0.0 \n", + " 65 | 17 | 5 | 1 | 1 | 63 | 61 | False |0.657..|2.575..| 0.0 | 0.0 |1311.550..| 0.0 \n", + " 66 | 13 | 11 | 1 | 1 | 64 | 61 | False |0.213..|0.016..| 0.0 | 0.0 |114.4995..| 0.0 \n", + " 67 | 5 | 18 | 1 | 1 | 63 | 61 | False |0.061..|0.029..| 0.0 | 0.0 |170.8020..| 0.0 \n", + " (..20 hidden rows..) \n", + " 88 | 19 | 15 | 1 | 0 | -2147483648 | -2147483648 | False |0.003..|0.003..| 0.0 | 0.0 |203.2692..| 0.0 \n", + " 89 | 1 | 18 | 1 | 0 | -2147483648 | -2147483648 | False |0.341..|0.012..| 0.0 | 0.0 |221.8579..| 0.0 \n", + " 90 | 18 | 2 | 1 | 0 | -2147483648 | -2147483648 | False |0.122..|0.006..| 0.0 | 0.0 |387.5294..| 0.0 \n", + " 91 | 61 | 17 | 1 | 0 | -2147483648 | -2147483648 | True |0.210..|0.001..| 0.0 | 0.0 |267.6662..| 0.0 \n", + " 92 | 3 | 11 | 1 | 0 | -2147483648 | -2147483648 | False |0.030..|0.050..| 0.0 | 0.0 |272.8941..| 0.0 \n" + ] + } + ], "source": [ "print(grid.line)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Overloaded nodes: [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 61 93]\n", + "Overloaded lines: []\n" + ] + } + ], "source": [ "print(f\"Overloaded nodes: {grid.node[grid.node.is_overloaded].id}\")\n", "print(f\"Overloaded lines: {grid.line[grid.line.is_overloaded].id}\")" @@ -244,9 +304,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "AttributeError", + "evalue": "'numpy.void' object has no attribute 'x_coor'", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mAttributeError\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[9]\u001b[39m\u001b[32m, line 5\u001b[39m\n\u001b[32m 1\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m _ \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[32m10\u001b[39m):\n\u001b[32m 2\u001b[39m new_consumer, new_consumer_load = create_new_consumer_arrays(\n\u001b[32m 3\u001b[39m \u001b[32m10_500\u001b[39m, np.random.uniform(\u001b[32m0\u001b[39m, \u001b[32m500\u001b[39m), np.random.uniform(\u001b[32m0\u001b[39m, \u001b[32m500\u001b[39m), \u001b[32m1_000_000\u001b[39m, \u001b[32m200_000\u001b[39m\n\u001b[32m 4\u001b[39m )\n\u001b[32m----> \u001b[39m\u001b[32m5\u001b[39m \u001b[43mconnect_new_consumer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mgrid\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnew_consumer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnew_consumer_load\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 6\u001b[39m update_grid(grid)\n\u001b[32m 8\u001b[39m \u001b[38;5;28mprint\u001b[39m(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mOverloaded nodes: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mgrid.node[grid.node.is_overloaded].id\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m)\n", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[4]\u001b[39m\u001b[32m, line 28\u001b[39m, in \u001b[36mconnect_new_consumer\u001b[39m\u001b[34m(grid, new_consumer, new_consumer_load)\u001b[39m\n\u001b[32m 25\u001b[39m new_consumer_load.node = new_consumer.id\n\u001b[32m 26\u001b[39m grid.append(new_consumer_load)\n\u001b[32m---> \u001b[39m\u001b[32m28\u001b[39m dist = np.sqrt((\u001b[43mclosest_node\u001b[49m\u001b[43m.\u001b[49m\u001b[43mx_coor\u001b[49m - new_consumer.x_coor) ** \u001b[32m2\u001b[39m + (closest_node.y_coor - new_consumer.y_coor) ** \u001b[32m2\u001b[39m)\n\u001b[32m 30\u001b[39m new_line = ExtendedLineArray(\n\u001b[32m 31\u001b[39m from_node=[closest_node.id],\n\u001b[32m 32\u001b[39m to_node=[new_consumer.id],\n\u001b[32m (...)\u001b[39m\u001b[32m 39\u001b[39m i_n=[\u001b[32m200\u001b[39m],\n\u001b[32m 40\u001b[39m )\n\u001b[32m 41\u001b[39m grid.append(new_line)\n", + "\u001b[31mAttributeError\u001b[39m: 'numpy.void' object has no attribute 'x_coor'" + ] + } + ], "source": [ "for _ in range(10):\n", " new_consumer, new_consumer_load = create_new_consumer_arrays(\n", @@ -262,7 +335,7 @@ ], "metadata": { "kernelspec": { - "display_name": ".venv", + "display_name": "power-grid-model-ds", "language": "python", "name": "python3" }, @@ -276,7 +349,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.6" + "version": "3.14.2" } }, "nbformat": 4, diff --git a/docs/examples/generators/generator_examples.ipynb b/docs/examples/generators/generator_examples.ipynb index 606f2062..f913b3b0 100644 --- a/docs/examples/generators/generator_examples.ipynb +++ b/docs/examples/generators/generator_examples.ipynb @@ -17,9 +17,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Number of nodes: 102\n", + "Number of sources: 2\n", + "Number of loads: 100\n" + ] + } + ], "source": [ "from power_grid_model_ds import Grid\n", "from power_grid_model_ds.generators import RadialGridGenerator\n", @@ -45,9 +55,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Number of transformers: 2\n" + ] + } + ], "source": [ "from power_grid_model_ds import Grid\n", "from power_grid_model_ds.generators import RadialGridGenerator\n", @@ -71,9 +89,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Generated nodes: \n", + " id | u_rated | node_type | feeder_branch_id | feeder_node_id \n", + " 1 | 10500.0 | 0 | 0 | 0 \n", + " 2 | 10500.0 | 0 | 0 | 0 \n", + "Low load scenarios: \n", + " id | node | status | type | p_specified | q_specified \n", + " 3 | 1 | 1 | 0 | 218860.0 | 29606.0 \n", + " 4 | 2 | 1 | 0 | 180184.0 | 21574.0 \n", + "High load scenarios: \n", + " id | node | status | type | p_specified | q_specified \n", + " 5 | 1 | 1 | 0 | -287484.0 | 40640.0 \n", + " 6 | 2 | 1 | 0 | 26558.0 | 28148.0 \n" + ] + } + ], "source": [ "from power_grid_model_ds import Grid\n", "from power_grid_model_ds.arrays import NodeArray\n", @@ -101,9 +138,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Generated nodes: \n", + " id | u_rated | node_type | feeder_branch_id | feeder_node_id \n", + " 1 | 10500.0 | 1 | -2147483648 | -2147483648 \n", + "Generated sources: \n", + " id | node | status | u_ref \n", + " 2 | 1 | 1 | 1.0 \n" + ] + } + ], "source": [ "from power_grid_model_ds import Grid\n", "from power_grid_model_ds.arrays import SourceArray\n", @@ -130,9 +180,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Generated lines: \n", + " id | from_node | to_node | from_status | to_status | feeder_branch_id | feeder_node_id | is_feeder | r1 | x1 | c1 | tan1 | i_n \n", + " 5 | 0 | 3 | 1 | 1 | 0 | 0 | False |0.003..|4.538..| 0.0 | 0.0 |303.919..\n", + " 6 | 0 | 2 | 1 | 1 | 0 | 0 | False |0.134..|0.015..| 0.0 | 0.0 |425.988..\n", + " 7 | 3 | 1 | 1 | 1 | 0 | 0 | False |1.211..|0.065..| 0.0 | 0.0 |663.357..\n", + " 8 | 0 | 2 | 1 | 0 | 0 | 0 | False |0.629..|0.006..| 0.0 | 0.0 |313.880..\n", + " 9 | 3 | 2 | 1 | 0 | 0 | 0 | False |0.070..|0.029..| 0.0 | 0.0 |269.786..\n" + ] + } + ], "source": [ "from power_grid_model_ds import Grid\n", "from power_grid_model_ds.generators import LineGenerator\n", @@ -173,9 +237,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Generated routes: \n", + " id | from_node | to_node | from_status | to_status | feeder_branch_id | feeder_node_id | is_feeder | r1 | x1 | c1 | tan1 | i_n \n", + " 5 | 0 | 3 | 1 | 1 | 0 | 0 | False |0.347..|0.008..| 0.0 | 0.0 |306.03..\n", + " 6 | 0 | 1 | 1 | 1 | 0 | 0 | False |0.082..|0.037..| 0.0 | 0.0 |254.90..\n" + ] + } + ], "source": [ "# Create routes\n", "line_generator.create_routes(2)\n", @@ -195,9 +270,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Connected nodes: [0, 1, 3]\n", + "Unconnected nodes: [2]\n" + ] + } + ], "source": [ "# Connect unconnected nodes\n", "line_generator.set_unconnected_nodes()\n", @@ -219,9 +303,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Generated NOP lines: \n", + " id | from_node | to_node | from_status | to_status | feeder_branch_id | feeder_node_id | is_feeder | r1 | x1 | c1 | tan1 | i_n \n", + " 5 | 0 | 3 | 1 | 1 | 0 | 0 | False |0.347..|0.008..| 0.0 | 0.0 |306.039..\n", + " 6 | 0 | 1 | 1 | 1 | 0 | 0 | False |0.082..|0.037..| 0.0 | 0.0 |254.909..\n", + " 7 | 0 | 2 | 1 | 1 | 0 | 0 | False |0.064..|0.004..| 0.0 | 0.0 |445.042..\n", + " 8 | 1 | 2 | 1 | 0 | 0 | 0 | False |0.209..|0.024..| 0.0 | 0.0 |270.937..\n" + ] + } + ], "source": [ "# Create normally open points\n", "line_generator.create_nop_lines(1)\n", @@ -233,7 +330,7 @@ ], "metadata": { "kernelspec": { - "display_name": ".venv", + "display_name": "power-grid-model-ds", "language": "python", "name": "python3" }, @@ -247,7 +344,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.14.2" } }, "nbformat": 4, diff --git a/docs/examples/model/array_examples.ipynb b/docs/examples/model/array_examples.ipynb index 92779ccb..a075cfd6 100644 --- a/docs/examples/model/array_examples.ipynb +++ b/docs/examples/model/array_examples.ipynb @@ -17,7 +17,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -671,7 +671,7 @@ ], "metadata": { "kernelspec": { - "display_name": ".venv", + "display_name": "power-grid-model-ds", "language": "python", "name": "python3" }, @@ -685,7 +685,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.6" + "version": "3.14.2" } }, "nbformat": 4, diff --git a/docs/examples/model/graph_examples.ipynb b/docs/examples/model/graph_examples.ipynb index fc92f7ba..0ffee59f 100644 --- a/docs/examples/model/graph_examples.ipynb +++ b/docs/examples/model/graph_examples.ipynb @@ -84,9 +84,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Shortest path: [1, 2, 3], Length: 2\n" + ] + } + ], "source": [ "graph = RustworkxGraphModel()\n", "\n", @@ -116,9 +124,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "All paths from 1 to 3: [[1, 2, 3], [1, 5, 4, 3]]\n" + ] + } + ], "source": [ "# Retrieving all paths from node 1 to node 3\n", "paths = graph.get_all_paths(1, 3)\n", @@ -136,9 +152,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Connected components: [[2, 3, 4, 5]]\n" + ] + } + ], "source": [ "import numpy as np\n", "\n", @@ -149,7 +173,8 @@ "graph.add_branch(5, 4)\n", "\n", "substation_nodes = np.array([1])\n", - "components = graph.get_components(substation_nodes=substation_nodes)\n", + "with graph.tmp_remove_nodes(substation_nodes):\n", + " components = graph.get_components()\n", "print(f\"Connected components: {components}\")" ] }, @@ -164,9 +189,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nodes connected to 1: [5, 2, 4, 3]\n", + "Nodes connected to 1 (inclusive): [1, 5, 2, 4, 3]\n" + ] + } + ], "source": [ "# Getting nodes connected to node 1, exclusive of node 1\n", "connected_nodes = graph.get_connected(node_id=1)\n", @@ -180,7 +214,7 @@ ], "metadata": { "kernelspec": { - "display_name": ".venv", + "display_name": "power-grid-model-ds", "language": "python", "name": "python3" }, @@ -194,7 +228,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.6" + "version": "3.14.2" } }, "nbformat": 4, diff --git a/docs/examples/model/grid_examples.ipynb b/docs/examples/model/grid_examples.ipynb index 2d745ec2..0b6a6a8d 100644 --- a/docs/examples/model/grid_examples.ipynb +++ b/docs/examples/model/grid_examples.ipynb @@ -435,7 +435,7 @@ ], "metadata": { "kernelspec": { - "display_name": ".venv", + "display_name": "power-grid-model-ds", "language": "python", "name": "python3" }, @@ -449,7 +449,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.14.2" } }, "nbformat": 4, diff --git a/docs/examples/model/grid_extensions_examples.ipynb b/docs/examples/model/grid_extensions_examples.ipynb index e60b71ad..661c9219 100644 --- a/docs/examples/model/grid_extensions_examples.ipynb +++ b/docs/examples/model/grid_extensions_examples.ipynb @@ -83,9 +83,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "ExtendedGrid(_id_counter=0, graphs=GraphContainer(active_graph=, complete_graph=), node=ExtendedNodeArray([[]]), transformer=TransformerArray([[]]), three_winding_transformer=ThreeWindingTransformerArray([[]]), line=ExtendedLineArray([[]]), link=LinkArray([[]]), source=SourceArray([[]]), sym_load=SymLoadArray([[]]), sym_gen=SymGenArray([[]]), transformer_tap_regulator=TransformerTapRegulatorArray([[]]), sym_power_sensor=SymPowerSensorArray([[]]), sym_voltage_sensor=SymVoltageSensorArray([[]]), asym_voltage_sensor=AsymVoltageSensorArray([[]]))" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "ExtendedGrid.empty()" ] @@ -93,7 +104,7 @@ ], "metadata": { "kernelspec": { - "display_name": ".venv", + "display_name": "power-grid-model-ds", "language": "python", "name": "python3" }, @@ -107,7 +118,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.14.2" } }, "nbformat": 4, diff --git a/docs/examples/pgm/basic_pgm_examples.ipynb b/docs/examples/pgm/basic_pgm_examples.ipynb index 64858ef8..f6074674 100644 --- a/docs/examples/pgm/basic_pgm_examples.ipynb +++ b/docs/examples/pgm/basic_pgm_examples.ipynb @@ -31,9 +31,53 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Created Grid:\n", + " id | from_node | to_node | from_status | to_status | feeder_branch_id | feeder_node_id | is_feeder \n", + " 18 | 16 | 5 | 1 | 1 | 0 | 0 | False \n", + " 19 | 5 | 3 | 1 | 1 | 0 | 0 | False \n", + " 20 | 5 | 4 | 1 | 1 | 0 | 0 | False \n", + " 21 | 4 | 2 | 1 | 1 | 0 | 0 | False \n", + " 22 | 16 | 1 | 1 | 1 | 0 | 0 | False \n", + "Power Flow Results:\n" + ] + }, + { + "data": { + "text/plain": [ + "array([( 1, 1, 1.00022909, 10502.40547296, 1.99595527e-04, 318145.99999988, 30628.99999997),\n", + " ( 2, 1, 1.00181391, 10519.04604187, 8.18373270e-05, 85535.99999973, 24048.99999998),\n", + " ( 3, 1, 1.00120197, 10512.62069113, 3.07703301e-04, 913761.00000028, 16071.00000004),\n", + " ( 4, 1, 1.00164458, 10517.26805716, 1.15203146e-04, 176577.00000024, -9406.99999999),\n", + " ( 5, 1, 1.00008458, 10500.88803896, 2.02276426e-04, 536068.99999626, -31488.00000003),\n", + " (16, 1, 1.00002312, 10500.2427774 , 2.01540352e-04, -2028475.46388834, -29731.71601102)],\n", + " dtype={'names': ['id', 'energized', 'u_pu', 'u', 'u_angle', 'p', 'q'], 'formats': ['