From b1bee0c3ee36223271e02b6ba7ca6d755fe57265 Mon Sep 17 00:00:00 2001 From: Michael Lindner Date: Mon, 2 Mar 2026 10:36:58 +0100 Subject: [PATCH 1/3] rename overnight_cost for compatibility with pypsa 1.1 --- config/config.de.yaml | 2 +- config/config.default.yaml | 8 +- pixi.lock | 30 +-- pixi.toml | 2 +- scripts/add_electricity.py | 36 ++-- scripts/add_existing_baseyear.py | 29 ++- scripts/prepare_sector_network.py | 205 +++++++++---------- scripts/pypsa-de/export_ariadne_variables.py | 32 ++- scripts/pypsa-de/modify_prenetwork.py | 36 ++-- 9 files changed, 183 insertions(+), 197 deletions(-) diff --git a/config/config.de.yaml b/config/config.de.yaml index 3ccd389ed..c4c784493 100644 --- a/config/config.de.yaml +++ b/config/config.de.yaml @@ -4,7 +4,7 @@ # docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#run run: - prefix: 20260220_merge_v2026.02 + prefix: 20260227_compat_pypsa1.1 name: # - ExPol - KN2045_Mix diff --git a/config/config.default.yaml b/config/config.default.yaml index e0e084f69..5357a64d4 100644 --- a/config/config.default.yaml +++ b/config/config.default.yaml @@ -1122,12 +1122,12 @@ clustering: ramp_limit_up: max ramp_limit_down: max investment: mean - overnight_cost: mean - connection_overnight_cost: mean + onight_cost: mean + connection_onight_cost: mean lines: - overnight_cost: mean + onight_cost: mean one_ports: - overnight_cost: mean + onight_cost: mean buses: {} temporal: resolution_elec: false diff --git a/pixi.lock b/pixi.lock index c2b211eea..c3f35f087 100644 --- a/pixi.lock +++ b/pixi.lock @@ -494,7 +494,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.3.2-pyhcf101f3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyphonetics-0.5.3-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pyproj-3.7.2-py312h9b6a7d9_2.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.0.7-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.1.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pyscipopt-6.1.0-np2py312h0f77346_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyshp-3.0.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pyside6-6.10.2-py312h9da60e5_0.conda @@ -1154,7 +1154,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.3.2-pyhcf101f3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyphonetics-0.5.3-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/pyproj-3.7.2-py312hfea2d77_2.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.0.7-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.1.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/pyscipopt-6.1.0-np2py312h834d234_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyshp-3.0.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha55dd90_7.conda @@ -1785,7 +1785,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.3.2-pyhcf101f3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyphonetics-0.5.3-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pyproj-3.7.2-py312h66ed876_2.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.0.7-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.1.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pyscipopt-6.1.0-np2py312h60fbb24_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyshp-3.0.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha55dd90_7.conda @@ -2390,7 +2390,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.3.2-pyhcf101f3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyphonetics-0.5.3-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/win-64/pyproj-3.7.2-py312habbd053_2.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.0.7-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.1.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/pyreadline3-3.5.4-py312h2e8e312_2.conda - conda: https://conda.anaconda.org/conda-forge/win-64/pyscipopt-6.1.0-np2py312ha76dc74_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyshp-3.0.3-pyhd8ed1ab_0.conda @@ -4577,7 +4577,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.3.2-pyhcf101f3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyphonetics-0.5.3-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pyproj-3.7.2-py312h9b6a7d9_2.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.0.7-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.1.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pyscipopt-6.1.0-np2py312h0f77346_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyshp-3.0.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pyside6-6.10.2-py312h9da60e5_0.conda @@ -5237,7 +5237,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.3.2-pyhcf101f3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyphonetics-0.5.3-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/pyproj-3.7.2-py312hfea2d77_2.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.0.7-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.1.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/pyscipopt-6.1.0-np2py312h834d234_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyshp-3.0.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha55dd90_7.conda @@ -5868,7 +5868,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.3.2-pyhcf101f3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyphonetics-0.5.3-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pyproj-3.7.2-py312h66ed876_2.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.0.7-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.1.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pyscipopt-6.1.0-np2py312h60fbb24_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyshp-3.0.3-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pysocks-1.7.1-pyha55dd90_7.conda @@ -6473,7 +6473,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/pyparsing-3.3.2-pyhcf101f3_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyphonetics-0.5.3-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/win-64/pyproj-3.7.2-py312habbd053_2.conda - - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.0.7-pyhd8ed1ab_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.1.2-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/pyreadline3-3.5.4-py312h2e8e312_2.conda - conda: https://conda.anaconda.org/conda-forge/win-64/pyscipopt-6.1.0-np2py312ha76dc74_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pyshp-3.0.3-pyhd8ed1ab_0.conda @@ -26601,20 +26601,20 @@ packages: license_family: MIT size: 220834 timestamp: 1762426425913 -- conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.0.7-pyhd8ed1ab_0.conda - sha256: 6174a3b8fc5ff409e5b0f88eef9ba2b089f2fd9a8ba2d425b19c8ff546042e43 - md5: e451a3c0ab3ad6fbe7bf83c59f0e2f9b +- conda: https://conda.anaconda.org/conda-forge/noarch/pypsa-1.1.2-pyhd8ed1ab_0.conda + sha256: 60c71d1f6b0ee8bbc0bd7b58f6e842745ecdc0042cc8e1b95057282f28219ee3 + md5: 658fdb0a50c41f214553706c4d702195 depends: - deprecation - geopandas >=0.9 - highspy - levenshtein >=0.27.1 - - linopy >=0.5.5 + - linopy >=0.6.1 - matplotlib-base - netcdf4 !=1.7.4 - networkx >=2 - numpy - - pandas >=0.24 + - pandas >=2.0 - plotly - pydeck >=0.6 - pytables @@ -26626,8 +26626,8 @@ packages: - xarray license: MIT license_family: MIT - size: 222295 - timestamp: 1768392650051 + size: 242307 + timestamp: 1772004090295 - conda: https://conda.anaconda.org/conda-forge/win-64/pyreadline3-3.5.4-py312h2e8e312_2.conda sha256: 34dc1bd52ea27ddb9ee3dbdf5edbfe0ec8fce613b7328b983c11893ef7d7cd7b md5: 13c17a25c72912ca7f86ea48f964ddac diff --git a/pixi.toml b/pixi.toml index f5da876f3..80ae30beb 100644 --- a/pixi.toml +++ b/pixi.toml @@ -82,7 +82,7 @@ pre-commit = ">=4.3.0" proj = ">=9.6.2" pylint = ">=4.0.2" pydeck = ">0.6" # pypsa fails to import with pydeck <0.6, lower bound was only added from pypsa 1.0.6 -pypsa = "<1.1" +pypsa = ">=1.1.2" pyscipopt = ">=5.6.0" pytables = ">=3.10.2" python = ">=3.10" diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index c3862319c..cd5b8345d 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -442,7 +442,7 @@ def set_transmission_costs( * line_length_factor * costs.at["HVAC overhead", "capital_cost"] ) - n.lines["overnight_cost"] = ( + n.lines["onight_cost"] = ( n.lines["length"] * line_length_factor * costs.at["HVAC overhead", "investment"] ) @@ -467,7 +467,7 @@ def set_transmission_costs( ) + costs.at["HVDC inverter pair", "capital_cost"] ) - overnight_cost = ( + onight_cost = ( n.links.loc[dc_b, "length"] * line_length_factor * ( @@ -480,7 +480,7 @@ def set_transmission_costs( ) n.links.loc[dc_b, "capital_cost"] = capital_cost - n.links.loc[dc_b, "overnight_cost"] = overnight_cost + n.links.loc[dc_b, "onight_cost"] = onight_cost def attach_wind_and_solar( @@ -550,7 +550,7 @@ def attach_wind_and_solar( underground_investment = costs.at[ car + "-connection-underground", "investment" ] - connection_overnight_cost = line_length_factor * ( + connection_onight_cost = line_length_factor * ( distance * submarine_investment + landfall_length * underground_investment ) @@ -563,22 +563,22 @@ def attach_wind_and_solar( + costs.at[car + "-station", "capital_cost"] + connection_cost ) - overnight_cost = costs.at[car, "investment"] + onight_cost = costs.at[car, "investment"] else: capital_cost = ( costs.at["offwind", "capital_cost"] + costs.at[car + "-station", "capital_cost"] + connection_cost ) - overnight_cost = costs.at["offwind", "investment"] - connection_overnight_cost += costs.at[car + "-station", "investment"] + onight_cost = costs.at["offwind", "investment"] + connection_onight_cost += costs.at[car + "-station", "investment"] logger.info( f"Added connection cost of {connection_cost.min():0.0f}-{connection_cost.max():0.0f} Eur/MW/a to {car}" ) else: capital_cost = costs.at[car, "capital_cost"] - overnight_cost = costs.at[car, "investment"] - connection_overnight_cost = pd.NA + onight_cost = costs.at[car, "investment"] + connection_onight_cost = pd.NA buses = ds.indexes["bus_bin"].get_level_values("bus") bus_bins = ds.indexes["bus_bin"].map(flatten) @@ -599,8 +599,8 @@ def attach_wind_and_solar( p_nom_max=p_nom_max, marginal_cost=costs.at[supcar, "marginal_cost"], capital_cost=capital_cost, - overnight_cost=overnight_cost, - connection_overnight_cost=connection_overnight_cost, + onight_cost=onight_cost, + connection_onight_cost=connection_onight_cost, efficiency=costs.at[supcar, "efficiency"], p_max_pu=p_max_pu, lifetime=costs.at[supcar, "lifetime"], @@ -697,7 +697,7 @@ def attach_conventional_generators( efficiency=ppl.efficiency, marginal_cost=marginal_cost, capital_cost=ppl.capital_cost, - overnight_cost=ppl.investment, + onight_cost=ppl.investment, build_year=ppl.build_year, lifetime=ppl.lifetime, **committable_attrs, @@ -838,7 +838,7 @@ def attach_hydro( p_nom=ror["p_nom"], efficiency=costs.at["ror", "efficiency"], capital_cost=costs.at["ror", "capital_cost"], - overnight_cost=costs.at["ror", "investment"], + onight_cost=costs.at["ror", "investment"], weight=ror["p_nom"], p_max_pu=( inflow_t[ror.index] # pylint: disable=E0606 @@ -859,7 +859,7 @@ def attach_hydro( bus=phs["bus"], p_nom=phs["p_nom"], capital_cost=costs.at["PHS", "capital_cost"], - overnight_cost=costs.at["PHS", "investment"], + onight_cost=costs.at["PHS", "investment"], max_hours=phs["max_hours"], efficiency_store=np.sqrt(costs.at["PHS", "efficiency"]), efficiency_dispatch=np.sqrt(costs.at["PHS", "efficiency"]), @@ -927,7 +927,7 @@ def attach_hydro( p_nom=hydro["p_nom"], max_hours=hydro_max_hours, capital_cost=costs.at["hydro", "capital_cost"], - overnight_cost=costs.at["hydro", "investment"], + onight_cost=costs.at["hydro", "investment"], marginal_cost=costs.at["hydro", "marginal_cost"], p_max_pu=p_max_pu, # dispatch p_min_pu=0.0, # store @@ -1112,7 +1112,7 @@ def attach_storageunits( carrier=carrier, p_nom_extendable=True, capital_cost=costs.at[carrier, "capital_cost"], - overnight_costs=costs.at[carrier, "investment"], + onight_costs=costs.at[carrier, "investment"], marginal_cost=costs.at[carrier, "marginal_cost"], efficiency_store=costs.at[lookup_charge, "efficiency"] ** roundtrip_correction, @@ -1186,7 +1186,7 @@ def attach_stores( e_nom_extendable=True, carrier=carrier, capital_cost=costs.at[lookup_store, "capital_cost"], - overnight_cost=costs.at[lookup_store, "investment"], + onight_cost=costs.at[lookup_store, "investment"], lifetime=costs.at[lookup_store, "lifetime"], ) @@ -1201,7 +1201,7 @@ def attach_stores( carrier=f"{carrier} {charge_name}", efficiency=costs.at[lookup_charge, "efficiency"] ** roundtrip_correction, capital_cost=costs.at[lookup_charge, "capital_cost"], - overnight_cost=costs.at[lookup_charge, "investment"], + onight_cost=costs.at[lookup_charge, "investment"], p_nom_extendable=True, marginal_cost=costs.at[lookup_charge, "marginal_cost"], lifetime=costs.at[lookup_charge, "lifetime"], diff --git a/scripts/add_existing_baseyear.py b/scripts/add_existing_baseyear.py index 13a32a0c0..35c289006 100644 --- a/scripts/add_existing_baseyear.py +++ b/scripts/add_existing_baseyear.py @@ -391,8 +391,8 @@ def add_power_capacities_installed_before_baseyear( capital_cost = n.generators.loc[ n.generators.carrier == generator + suffix, "capital_cost" ].mean() - overnight_cost = n.generators.loc[ - n.generators.carrier == generator + suffix, "overnight_cost" + onight_cost = n.generators.loc[ + n.generators.carrier == generator + suffix, "onight_cost" ].mean() marginal_cost = n.generators.loc[ n.generators.carrier == generator + suffix, "marginal_cost" @@ -421,7 +421,7 @@ def add_power_capacities_installed_before_baseyear( p_nom=new_capacity, marginal_cost=marginal_cost, capital_cost=capital_cost, - overnight_cost=overnight_cost, + onight_cost=onight_cost, efficiency=costs.at[cost_key, "efficiency"], p_max_pu=p_max_pu.values, build_year=grouping_year, @@ -487,7 +487,7 @@ def add_power_capacities_installed_before_baseyear( * costs.at[ generator, "capital_cost" ], # NB: fixed cost is per MWel - overnight_cost=costs.at[generator, "efficiency"] + onight_cost=costs.at[generator, "efficiency"] * costs.at[ generator, "investment" ], # NB: investment is per MWel @@ -527,7 +527,7 @@ def add_power_capacities_installed_before_baseyear( p_nom=new_capacity / costs.at[key, "efficiency"], capital_cost=costs.at[key, "capital_cost"] * costs.at[key, "efficiency"], - overnight_cost=costs.at[key, "investment"] + onight_cost=costs.at[key, "investment"] * costs.at[key, "efficiency"], marginal_cost=costs.at[key, "VOM"], efficiency=costs.at[key, "efficiency"], @@ -745,7 +745,7 @@ def add_chp_plants( p_nom=p_nom[bus], capital_cost=costs.at[key, "capital_cost"] * costs.at[key, "efficiency"], - overnight_cost=costs.at[key, "investment"] + onight_cost=costs.at[key, "investment"] * costs.at[key, "efficiency"], marginal_cost=costs.at[key, "VOM"], efficiency=efficiency_power.loc[bus], @@ -767,7 +767,7 @@ def add_chp_plants( p_nom=p_nom[bus], capital_cost=costs.at[key, "capital_cost"] * costs.at[key, "efficiency"], - overnight_cost=costs.at[key, "investment"] + onight_cost=costs.at[key, "investment"] * costs.at[key, "efficiency"], marginal_cost=costs.at[key, "VOM"], efficiency=efficiency_power.loc[bus], @@ -838,7 +838,7 @@ def add_chp_plants( p_nom=p_nom[bus] / costs.at[key, "efficiency"], capital_cost=costs.at[key, "capital_cost"] * costs.at[key, "efficiency"], - overnight_cost=costs.at[key, "investment"] + onight_cost=costs.at[key, "investment"] * costs.at[key, "efficiency"], marginal_cost=costs.at[key, "VOM"], efficiency=costs.at[key, "efficiency"], @@ -860,7 +860,7 @@ def add_chp_plants( p_nom=p_nom[bus] / costs.at[key, "efficiency"], capital_cost=costs.at[key, "capital_cost"] * costs.at[key, "efficiency"], - overnight_cost=costs.at[key, "investment"] + onight_cost=costs.at[key, "investment"] * costs.at[key, "efficiency"], marginal_cost=costs.at[key, "VOM"], efficiency=costs.at[key, "efficiency"], @@ -1048,7 +1048,7 @@ def add_heating_capacities_installed_before_baseyear( carrier=f"{heat_system} {heat_source} heat pump", efficiency=1 / efficiency.clip(lower=0.001), capital_cost=costs.at[costs_name, "capital_cost"], - overnight_cost=costs.at[costs_name, "investment"], + onight_cost=costs.at[costs_name, "investment"], p_nom=existing_capacities.loc[ nodes, (heat_system.value, f"{heat_source} heat pump") ] @@ -1074,7 +1074,7 @@ def add_heating_capacities_installed_before_baseyear( costs.at[heat_system.resistive_heater_costs_name, "efficiency"] * costs.at[heat_system.resistive_heater_costs_name, "capital_cost"] ), - overnight_cost=( + onight_cost=( costs.at[heat_system.resistive_heater_costs_name, "efficiency"] * costs.at[heat_system.resistive_heater_costs_name, "investment"] ), @@ -1107,7 +1107,7 @@ def add_heating_capacities_installed_before_baseyear( costs.at[heat_system.gas_boiler_costs_name, "efficiency"] * costs.at[heat_system.gas_boiler_costs_name, "capital_cost"] ), - overnight_cost=( + onight_cost=( costs.at[heat_system.gas_boiler_costs_name, "efficiency"] * costs.at[heat_system.gas_boiler_costs_name, "investment"] ), @@ -1136,7 +1136,7 @@ def add_heating_capacities_installed_before_baseyear( efficiency2=costs.at["oil", "CO2 intensity"], capital_cost=costs.at[heat_system.oil_boiler_costs_name, "efficiency"] * costs.at[heat_system.oil_boiler_costs_name, "capital_cost"], - overnight_cost=costs.at[heat_system.oil_boiler_costs_name, "efficiency"] + onight_cost=costs.at[heat_system.oil_boiler_costs_name, "efficiency"] * costs.at[heat_system.oil_boiler_costs_name, "investment"], p_nom=( existing_capacities.loc[nodes, (heat_system.value, "oil boiler")] @@ -1170,8 +1170,7 @@ def add_heating_capacities_installed_before_baseyear( efficiency=efficiency, capital_cost=efficiency * costs.at["biomass boiler", "capital_cost"], - overnight_cost=efficiency - * costs.at["biomass boiler", "investment"], + onight_cost=efficiency * costs.at["biomass boiler", "investment"], p_nom=( existing_capacities.loc[ nodes, (heat_system.value, "biomass boiler") diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index 018be0dfb..98298f416 100755 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -490,7 +490,7 @@ def update_wind_solar_costs( n.generators.loc[n.generators.carrier == carrier, "capital_cost"] = costs.at[ cost_key, "capital_cost" ] - n.generators.loc[n.generators.carrier == carrier, "overnight_cost"] = costs.at[ + n.generators.loc[n.generators.carrier == carrier, "onight_cost"] = costs.at[ cost_key, "investment" ] @@ -524,7 +524,7 @@ def update_wind_solar_costs( underground_investment = costs.at[ tech + "-connection-underground", "investment" ] - connection_overnight_cost = line_length_factor * ( + connection_onight_cost = line_length_factor * ( distance * submarine_investment + landfall_length * underground_investment ) @@ -537,15 +537,15 @@ def update_wind_solar_costs( + costs.at[tech + "-station", "capital_cost"] + connection_cost ) - overnight_cost = costs.at[tech, "investment"] + onight_cost = costs.at[tech, "investment"] else: capital_cost = ( costs.at["offwind", "capital_cost"] + costs.at[tech + "-station", "capital_cost"] + connection_cost ) - overnight_cost = costs.at["offwind", "investment"] - connection_overnight_cost += costs.at[ + onight_cost = costs.at["offwind", "investment"] + connection_onight_cost += costs.at[ tech + "-station", "investment" ] # Assuming the station belongs to the connection cost @@ -556,12 +556,10 @@ def update_wind_solar_costs( n.generators.loc[n.generators.carrier == tech, "capital_cost"] = ( capital_cost.rename(index=lambda node: node + " " + tech) ) - n.generators.loc[n.generators.carrier == tech, "overnight_cost"] = ( - overnight_cost + n.generators.loc[n.generators.carrier == tech, "onight_cost"] = onight_cost + n.generators.loc[n.generators.carrier == tech, "connection_onight_cost"] = ( + connection_onight_cost.rename(index=lambda node: node + " " + tech) ) - n.generators.loc[ - n.generators.carrier == tech, "connection_overnight_cost" - ] = connection_overnight_cost.rename(index=lambda node: node + " " + tech) def add_carrier_buses( @@ -630,7 +628,7 @@ def add_carrier_buses( # Calculate carrier-specific storage costs if carrier == "gas": capital_cost = costs.at["gas storage", "capital_cost"] - overnight_cost = costs.at["gas storage", "investment"] + onight_cost = costs.at["gas storage", "investment"] elif carrier == "oil": # based on https://www.engineeringtoolbox.com/fuels-higher-calorific-values-d_169.html mwh_per_m3 = 44.9 * 724 * 0.278 * 1e-3 # MJ/kg * kg/m3 * kWh/MJ * MWh/kWh @@ -638,7 +636,7 @@ def add_carrier_buses( costs.at["General liquid hydrocarbon storage (product)", "capital_cost"] / mwh_per_m3 ) - overnight_cost = ( + onight_cost = ( costs.at["General liquid hydrocarbon storage (product)", "investment"] / mwh_per_m3 ) @@ -649,13 +647,13 @@ def add_carrier_buses( costs.at["General liquid hydrocarbon storage (product)", "capital_cost"] / mwh_per_m3 ) - overnight_cost = ( + onight_cost = ( costs.at["General liquid hydrocarbon storage (product)", "investment"] / mwh_per_m3 ) else: capital_cost = 0.1 - overnight_cost = np.nan + onight_cost = np.nan n.add("Bus", nodes, location=location, carrier=carrier, unit=unit) @@ -667,7 +665,7 @@ def add_carrier_buses( e_cyclic=True, carrier=carrier, capital_cost=capital_cost, - overnight_cost=overnight_cost, + onight_cost=onight_cost, ) fossils = ["coal", "gas", "oil", "lignite", "uranium"] @@ -875,7 +873,7 @@ def add_co2_tracking( spatial.co2.nodes, e_nom_extendable=True, capital_cost=costs.at["CO2 storage tank", "capital_cost"], - overnight_cost=costs.at["CO2 storage tank", "investment"], + onight_cost=costs.at["CO2 storage tank", "investment"], carrier="co2 stored", e_cyclic=True, bus=spatial.co2.nodes, @@ -938,7 +936,7 @@ def add_co2_tracking( e_nom_extendable=True, e_nom_max=e_nom_max, capital_cost=options["co2_sequestration_cost"], - overnight_cost=pd.NA, + onight_cost=pd.NA, marginal_cost=-0.1, bus=sequestration_buses, lifetime=options["co2_sequestration_lifetime"], @@ -1016,9 +1014,9 @@ def add_co2_network(n, costs, co2_network_cost_factor=1.0): * co2_links.length ) capital_cost = cost_onshore + cost_submarine - overnight_cost = investment_onshore + investment_submarine + onight_cost = investment_onshore + investment_submarine capital_cost *= co2_network_cost_factor - overnight_cost *= co2_network_cost_factor + onight_cost *= co2_network_cost_factor n.add( "Link", @@ -1029,7 +1027,7 @@ def add_co2_network(n, costs, co2_network_cost_factor=1.0): p_nom_extendable=True, length=co2_links.length.values, capital_cost=capital_cost.values, - overnight_cost=overnight_cost.values, + onight_cost=onight_cost.values, carrier="CO2 pipeline", lifetime=costs.at["CO2 pipeline", "lifetime"], ) @@ -1093,8 +1091,7 @@ def add_allam_gas( p_nom_extendable=True, capital_cost=costs.at["allam", "capital_cost"] * costs.at["allam", "efficiency"], - overnight_cost=costs.at["allam", "investment"] - * costs.at["allam", "efficiency"], + onight_cost=costs.at["allam", "investment"] * costs.at["allam", "efficiency"], marginal_cost=costs.at["allam", "VOM"] * costs.at["allam", "efficiency"], efficiency=costs.at["allam", "efficiency"], efficiency2=0.98 * costs.at["gas", "CO2 intensity"], @@ -1119,7 +1116,7 @@ def add_biomass_to_methanol(n, costs): p_nom_extendable=True, capital_cost=costs.at["biomass-to-methanol", "capital_cost"] * costs.at["biomass-to-methanol", "efficiency"], - overnight_cost=costs.at["biomass-to-methanol", "investment"] + onight_cost=costs.at["biomass-to-methanol", "investment"] * costs.at["biomass-to-methanol", "efficiency"], marginal_cost=costs.loc["biomass-to-methanol", "VOM"] * costs.at["biomass-to-methanol", "efficiency"], @@ -1148,7 +1145,7 @@ def add_biomass_to_methanol_cc(n, costs): * costs.at["biomass-to-methanol", "efficiency"] + costs.at["biomass CHP capture", "capital_cost"] * costs.at["biomass-to-methanol", "CO2 stored"], - overnight_cost=costs.at["biomass-to-methanol", "investment"] + onight_cost=costs.at["biomass-to-methanol", "investment"] * costs.at["biomass-to-methanol", "efficiency"] + costs.at["biomass CHP capture", "investment"] * costs.at["biomass-to-methanol", "CO2 stored"], @@ -1178,7 +1175,7 @@ def add_methanol_to_power(n, costs, pop_layout, types=None): p_nom_extendable=True, capital_cost=costs.at["allam", "capital_cost"] * costs.at["allam", "efficiency"], - overnight_cost=costs.at["allam", "investment"] + onight_cost=costs.at["allam", "investment"] * costs.at["allam", "efficiency"], marginal_cost=costs.at["allam", "VOM"] * costs.at["allam", "efficiency"], efficiency=costs.at["allam", "efficiency"], @@ -1203,8 +1200,7 @@ def add_methanol_to_power(n, costs, pop_layout, types=None): carrier="CCGT methanol", p_nom_extendable=True, capital_cost=capital_cost, - overnight_cost=costs.at["CCGT", "investment"] - * costs.at["CCGT", "efficiency"], + onight_cost=costs.at["CCGT", "investment"] * costs.at["CCGT", "efficiency"], marginal_cost=costs.at["CCGT", "VOM"], efficiency=costs.at["CCGT", "efficiency"], efficiency2=costs.at["methanolisation", "carbondioxide-input"], @@ -1220,15 +1216,15 @@ def add_methanol_to_power(n, costs, pop_layout, types=None): # efficiency * EUR/MW * (annuity + FOM) capital_cost = costs.at["CCGT", "efficiency"] * costs.at["CCGT", "capital_cost"] - overnight_cost = costs.at["CCGT", "investment"] * costs.at["CCGT", "efficiency"] + onight_cost = costs.at["CCGT", "investment"] * costs.at["CCGT", "efficiency"] capital_cost_cc = ( capital_cost + costs.at["cement capture", "capital_cost"] * costs.at["methanolisation", "carbondioxide-input"] ) - overnight_cost_cc = ( - overnight_cost + onight_cost_cc = ( + onight_cost + costs.at["cement capture", "investment"] * costs.at["methanolisation", "carbondioxide-input"] ) @@ -1244,7 +1240,7 @@ def add_methanol_to_power(n, costs, pop_layout, types=None): carrier="CCGT methanol CC", p_nom_extendable=True, capital_cost=capital_cost_cc, - overnight_cost=overnight_cost_cc, + onight_cost=onight_cost_cc, marginal_cost=costs.at["CCGT", "VOM"], efficiency=costs.at["CCGT", "efficiency"], efficiency2=costs.at["cement capture", "capture_rate"] @@ -1268,8 +1264,7 @@ def add_methanol_to_power(n, costs, pop_layout, types=None): p_nom_extendable=True, capital_cost=costs.at["OCGT", "capital_cost"] * costs.at["OCGT", "efficiency"], - overnight_cost=costs.at["OCGT", "investment"] - * costs.at["OCGT", "efficiency"], + onight_cost=costs.at["OCGT", "investment"] * costs.at["OCGT", "efficiency"], marginal_cost=costs.at["OCGT", "VOM"] * costs.at["OCGT", "efficiency"], efficiency=costs.at["OCGT", "efficiency"], efficiency2=costs.at["methanolisation", "carbondioxide-input"], @@ -1283,7 +1278,7 @@ def add_methanol_reforming(n, costs): tech = "Methanol steam reforming" capital_cost = costs.at[tech, "capital_cost"] / costs.at[tech, "methanol-input"] - overnight_cost = costs.at[tech, "investment"] / costs.at[tech, "methanol-input"] + onight_cost = costs.at[tech, "investment"] / costs.at[tech, "methanol-input"] n.add( "Link", @@ -1294,7 +1289,7 @@ def add_methanol_reforming(n, costs): bus2="co2 atmosphere", p_nom_extendable=True, capital_cost=capital_cost, - overnight_cost=overnight_cost, + onight_cost=onight_cost, efficiency=1 / costs.at[tech, "methanol-input"], efficiency2=costs.at["methanolisation", "carbondioxide-input"], carrier=tech, @@ -1312,15 +1307,15 @@ def add_methanol_reforming_cc(n, costs): # 10.1016/j.rser.2020.110171: 0.129 kWh_e/kWh_H2, -0.09 kWh_heat/kWh_H2 capital_cost = costs.at[tech, "capital_cost"] / costs.at[tech, "methanol-input"] - overnight_cost = costs.at[tech, "investment"] / costs.at[tech, "methanol-input"] + onight_cost = costs.at[tech, "investment"] / costs.at[tech, "methanol-input"] capital_cost_cc = ( capital_cost + costs.at["cement capture", "capital_cost"] * costs.at["methanolisation", "carbondioxide-input"] ) - overnight_cost_cc = ( - overnight_cost + onight_cost_cc = ( + onight_cost + costs.at["cement capture", "investment"] * costs.at["methanolisation", "carbondioxide-input"] ) @@ -1335,7 +1330,7 @@ def add_methanol_reforming_cc(n, costs): bus3=spatial.co2.nodes, p_nom_extendable=True, capital_cost=capital_cost_cc, - overnight_cost=overnight_cost_cc, + onight_cost=onight_cost_cc, efficiency=1 / costs.at[tech, "methanol-input"], efficiency2=(1 - costs.at["cement capture", "capture_rate"]) * costs.at["methanolisation", "carbondioxide-input"], @@ -1369,7 +1364,7 @@ def add_dac(n, costs): bus3=spatial.co2.df.loc[locations, "nodes"].values, carrier="DAC", capital_cost=costs.at["direct air capture", "capital_cost"] / electricity_input, - overnight_cost=costs.at["direct air capture", "investment"] / electricity_input, + onight_cost=costs.at["direct air capture", "investment"] / electricity_input, efficiency=-heat_input / electricity_input, efficiency2=-1 / electricity_input, efficiency3=1 / electricity_input, @@ -1516,7 +1511,7 @@ def add_generation( * costs.at[generator, "VOM"], # NB: VOM is per MWel capital_cost=costs.at[generator, "efficiency"] * costs.at[generator, "capital_cost"], # NB: fixed cost is per MWel - overnight_cost=costs.at[generator, "efficiency"] + onight_cost=costs.at[generator, "efficiency"] * costs.at[generator, "investment"], p_nom_extendable=True, carrier=generator, @@ -1598,7 +1593,7 @@ def add_ammonia( / costs.at["Haber-Bosch", "electricity-input"], capital_cost=costs.at["Haber-Bosch", "capital_cost"] / costs.at["Haber-Bosch", "electricity-input"], - overnight_cost=costs.at["Haber-Bosch", "investment"] + onight_cost=costs.at["Haber-Bosch", "investment"] / costs.at["Haber-Bosch", "electricity-input"], marginal_cost=costs.at["Haber-Bosch", "VOM"] / costs.at["Haber-Bosch", "electricity-input"], @@ -1616,7 +1611,7 @@ def add_ammonia( efficiency=1 / cf_industry["MWh_NH3_per_MWh_H2_cracker"], capital_cost=costs.at["Ammonia cracker", "capital_cost"] / cf_industry["MWh_NH3_per_MWh_H2_cracker"], # given per MW_H2 - overnight_cost=costs.at["Ammonia cracker", "investment"] + onight_cost=costs.at["Ammonia cracker", "investment"] / cf_industry["MWh_NH3_per_MWh_H2_cracker"], # given per MW_H2 lifetime=costs.at["Ammonia cracker", "lifetime"], ) @@ -1633,9 +1628,7 @@ def add_ammonia( capital_cost=costs.at[ "NH3 (l) storage tank incl. liquefaction", "capital_cost" ], - overnight_cost=costs.at[ - "NH3 (l) storage tank incl. liquefaction", "investment" - ], + onight_cost=costs.at["NH3 (l) storage tank incl. liquefaction", "investment"], lifetime=costs.at["NH3 (l) storage tank incl. liquefaction", "lifetime"], ) @@ -1712,7 +1705,7 @@ def insert_electricity_distribution_grid( efficiency=1, lifetime=costs.at["electricity distribution grid", "lifetime"], capital_cost=costs.at["electricity distribution grid", "capital_cost"], - overnight_cost=costs.at["electricity distribution grid", "investment"], + onight_cost=costs.at["electricity distribution grid", "investment"], ) # deduct distribution losses from electricity demand as these are included in total load @@ -1752,7 +1745,7 @@ def insert_electricity_distribution_grid( # set existing solar to cost of utility cost rather the 50-50 rooftop-utility solar = n.generators.index[n.generators.carrier == "solar"] n.generators.loc[solar, "capital_cost"] = costs.at["solar-utility", "capital_cost"] - n.generators.loc[solar, "overnight_cost"] = costs.at["solar-utility", "investment"] + n.generators.loc[solar, "onight_cost"] = costs.at["solar-utility", "investment"] fn = solar_rooftop_potentials_fn if len(fn) > 0: @@ -1769,7 +1762,7 @@ def insert_electricity_distribution_grid( p_nom_max=potential.loc[solar], marginal_cost=n.generators.loc[solar, "marginal_cost"], capital_cost=costs.at["solar-rooftop", "capital_cost"], - overnight_cost=costs.at["solar-rooftop", "investment"], + onight_cost=costs.at["solar-rooftop", "investment"], efficiency=n.generators.loc[solar, "efficiency"], p_max_pu=n.generators_t.p_max_pu[solar], lifetime=costs.at["solar-rooftop", "lifetime"], @@ -1794,7 +1787,7 @@ def insert_electricity_distribution_grid( e_nom_extendable=True, carrier="home battery", capital_cost=costs.at["home battery storage", "capital_cost"], - overnight_cost=costs.at["home battery storage", "investment"], + onight_cost=costs.at["home battery storage", "investment"], lifetime=costs.at["battery storage", "lifetime"], ) @@ -1806,7 +1799,7 @@ def insert_electricity_distribution_grid( carrier="home battery charger", efficiency=costs.at["battery inverter", "efficiency"] ** 0.5, capital_cost=costs.at["home battery inverter", "capital_cost"], - overnight_cost=costs.at["home battery inverter", "investment"], + onight_cost=costs.at["home battery inverter", "investment"], p_nom_extendable=True, lifetime=costs.at["battery inverter", "lifetime"], ) @@ -1870,7 +1863,7 @@ def insert_gas_distribution_costs( ) capital_cost = costs.at["electricity distribution grid", "capital_cost"] * f_costs - overnight_cost = costs.at["electricity distribution grid", "investment"] * f_costs + onight_cost = costs.at["electricity distribution grid", "investment"] * f_costs # Add costs to decentralized gas boilers gas_b = n.links.index[ @@ -1878,12 +1871,12 @@ def insert_gas_distribution_costs( & (~n.links.carrier.str.contains("urban central")) ] n.links.loc[gas_b, "capital_cost"] += capital_cost - n.links.loc[gas_b, "overnight_cost"] += overnight_cost + n.links.loc[gas_b, "onight_cost"] += onight_cost # Add costs to micro CHPs mchp = n.links.index[n.links.carrier.str.contains("micro gas")] n.links.loc[mchp, "capital_cost"] += capital_cost - n.links.loc[mchp, "overnight_cost"] += overnight_cost + n.links.loc[mchp, "onight_cost"] += onight_cost def add_electricity_grid_connection(n, costs): @@ -1894,7 +1887,7 @@ def add_electricity_grid_connection(n, costs): n.generators.loc[gens, "capital_cost"] += costs.at[ "electricity grid connection", "capital_cost" ] - n.generators.loc[gens, "overnight_cost"] += costs.at[ + n.generators.loc[gens, "onight_cost"] += costs.at[ "electricity grid connection", "investment" ] @@ -1982,7 +1975,7 @@ def add_h2_gas_infrastructure( carrier="H2 Electrolysis", efficiency=costs.at["electrolysis", "efficiency"], capital_cost=costs.at["electrolysis", "capital_cost"], - overnight_cost=costs.at["electrolysis", "investment"], + onight_cost=costs.at["electrolysis", "investment"], p_min_pu=options["min_part_load_electrolysis"], lifetime=costs.at["electrolysis", "lifetime"], ) @@ -2000,7 +1993,7 @@ def add_h2_gas_infrastructure( efficiency=costs.at["fuel cell", "efficiency"], capital_cost=costs.at["fuel cell", "capital_cost"] * costs.at["fuel cell", "efficiency"], # NB: fixed cost is per MWel - overnight_cost=costs.at["fuel cell", "investment"] + onight_cost=costs.at["fuel cell", "investment"] * costs.at["fuel cell", "efficiency"], # NB: fixed cost is per MWel lifetime=costs.at["fuel cell", "lifetime"], ) @@ -2021,7 +2014,7 @@ def add_h2_gas_infrastructure( efficiency=costs.at["OCGT", "efficiency"], capital_cost=costs.at["OCGT", "capital_cost"] * costs.at["OCGT", "efficiency"], # NB: fixed cost is per MWel - overnight_cost=costs.at["OCGT", "investment"] + onight_cost=costs.at["OCGT", "investment"] * costs.at["OCGT", "efficiency"], # NB: fixed cost is per MWel marginal_cost=costs.at["OCGT", "VOM"], lifetime=costs.at["OCGT", "lifetime"], @@ -2058,7 +2051,7 @@ def add_h2_gas_infrastructure( e_cyclic=True, carrier="H2 Store", capital_cost=h2_capital_cost, - overnight_cost=costs.at["hydrogen storage underground", "investment"], + onight_cost=costs.at["hydrogen storage underground", "investment"], lifetime=costs.at["hydrogen storage underground", "lifetime"], ) @@ -2075,7 +2068,7 @@ def add_h2_gas_infrastructure( carrier="H2 Store", capital_cost=costs.at[tech, "capital_cost"], lifetime=costs.at[tech, "lifetime"], - overnight_cost=costs.at[tech, "investment"], + onight_cost=costs.at[tech, "investment"], ) if options["H2_retrofit"]: @@ -2102,7 +2095,7 @@ def add_h2_gas_infrastructure( gas_pipes["p_nom_min"] = 0.0 # 0.1 EUR/MWkm/a to prefer decommissioning to address degeneracy gas_pipes["capital_cost"] = 0.1 * gas_pipes.length - gas_pipes["overnight_cost"] = np.nan + gas_pipes["onight_cost"] = np.nan gas_pipes["p_nom_extendable"] = True else: gas_pipes["p_nom_max"] = np.inf @@ -2110,7 +2103,7 @@ def add_h2_gas_infrastructure( gas_pipes["capital_cost"] = ( gas_pipes.length * costs.at["CH4 (g) pipeline", "capital_cost"] ) - gas_pipes["overnight_cost"] = ( + gas_pipes["onight_cost"] = ( gas_pipes.length * costs.at["CH4 (g) pipeline", "investment"] ) gas_pipes["p_nom_extendable"] = False @@ -2127,7 +2120,7 @@ def add_h2_gas_infrastructure( p_nom_min=gas_pipes.p_nom_min, length=gas_pipes.length, capital_cost=gas_pipes.capital_cost, - overnight_cost=gas_pipes.overnight_cost, + onight_cost=gas_pipes.onight_cost, tags=gas_pipes.name, carrier="gas pipeline", lifetime=np.inf, @@ -2206,7 +2199,7 @@ def add_h2_gas_infrastructure( length=new_gas_pipes.length, capital_cost=new_gas_pipes.length * costs.at["CH4 (g) pipeline", "capital_cost"], - overnight_cost=new_gas_pipes.length + onight_cost=new_gas_pipes.length * costs.at["CH4 (g) pipeline", "investment"], carrier="gas pipeline new", lifetime=costs.at["CH4 (g) pipeline", "lifetime"], @@ -2230,7 +2223,7 @@ def add_h2_gas_infrastructure( length=h2_pipes.length, capital_cost=costs.at["H2 (g) pipeline repurposed", "capital_cost"] * h2_pipes.length, - overnight_cost=costs.at["H2 (g) pipeline repurposed", "investment"] + onight_cost=costs.at["H2 (g) pipeline repurposed", "investment"] * h2_pipes.length, tags=h2_pipes.name, carrier="H2 pipeline retrofitted", @@ -2257,7 +2250,7 @@ def add_h2_gas_infrastructure( length=h2_pipes.length.values, capital_cost=costs.at["H2 (g) pipeline", "capital_cost"] * h2_pipes.length.values, - overnight_cost=costs.at["H2 (g) pipeline", "investment"] + onight_cost=costs.at["H2 (g) pipeline", "investment"] * h2_pipes.length.values, carrier="H2 pipeline", lifetime=costs.at["H2 (g) pipeline", "lifetime"], @@ -2275,7 +2268,7 @@ def add_h2_gas_infrastructure( e_nom_extendable=True, carrier="battery", capital_cost=costs.at["battery storage", "capital_cost"], - overnight_cost=costs.at["battery storage", "investment"], + onight_cost=costs.at["battery storage", "investment"], lifetime=costs.at["battery storage", "lifetime"], ) @@ -2287,7 +2280,7 @@ def add_h2_gas_infrastructure( carrier="battery charger", efficiency=costs.at["battery inverter", "efficiency"] ** 0.5, capital_cost=costs.at["battery inverter", "capital_cost"], - overnight_cost=costs.at["battery inverter", "investment"], + onight_cost=costs.at["battery inverter", "investment"], p_nom_extendable=True, lifetime=costs.at["battery inverter", "lifetime"], ) @@ -2319,7 +2312,7 @@ def add_h2_gas_infrastructure( * costs.at["gas", "CO2 intensity"], capital_cost=costs.at["methanation", "capital_cost"] * costs.at["methanation", "efficiency"], # costs given per kW_gas - overnight_cost=costs.at["methanation", "investment"] + onight_cost=costs.at["methanation", "investment"] * costs.at["methanation", "efficiency"], lifetime=costs.at["methanation", "lifetime"], ) @@ -2339,8 +2332,7 @@ def add_h2_gas_infrastructure( * costs.at["coal", "capital_cost"] + costs.at["biomass CHP capture", "capital_cost"] * costs.at["coal", "CO2 intensity"], # NB: fixed cost is per MWel - overnight_cost=costs.at["coal", "efficiency"] - * costs.at["coal", "investment"] + onight_cost=costs.at["coal", "efficiency"] * costs.at["coal", "investment"] + costs.at["biomass CHP capture", "investment"] * costs.at["coal", "CO2 intensity"], p_nom_extendable=True, @@ -2368,7 +2360,7 @@ def add_h2_gas_infrastructure( efficiency2=costs.at["gas", "CO2 intensity"] * (1 - options["cc_fraction"]), efficiency3=costs.at["gas", "CO2 intensity"] * options["cc_fraction"], capital_cost=costs.at["SMR CC", "capital_cost"], - overnight_cost=costs.at["SMR CC", "investment"], + onight_cost=costs.at["SMR CC", "investment"], lifetime=costs.at["SMR CC", "lifetime"], ) @@ -2384,7 +2376,7 @@ def add_h2_gas_infrastructure( efficiency=costs.at["SMR", "efficiency"], efficiency2=costs.at["gas", "CO2 intensity"], capital_cost=costs.at["SMR", "capital_cost"], - overnight_cost=costs.at["SMR", "investment"], + onight_cost=costs.at["SMR", "investment"], lifetime=costs.at["SMR", "lifetime"], ) @@ -3304,7 +3296,7 @@ def add_heat( heat_system.central_or_decentral + " water tank storage", "capital_cost", ], - overnight_cost=costs.at[ + onight_cost=costs.at[ heat_system.central_or_decentral + " water tank storage", "investment", ], @@ -3512,7 +3504,7 @@ def add_heat( ] * overdim_factor ) - overnight_cost = ( + onight_cost = ( costs.at[ heat_system.heat_source_costs_name(heat_source), "investment", @@ -3527,7 +3519,7 @@ def add_heat( f"Heat source {heat_source} not found in cost data. Assuming zero cost and infinite lifetime." ) capital_cost = 0.0 - overnight_cost = 0.0 + onight_cost = 0.0 lifetime = np.inf n.add( @@ -3538,7 +3530,7 @@ def add_heat( carrier=heat_carrier, p_nom_extendable=True, capital_cost=capital_cost, - overnight_cost=overnight_cost, + onight_cost=onight_cost, lifetime=lifetime, p_nom_max=p_max_source.max(), p_max_pu=p_max_source / p_max_source.max(), @@ -3556,7 +3548,7 @@ def add_heat( efficiency2=(1 - (1 / cop_heat_pump.clip(lower=0.001))).squeeze(), capital_cost=costs.at[costs_name_heat_pump, "capital_cost"] * overdim_factor, - overnight_cost=costs.at[costs_name_heat_pump, "investment"] + onight_cost=costs.at[costs_name_heat_pump, "investment"] * overdim_factor, p_nom_extendable=True, p_min_pu=( @@ -3621,7 +3613,7 @@ def add_heat( efficiency2=(1 - 1 / cop_heat_pump.clip(lower=0.001)).squeeze(), capital_cost=costs.at[costs_name_heat_pump, "capital_cost"] * overdim_factor, - overnight_cost=costs.at[costs_name_heat_pump, "investment"] + onight_cost=costs.at[costs_name_heat_pump, "investment"] * overdim_factor, p_nom_extendable=True, p_min_pu=( @@ -3642,7 +3634,7 @@ def add_heat( efficiency=(1 / cop_heat_pump.clip(lower=0.001)).squeeze(), capital_cost=costs.at[costs_name_heat_pump, "capital_cost"] * overdim_factor, - overnight_cost=costs.at[costs_name_heat_pump, "investment"] + onight_cost=costs.at[costs_name_heat_pump, "investment"] * overdim_factor, p_min_pu=( -cop_heat_pump / cop_heat_pump.clip(lower=0.001) @@ -3665,7 +3657,7 @@ def add_heat( capital_cost=costs.at[key, "efficiency"] * costs.at[key, "capital_cost"] * overdim_factor, - overnight_cost=costs.at[key, "efficiency"] + onight_cost=costs.at[key, "efficiency"] * costs.at[key, "investment"] * overdim_factor, p_nom_extendable=True, @@ -3688,7 +3680,7 @@ def add_heat( capital_cost=costs.at[key, "efficiency"] * costs.at[key, "capital_cost"] * overdim_factor, - overnight_cost=costs.at[key, "efficiency"] + onight_cost=costs.at[key, "efficiency"] * costs.at[key, "investment"] * overdim_factor, lifetime=costs.at[key, "lifetime"], @@ -3707,7 +3699,7 @@ def add_heat( capital_cost=costs.at[ heat_system.central_or_decentral + " solar thermal", "capital_cost" ], - overnight_cost=costs.at[ + onight_cost=costs.at[ heat_system.central_or_decentral + " solar thermal", "investment" ], p_max_pu=solar_thermal[nodes], @@ -3734,7 +3726,7 @@ def add_heat( p_nom_extendable=True, capital_cost=costs.at["central gas CHP", "capital_cost"] * costs.at["central gas CHP", "efficiency"], - overnight_cost=costs.at["central gas CHP", "investment"] + onight_cost=costs.at["central gas CHP", "investment"] * costs.at["central gas CHP", "efficiency"], marginal_cost=costs.at["central gas CHP", "VOM"], efficiency=costs.at["central gas CHP", "efficiency"], @@ -3758,7 +3750,7 @@ def add_heat( * costs.at["central gas CHP", "efficiency"] + costs.at["biomass CHP capture", "capital_cost"] * costs.at[fuel, "CO2 intensity"], - overnight_cost=costs.at["central gas CHP", "investment"] + onight_cost=costs.at["central gas CHP", "investment"] * costs.at["central gas CHP", "efficiency"] + costs.at["biomass CHP capture", "investment"] * costs.at[fuel, "CO2 intensity"], @@ -3804,7 +3796,7 @@ def add_heat( efficiency2=costs.at["micro CHP", "efficiency-heat"], efficiency3=costs.at["gas", "CO2 intensity"], capital_cost=costs.at["micro CHP", "capital_cost"], - overnight_cost=costs.at["micro CHP", "investment"], + onight_cost=costs.at["micro CHP", "investment"], lifetime=costs.at["micro CHP", "lifetime"], ) @@ -3921,7 +3913,7 @@ def add_heat( country=ct, capital_cost=capital_cost[strength] * options["retrofitting"]["cost_factor"], - overnight_cost=pd.NA, # TODO add proper overnight_cost value + onight_cost=pd.NA, # TODO add proper onight_cost value ) @@ -4319,7 +4311,7 @@ def add_biomass( carrier="biogas to gas", capital_cost=costs.at["biogas", "capital_cost"] + costs.at["biogas upgrading", "capital_cost"], - overnight_cost=costs.at["biogas", "investment"] + onight_cost=costs.at["biogas", "investment"] + costs.at["biogas upgrading", "investment"], marginal_cost=costs.at["biogas upgrading", "VOM"], efficiency=costs.at["biogas", "efficiency"], @@ -4344,7 +4336,7 @@ def add_biomass( + costs.at["biogas upgrading", "capital_cost"] + costs.at["biomass CHP capture", "capital_cost"] * costs.at["biogas CC", "CO2 stored"], - overnight_cost=costs.at["biogas CC", "investment"] + onight_cost=costs.at["biogas CC", "investment"] + costs.at["biogas upgrading", "investment"] + costs.at["biomass CHP capture", "investment"] * costs.at["biogas CC", "CO2 stored"], @@ -4506,7 +4498,7 @@ def add_biomass( carrier="urban central solid biomass CHP", p_nom_extendable=True, capital_cost=costs.at[key, "capital_cost"] * costs.at[key, "efficiency"], - overnight_cost=costs.at[key, "investment"] * costs.at[key, "efficiency"], + onight_cost=costs.at[key, "investment"] * costs.at[key, "efficiency"], marginal_cost=costs.at[key, "VOM"], efficiency=costs.at[key, "efficiency"], efficiency2=costs.at[key, "efficiency-heat"], @@ -4527,7 +4519,7 @@ def add_biomass( * costs.at[key + " CC", "efficiency"] + costs.at["biomass CHP capture", "capital_cost"] * costs.at["solid biomass", "CO2 intensity"], - overnight_cost=costs.at[key + " CC", "investment"] + onight_cost=costs.at[key + " CC", "investment"] * costs.at[key + " CC", "efficiency"] + costs.at["biomass CHP capture", "investment"] * costs.at["solid biomass", "CO2 intensity"], @@ -4568,7 +4560,7 @@ def add_biomass( * options["overdimension_heat_generators"][ HeatSystem(name).central_or_decentral ], - overnight_cost=costs.at["biomass boiler", "efficiency"] + onight_cost=costs.at["biomass boiler", "efficiency"] * costs.at["biomass boiler", "investment"] * options["overdimension_heat_generators"][ HeatSystem(name).central_or_decentral @@ -4602,8 +4594,7 @@ def add_biomass( p_nom_extendable=True, capital_cost=costs.at["BtL", "capital_cost"] * costs.at["BtL", "efficiency"], - overnight_cost=costs.at["BtL", "investment"] - * costs.at["BtL", "efficiency"], + onight_cost=costs.at["BtL", "investment"] * costs.at["BtL", "efficiency"], marginal_cost=costs.at["BtL", "VOM"] * costs.at["BtL", "efficiency"], ) @@ -4629,7 +4620,7 @@ def add_biomass( capital_cost=costs.at["BtL", "capital_cost"] * costs.at["BtL", "efficiency"] + costs.at["biomass CHP capture", "capital_cost"] * costs.at["BtL", "CO2 stored"], - overnight_cost=costs.at["BtL", "investment"] * costs.at["BtL", "efficiency"] + onight_cost=costs.at["BtL", "investment"] * costs.at["BtL", "efficiency"] + costs.at["biomass CHP capture", "investment"] * costs.at["BtL", "CO2 stored"], marginal_cost=costs.at["BtL", "VOM"] * costs.at["BtL", "efficiency"], @@ -4674,7 +4665,7 @@ def add_biomass( + efuel_scale_factor * costs.at["Fischer-Tropsch", "capital_cost"] * costs.at["Fischer-Tropsch", "efficiency"], - overnight_cost=costs.at["BtL", "investment"] * costs.at["BtL", "efficiency"] + onight_cost=costs.at["BtL", "investment"] * costs.at["BtL", "efficiency"] + efuel_scale_factor * costs.at["Fischer-Tropsch", "investment"] * costs.at["Fischer-Tropsch", "efficiency"], @@ -4701,7 +4692,7 @@ def add_biomass( p_nom_extendable=True, capital_cost=costs.at["BioSNG", "capital_cost"] * costs.at["BioSNG", "efficiency"], - overnight_cost=costs.at["BioSNG", "investment"] + onight_cost=costs.at["BioSNG", "investment"] * costs.at["BioSNG", "efficiency"], marginal_cost=costs.at["BioSNG", "VOM"] * costs.at["BioSNG", "efficiency"], ) @@ -4731,7 +4722,7 @@ def add_biomass( * costs.at["BioSNG", "efficiency"] + costs.at["biomass CHP capture", "capital_cost"] * costs.at["BioSNG", "CO2 stored"], - overnight_cost=costs.at["BioSNG", "investment"] + onight_cost=costs.at["BioSNG", "investment"] * costs.at["BioSNG", "efficiency"] + costs.at["biomass CHP capture", "investment"] * costs.at["BioSNG", "CO2 stored"], @@ -4923,7 +4914,7 @@ def add_industry( p_nom_extendable=True, capital_cost=costs.at["cement capture", "capital_cost"] * costs.at["solid biomass", "CO2 intensity"], - overnight_cost=costs.at["cement capture", "investment"] + onight_cost=costs.at["cement capture", "investment"] * costs.at["solid biomass", "CO2 intensity"], efficiency=0.9, # TODO: make config option efficiency2=-costs.at["solid biomass", "CO2 intensity"] @@ -4979,7 +4970,7 @@ def add_industry( p_nom_extendable=True, capital_cost=costs.at["cement capture", "capital_cost"] * costs.at["gas", "CO2 intensity"], - overnight_cost=costs.at["cement capture", "investment"] + onight_cost=costs.at["cement capture", "investment"] * costs.at["gas", "CO2 intensity"], efficiency=0.9, efficiency2=costs.at["gas", "CO2 intensity"] @@ -5047,7 +5038,7 @@ def add_industry( p_min_pu=options["min_part_load_methanolisation"], capital_cost=costs.at["methanolisation", "capital_cost"] / costs.at["methanolisation", "hydrogen-input"], # EUR/MW_H2/a - overnight_cost=costs.at["methanolisation", "investment"] + onight_cost=costs.at["methanolisation", "investment"] / costs.at["methanolisation", "hydrogen-input"], marginal_cost=costs.at["methanolisation", "VOM"] / costs.at["methanolisation", "hydrogen-input"], @@ -5079,7 +5070,7 @@ def add_industry( * options["overdimension_heat_generators"][ heat_system.central_or_decentral ], - overnight_cost=costs.at["decentral oil boiler", "efficiency"] + onight_cost=costs.at["decentral oil boiler", "efficiency"] * costs.at["decentral oil boiler", "investment"] * options["overdimension_heat_generators"][ heat_system.central_or_decentral @@ -5097,7 +5088,7 @@ def add_industry( efficiency=costs.at["Fischer-Tropsch", "efficiency"], capital_cost=costs.at["Fischer-Tropsch", "capital_cost"] * costs.at["Fischer-Tropsch", "efficiency"], # EUR/MW_H2/a - overnight_cost=costs.at["Fischer-Tropsch", "investment"] + onight_cost=costs.at["Fischer-Tropsch", "investment"] * costs.at["Fischer-Tropsch", "efficiency"], marginal_cost=costs.at["Fischer-Tropsch", "efficiency"] * costs.at["Fischer-Tropsch", "VOM"], @@ -5249,7 +5240,7 @@ def add_industry( p_nom_extendable=True, capital_cost=costs.at["waste CHP", "capital_cost"] * costs.at["waste CHP", "efficiency"], - overnight_cost=costs.at["waste CHP", "investment"] + onight_cost=costs.at["waste CHP", "investment"] * costs.at["waste CHP", "efficiency"], marginal_cost=costs.at["waste CHP", "VOM"], efficiency=costs.at["waste CHP", "efficiency"], @@ -5273,7 +5264,7 @@ def add_industry( * costs.at["waste CHP CC", "efficiency"] + costs.at["biomass CHP capture", "capital_cost"] * costs.at["oil", "CO2 intensity"], - overnight_cost=costs.at["waste CHP CC", "investment"] + onight_cost=costs.at["waste CHP CC", "investment"] * costs.at["waste CHP CC", "efficiency"] + costs.at["biomass CHP capture", "investment"] * costs.at["oil", "CO2 intensity"], @@ -5375,7 +5366,7 @@ def add_industry( carrier="process emissions CC", p_nom_extendable=True, capital_cost=costs.at["cement capture", "capital_cost"], - overnight_cost=costs.at["cement capture", "investment"], + onight_cost=costs.at["cement capture", "investment"], efficiency=1 - costs.at["cement capture", "capture_rate"], efficiency2=costs.at["cement capture", "capture_rate"], lifetime=costs.at["cement capture", "lifetime"], @@ -6183,7 +6174,7 @@ def lossy_bidirectional_links(n, carrier, efficiencies={}, subset=None): ) rev_links["length_original"] = rev_links["length"] rev_links["capital_cost"] = 0 - rev_links["overnight_cost"] = 0 + rev_links["onight_cost"] = 0 rev_links["length"] = 0 rev_links["reversed"] = True rev_links.index = rev_links.index.map(lambda x: x + "-reversed") diff --git a/scripts/pypsa-de/export_ariadne_variables.py b/scripts/pypsa-de/export_ariadne_variables.py index f06179bb1..d5f43f069 100644 --- a/scripts/pypsa-de/export_ariadne_variables.py +++ b/scripts/pypsa-de/export_ariadne_variables.py @@ -396,7 +396,7 @@ def fill_if_lifetime_inf(n, carrier, lifetime, component="links"): for idx, discount_rate in zip([decentral_idx, not_decentral_idx], [0.04, 0.07]): df.loc[idx, "annuity"] = ( calculate_annuity(df.loc[idx, "lifetime"], discount_rate) - * df.loc[idx, "overnight_cost"] + * df.loc[idx, "onight_cost"] ) df["FOM"] = df["capital_cost"] - df["annuity"] @@ -409,7 +409,7 @@ def fill_if_lifetime_inf(n, carrier, lifetime, component="links"): 0.023185 * df.loc[ df.carrier.str.contains("offwind"), - "overnight_cost", + "onight_cost", ] ) if df["FOM"].min() < 0: @@ -432,7 +432,7 @@ def get_system_cost(n, region): n, region, lambda **kwargs: n.statistics.expanded_capex( - **kwargs, cost_attribute="overnight_cost" + **kwargs, cost_attribute="onight_cost" ), cap_string="Investment|Energy Supply|", ) @@ -4134,11 +4134,11 @@ def get_grid_investments( ) common_index = offwind.index.intersection(offwind2020.index) offwind_capacity.loc[common_index] -= offwind2020.loc[common_index] - offwind_connection_overnight_cost = ( - offwind_capacity * offwind.connection_overnight_cost + offwind_connection_onight_cost = ( + offwind_capacity * offwind.connection_onight_cost ) * 1e-9 - offwind_connection_ac = offwind_connection_overnight_cost.filter(like="ac") - offwind_connection_dc = offwind_connection_overnight_cost.filter(regex="dc|float") + offwind_connection_ac = offwind_connection_onight_cost.filter(like="ac") + offwind_connection_dc = offwind_connection_onight_cost.filter(regex="dc|float") var[var_name + "AC|Offshore"] = offwind_connection_ac.sum() / 5 var[var_name + "AC|NEP|Offshore"] = ( @@ -4168,7 +4168,7 @@ def get_grid_investments( # Subtracting 2020 capacity dc_capacity -= networks[0].links.loc[dc_links.index].p_nom_min - dc_investments = dc_capacity * dc_links.overnight_cost * 1e-9 + dc_investments = dc_capacity * dc_links.onight_cost * 1e-9 # International dc_projects are only accounted with half the costs dc_investments[ ~(dc_links.bus0.str.contains(region) & dc_links.bus1.str.contains(region)) @@ -4187,7 +4187,7 @@ def get_grid_investments( # Subtracting 2020 capacity ac_capacity -= networks[0].lines.loc[ac_lines.index].s_nom_min - ac_investments = ac_capacity * ac_lines.overnight_cost * 1e-9 + ac_investments = ac_capacity * ac_lines.onight_cost * 1e-9 # International ac_projects are only accounted with half the costs ac_investments[ ~(ac_lines.bus0.str.contains(region) & ac_lines.bus1.str.contains(region)) @@ -4263,9 +4263,7 @@ def get_grid_investments( distribution_grid.build_year <= 2020 ].p_nom_opt.sum() - dg_investment = ( - dg_capacity * distribution_grid.overnight_cost.unique().item() * 1e-9 - ) + dg_investment = dg_capacity * distribution_grid.onight_cost.unique().item() * 1e-9 var["Investment|Energy Supply|Electricity|Distribution"] = dg_investment / 5 var["Investment|Energy Supply|Electricity|Transmission and Distribution"] = ( @@ -4288,7 +4286,7 @@ def get_grid_investments( new_h2_links = h2_links.copy() h2_expansion = new_h2_links.p_nom_opt - h2_investments = h2_expansion * new_h2_links.overnight_cost * 1e-9 + h2_investments = h2_expansion * new_h2_links.onight_cost * 1e-9 # International h2_projects are only accounted with domestic_length_factor * costs if len(h2_links.carrier.unique()) == 1: dlf = domestic_length_factor(n, h2_links.carrier.unique().tolist(), region) @@ -5288,7 +5286,7 @@ def hack_DC_projects(n, p_nom_start, p_nom_planned, model_year, snakemake, costs snakemake.params.NEP_transmission == "overhead" ): logger.warning("Switching DC projects to NEP23 and underground costs.") - n.links.loc[current_projects, "overnight_cost"] = ( + n.links.loc[current_projects, "onight_cost"] = ( n.links.loc[current_projects, "length"] * ( (1.0 - n.links.loc[current_projects, "underwater_fraction"]) @@ -5336,7 +5334,7 @@ def hack_AC_projects(n, s_nom_start, model_year, snakemake): if snakemake.params.NEP_year == 2021: logger.warning("Switching AC projects to NEP23 costs post-optimization") - n.lines.loc[current_projects, "overnight_cost"] *= 772 / 472 + n.lines.loc[current_projects, "onight_cost"] *= 772 / 472 # Even though the lines are available to the model from the start, # we pretend that the lines were expanded in the current year @@ -5372,12 +5370,12 @@ def process_postnetworks(n, n_start, model_year, snakemake, costs): 0.7 * costs.at["H2 (g) pipeline", "capital_cost"] + 0.3 * costs.at["H2 (g) pipeline repurposed", "capital_cost"] ) * n.links.loc[h2_links_kern, "length"] - overnight_costs = ( + onight_costs = ( 0.7 * costs.at["H2 (g) pipeline", "investment"] + 0.3 * costs.at["H2 (g) pipeline repurposed", "investment"] ) * n.links.loc[h2_links_kern, "length"] n.links.loc[h2_links_kern, "capital_cost"] = capital_costs - n.links.loc[h2_links_kern, "overnight_cost"] = overnight_costs + n.links.loc[h2_links_kern, "onight_cost"] = onight_costs logger.info("Post-Discretizing DC links") diff --git a/scripts/pypsa-de/modify_prenetwork.py b/scripts/pypsa-de/modify_prenetwork.py index 132f171b6..1964e2094 100644 --- a/scripts/pypsa-de/modify_prenetwork.py +++ b/scripts/pypsa-de/modify_prenetwork.py @@ -207,7 +207,7 @@ def add_wasserstoff_kernnetz(n, wkn, costs): # costs.at["H2 (g) pipeline repurposed", "capital_cost"] * wkn_new.length.values, # ) - # overnight_costs = np.where( + # onight_costs = np.where( # wkn_new.retrofitted == False, # costs.at["H2 (g) pipeline", "investment"] * wkn_new.length.values, # costs.at["H2 (g) pipeline repurposed", "investment"] @@ -222,7 +222,7 @@ def add_wasserstoff_kernnetz(n, wkn, costs): 0.7 * costs.at["H2 (g) pipeline", "capital_cost"] + 0.3 * costs.at["H2 (g) pipeline repurposed", "capital_cost"] ) * wkn_new.length.values - overnight_costs = ( + onight_costs = ( 0.7 * costs.at["H2 (g) pipeline", "investment"] + 0.3 * costs.at["H2 (g) pipeline repurposed", "investment"] ) * wkn_new.length.values @@ -245,7 +245,7 @@ def add_wasserstoff_kernnetz(n, wkn, costs): build_year=wkn_new.build_year.values, length=wkn_new.length.values, capital_cost=capital_costs, - overnight_cost=overnight_costs, + onight_cost=onight_costs, carrier="H2 pipeline (Kernnetz)", lifetime=lifetime, retrofitted=wkn_new.retrofitted.values, @@ -441,7 +441,7 @@ def unravel_carbonaceous_fuels(n): e_nom_extendable=EU_oil_store.e_nom_extendable, e_cyclic=EU_oil_store.e_cyclic, capital_cost=EU_oil_store.capital_cost, - overnight_cost=EU_oil_store.overnight_cost, + onight_cost=EU_oil_store.onight_cost, lifetime=costs.at["General liquid hydrocarbon storage (product)", "lifetime"], ) # check if there are loads at the EU oil bus @@ -511,7 +511,7 @@ def unravel_carbonaceous_fuels(n): e_nom_extendable=EU_meoh_store.e_nom_extendable, e_cyclic=EU_meoh_store.e_cyclic, capital_cost=EU_meoh_store.capital_cost, - overnight_cost=EU_meoh_store.overnight_cost, + onight_cost=EU_meoh_store.onight_cost, lifetime=costs.at["General liquid hydrocarbon storage (product)", "lifetime"], ) # check for loads @@ -649,7 +649,7 @@ def unravel_gasbus(n, costs): e_nom_extendable=True, e_cyclic=True, capital_cost=costs.at["gas storage", "capital_cost"], - overnight_cost=costs.at["gas storage", "investment"], + onight_cost=costs.at["gas storage", "investment"], lifetime=costs.at["gas storage", "lifetime"], ) @@ -756,9 +756,7 @@ def transmission_costs_from_modified_cost_data(n, costs, transmission): n.lines["capital_cost"] = ( n.lines["length"] * costs.at["HVAC overhead", "capital_cost"] ) - n.lines["overnight_cost"] = ( - n.lines["length"] * costs.at["HVAC overhead", "investment"] - ) + n.lines["onight_cost"] = n.lines["length"] * costs.at["HVAC overhead", "investment"] if n.links.empty: return @@ -786,7 +784,7 @@ def transmission_costs_from_modified_cost_data(n, costs, transmission): + costs.at["HVDC inverter pair", "capital_cost"] ) - overnight_cost = ( + onight_cost = ( n.links.loc[dc_b, "length"] * ( (1.0 - n.links.loc[dc_b, "underwater_fraction"]) @@ -797,7 +795,7 @@ def transmission_costs_from_modified_cost_data(n, costs, transmission): + costs.at["HVDC inverter pair", "investment"] ) n.links.loc[dc_b, "capital_cost"] = capital_cost - n.links.loc[dc_b, "overnight_cost"] = overnight_cost + n.links.loc[dc_b, "onight_cost"] = onight_cost def must_run(n, params): @@ -1119,7 +1117,7 @@ def force_retrofit(n, params): h2_plants.efficiency -= params["efficiency_loss"] h2_plants.efficiency2 = 1 # default value h2_plants.capital_cost *= 1 + params["cost_factor"] - h2_plants.overnight_cost *= 1 + params["cost_factor"] + h2_plants.onight_cost *= 1 + params["cost_factor"] # add the new links n.add("Link", h2_plants.index, **h2_plants) n.links.drop(gas_plants, inplace=True) @@ -1141,7 +1139,7 @@ def force_retrofit(n, params): h2_plants.efficiency -= params["efficiency_loss"] h2_plants.efficiency3 = 1 # default value h2_plants.capital_cost *= 1 + params["cost_factor"] - h2_plants.overnight_cost *= 1 + params["cost_factor"] + h2_plants.onight_cost *= 1 + params["cost_factor"] n.add("Link", h2_plants.index, **h2_plants) n.links.drop(gas_plants, inplace=True) @@ -1235,7 +1233,7 @@ def force_connection_nep_offshore(n, current_year, costs): + costs.at["offwind-dc-station", "investment"] ) * dc_projects["Übertragungsleistung in MW"] - dc_connection_overnight_costs = ( + dc_connection_onight_costs = ( dc_connection_totals.groupby(dc_projects.name).sum().div(dc_power) ) # Instead of taking over capacities from add_existing, set everything to 0 and use only the NEP projects. @@ -1267,8 +1265,8 @@ def force_connection_nep_offshore(n, current_year, costs): n.generators.at[node_off, "p_nom"] = 0 n.generators.at[node_off, "p_nom_min"] = dc_power.loc[node] - n.generators.at[node_off, "connection_overnight_cost"] = ( - dc_connection_overnight_costs.loc[node] + n.generators.at[node_off, "connection_onight_cost"] = ( + dc_connection_onight_costs.loc[node] ) # Differing from add_existing_baseyear "p_nom" is not set, # because we want to fully account the capacity expansion in the exporter @@ -1313,7 +1311,7 @@ def force_connection_nep_offshore(n, current_year, costs): + costs.at["offwind-ac-station", "investment"] ) * ac_projects["Übertragungsleistung in MW"] - ac_connection_overnight_costs = ( + ac_connection_onight_costs = ( ac_connection_totals.groupby(ac_projects.name).sum().div(ac_power) ) @@ -1334,8 +1332,8 @@ def force_connection_nep_offshore(n, current_year, costs): ) n.generators.at[node_off, "p_nom_min"] = ac_power.loc[node] - n.generators.at[node_off, "connection_overnight_cost"] = ( - ac_connection_overnight_costs.loc[node] + n.generators.at[node_off, "connection_onight_cost"] = ( + ac_connection_onight_costs.loc[node] ) From 2f7772d738e082e291e17b93393735102d6e671b Mon Sep 17 00:00:00 2001 From: Michael Lindner Date: Mon, 2 Mar 2026 10:37:11 +0100 Subject: [PATCH 2/3] switch to secant-based transmission losses --- config/config.de.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/config.de.yaml b/config/config.de.yaml index c4c784493..e37291c6c 100644 --- a/config/config.de.yaml +++ b/config/config.de.yaml @@ -423,6 +423,7 @@ solving: runtime: 12h mem_mb: 70000 #30000 is OK for 22 nodes, 365H; 140000 for 22 nodes 3H; 400000 for 44 nodes 3H options: + transmission_losses: true custom_extra_functionality: "../scripts/pypsa-de/additional_functionality.py" assign_all_duals: true load_shedding: false From 422aab38fcbdfcc3eb7a2dc80d68912fe8de1afd Mon Sep 17 00:00:00 2001 From: Michael Lindner Date: Thu, 5 Mar 2026 09:33:25 +0100 Subject: [PATCH 3/3] add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdfa82351..6e09cdab5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog +- Switched to new secant based transmission losses from pypsa 1.1 - Switched to weather year 2013 - in 2030 use UBA data for industry and mobility - start myopic optimization in 2025