pandapower
pandapower copied to clipboard
[bug] create_bus supports coords but they dont get plotted by simple_plot and are not documented fully
Bug report checklis
-
[X] Searched the issues page for similar reports
-
[X] Read the relevant sections of the documentation
-
[X] Browse the tutorials and tests for usefull code snippets and examples of use
-
[X] Reproduced the issue after updating with
pip install --upgrade pandapower
(orgit pull
) -
[X] Tried basic troubleshooting (if a bug/error) like restarting the interpreter and checking the pythonpath
Reproducible Example
import pandapower as pp
from pandapower.plotting import simple_plot
import matplotlib.pyplot as plt
net = pp.create_empty_network()
b1 = pp.create_bus(net, 20., "BusBar0", coords=[(1, 1), (5, 5)])
b2 = pp.create_bus(net, 20., "Bus0", geodata=(3, 7))
b3 = pp.create_bus(net, 20., "Bus1", geodata=(5, 7))
pp.create_line(net, from_bus=b1, to_bus=b2, length_km=1., std_type="NAYY 4x50 SE")
pp.create_line(net, from_bus=b2, to_bus=b3, length_km=1., std_type="NAYY 4x50 SE")
pp.create_line(net, from_bus=b1, to_bus=b3, length_km=1., std_type="NAYY 4x50 SE", geodata=[(2, 2), (2, 4), (5, 7)])
print(net.bus_geodata[net.bus["name"]=="BusBar0"])
simple_plot(net)
plt.show()
Issue Description and Traceback
The example should show three lines and three buses but only two line gets drawn and the third bus does not show up.
This is the result of busbar type of geometries not being drawn by simple plot.
The coords
argument of create_bus
is only partially documented. It is documented in the create_bus function. But it is not documented that it is stored in bus_geodata
table.
The test_network does not contain any such bus so it is mostly untested.
simple_plot ignores any bus that has no x, y values in bus_geodata
. It generates line geodata from the from_bus
and to_bus
values which leads it to ignore any lines that end at a busbar, and do not have their own geodata. Also lines that have their own geodata appear to end in nothing as the bus is missing.
I would prefer the support for coords being droped from bus altogether as drawing a bus in the style of a Line is also ill advised. This would mean every bus has a Point geometry and every line has a LineString geometry, simplifying plotting a network altogether. Else the coords needs to be documented and plotting functions updated to handle the fact that a bus can have a LineString geometry.
Expected Behavior
The bus should get drawn.
Installed Versions
- python version: 3.10.11
- pandas version: 2.0.3
- networkx version: 3.1
- scipy version: 1.11.1
- numpy version: 1.24.4
- packaging version: 23.1
- tqdm version: 4.65.0
- deepdiff version: 6.3.1
- Operating System name/version: Windows 10
Label
- [X] Relevant labels are selected