Merge pull request #798 from tgi-climact/fix/distributed-generators

Fix nodal fraction with distributed generators
This commit is contained in:
Fabian Neumann 2023-12-11 14:02:16 +01:00 committed by GitHub
commit 4ed59eb4b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 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,9 @@ 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