77"""
88
99import logging
10- import os
11- import sys
1210from types import SimpleNamespace
1311
1412import country_converter as coco
2523 update_config_from_wildcards ,
2624)
2725from scripts .add_electricity import sanitize_carriers
28- from scripts .definitions . heat_sector import HeatSector
26+ from scripts .build_powerplants import add_custom_powerplants
2927from scripts .definitions .heat_system import HeatSystem
30- from scripts .definitions .heat_system_type import HeatSystemType
3128from scripts .prepare_sector_network import (
3229 cluster_heat_buses ,
3330 define_spatial ,
3936idx = pd .IndexSlice
4037spatial = SimpleNamespace ()
4138
42- from scripts .build_powerplants import add_custom_powerplants
43-
4439
4540def add_build_year_to_new_assets (n : pypsa .Network , baseyear : int ) -> None :
4641 """
@@ -500,8 +495,8 @@ def add_chp_plants(n, grouping_years, costs, baseyear):
500495
501496 # drop assets which are already phased out / decommissioned
502497 # drop hydro, waste and oil fueltypes for CHP
503- limit = np .max (grouping_years )
504- drop_fueltypes = ["Hydro" , "Other" , "Waste" , "nicht biogener Abfall" ]
498+ limit = np .max (grouping_years ) # noqa
499+ drop_fueltypes = ["Hydro" , "Other" , "Waste" , "nicht biogener Abfall" ] # noqa
505500 chp = ppl .query (
506501 "Set == 'CHP' and (DateOut >= @baseyear or DateOut != DateOut) and (DateIn <= @limit or DateIn != DateIn) and Fueltype not in @drop_fueltypes"
507502 ).copy ()
@@ -516,7 +511,9 @@ def add_chp_plants(n, grouping_years, costs, baseyear):
516511 chp ["lifetime" ] = (chp .DateOut - chp ["grouping_year" ] + 1 ).fillna (
517512 snakemake .params .costs ["fill_values" ]["lifetime" ]
518513 )
519- chp = chp .loc [chp .grouping_year + chp .lifetime > baseyear ] # in add_brownfield this is build_year + lifetime <= baseyear
514+ chp = chp .loc [
515+ chp .grouping_year + chp .lifetime > baseyear
516+ ] # in add_brownfield this is build_year + lifetime <= baseyear
520517
521518 # check if the CHPs were read in from MaStR for Germany
522519 if "Capacity_thermal" in chp .columns :
@@ -1054,7 +1051,6 @@ def add_heating_capacities_installed_before_baseyear(
10541051 )
10551052
10561053 # delete links with capacities below threshold
1057- threshold = snakemake .params .existing_capacities ["threshold_capacity" ]
10581054 n .remove (
10591055 "Link" ,
10601056 [
0 commit comments