From 3294692a073f1f8a54a79a2723819b6a19016abd Mon Sep 17 00:00:00 2001 From: "adnan.alakori@rl-institut.de" Date: Wed, 6 Apr 2022 15:30:06 +0200 Subject: [PATCH] Add stability constraint --- src/G1_oemof_create_model.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/G1_oemof_create_model.py b/src/G1_oemof_create_model.py index 4c55795..f5afe62 100644 --- a/src/G1_oemof_create_model.py +++ b/src/G1_oemof_create_model.py @@ -450,11 +450,22 @@ def build(experiment, case_dict): el_bus_dc=bus_electricity_dc, ) elif case_dict[STABILITY_CONSTRAINT] == CRITICAL: - # TODO: add the function to make the stability constraint favor critical demand over demand - pass - # constraints_custom.critical( - # model, - # ) + # ADDED: a function to make the stability constraint favor critical demand over demand + logging.info( + "Added constraint: Stability though actual generation of diesel generators and backup through batteries." + ) + constraints_custom.critical( + model, + case_dict, + experiment=experiment, + storage=storage, + sink_demand=sink_demand_ac, + genset=genset, + pcc_consumption=pointofcoupling_consumption, + source_shortage=source_shortage, + el_bus_ac=bus_electricity_ac, + el_bus_dc=bus_electricity_dc, + ) else: logging.warning( "Case definition of "