fix eafs and conventional setttings

This commit is contained in:
Fabian 2022-06-23 16:04:49 +02:00
parent db78f9cd2a
commit 441d7d56f9
3 changed files with 16 additions and 28 deletions

View File

@ -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:

View File

@ -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())

View File

@ -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])