e2nIEE / pandapower

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

Finding the Nearest Transformer #383

Closed rahulkhatri121 closed 5 years ago

rahulkhatri121 commented 5 years ago

Hi All ,

I have a network , in which I want to find the effect of adding the sgen element to nearest transformer connected. For that could any one of you have an idea that how I find the nearest transformer(index) which is connected to sgen bus ?

Thanks in advance :)

ascheidl commented 5 years ago

Hi,

you can use the topology package. See https://pandapower.readthedocs.io/en/v2.0.1/topology.html or https://www.youtube.com/watch?v=ubpHrrMA63A&list=PLWIXcESdYmbxuDXSrARFZaqU3qR3JbGR5&index=9

In your case, with

import pandas import pandapower.topology as top d = pandas.DataFrame((top.calc_distance_to_bus(net, b) for b in net.trafo.lv_bus.values), index=net.trafo.index)

you can find the nearest transformer of bus 123 with d[123].idxmin()

cheers alex

rahulkhatri121 commented 5 years ago

Hi Alex,

Thanks alot ;)

ascheidl commented 5 years ago

had to edit the code ... first version gave the lv_bus of the transformer ... now it should give the index