From 54bba03d1bfb5a7111cf5c43f15ddfc9d56752aa Mon Sep 17 00:00:00 2001 From: birgits Date: Tue, 20 Aug 2024 10:37:02 +0200 Subject: [PATCH] Try fixing infeasibility by adding negative load shedding at EV buses --- etrago/tools/utilities.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/etrago/tools/utilities.py b/etrago/tools/utilities.py index df8e6058..2bf2fb55 100755 --- a/etrago/tools/utilities.py +++ b/etrago/tools/utilities.py @@ -682,6 +682,40 @@ def load_shedding(self, temporal_disaggregation=False, **kwargs): "Generator", ) + start = ( + network.generators.index.to_series() + .str.rsplit(" ") + .str[0] + .astype(int) + .sort_values() + .max() + + 1 + ) + + # 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*2, + 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