diff --git a/etrago/appl.py b/etrago/appl.py index ab64b5e17..03e1f0319 100644 --- a/etrago/appl.py +++ b/etrago/appl.py @@ -74,7 +74,7 @@ "threads": 4, }, "model_formulation": "kirchhoff", # angles or kirchhoff - "scn_name": "eGon2035", # scenario: eGon2035 or eGon100RE + "scn_name": "eGon2035", # scenario: eGon2035, eGon100RE or status2019 # Scenario variations: "scn_extension": None, # None or array of extension scenarios "scn_decommissioning": None, # None or decommissioning scenario diff --git a/etrago/cluster/gas.py b/etrago/cluster/gas.py index 733b9905a..4385b55a2 100644 --- a/etrago/cluster/gas.py +++ b/etrago/cluster/gas.py @@ -345,8 +345,9 @@ def gas_postprocessing(etrago, busmap, medoid_idx=None): + str(settings["n_clusters_gas"]) + "_result.csv" ) - - busmap = get_h2_clusters(etrago, busmap) + + if 'H2' in etrago.network.buses.carrier.unique(): + busmap = get_h2_clusters(etrago, busmap) # Add all other buses to busmap missing_idx = list( diff --git a/etrago/tools/constraints.py b/etrago/tools/constraints.py index b2d9a0446..82a5037b9 100755 --- a/etrago/tools/constraints.py +++ b/etrago/tools/constraints.py @@ -1297,7 +1297,6 @@ def read_max_gas_generation(self): "biogas": 14450103 }, # [MWh] Value from reference p-e-s run used in eGon-data } - engine = db.connection(section=self.args["db"]) try: sql = f""" @@ -2738,10 +2737,12 @@ def functionality(self, network, snapshots): if "CH4" in network.buses.carrier.values: if self.args["method"]["pyomo"]: add_chp_constraints(network, snapshots) - add_ch4_constraints(self, network, snapshots) + if self.args["scn_name"] != "status2019": + add_ch4_constraints(self, network, snapshots) else: add_chp_constraints_nmp(network) - add_ch4_constraints_nmp(self, network, snapshots) + if self.args["scn_name"] != "status2019": + add_ch4_constraints_nmp(self, network, snapshots) for constraint in self.args["extra_functionality"].keys(): try: diff --git a/etrago/tools/network.py b/etrago/tools/network.py index 97ffbfe77..a5900238f 100644 --- a/etrago/tools/network.py +++ b/etrago/tools/network.py @@ -324,7 +324,8 @@ def build_network_from_db(self): self.decommissioning() - self.add_ch4_h2_correspondence() + if "H2" in self.network.buses.carrier: + self.add_ch4_h2_correspondence() logger.info("Imported network from db") diff --git a/etrago/tools/utilities.py b/etrago/tools/utilities.py index 575f07761..6a37c3cfa 100755 --- a/etrago/tools/utilities.py +++ b/etrago/tools/utilities.py @@ -2336,7 +2336,14 @@ def check_args(etrago): """ - names = ["eGon2035", "eGon100RE", "eGon2035_lowflex", "eGon100RE_lowflex"] + names = [ + "eGon2035", + "eGon100RE", + "eGon2035_lowflex", + "eGon100RE_lowflex", + "status2019", + ] + assert ( etrago.args["scn_name"] in names ), f"'scn_name' has to be in {names} but is {etrago.args['scn_name']}."