From 441d7d56f9f25b0b187008931c3c615b1d599942 Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 23 Jun 2022 16:04:49 +0200 Subject: [PATCH] fix eafs and conventional setttings --- config.default.yaml | 23 +++-------------------- scripts/add_electricity.py | 17 +++++++++-------- scripts/solve_network.py | 4 ++++ 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/config.default.yaml b/config.default.yaml index fc09dfd6..30f1d2b6 100755 --- a/config.default.yaml +++ b/config.default.yaml @@ -43,14 +43,14 @@ electricity: agg_p_nom_limits: data/agg_p_nom_minmax.csv operational_reserve: # like https://genxproject.github.io/GenX/dev/core/#Reserves - activate: true + activate: false epsilon_load: 0.02 # share of total load epsilon_vres: 0.02 # share of total renewable supply contingency: 4000 # fixed capacity in MW max_hours: battery: 6 - H2: 168 + H2: 168 extendable_carriers: Generator: [solar, onwind, offwind-ac, offwind-dc, OCGT] @@ -189,24 +189,7 @@ renewable: conventional: nuclear: - energy_availability_factors: - # From IAEA - # https://pris.iaea.org/PRIS/WorldStatistics/ThreeYrsEnergyAvailabilityFactor.aspx (2022-04-08) - BE: 0.65 - BG: 0.89 - CZ: 0.82 - FI: 0.92 - FR: 0.70 - DE: 0.88 - HU: 0.90 - NL: 0.86 - RO: 0.92 - SK: 0.89 - SI: 0.94 - ES: 0.89 - SE: 0.82 - CH: 0.86 - GB: 0.67 + energy_availability_factors: "data/nuclear-eafs.csv" # float of file name lines: types: diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index 4e4fdecd..c37a791d 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -302,7 +302,7 @@ def attach_wind_and_solar(n, costs, input_profiles, technologies, extendable_car p_max_pu=ds['profile'].transpose('time', 'bus').to_pandas()) -def attach_conventional_generators(n, costs, ppl, conventional_carriers, extendable_carriers, **config): +def attach_conventional_generators(n, costs, ppl, conventional_carriers, extendable_carriers, conventional_config): carriers = set(conventional_carriers) | set(extendable_carriers['Generator']) _add_missing_carriers_from_costs(n, costs, carriers) @@ -327,20 +327,21 @@ def attach_conventional_generators(n, costs, ppl, conventional_carriers, extenda lifetime=(ppl.dateout - ppl.datein).fillna(9999).astype(int), ) - for carrier in config: + for carrier in conventional_config: # Generators with technology affected idx = n.generators.query("carrier == @carrier").index - factors = config[carrier].get("energy_availability_factors") + factors = conventional_config[carrier].get("energy_availability_factors") - if isinstance(v, float): + if isinstance(factors, float): # Single value affecting all generators of technology k indiscriminantely of country - n.generators.loc[idx, "p_max_pu"] = v - elif isinstance(v, dict): - v = pd.Series(v) + n.generators.loc[idx, "p_max_pu"] = factors + elif isinstance(factors, str): + factors = pd.read_file(factors, index_col=0) # Values affecting generators of technology k country-specific # First map generator buses to countries; then map countries to p_max_pu - n.generators.p_max_pu.update(n.generators.loc[idx].bus.map(v).dropna()) + bus_factors = n.buses.country.map(factors) + n.generators.p_max_pu.update(n.generators.loc[idx].bus.map(bus_factors).dropna()) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index a5ebfe6e..06296723 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -271,6 +271,10 @@ def update_capacity_constraint(n): def add_operational_reserve_margin(n, sns, config): + """ + Build reserve margin constraints based on the formulation given in + https://genxproject.github.io/GenX/dev/core/#Reserves. + """ define_variables(n, 0, np.inf, 'Generator', 'r', axes=[sns, n.generators.index])