pandapower icon indicating copy to clipboard operation
pandapower copied to clipboard

Feature/additional patches

Open hzraja opened this issue 1 year ago • 4 comments

  • Added patch for the Wind turbine
  • Added patch for PV
  • static alignment for generic patches based on the different patch type at each bus (3 patches -> 120°, 4 patches -> 90°)
  • Fix visual Bugs
  • Fixed Pandapipes compatibility issue
  • Add changes to \pandapower\CHANGELOG.rs

hzraja avatar Aug 16 '23 17:08 hzraja

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.66%. Comparing base (873b90e) to head (9a55153). Report is 49 commits behind head on develop.

:exclamation: Current head 9a55153 differs from pull request most recent head 8dc50bd. Consider uploading reports for the commit 8dc50bd to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2114      +/-   ##
===========================================
- Coverage    79.84%   79.66%   -0.18%     
===========================================
  Files          255      255              
  Lines        27971    27822     -149     
===========================================
- Hits         22333    22164     -169     
- Misses        5638     5658      +20     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 16 '23 18:08 codecov[bot]

I like the idea of having new patches for wind turbines and PV plants, but I doubt that the implementation does exactly what it is supposed to do. A few aspects that I would like to clarify:

  • Are there any tests for this to get some information on what is plotted in different cases? I don't mean that it is necessary to draw plots and have some tests check what is on the drawing pane, but at least try to get some more output from the plotting functions to check for different corner cases...
  • Could you provide a small example of what is drawn in what case in the chat? I would prefer not to have to create my own plot from this to know what we are discussing about.
  • What do you think the user will do with this option of choosing between different patch types? Do you think that anyone would like to create different patches in the same collection? If not, then I would suggest to create new functions with the different patch types that could be called separately. So, say 99.9% of users using this function will have to go through the pain to call create_sgen_collection with a subset of sgens and a complex syntax for the unique_angles keyword, while only 0.1% of the users benefit from calling this function just once for all different types of sgens. On the other hand, those 99.9% could just call create_wind_turbine_collection on the subset without even having to pass any unique_angles. That would make it a lot easier to use and we could even speed up the function, as we don't have to do complex operations on the unique_angles argument. In that case it might also be easier to add some kwarg to the simple_plot function like "draw_sgens_by_type" that just differentiates between the old and the new implementation.
  • Did you check on the performance of this implementation? It appears to me that there are lots of loops with lots of complex calculations inside, which would slow down the collection creation tremendously in case of large data.

dlohmeier avatar Sep 18 '23 21:09 dlohmeier

@dlohmeier @jwiemer112

The new patches implementation can be utilized with simple_plot as well as create collections, in both cases user has the capability to use or not use the feature (in which case the old implementation kicks in)

Attached herewith are the examples of some user created scenarios with and without the new implementation

pp.plotting.simple_plot(net, plot_sgens=True, plot_gens=True, plot_loads=True, orientation=0, draw_sgens_by_type=False) Simple_plot_default The patches here overlap at one default position regardless of how many sgens are created

pp.plotting.simple_plot(net, plot_sgens=True, plot_gens=True, plot_loads=True, orientation=0, draw_sgens_by_type=True) Simple_plot_new If user want properly seperated patches (dynamic based on no of sgens), simply setting draw_sgens_by_type = True would result in the attached output. WT and PV have new patches if user sets the sgen type to them, whereas default sgen patch for wye type sgens.

*Create collections (simple_plot not used)

Old implementation: ax=pp.plotting.create_sgen_collection(net, size=0.1, infofunc=None, orientation=0., picker=False) collections_oldJPG Again, the patches here overlap regardless of their count

New implementation (only unique_angles, no new patches) angles = calculate_unique_angles(net)

ax=pp.plotting.create_sgen_collection(net, size=0.1, infofunc=None, orientation=0., picker=False, unique_angles=angles, draw_sgens_by_type=False) Collections_new_sgen-patches-is-false Default patches albeit properly seperated

New implementation (unique_angles, new patches) angles = calculate_unique_angles(net)

ax=pp.plotting.create_sgen_collection(net, size=0.1, infofunc=None, orientation=0., picker=False, unique_angles=angles, draw_sgens_by_type=True) Collections_new_sgen-patches-is-true Properly seperated and new patches for WT and PV if user has selected the type to be of them.

hzraja avatar Dec 08 '23 15:12 hzraja

Looks nice, but please resolve the conflicts and add an entry to the changelog. @hzraja @jwiemer112

vogt31337 avatar Jun 14 '24 11:06 vogt31337