From de384c7cf620c769df2ae91a588ac4e78ea77c3f Mon Sep 17 00:00:00 2001 From: Koen van Greevenbroek Date: Thu, 1 Feb 2024 14:46:13 +0000 Subject: [PATCH] Correctly carry over time-varying data between investment periods Previously, time-varying data in each "next" investment period was set to the default values, implying capacity factors of 1 for renewable generators for example. --- scripts/prepare_perfect_foresight.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/prepare_perfect_foresight.py b/scripts/prepare_perfect_foresight.py index f5ae3919..8fd6bc1f 100644 --- a/scripts/prepare_perfect_foresight.py +++ b/scripts/prepare_perfect_foresight.py @@ -199,8 +199,13 @@ def concat_networks(years): pnl[k].loc[pnl_year.index, pnl_year.columns] = pnl_year else: - # this is to avoid adding multiple times assets with - # infinite lifetime as ror + # For components that aren't new, we just extend + # time-varying data from the previous investment + # period. + if i > 0: + pnl[k].loc[(year,)] = pnl[k].loc[(years[i - 1],)].values + + # Now, add time-varying data for new components. cols = pnl_year.columns.difference(pnl[k].columns) pnl[k] = pd.concat([pnl[k], pnl_year[cols]], axis=1)