e2nIEE / pandapower

Convenient Power System Modelling and Analysis based on PYPOWER and pandas
https://www.pandapower.org
Other
867 stars 482 forks source link

Problem with defining angles when using ext_grid #1590

Open shamigulov opened 2 years ago

shamigulov commented 2 years ago

#I have this simple code:

import pandapower as pp net = pp.create_empty_network() b1 = pp.create_bus(net, vn_kv=10.) b2 = pp.create_bus(net, vn_kv=10.) pp.create_line(net, from_bus=b1, to_bus=b2, length_km=30, std_type="NAYY 4x50 SE") pp.create_ext_grid(net, bus=b1, va_degree= -1.0, slack_weight= 1) pp.create_ext_grid(net, bus=b2, va_degree= 12.0, vm_pu= 1.0, slack_weight= 1) pp.runpp(net, calculate_voltage_angles= True, distributed_slack= True) print('buses:\n',net.resbus) print('\'150, '\nlines:') print(net.resline) print('\'150, '\next_grids:') print(net.res_ext_grid)

#And I get this result:

buses: vm_pu va_degree p_mw q_mvar 0 1.0 -1.0 -3.478121e-16 0.09896 1 1.0 -1.0 3.812055e-16 0.09896


lines: p_from_mw q_from_mvar p_to_mw q_to_mvar pl_mw ql_mvar \ 0 3.478121e-16 -0.09896 -3.812055e-16 -0.09896 -3.339343e-17 -0.19792

i_from_ka i_to_ka i_ka vm_from_pu va_from_degree vm_to_pu \ 0 0.005713 0.005713 0.005713 1.0 -1.0 1.0

va_to_degree loading_percent
0 -1.0 4.023569


ext_grids: p_mw q_mvar 0 3.478121e-16 -0.09896 1 -3.812055e-16 -0.09896

_"""Why does the second bus get the wrong angle - (-1.0), like on the first bus? This should result in 12.0. And, accordingly, the calculation of the power flow from the first bus to the second is completely wrong. There is practically no power flow, although it should be quite significant. The link to Colab https://colab.research.google.com/drive/1Vrj4ycpZ_TIfyHWsW8CVcmi8T0UD_WQi?usp=sharing """_

SteffenMeinecke commented 2 years ago

Dear @shamigulov, the power flow between two ext_grids is already fixed by its angles. One cannot consider both, the fixed angles and the constraint that the slack power should be distributed as defined by the factor slack_weight. If you want the first, run the powerflow without distributed slack. If you want the second, using just one ext_grid and other generation elements as gen with values for slack_weight is a good idea. Furthermore, investigating a grid without loads and thus power flows in value range of 1e-16 can possibly raise issues which you do not want to investigate.

shamigulov commented 2 years ago

Ok. I'm tried like this:

import pandapower as pp net = pp.create_empty_network() b1 = pp.create_bus(net, vn_kv=10.) b2 = pp.create_bus(net, vn_kv=10.) pp.create_line(net, from_bus=b1, to_bus=b2, length_km=30, std_type="NAYY 4x50 SE") pp.create_ext_grid(net, bus=b1, va_degree= -1.0, slack_weight= 1) pp.create_ext_grid(net, bus=b2, va_degree= 12.0, vm_pu= 1.0, slack_weight= 1) pp.runpp(net, calculate_voltage_angles= True, distributed_slack= False) print('buses:\n',net.resbus) print(''150, '\nlines:') print(net.resline) print(''150, '\next_grids:') print(net.res_ext_grid)

Result:

buses: vm_pu va_degree p_mw q_mvar 0 1.0 0.0 0.0 0.09896 1 1.0 0.0 0.0 0.09896


lines: p_from_mw q_from_mvar p_to_mw q_to_mvar pl_mw ql_mvar i_from_ka \ 0 0.0 -0.09896 0.0 -0.09896 0.0 -0.19792 0.005713

i_to_ka      i_ka  vm_from_pu  va_from_degree  vm_to_pu  va_to_degree  \

0 0.005713 0.005713 1.0 0.0 1.0 0.0

loading_percent
0 4.023569


ext_grids: p_mw q_mvar 0 0.0 -0.09896 1 0.0 -0.09896

Both angles are becoming zeros. Why?

AnkurArohi commented 2 years ago

There is no power flow. Please define the network correctly, you have two buses and both have external grids. Please define another bus with a load or so

shamigulov commented 2 years ago

Thanks for your reply. Of course, I will try to do as you write. But can't power flow from one external network to another? Without any other elements of the power system in the area under consideration.

AnkurArohi commented 2 years ago

The thing is external network grid is the reference for your NR (Newton Raphson) convergence (Power Flow equation solution) If you have two external grid types connected together and you let power flow find the angles and no distributed slack feature is on as can be seen here pp.runpp(net, calculate_voltage_angles= True, distributed_slack= False)

Then the calculated angle would be zero as this is the property of the external grid. If you really want to simulate two external grids connected to each other then you need to make distributed_slack = True Internally then one of the external grid element will be handled as Element without angle zero.

This is then theretically possible, the other external grid where angle is not zero or where the angle is lesser than the other one (in case you forcibly change the angle) will act as load and take in the power supplied by the other external grid

shamigulov commented 2 years ago

If you really want to simulate two external grids connected to each other then you need to make distributed_slack = True

Please see my first example (at the top of the issue). If I understand correctly, that's exactly what I did. But the simulation result was wrong.

rbolgaryn commented 2 years ago

you can contribute a failing tets in a pull request