{ "cells": [ { "cell_type": "markdown", "id": "d3852261", "metadata": {}, "source": [ "# Using power-grid-model for calculations" ] }, { "cell_type": "markdown", "id": "fdc5b02d", "metadata": {}, "source": [ "power-grid-model is a Python library for steady-state distribution power system analysis. The core of the library is written in C++. Using it for calculation can give a significant boost to performance, especially for asymmetric calculations. \n", "\n", "Currently power-grid-model supports limited components hence some of components or features are not supported. You can find the complete details about them [here](https://power-grid-model-io.readthedocs.io/en/stable/converters/pandapower_converter.html). An exception will be raised for them. " ] }, { "cell_type": "markdown", "id": "dbdfef8f", "metadata": {}, "source": [ "## Power flow calculation" ] }, { "cell_type": "markdown", "id": "0513d97e", "metadata": {}, "source": [ "First imports and initialize a basic network" ] }, { "cell_type": "code", "execution_count": 1, "id": "49ae727b", "metadata": {}, "outputs": [], "source": [ "import pandapower as pp\n", "from pandapower.networks import example_simple\n", "\n", "net = example_simple()\n", "# Remove Generator since its not supported yet\n", "net[\"gen\"] = net[\"gen\"].iloc[:0]" ] }, { "cell_type": "markdown", "id": "b3e4879a", "metadata": {}, "source": [ "A powerflow can be run using power-grid-model for calculation by using the `pp.runpp_pgm` function. The function has its own arguments different from `pp.runpp()`" ] }, { "cell_type": "code", "execution_count": 2, "id": "456b50b1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
vm_puva_degreep_mwq_mvar
01.02039050.0021107.776054e-013.923591e+00
11.02055350.0042729.659178e-09-5.178393e-08
21.02055350.0042722.272012e-08-9.998678e-01
31.007663-99.760602-2.291840e-08-5.021892e-09
41.007663-99.760602-1.263901e-082.271646e-08
51.007687-99.7620837.659661e-14-1.713588e-13
61.006282-99.606095-8.000000e-012.900000e+00
\n", "
" ], "text/plain": [ " vm_pu va_degree p_mw q_mvar\n", "0 1.020390 50.002110 7.776054e-01 3.923591e+00\n", "1 1.020553 50.004272 9.659178e-09 -5.178393e-08\n", "2 1.020553 50.004272 2.272012e-08 -9.998678e-01\n", "3 1.007663 -99.760602 -2.291840e-08 -5.021892e-09\n", "4 1.007663 -99.760602 -1.263901e-08 2.271646e-08\n", "5 1.007687 -99.762083 7.659661e-14 -1.713588e-13\n", "6 1.006282 -99.606095 -8.000000e-01 2.900000e+00" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pp.runpp_pgm(net)\n", "net.res_bus" ] }, { "cell_type": "markdown", "id": "78400d02", "metadata": {}, "source": [ "To know more about the library, refer to [power-grid-model](https://github.com/alliander-opensource/power-grid-model) and repository and [power-grid-model documentation](https://power-grid-model.readthedocs.io/en/stable/). The conversion from pandapower net to and from power-grid-model is handled by [power-grid-model-io](https://github.com/alliander-opensource/power-grid-model-io) ([power-grid-model-io documentation](https://power-grid-model-io.readthedocs.io/en/stable/)).\n", "\n", "The user however would usually not have to concern with these as power-grid-model is integrated into pandapower powerflow functions directly." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.9" } }, "nbformat": 4, "nbformat_minor": 5 }