From e9f2eda192a125bd0994956c1c45a8adb8f0d6a3 Mon Sep 17 00:00:00 2001 From: Renato-Rodrigues Date: Fri, 11 Oct 2024 14:34:15 +0200 Subject: [PATCH 1/4] avoiding infeasibilities for years defined at c_H2InBuildOnlyAfter --- core/bounds.gms | 4 ++-- .../29_CES_parameters/calibrate/datainput.gms | 21 +++++++++++-------- modules/36_buildings/simple/equations.gms | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/core/bounds.gms b/core/bounds.gms index 165215412..6f37fc7d6 100755 --- a/core/bounds.gms +++ b/core/bounds.gms @@ -535,8 +535,8 @@ v_shfe.lo(t,regi,entyFe,sector)$pm_shfe_lo(t,regi,entyFe,sector) = pm_shfe_lo(t, v_shGasLiq_fe.up(t,regi,sector)$pm_shGasLiq_fe_up(t,regi,sector) = pm_shGasLiq_fe_up(t,regi,sector); v_shGasLiq_fe.lo(t,regi,sector)$pm_shGasLiq_fe_lo(t,regi,sector) = pm_shGasLiq_fe_lo(t,regi,sector); -*** RH: Fix H2 in buildings to zero until given year (always zero by default) -vm_demFeSector.up(t,regi,"seh2","feh2s","build",emiMkt)$(t.val le c_H2InBuildOnlyAfter) = 0; +*** Set H2 upper bound in buildings for years defined at c_H2InBuildOnlyAfter +vm_demFeSector.up(t,regi,"seh2","feh2s","build",emiMkt)$(t.val le c_H2InBuildOnlyAfter) = 1e-6; ***---------------------------------------------------------------------------- *** Controlling if active, dampening factor to align edge-t non-energy transportation costs with historical GDP data diff --git a/modules/29_CES_parameters/calibrate/datainput.gms b/modules/29_CES_parameters/calibrate/datainput.gms index cbb008ad7..2665d8bef 100644 --- a/modules/29_CES_parameters/calibrate/datainput.gms +++ b/modules/29_CES_parameters/calibrate/datainput.gms @@ -305,15 +305,18 @@ $ifthen.build_H2_offset "%buildings%" == "simple" *); *** RK: feh2b offset scaled from 1% in 2025 to 50% in 2050 of fegab quantity -loop ((t,regi), - pm_cesdata(t,regi,"feh2b","offset_quantity") - = - (0.05 + 0.45 * min(1, max(0, (t.val - 2025) / (2050 - 2025)))) - * pm_cesdata(t,regi,"fegab","quantity") - - pm_cesdata(t,regi,"feh2b","quantity"); - pm_cesdata(t,regi,"feh2b","quantity") - = (0.05 + 0.45 * min(1, max(0, (t.val - 2025) / (2050 - 2025)))) - * pm_cesdata(t,regi,"fegab","quantity"); -); +pm_cesdata(t,regi,"feh2b","offset_quantity")$(t.val gt c_H2InBuildOnlyAfter) = + - (0.05 + 0.45 * min(1, max(0, (t.val - 2025) / (2050 - 2025)))) + * pm_cesdata(t,regi,"fegab","quantity") + - pm_cesdata(t,regi,"feh2b","quantity"); +pm_cesdata(t,regi,"feh2b","quantity")$(t.val gt c_H2InBuildOnlyAfter) = + (0.05 + 0.45 * min(1, max(0, (t.val - 2025) / (2050 - 2025)))) + * pm_cesdata(t,regi,"fegab","quantity"); + +*** for the years that H2 buildings is fixed to zero, set offset to the exact value of the calibrated quantity to ignore it after calibration +pm_cesdata(t,regi,"feh2b","quantity") = 1e-6; +pm_cesdata(t,regi,"feh2b","offset_quantity")$(t.val le c_H2InBuildOnlyAfter) = - pm_cesdata(t,regi,"feh2b","quantity"); + $endif.build_H2_offset *** Add an epsilon to the values which are 0 so that they can fit in the CES diff --git a/modules/36_buildings/simple/equations.gms b/modules/36_buildings/simple/equations.gms index bea5febef..c2c640915 100644 --- a/modules/36_buildings/simple/equations.gms +++ b/modules/36_buildings/simple/equations.gms @@ -65,7 +65,7 @@ q36_auxCostAddTeInv(t,regi).. *' Hydrogen fe share in buildings gases use (natural gas + hydrogen) -q36_H2Share(t,regi).. +q36_H2Share(t,regi)$(t.val ge 2020).. v36_H2share(t,regi) * sum(se2fe(entySe,entyFe,te)$(SAMEAS(entyFe,"feh2s") OR SAMEAS(entyFe,"fegas")), From 4843ee0769310201cc999c0a9f6344821a154965 Mon Sep 17 00:00:00 2001 From: Renato-Rodrigues Date: Fri, 11 Oct 2024 14:51:25 +0200 Subject: [PATCH 2/4] add missing time condition --- modules/29_CES_parameters/calibrate/datainput.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/29_CES_parameters/calibrate/datainput.gms b/modules/29_CES_parameters/calibrate/datainput.gms index 2665d8bef..b3683514d 100644 --- a/modules/29_CES_parameters/calibrate/datainput.gms +++ b/modules/29_CES_parameters/calibrate/datainput.gms @@ -314,7 +314,7 @@ pm_cesdata(t,regi,"feh2b","quantity")$(t.val gt c_H2InBuildOnlyAfter) = * pm_cesdata(t,regi,"fegab","quantity"); *** for the years that H2 buildings is fixed to zero, set offset to the exact value of the calibrated quantity to ignore it after calibration -pm_cesdata(t,regi,"feh2b","quantity") = 1e-6; +pm_cesdata(t,regi,"feh2b","quantity")$(t.val le c_H2InBuildOnlyAfter) = 1e-6; pm_cesdata(t,regi,"feh2b","offset_quantity")$(t.val le c_H2InBuildOnlyAfter) = - pm_cesdata(t,regi,"feh2b","quantity"); $endif.build_H2_offset From b64f600ae3caf90b960589fb965784aaa31c9ed1 Mon Sep 17 00:00:00 2001 From: Renato-Rodrigues Date: Fri, 18 Oct 2024 15:07:35 +0200 Subject: [PATCH 3/4] adjusting switch name convention due to the use on module code --- core/bounds.gms | 4 ++-- main.gms | 4 ++-- modules/29_CES_parameters/calibrate/datainput.gms | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/bounds.gms b/core/bounds.gms index 6f37fc7d6..6c6524a0e 100755 --- a/core/bounds.gms +++ b/core/bounds.gms @@ -535,8 +535,8 @@ v_shfe.lo(t,regi,entyFe,sector)$pm_shfe_lo(t,regi,entyFe,sector) = pm_shfe_lo(t, v_shGasLiq_fe.up(t,regi,sector)$pm_shGasLiq_fe_up(t,regi,sector) = pm_shGasLiq_fe_up(t,regi,sector); v_shGasLiq_fe.lo(t,regi,sector)$pm_shGasLiq_fe_lo(t,regi,sector) = pm_shGasLiq_fe_lo(t,regi,sector); -*** Set H2 upper bound in buildings for years defined at c_H2InBuildOnlyAfter -vm_demFeSector.up(t,regi,"seh2","feh2s","build",emiMkt)$(t.val le c_H2InBuildOnlyAfter) = 1e-6; +*** Set H2 upper bound in buildings for years defined at cm_H2InBuildOnlyAfter +vm_demFeSector.up(t,regi,"seh2","feh2s","build",emiMkt)$(t.val le cm_H2InBuildOnlyAfter) = 1e-6; ***---------------------------------------------------------------------------- *** Controlling if active, dampening factor to align edge-t non-energy transportation costs with historical GDP data diff --git a/main.gms b/main.gms index 3f26b96f9..6bb103870 100755 --- a/main.gms +++ b/main.gms @@ -1001,9 +1001,9 @@ parameter *' * (4) Energy Efficiency policy: higher discount rate until cm_startyear, decreasing to 25% value linearly until 2030. *' parameter - c_H2InBuildOnlyAfter "Switch to fix H2 in buildings to zero until given year" + cm_H2InBuildOnlyAfter "Switch to fix H2 in buildings to zero until given year" ; - c_H2InBuildOnlyAfter = 2150; !! def = 2150 (rule out H2 in buildings) + cm_H2InBuildOnlyAfter = 2150; !! def = 2150 (rule out H2 in buildings) *' For all years until the given year, FE demand for H2 in buildings is set to zero parameter cm_peakBudgYr "date of net-zero CO2 emissions for peak budget runs without overshoot" diff --git a/modules/29_CES_parameters/calibrate/datainput.gms b/modules/29_CES_parameters/calibrate/datainput.gms index b3683514d..cd5ed171f 100644 --- a/modules/29_CES_parameters/calibrate/datainput.gms +++ b/modules/29_CES_parameters/calibrate/datainput.gms @@ -305,17 +305,17 @@ $ifthen.build_H2_offset "%buildings%" == "simple" *); *** RK: feh2b offset scaled from 1% in 2025 to 50% in 2050 of fegab quantity -pm_cesdata(t,regi,"feh2b","offset_quantity")$(t.val gt c_H2InBuildOnlyAfter) = +pm_cesdata(t,regi,"feh2b","offset_quantity")$(t.val gt cm_H2InBuildOnlyAfter) = - (0.05 + 0.45 * min(1, max(0, (t.val - 2025) / (2050 - 2025)))) * pm_cesdata(t,regi,"fegab","quantity") - pm_cesdata(t,regi,"feh2b","quantity"); -pm_cesdata(t,regi,"feh2b","quantity")$(t.val gt c_H2InBuildOnlyAfter) = +pm_cesdata(t,regi,"feh2b","quantity")$(t.val gt cm_H2InBuildOnlyAfter) = (0.05 + 0.45 * min(1, max(0, (t.val - 2025) / (2050 - 2025)))) * pm_cesdata(t,regi,"fegab","quantity"); *** for the years that H2 buildings is fixed to zero, set offset to the exact value of the calibrated quantity to ignore it after calibration -pm_cesdata(t,regi,"feh2b","quantity")$(t.val le c_H2InBuildOnlyAfter) = 1e-6; -pm_cesdata(t,regi,"feh2b","offset_quantity")$(t.val le c_H2InBuildOnlyAfter) = - pm_cesdata(t,regi,"feh2b","quantity"); +pm_cesdata(t,regi,"feh2b","quantity")$(t.val le cm_H2InBuildOnlyAfter) = 1e-6; +pm_cesdata(t,regi,"feh2b","offset_quantity")$(t.val le cm_H2InBuildOnlyAfter) = - pm_cesdata(t,regi,"feh2b","quantity"); $endif.build_H2_offset From f6e4b8604b8a2751c2c7685969ee5ead40c406c6 Mon Sep 17 00:00:00 2001 From: Renato-Rodrigues Date: Fri, 18 Oct 2024 15:24:29 +0200 Subject: [PATCH 4/4] code check compliance --- modules/29_CES_parameters/load/not_used.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/29_CES_parameters/load/not_used.txt b/modules/29_CES_parameters/load/not_used.txt index cd181cc66..4e462767a 100644 --- a/modules/29_CES_parameters/load/not_used.txt +++ b/modules/29_CES_parameters/load/not_used.txt @@ -22,3 +22,4 @@ pm_calibrate_eff_scale,parameter,not needed pm_fedemand,parameter,not needed pm_energy_limit,, sm_CES_calibration_iteration,scalar,only applicable during calibration +cm_H2InBuildOnlyAfter,parameter,???