diff --git a/scripts/add_existing_baseyear.py b/scripts/add_existing_baseyear.py index c8ff5f680..fa61ebf57 100644 --- a/scripts/add_existing_baseyear.py +++ b/scripts/add_existing_baseyear.py @@ -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) @@ -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 @@ -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() @@ -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) diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index f083547fb..745a2317c 100755 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -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"], @@ -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"], @@ -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"], @@ -1005,7 +1008,6 @@ def add_methanol_to_power(n, costs, types=None): * costs.at["methanolisation", "carbondioxide-input"] ) - n.madd( "Link", nodes, @@ -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"], @@ -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 )