From d7435b6214a6fb27415730646a3eab72c46b279f Mon Sep 17 00:00:00 2001 From: Sermisha Date: Mon, 20 May 2024 14:57:18 +0530 Subject: [PATCH 1/2] Modification to function "add_operational_reserve_margin" in solve_network.py Typecasted pandas dataframes to xarray datasets to allow for multiplication with pypsa variables --- scripts/solve_network.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 11de6151..4028a156 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -735,7 +735,7 @@ def add_operational_reserve_margin(n, sns, config): .loc[vres_i.intersection(ext_i)] .rename({"Generator-ext": "Generator"}) ) - lhs = summed_reserve + (p_nom_vres * (-EPSILON_VRES * capacity_factor)).sum( + lhs = summed_reserve + (p_nom_vres * (-EPSILON_VRES * xr.DataArray(capacity_factor))).sum( "Generator" ) @@ -767,7 +767,7 @@ def add_operational_reserve_margin(n, sns, config): p_max_pu = get_as_dense(n, "Generator", "p_max_pu") - lhs = dispatch + reserve - capacity_variable * p_max_pu[ext_i] + lhs = dispatch + reserve - capacity_variable * xr.DataArray(p_max_pu[ext_i]) rhs = (p_max_pu[fix_i] * capacity_fixed).reindex(columns=gen_i, fill_value=0) From 6722e584ba179a99ae5684c2fff93dab3d418934 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 10:03:41 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/solve_network.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 4028a156..8a577e23 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -735,9 +735,9 @@ def add_operational_reserve_margin(n, sns, config): .loc[vres_i.intersection(ext_i)] .rename({"Generator-ext": "Generator"}) ) - lhs = summed_reserve + (p_nom_vres * (-EPSILON_VRES * xr.DataArray(capacity_factor))).sum( - "Generator" - ) + lhs = summed_reserve + ( + p_nom_vres * (-EPSILON_VRES * xr.DataArray(capacity_factor)) + ).sum("Generator") # Total demand per t demand = get_as_dense(n, "Load", "p_set").sum(axis=1)