{ "cells": [ { "cell_type": "markdown", "id": "religious-curve", "metadata": {}, "source": [ "# Consumption and Generation Reference System" ] }, { "cell_type": "markdown", "id": "furnished-anger", "metadata": {}, "source": [ "This tutorial is about the effect of the sign of active and reactive power in load and sgen in pandapower. In this tutorial, the load element is used to model power consumption and the static generator element is used to model power generation. In pandapower, the convention for consumption and generation is different. This difference between consumer frame convention and generator frame convention will be demonstrated here." ] }, { "cell_type": "markdown", "id": "lovely-manhattan", "metadata": {}, "source": [ "![reference_system](pics/reference_system.png)\n" ] }, { "cell_type": "markdown", "id": "considerable-holiday", "metadata": {}, "source": [ "![](l.png)" ] }, { "cell_type": "markdown", "id": "working-thumb", "metadata": {}, "source": [ "In regard to reactive power, there are 2 states for the 4 quadrants of each frame convention: under-excited and over-excited (see figure above).\n", "\n", "In the Consumer Frame Convention, which is used for load-like elements (load, shunt, ward, xward, storage), the term ‘under-excited’ is used to indicate that the load is in I and II quadrants and is absorbing reactive power (decreases voltage) and the term ‘over-excited’ is used to indicate that the load is in the III and IV quadrants and is injecting reactive power (increases voltage).\n", "\n", "In the Generator Frame Convention, which is used for generator-like elements (gen, sgen, ext_grid), the term ‘over-excited’ is used to indicate the generator is in the I and II quadrants and is injecting reactive power (increases voltage), and the term ‘under-excited’ is used to indicate the generator is in III and IV quadrants and is absorbing reactive power (decreases voltage)." ] }, { "cell_type": "markdown", "id": "immune-evans", "metadata": {}, "source": [ "We show the differences between the reference systems with the following example." ] }, { "cell_type": "code", "execution_count": 1, "id": "understood-fellowship", "metadata": {}, "outputs": [], "source": [ "import pandapower as pp\n", "import pandas as pd\n", "import numpy as np\n", "import seaborn as sn" ] }, { "cell_type": "code", "execution_count": 2, "id": "fatty-proposal", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "This pandapower network includes the following parameter tables:\n", " - bus (2 elements)\n", " - load (1 element)\n", " - sgen (1 element)\n", " - ext_grid (1 element)\n", " - line (1 element)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "net=pp.create_empty_network()\n", "bus0 = pp.create_bus(net, name=\"Bus 0\", vn_kv=110, type=\"b\")\n", "bus1 = pp.create_bus(net, name=\"Bus 1\", vn_kv=110, type=\"b\")\n", "line0 = pp.create_line(net, bus0, bus1, length_km=50, std_type=\"70-AL1/11-ST1A 110.0\", name=\"Line 1\")\n", "pp.create_sgen(net, bus1, p_mw=0, q_mvar=0, name=\"static generator\")\n", "pp.create_ext_grid(net, bus0, vm_pu=1.02, va_degree=50)\n", "pp.create_load(net, bus1, p_mw=0, q_mvar=0, name=\"load i\")\n", "net" ] }, { "cell_type": "code", "execution_count": 3, "id": "honey-serbia", "metadata": {}, "outputs": [], "source": [ "df=pd.DataFrame(columns=['element', 'p_mw', 'q_mvar', 'vm_pu', 'p_from_mw', 'p_to_mw'])" ] }, { "cell_type": "markdown", "id": "suspended-coffee", "metadata": {}, "source": [ "We will take three variations of p_mw (0, 50, -50) and three variations of q_mvar (0, 25, -25) for both load and sgen to analyze the output of the voltages." ] }, { "cell_type": "code", "execution_count": 4, "id": "weird-argument", "metadata": {}, "outputs": [], "source": [ "i=0\n", "for element in ('load', 'sgen'):\n", " for x in [0, 50, -50]:\n", " for y in [0, 25, -25]:\n", " net[element].loc[0,['p_mw', 'q_mvar']] = x, y\n", " pp.runpp(net)\n", " df.loc[i, 'element'] = element\n", " df.loc[i, ['p_mw', 'q_mvar']] = x,y\n", " df.loc[i, 'vm_pu'] = net.res_bus.vm_pu.at[bus1]\n", " df.loc[i, 'p_from_mw'] = net.res_line.p_from_mw.at[line0]\n", " df.loc[i, 'p_to_mw'] = net.res_line.p_to_mw.at[line0]\n", " i += 1\n", " net[element].loc[0, ['p_mw', 'q_mvar']] = 0, 0" ] }, { "cell_type": "code", "execution_count": 5, "id": "acceptable-appointment", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | element | \n", "p_mw | \n", "q_mvar | \n", "vm_pu | \n", "p_from_mw | \n", "p_to_mw | \n", "
---|---|---|---|---|---|---|
0 | \n", "load | \n", "0 | \n", "0 | \n", "1.021515 | \n", "0.001135 | \n", "0.0 | \n", "
1 | \n", "load | \n", "0 | \n", "25 | \n", "0.972767 | \n", "1.060615 | \n", "-0.0 | \n", "
2 | \n", "load | \n", "0 | \n", "-25 | \n", "1.064408 | \n", "1.011292 | \n", "-0.0 | \n", "
3 | \n", "load | \n", "50 | \n", "0 | \n", "0.923861 | \n", "55.002097 | \n", "-50.0 | \n", "
4 | \n", "load | \n", "50 | \n", "25 | \n", "0.867587 | \n", "57.021399 | \n", "-50.0 | \n", "
5 | \n", "load | \n", "50 | \n", "-25 | \n", "0.971638 | \n", "55.720967 | \n", "-50.0 | \n", "
6 | \n", "load | \n", "-50 | \n", "0 | \n", "1.096104 | \n", "-46.445807 | \n", "50.0 | \n", "
7 | \n", "load | \n", "-50 | \n", "25 | \n", "1.050547 | \n", "-45.232313 | \n", "50.0 | \n", "
8 | \n", "load | \n", "-50 | \n", "-25 | \n", "1.136787 | \n", "-45.80152 | \n", "50.0 | \n", "
9 | \n", "sgen | \n", "0 | \n", "0 | \n", "1.021515 | \n", "0.001135 | \n", "0.0 | \n", "
10 | \n", "sgen | \n", "0 | \n", "25 | \n", "1.064408 | \n", "1.011292 | \n", "-0.0 | \n", "
11 | \n", "sgen | \n", "0 | \n", "-25 | \n", "0.972767 | \n", "1.060615 | \n", "-0.0 | \n", "
12 | \n", "sgen | \n", "50 | \n", "0 | \n", "1.096104 | \n", "-46.445807 | \n", "50.0 | \n", "
13 | \n", "sgen | \n", "50 | \n", "25 | \n", "1.136787 | \n", "-45.80152 | \n", "50.0 | \n", "
14 | \n", "sgen | \n", "50 | \n", "-25 | \n", "1.050547 | \n", "-45.232313 | \n", "50.0 | \n", "
15 | \n", "sgen | \n", "-50 | \n", "0 | \n", "0.923861 | \n", "55.002097 | \n", "-50.0 | \n", "
16 | \n", "sgen | \n", "-50 | \n", "25 | \n", "0.971638 | \n", "55.720967 | \n", "-50.0 | \n", "
17 | \n", "sgen | \n", "-50 | \n", "-25 | \n", "0.867587 | \n", "57.021399 | \n", "-50.0 | \n", "