diff --git a/etrago/cluster/electrical.py b/etrago/cluster/electrical.py index 2a73ca24..b20cace6 100755 --- a/etrago/cluster/electrical.py +++ b/etrago/cluster/electrical.py @@ -296,6 +296,7 @@ def cluster_on_extra_high_voltage(etrago, busmap, with_time=True): "y": _leading(busmap, network.buses), "geom": lambda x: np.nan, "country": lambda x: "", + "scn_name": "first", }, ) diff --git a/etrago/execute/market_optimization.py b/etrago/execute/market_optimization.py index e175ed44..7db69528 100644 --- a/etrago/execute/market_optimization.py +++ b/etrago/execute/market_optimization.py @@ -257,7 +257,7 @@ def build_market_model(self): """ # use existing preprocessing to get only the electricity system - net, weight, n_clusters, busmap_foreign = preprocessing( + net, _, _, busmap_foreign, _, _ = preprocessing( self, apply_on="market_model" ) diff --git a/etrago/tools/io.py b/etrago/tools/io.py index 87f7537e..7f1153e5 100644 --- a/etrago/tools/io.py +++ b/etrago/tools/io.py @@ -831,10 +831,6 @@ def extension(self, **kwargs): self.network = scenario.build_network(self.network) - # Allow lossless links to conduct bidirectional - self.network.links.loc[ - self.network.links.efficiency == 1.0, "p_min_pu" - ] = -1 def decommissioning(self, **kwargs): diff --git a/etrago/tools/utilities.py b/etrago/tools/utilities.py index df8e6058..ccaabca1 100755 --- a/etrago/tools/utilities.py +++ b/etrago/tools/utilities.py @@ -623,7 +623,12 @@ def connected_transformer(network, busids): return network.transformers[mask] -def load_shedding(self, temporal_disaggregation=False, **kwargs): +def load_shedding( + self, + temporal_disaggregation=False, + negative_load_shedding_ev=True, + **kwargs, +): """Implement load shedding in existing network to identify feasibility problems @@ -682,6 +687,31 @@ def load_shedding(self, temporal_disaggregation=False, **kwargs): "Generator", ) + if negative_load_shedding_ev: + # Add negative load shedding generators for e-Mobility buses + ev_buses = network.buses[network.buses.carrier == "Li_ion"].index + index_ev = list( + range( + start + len(network.buses.index), + start + len(network.buses.index) + len(ev_buses), + ) + ) + network.import_components_from_dataframe( + pd.DataFrame( + dict( + marginal_cost=-marginal_cost, + p_nom=p_nom, + p_min_pu=-1, + p_max_pu=0, + carrier="negative load shedding", + bus=ev_buses, + control="PQ", + ), + index=index_ev, + ), + "Generator", + ) + def set_control_strategies(network): """Sets control strategies for AC generators and storage units @@ -3065,6 +3095,8 @@ def select_elec_network(etrago, apply_on="grid_model"): ) area_network = pypsa.Network() + n_clusters = pd.NA + else: logger.warning( """Parameter apply_on must be either 'grid_model' or 'market_model'