Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sector_opts and duplicated CHP plants #1328

Merged
merged 5 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions scripts/add_existing_baseyear.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,9 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas

# If heat is considered, add CHPs in the add_heating_capacities function.
# Assume that all oil power plants are not CHPs.
if "H" in snakemake.wildcards.sector_opts.split("-"):
if options["heating"]:
df_agg = df_agg.query("Set != 'CHP'")
elif (
"I" not in snakemake.wildcards.sector_opts.split("-")
and "Industry" in df_agg.columns
):
elif not options["industry"] and "Industry" in df_agg.columns:
df_agg["Industry"].fillna(False, inplace=True)
df_agg.query("not Industry", inplace=True)

Expand Down Expand Up @@ -492,6 +489,9 @@ def add_chp_plants(n, grouping_years, costs, baseyear, clustermaps):
ppl = pd.read_csv(snakemake.input.powerplants, index_col=0)

if snakemake.input.get("custom_powerplants"):
if snakemake.input.custom_powerplants.endswith("german_chp.csv"):
logger.info("Supersedeing default German CHPs with custom_powerplants.")
ppl = ppl.query("~(Set == 'CHP' and Country == 'DE')")
ppl = add_custom_powerplants(ppl, snakemake.input.custom_powerplants, True)

# drop assets which are already phased out / decommissioned
Expand All @@ -517,7 +517,7 @@ def add_chp_plants(n, grouping_years, costs, baseyear, clustermaps):

# check if the CHPs were read in from MaStR for Germany
if "Capacity_thermal" in chp.columns:
if "I" not in snakemake.wildcards.sector_opts.split("-"):
if not options["industry"]:
chp.query("Industry == False", inplace=True)

thermal_capacity_b = ~chp.Capacity_thermal.isna()
Expand Down Expand Up @@ -1054,13 +1054,13 @@ def set_defaults(n):

snakemake = mock_snakemake(
"add_existing_baseyear",
configfiles="config/test/config.myopic.yaml",
simpl="",
clusters="5",
ll="v1.5",
clusters=27,
opts="",
sector_opts="",
planning_horizons=2030,
ll="vopt",
sector_opts="none",
planning_horizons="2020",
run="KN2045_Bal_v4",
)

configure_logging(snakemake)
Expand Down
15 changes: 9 additions & 6 deletions scripts/prepare_sector_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,8 @@ def add_allam_gas(n, costs):
carrier="allam gas",
p_nom_extendable=True,
capital_cost=costs.at["allam", "fixed"] * costs.at["allam", "efficiency"],
overnight_cost=costs.at["allam", "investment"] * costs.at["allam", "efficiency"],
overnight_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"],
Expand Down Expand Up @@ -952,7 +953,8 @@ def add_methanol_to_power(n, costs, types=None):
carrier="allam methanol",
p_nom_extendable=True,
capital_cost=costs.at["allam", "fixed"] * costs.at["allam", "efficiency"],
overnight_cost=costs.at["allam", "investment"] * costs.at["allam", "efficiency"],
overnight_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["methanolisation", "carbondioxide-input"],
Expand All @@ -976,7 +978,8 @@ def add_methanol_to_power(n, costs, types=None):
carrier="CCGT methanol",
p_nom_extendable=True,
capital_cost=capital_cost,
overnight_cost=costs.at["CCGT", "investment"], * costs.at["CCGT", "efficiency"],
overnight_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"],
Expand Down Expand Up @@ -1005,7 +1008,6 @@ def add_methanol_to_power(n, costs, types=None):
* costs.at["methanolisation", "carbondioxide-input"]
)


n.madd(
"Link",
nodes,
Expand Down Expand Up @@ -1040,7 +1042,8 @@ def add_methanol_to_power(n, costs, types=None):
carrier="OCGT methanol",
p_nom_extendable=True,
capital_cost=costs.at["OCGT", "fixed"] * costs.at["OCGT", "efficiency"],
overnight_cost=costs.at["OCGT", "investment"] * costs.at["OCGT", "efficiency"],
overnight_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"],
Expand Down Expand Up @@ -3584,7 +3587,7 @@ def add_biomass(n, costs):
+ costs.at["biomass CHP capture", "investment"]
* costs.at["solid biomass", "CO2 intensity"],
marginal_cost=0.0,
lifetime=25, # TODO: add value to technology-data
lifetime=25, # TODO: add value to technology-data
)


Expand Down