Fix nodal fraction with distributed generators

This commit is contained in:
Thomas Gilon 2023-12-08 10:30:08 +01:00
parent 1b88dc7660
commit 1352f6c30e
2 changed files with 2 additions and 1 deletions

View File

@ -39,6 +39,7 @@ Upcoming Release
**Bugs and Compatibility**
* A bug preventing custom powerplants specified in ``data/custom_powerplants.csv`` was fixed. (https://github.com/PyPSA/pypsa-eur/pull/732)
* Fix nodal fraction in ``add_existing_year`` when using distributed generators
PyPSA-Eur 0.8.1 (27th July 2023)

View File

@ -88,7 +88,7 @@ def add_existing_renewables(df_agg):
]
cfs = n.generators_t.p_max_pu[gens].mean()
cfs_key = cfs / cfs.sum()
nodal_fraction.loc[n.generators.loc[gens, "bus"]] = cfs_key.values
nodal_fraction.loc[n.generators.loc[gens, "bus"]] = cfs_key.groupby(n.generators.loc[gens, "bus"]).sum()
nodal_df = df.loc[n.buses.loc[elec_buses, "country"]]
nodal_df.index = elec_buses