fix unit_commitment function and file, add it to config.validation

This commit is contained in:
Fabian 2023-04-26 15:37:46 +02:00
parent 9c37eccaec
commit e2119d6229
3 changed files with 7 additions and 5 deletions

View File

@ -334,6 +334,8 @@ solar_thermal:
# only relevant for foresight = myopic or perfect
existing_capacities:
unit_commitment: true # if unit commitment (UC) for conventional power plants is used
# UC is only applied to extendable plants if linearized UC is used
grouping_years_power: [1980, 1985, 1990, 1995, 2000, 2005, 2010, 2015, 2020, 2025, 2030]
grouping_years_heat: [1980, 1985, 1990, 1995, 2000, 2005, 2010, 2015, 2019] # these should not extend 2020
threshold_capacity: 10
@ -612,6 +614,7 @@ solving:
options:
formulation: kirchhoff
clip_p_max_pu: 1.e-2
linearized_unit_commitment: true
load_shedding: false
noisy_costs: true
skip_iterations: true

View File

@ -5,6 +5,7 @@
rule solve_network:
input:
unit_commitment_file="data/unit_commitment.csv",
network=RESOURCES + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
output:
network=RESULTS + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",

View File

@ -144,7 +144,7 @@ def add_co2_sequestration_limit(n, limit=200):
def prepare_network(n, solve_opts=None, config=None):
if snakemake.config["existing_capacities"]["unit_commitment"]:
add_unit_committment(n)
add_unit_commitment(n, snakemake.input.unit_commitment_params)
if "clip_p_max_pu" in solve_opts:
for df in (
@ -594,14 +594,12 @@ def extra_functionality(n, snapshots):
add_pipe_retrofit_constraint(n)
def add_unit_committment(n):
def add_unit_commitment(n, fn):
"""
Add unit commitment.
"""
c = "Link" if ("sector_opts" in snakemake.wildcards.keys()) else "Generator"
uc_data = pd.read_csv(
"/home/lisa/Documents/pypsa-eur/data/unit_committment.csv", index_col=0
)
uc_data = pd.read_csv(fn, index_col=0)
for attr in uc_data.index:
n.df(c)[attr] = n.df(c)["carrier"].map(uc_data.loc[attr])