Skip to content

Commit

Permalink
feat: add logic to map_generator_to_bus_by_sub function
Browse files Browse the repository at this point in the history
  • Loading branch information
danielolsen committed Sep 21, 2021
1 parent 6eadb74 commit 0270072
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion prereise/gather/griddata/hifld/data_process/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,15 @@ def map_generator_to_sub_by_location(generator, substation_groupby):
def map_generator_to_bus_by_sub(generator, bus_groupby):
"""Determine a likely bus for a generator to be connected to, based on the bus with
the lowest voltage within the generator's specified substation.
:param pandas.Series generator: one generating unit from data frame.
:param pandas.GroupBy bus_groupby: data frame of buses, grouped by substation ID.
:return: (*int/pd.NA*) -- bus ID if the generator has a substation ID, else pd.NA.
"""
pass
if pd.isna(generator.sub_id):
return pd.NA
else:
return bus_groupby.get_group(generator.sub_id)["baseKV"].idxmin()


def build_plant(bus, substations):
Expand Down

0 comments on commit 0270072

Please sign in to comment.