From 49ccb0791645c1fffbaf47daa10bdef0e9301fba Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Tue, 12 Dec 2023 10:21:42 +0100 Subject: [PATCH 01/35] delete realization services_putty and services_with_capital of module 36_buildings --- modules/36_buildings/module.gms | 2 - .../36_buildings/services_putty/bounds.gms | 49 --- .../36_buildings/services_putty/datainput.gms | 327 ---------------- .../services_putty/declarations.gms | 117 ------ .../36_buildings/services_putty/equations.gms | 191 --------- .../36_buildings/services_putty/input/files | 4 - .../services_putty/input/generisdata_Eff.prn | 23 -- .../input/generisdata_feCapCosts.prn | 29 -- .../36_buildings/services_putty/not_used.txt | 22 -- .../36_buildings/services_putty/postsolve.gms | 54 --- .../36_buildings/services_putty/preloop.gms | 93 ----- .../36_buildings/services_putty/presolve.gms | 358 ----------------- .../services_putty/realization.gms | 36 -- modules/36_buildings/services_putty/sets.gms | 277 ------------- .../services_with_capital/bounds.gms | 46 --- .../services_with_capital/datainput.gms | 323 ---------------- .../services_with_capital/declarations.gms | 100 ----- .../services_with_capital/equations.gms | 116 ------ .../services_with_capital/input/files | 4 - .../input/generisdata_Eff.prn | 23 -- .../input/generisdata_feCapCosts.prn | 29 -- .../services_with_capital/not_used.txt | 28 -- .../services_with_capital/postsolve.gms | 50 --- .../services_with_capital/preloop.gms | 61 --- .../services_with_capital/presolve.gms | 365 ------------------ .../services_with_capital/realization.gms | 35 -- .../services_with_capital/sets.gms | 259 ------------- 27 files changed, 3021 deletions(-) delete mode 100644 modules/36_buildings/services_putty/bounds.gms delete mode 100644 modules/36_buildings/services_putty/datainput.gms delete mode 100644 modules/36_buildings/services_putty/declarations.gms delete mode 100644 modules/36_buildings/services_putty/equations.gms delete mode 100644 modules/36_buildings/services_putty/input/files delete mode 100644 modules/36_buildings/services_putty/input/generisdata_Eff.prn delete mode 100644 modules/36_buildings/services_putty/input/generisdata_feCapCosts.prn delete mode 100644 modules/36_buildings/services_putty/not_used.txt delete mode 100644 modules/36_buildings/services_putty/postsolve.gms delete mode 100644 modules/36_buildings/services_putty/preloop.gms delete mode 100644 modules/36_buildings/services_putty/presolve.gms delete mode 100644 modules/36_buildings/services_putty/realization.gms delete mode 100644 modules/36_buildings/services_putty/sets.gms delete mode 100644 modules/36_buildings/services_with_capital/bounds.gms delete mode 100644 modules/36_buildings/services_with_capital/datainput.gms delete mode 100644 modules/36_buildings/services_with_capital/declarations.gms delete mode 100644 modules/36_buildings/services_with_capital/equations.gms delete mode 100644 modules/36_buildings/services_with_capital/input/files delete mode 100644 modules/36_buildings/services_with_capital/input/generisdata_Eff.prn delete mode 100644 modules/36_buildings/services_with_capital/input/generisdata_feCapCosts.prn delete mode 100644 modules/36_buildings/services_with_capital/not_used.txt delete mode 100644 modules/36_buildings/services_with_capital/postsolve.gms delete mode 100644 modules/36_buildings/services_with_capital/preloop.gms delete mode 100644 modules/36_buildings/services_with_capital/presolve.gms delete mode 100644 modules/36_buildings/services_with_capital/realization.gms delete mode 100644 modules/36_buildings/services_with_capital/sets.gms diff --git a/modules/36_buildings/module.gms b/modules/36_buildings/module.gms index a1d8aa54e..731398851 100644 --- a/modules/36_buildings/module.gms +++ b/modules/36_buildings/module.gms @@ -14,8 +14,6 @@ *' @authors Antoine Levesque, Robin Hasse *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%buildings%" == "services_putty" $include "./modules/36_buildings/services_putty/realization.gms" -$Ifi "%buildings%" == "services_with_capital" $include "./modules/36_buildings/services_with_capital/realization.gms" $Ifi "%buildings%" == "simple" $include "./modules/36_buildings/simple/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ *** EOF ./modules/36_buildings/module.gms diff --git a/modules/36_buildings/services_putty/bounds.gms b/modules/36_buildings/services_putty/bounds.gms deleted file mode 100644 index 92776b9bf..000000000 --- a/modules/36_buildings/services_putty/bounds.gms +++ /dev/null @@ -1,49 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_putty/bounds.gms -vm_enerSerAdj.fx("2005",regi,in) = 0; - -if ((cm_noReboundEffect eq 1 ), !! Fix the upper bound of vm_cesIO to the level of input_ref if no rebound is allowed -vm_cesIO.up(t,regi,in)$(sameAs(in,"esswb") OR sameAs(in,"uealb") OR sameAs(in,"uecwb")) = (1 + 1e-14) * p36_cesIONoRebound(t,regi,in); -vm_cesIO.lo(t,regi,in)$( sameAs(in,"esswb") - OR sameAs(in,"uealb") - OR sameAs(in,"uecwb") ) - = max( - (1 - 1e-14) * p36_cesIONoRebound(t,regi,in), - abs(pm_cesdata(t,regi,in,"offset_quantity")) - ); -vm_cesIOdelta.up(t,regi,in)$(sameAs(in,"esswb") OR sameAs(in,"uealb") OR sameAs(in,"uecwb")) = (1 + 1e-14) * p36_cesIONoRebound_putty(t,regi,in); -vm_cesIOdelta.lo(t,regi,in)$(sameAs(in,"esswb") OR sameAs(in,"uealb") OR sameAs(in,"uecwb")) = (1 - 1e-14) * p36_cesIONoRebound_putty(t,regi,in); -); - -loop (t36_hist_last(ttot2) , - v36_deltaProdEs.lo(ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) $ ( - ttot.val le ttot2.val) - = max ( 0, - p36_deltaProdEs(ttot,regi,enty,esty,teEs) - -1e-6 - ) - ; - v36_deltaProdEs.up(ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) $ ( - ttot.val le ttot2.val) - = p36_deltaProdEs(ttot,regi,enty,esty,teEs) - +1e-6 - ; - ); -v36_deltaProdEs.lo(t36_scen(ttot),regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) = 1e-9; - -v36_vintageInfes.fx(ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) $( - v36_vintageInfes.L(ttot,regi,enty,esty,teEs)) - = v36_vintageInfes.L(ttot,regi,enty,esty,teEs); - -v36_vintageInfes.fx(ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) $( - NOT v36_vintageInfes.L(ttot,regi,enty,esty,teEs)) - = 0; - -v36_logitInfes.up(t,regi_dyn36(regi),inViaEs_dyn36(in)) = + INF ; - -*** EOF ./modules/36_buildings/services_putty/bounds.gms diff --git a/modules/36_buildings/services_putty/datainput.gms b/modules/36_buildings/services_putty/datainput.gms deleted file mode 100644 index 410584636..000000000 --- a/modules/36_buildings/services_putty/datainput.gms +++ /dev/null @@ -1,327 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_putty/datainput.gms -*** substitution elasticities -Parameter - p36_cesdata_sigma(all_in) "substitution elasticities" - / - enb 0.3 - esswb -1 !! The Esub is estimated with technological data - ueswb INF !! all sigma equal to INF will be treated as a sum with coefficients equal to unity ie OUT = IN1+ IN2. - uescb -1 !! The Esub is estimated with technological data - uealb -1 !! The Esub is estimated with technological data - / - -; -pm_cesdata_sigma(ttot,in)$p36_cesdata_sigma(in) = p36_cesdata_sigma(in); - -pm_capital_lifetime_exp(all_regi,"kapsc") = 20; -pm_capital_lifetime_exp(all_regi,"kapal") = 12; - -pm_capital_lifetime_exp(all_regi,"esswb") = log ( 0.25) / log ( 1 -0.02 ); - -pm_delta_kap(regi,in)$((ppfKap_dyn36(in) AND NOT in_putty(in)) OR nests_putty_dyn36(in,in)) = - log (0.25) / pm_capital_lifetime_exp(regi,in); - -loop (out, -pm_delta_kap(regi,in)$nests_putty_dyn36(out,in) = pm_delta_kap(regi,out); -); - -parameter - -p36_floorspace_scen(tall,all_regi,all_demScen) "floorspace" -/ -$ondelim -$include "./modules/36_buildings/services_putty/input/p36_floorspace_scen.cs4r" -$offdelim -/ -; -p36_floorspace(ttot,regi) = p36_floorspace_scen(ttot,regi,"%cm_demScen%") * 1e-3; !! from million to billion m2 - -parameter -p36_demFeForEs_scen "final energy demand projections for FE-UE technologies" -/ -$ondelim -$include "./modules/36_buildings/services_with_capital/input/p36_serviceInputs.cs4r" -$offdelim -/ - -p36_prodEs_scen "useful energy demand projections for FE-UE technologies" -/ -$ondelim -$include "./modules/36_buildings/services_with_capital/input/p36_serviceOutputs.cs4r" -$offdelim -/ -; - -table f36_datafecostsglob(char,all_teEs) "end-use (final energy) technologies characteristics" -$include "./modules/36_buildings/services_putty/input/generisdata_feCapCosts.prn" -; - - f36_datafecostsglob("inco0",teEs) = sm_D2015_2_D2005 * f36_datafecostsglob("inco0",teEs); - f36_datafecostsglob("inco0",teEs) = sm_DpKW_2_TDpTW * f36_datafecostsglob("inco0",teEs); - f36_datafecostsglob("omf",teEs) = sm_D2015_2_D2005 * f36_datafecostsglob("omf",teEs); - f36_datafecostsglob("omf",teEs) = sm_DpKW_2_TDpTW * f36_datafecostsglob("omf",teEs); - -table f36_dataeff(char,all_teEs) "end-use (final energy) long term efficiency assumptions" -$include "./modules/36_buildings/services_with_capital/input/generisdata_Eff.prn" -; - -p36_demFeForEs(ttot,regi,entyFe,esty,teEs)$fe2es_dyn36(entyFe,esty,teEs) = p36_demFeForEs_scen(ttot,regi,"%cm_GDPscen%",entyFe,esty,teEs) * sm_EJ_2_TWa; !! from EJ to TWa; -p36_prodEs(ttot,regi,entyFe,esty,teEs)$fe2es_dyn36(entyFe,esty,teEs) = p36_prodEs_scen(ttot,regi,"%cm_GDPscen%",entyFe,esty,teEs) * sm_EJ_2_TWa; !! from EJ to TWa; - - -***_____________________________Information for the ES layer and the multinomial logit function _____________________________ -*** Price sensitivity of the logit function -p36_logitLambda(regi,in)$inViaEs_dyn36(in) = cm_priceSensiBuild; - -*** Compute efficiencies of technologies producing ES(UE) from FE -loop ( fe2es_dyn36(entyFe,esty,teEs), -p36_fe2es(ttot,regi,teEs)$p36_demFeForEs(ttot,regi,entyFe,esty,teEs) = p36_prodEs(ttot,regi,entyFe,esty,teEs) / p36_demFeForEs(ttot,regi,entyFe,esty,teEs); -); - -p36_fe2es(ttot,regi,teEs)$(teEs_dyn36(teEs) AND ( NOT p36_fe2es(ttot,regi,teEs))) = 0.5; -p36_fe2es(ttot,regi,teEs)$(sameAs(teEs, "te_ueshhpb") OR sameAs(teEs,"te_uecwhpb")) = 3; - -*** Compute share of heat pumps based on the efficiency of electricity -loop (mapElHp(teEs,teEs2), !!teEs= electric resistance. teEs2= heat pump -loop (fe2es_dyn36(entyFe,esty,teEs), -loop (fe2es_dyn36_2(entyFe,esty2,teEs2), -sm_tmp = 0.9; !! maximum assumed efficiency of electric resistance -p36_demFeForEs(ttot,regi,entyFe,esty2,teEs2)$(p36_fe2es(ttot,regi,teEs) gt sm_tmp) - = p36_demFeForEs(ttot,regi,entyFe,esty,teEs) - * (p36_fe2es(ttot,regi,teEs) - sm_tmp) - / (p36_fe2es(ttot,regi,teEs2) -sm_tmp) - ; -p36_demFeForEs(ttot,regi,entyFe,esty,teEs) = p36_demFeForEs(ttot,regi,entyFe,esty,teEs) - - p36_demFeForEs(ttot,regi,entyFe,esty2,teEs2); - -p36_fe2es(ttot,regi,teEs)$(p36_fe2es(ttot,regi,teEs) gt sm_tmp) = sm_tmp; -); -); -); - -*** Correct the UE quantities of heat pumps and electricity in accordance -p36_prodEs(ttot,regi,entyFe,esty,teEs) = p36_demFeForEs(ttot,regi,entyFe,esty,teEs) * p36_fe2es(ttot,regi,teEs); - -if (cm_startyear gt 2005, -Execute_Loadpoint 'input_ref' p36_logitCalibration_load = p36_logitCalibration, p36_logitLambda_load = p36_logitLambda; -p36_logitCalibration(ttot,regi,enty,esty,teEs) = p36_logitCalibration_load(ttot,regi,enty,esty,teEs); -p36_logitLambda(regi,in) = p36_logitLambda_load(regi,in); -); - -*** Introduce long term assumption concerning efficiencies -loop (t36_hist_last(ttot2), - -p36_fe2es(ttot,regi,teEs)$( pm_ttot_val(ttot) gt pm_ttot_val(ttot2)) = p36_fe2es(ttot2,regi,teEs); - -p36_fe2es(ttot,regi,teEs)$f36_dataeff("eta",teEs) -= -min(max((2100 - pm_ttot_val(ttot))/(2100 -ttot2.val),0),1) !! lambda = 1 in 2015 and 0 in 2100 - * ( p36_fe2es(ttot,regi,teEs) - - f36_dataeff("eta",teEs) - ) - + f36_dataeff("eta",teEs) -; -); - -*** Compute FE shares of technologies producing ES(UE) from FE -p36_shFeCes(ttot,regi,entyFe,in,teEs)$(feViaEs2ppfen(entyFe,in,teEs) - AND teEs_dyn36(teEs) - AND sum(fe2es(entyFe2,esty,teEs2)$es2ppfen(esty,in), p36_demFeForEs(ttot,regi,entyFe2,esty,teEs2))) - = - sum(fe2es(entyFe,esty,teEs)$es2ppfen(esty,in), p36_demFeForEs(ttot,regi,entyFe,esty,teEs)) - / sum(fe2es(entyFe2,esty,teEs2)$es2ppfen(esty,in), p36_demFeForEs(ttot,regi,entyFe2,esty,teEs2)) -; - -*** Compute UE shares of technologies producing ES(UE) from FE -p36_shUeCes(ttot,regi,entyFe,in,teEs)$(feViaEs2ppfen(entyFe,in,teEs) - AND teEs_dyn36(teEs) - AND sum(fe2es(entyFe2,esty,teEs2)$es2ppfen(esty,in), p36_prodEs(ttot,regi,entyFe2,esty,teEs2))) -= -sum(fe2es(entyFe,esty,teEs)$es2ppfen(esty,in), p36_prodEs(ttot,regi,entyFe,esty,teEs)) -/ sum(fe2es(entyFe2,esty,teEs2)$es2ppfen(esty,in), p36_prodEs(ttot,regi,entyFe2,esty,teEs2)) -; -display p36_shFeCes, p36_fe2es, p36_demFeForEs, p36_prodEs, p36_shUeCes; - -p36_demUEtotal(ttot,regi,in) = sum (fe2ces_dyn36(entyFe,esty,teEs,in), p36_prodEs(ttot,regi,entyFe,esty,teEs)); - -loop (t0(ttot), -p36_prodUEintern(ttot,regi,entyFe,esty,teEs) = p36_prodEs(ttot,regi,entyFe,esty,teEs); -); - -if (cm_startyear gt 2005, -Execute_Loadpoint 'input_ref' p36_prodUEintern_load = vm_prodEs.L; -p36_prodUEintern(ttot,regi,enty,esty,teEs)$(ttot.val gt 2005 and ttot.val lt cm_startyear) = p36_prodUEintern_load(ttot,regi,enty,esty,teEs); -); - -*** Compute FE prices from input.gdx -if ( execError = 0, -Execute_Loadpoint 'input' p36_marginalUtility = qm_budget.m; - if (execError gt 0, - execError = 0; - p36_marginalUtility(ttot,regi) = 1; - ); -); -if ( execError = 0, -Execute_Loadpoint 'input' p36_fePrice_load = qm_balFe.m; -loop (se2fe(entySe,entyFe,te), - p36_fePrice(ttot,regi,entyFe) = p36_fePrice_load(ttot,regi,entySe,entyFe,te); - ); -if (execError gt 0, - execError = 0; - p36_fePrice(ttot,regi,entyFe) = 1; - ); -); - -p36_marginalUtility(ttot,regi)$( abs (p36_marginalUtility(ttot,regi)) lt sm_eps) = 1; - -p36_fePrice(ttot,regi,entyFe) = abs (p36_fePrice(ttot,regi,entyFe)) / abs (p36_marginalUtility(ttot,regi)); -p36_fePrice(ttot,regi,entyFe)$ ( NOT p36_fePrice(ttot,regi,entyFe)) = 0.01; !! give a default value in case the relevant information is not available in the input.gdx - -p36_fePrice_iter(iteration,ttot,regi,entyFe) = 0; - -if ((cm_noReboundEffect eq 1 ), -Execute_Load 'input_ref' p36_cesIONoRebound = vm_cesIO.L; -Execute_Load 'input_ref' p36_cesIONoRebound_putty = vm_cesIOdelta.L; -); - -*** Implicit discount rates mark-ups over the normal discount rate -if ((cm_DiscRateScen eq 0), -p36_implicitDiscRateMarg(ttot,regi,all_in) = 0; - elseif (cm_DiscRateScen eq 1), - p36_implicitDiscRateMarg(ttot,regi,"ueshb") = 0.05; !! 5% for the choice of space heating technology - p36_implicitDiscRateMarg(ttot,regi,"uecwb") = 0.05; !! 5% for the choice of cooking and water heating technology - elseif (cm_DiscRateScen eq 2), - p36_implicitDiscRateMarg(ttot,regi,all_in) = 0; - p36_implicitDiscRateMarg(ttot,regi,"ueshb")$(ttot.val ge 2005 AND ttot.val lt cm_startyear) = 0.05; !! 5% for the choice of space heating technology - p36_implicitDiscRateMarg(ttot,regi,"uecwb")$(ttot.val ge 2005 AND ttot.val lt cm_startyear) = 0.05; !! 5% for the choice of cooking and water heating technology - - elseif (cm_DiscRateScen eq 3), - p36_implicitDiscRateMarg(ttot,regi,all_in) = 0; - - p36_implicitDiscRateMarg(ttot,regi,"ueshb") = 0.05; !! 5% for the choice of space heating technology - p36_implicitDiscRateMarg(ttot,regi,"uecwb") = 0.05; !! 5% for the choice of cooking and water heating technology - - p36_implicitDiscRateMarg(ttot,regi,in)$( pm_ttot_val(ttot) ge cm_startyear - AND (sameAs(in,"ueshb") - OR sameAs(in,"uecwb") - ) - ) - = 0.25 * p36_implicitDiscRateMarg(ttot,regi,in) ; - - elseif (cm_DiscRateScen eq 4), - p36_implicitDiscRateMarg(ttot,regi,all_in) = 0; - - p36_implicitDiscRateMarg(ttot,regi,"ueshb") = 0.05; !! 5% for the choice of space heating technology - p36_implicitDiscRateMarg(ttot,regi,"uecwb") = 0.05; !! 5% for the choice of cooking and water heating technology - - p36_implicitDiscRateMarg(ttot,regi,"ueshb") = min(max((2030 - pm_ttot_val(ttot))/(2030 -2020),0),1) !! lambda = 1 in 2020 and 0 in 2030; - * 0.75 * p36_implicitDiscRateMarg(ttot,regi,"ueshb") - + 0.25 * p36_implicitDiscRateMarg(ttot,regi,"ueshb"); !! Reduction of 75% of the Efficiency gap - p36_implicitDiscRateMarg(ttot,regi,"uecwb") = min(max((2030 - pm_ttot_val(ttot))/(2030 -2020),0),1) !! lambda = 1 in 2020 and 0 in 2030; - * 0.75 * p36_implicitDiscRateMarg(ttot,regi,"uecwb") - + 0.25 * p36_implicitDiscRateMarg(ttot,regi,"uecwb"); !! Reduction of 75% of the Efficiency gap - ); - -p36_kapPrice(ttot,regi) = pm_cesdata(ttot,regi,"kap","price") - pm_delta_kap(regi,"kap"); -loop (fe2ces_dyn36(entyFe,esty,teEs,in), -p36_kapPriceImplicit(ttot,regi,teEs) = p36_kapPrice(ttot,regi) + p36_implicitDiscRateMarg(ttot,regi,in); -); - -*** Inconvenience mark-up -f36_inconvpen(teEs)$(sameAs(teEs,"te_ueshstb") OR sameAs(teEs,"te_uecwstb")) = 42; !! In dollar per GJ 42$/GJ is app. eq to 0.15$/kWh -f36_inconvpen(teEs)$(sameAs(teEs,"te_ueshhob") OR sameAs(teEs,"te_uecwhob")) = 14; !! In dollar per GJ 14$/GJ is app. eq to 0.05$/kWh -f36_inconvpen(teEs)$(sameAs(teEs,"te_ueshsob") OR sameAs(teEs,"te_uecwsob")) = 14; !! In dollar per GJ 14$/GJ is app. eq to 0.05$/kWh -f36_inconvpen(teEs) = f36_inconvpen(teEs) * sm_DpGJ_2_TDpTWa; !! conversion $/GJ -> T$/TWa - -*** Compute depreciation rates for technologies -p36_depreciationRate(teEs)$f36_datafecostsglob("lifetime",teEs) = - log (0.33) / f36_datafecostsglob("lifetime",teEs); - -*** Define which technologies will have a faster reduction of their calibration parameter -p36_pushCalib(ttot,teEs_dyn36) = 0; - -$ifthen "%cm_pushCalib%" == "none" -$elseif "%cm_pushCalib%" == "hydrogen" -teEs_pushCalib_dyn36("te_ueshh2b") = YES; -teEs_pushCalib_dyn36("te_uecwh2b") = YES; -p36_pushCalib(ttot,"te_ueshh2b") = 0; -p36_pushCalib(ttot,"te_ueshh2b") = 0.5; - -p36_pushCalib(ttot,teEs_pushCalib_dyn36(teEs)) = - min(max((2050 -ttot.val)/(2050 - cm_startyear),0),1) !! lambda = 1 in startyear and 0 in 2050 - * ( 1 - p36_pushCalib(ttot,teEs)) - + p36_pushCalib(ttot,teEs) ; -$endif - - -*** Define for which technologies the investment costs will evolve -p36_costReduc(ttot,teEs_dyn36) = 1; - -$ifthen "%cm_reducCostB%" == "none" -$elseif "%cm_reducCostB%" == "hydrogen" - -p36_costReduc(ttot,"te_ueshh2b") = 0.2; -p36_costReduc(ttot,"te_ueshh2b") = 0.5; - -p36_costReduc(ttot,teEs_pushCalib_dyn36(teEs)) = - min(max((2050 -ttot.val)/(2050 - cm_startyear),0),1) !! lambda = 1 in startyear and 0 in 2050 - * ( 1 - p36_costReduc(ttot,teEs)) - + p36_costReduc(ttot,teEs) ; -$elseif "%cm_reducCostB%" == "heatpumps" -p36_costReduc(ttot,"te_ueshhpb") = 0.8; -p36_costReduc(ttot,"te_uecwhpb") = 0.8; - -p36_costReduc(ttot,teEs_pushCalib_dyn36(teEs)) = - min(max((2050 -ttot.val)/(2050 - cm_startyear),0),1) !! lambda = 1 in startyear and 0 in 2050 - * ( 1 - p36_costReduc(ttot,teEs)) - + p36_costReduc(ttot,teEs) ; -$endif - -*** Computation of omegs and opTimeYr2teEs for technology vintages -p36_omegEs(regi,opTimeYr,teEs_dyn36(teEs)) = 0; - -loop(regi, - p36_aux_lifetime(teEs_dyn36(teEs)) = 5/4 * f36_datafecostsglob("lifetime",teEs); - loop(teEs_dyn36(teEs), - - loop(opTimeYr, - p36_omegEs(regi,opTimeYr,teEs) = 1 - ((opTimeYr.val-0.5) / p36_aux_lifetime(teEs))**4 ; - opTimeYr2teEs(teEs,opTimeYr)$(p36_omegEs(regi,opTimeYr,teEs) > 0 ) = yes; - if( p36_omegEs(regi,opTimeYr,teEs) <= 0, - p36_omegEs(regi,opTimeYr,teEs) = 0; - opTimeYr2teEs(teEs,opTimeYr) = no; - ); - ) - ); -); -display p36_omegEs , opTimeYr2teEs ; -***_____________________________END OF Information for the ES layer and the multinomial logit function _____________________________ - - -*** Adjustement cost factor -p36_adjFactor(ttot,regi) = 1; - -*** Set regions with high cooling demand, on which we impose a constraint on efficiency development -loop(regi $ (pm_cesdata("2100",regi,"fescelb","quantity") gt 0.01), - -regi_dyn36_cooling(regi) = YES; -); - -*** Set dynamic regional set depending on testOneRegi -$ifthen "%optimization%" == "testOneRegi" -regi_dyn36(all_regi) = regi_dyn80(all_regi); -$else -regi_dyn36(all_regi) = regi(all_regi); -$endif - -***------------------------------------------------------------------------- -*** pass on module specific parameter values to core parameters -***------------------------------------------------------------------------- - -pm_fe2es(ttot,regi,teEs_dyn36) = p36_fe2es(ttot,regi,teEs_dyn36); -pm_shFeCes(ttot,regi,entyFe,in,teEs)$p36_shFeCes(ttot,regi,entyFe,in,teEs) = p36_shFeCes(ttot,regi,entyFe,in,teEs); -*** EOF ./modules/36_buildings/services_putty/datainput.gms diff --git a/modules/36_buildings/services_putty/declarations.gms b/modules/36_buildings/services_putty/declarations.gms deleted file mode 100644 index 21316c668..000000000 --- a/modules/36_buildings/services_putty/declarations.gms +++ /dev/null @@ -1,117 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_putty/declarations.gms -Scalar -s36_switch_floor "switch for the inclusion of the floorspace equations. It should exclude the equations from hybrid" /0/, -s36_vintage_calib "switch for the inclusion of vintage equations and restricting ttot to historical. It should exclude the equations from hybrid" /0/, -s36_logit "switch for the inclusion of vintage equations. It should exclude the equations from hybrid" /0/ -; - -Parameter -p36_floorspace(tall,all_regi) "buildings floorspace, billion m2" -p36_floorspace_delta(tall,all_regi) "increase in floorspace, billion m2" -p36_adjFactor(tall,all_regi) "factor applied for the adjustment costs" -p36_floorspace_delta_gdx(tall,all_regi) "parameter storing fixings from input_ref for v36_floorspace_delta" - -p36_cesIONoRebound(tall,all_regi,all_in) "loads the vm_cesIO values from the input_ref and sets the upper bound to vm_cesIO to forbid a rebound effect" -p36_cesIONoRebound_putty(tall,all_regi,all_in) "loads the vm_cesIO_putty values from the input_ref and sets the upper bound to vm_cesIO to forbid a rebound effect" - -p36_demFeForEs_scen(tall,all_regi,all_GDPscen,all_enty,all_esty,all_teEs) "Final energy demand for technologies producing energy services (useful energy in the case of buildings)" -p36_demFeForEs(ttot,all_regi,all_enty,all_esty,all_teEs) "Final energy demand for technologies producing energy services (useful energy in the case of buildings)" - -p36_prodEs_scen(tall,all_regi,all_GDPscen,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) for technologies producing energy services and using FE" -p36_prodEs(ttot,all_regi,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) for technologies producing energy services and using FE" -p36_prodEs_iter(iteration,ttot,all_regi,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) for technologies producing energy services and using FE over iterations" -p36_deltaProdEs_iter(iteration,ttot,all_regi,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) addition for a year. For technologies producing energy services and using FE over iterations" -p36_deltaProdEs(ttot,all_regi,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) addition for a year. Result of vintage_36" - -p36_shFeCes(ttot,all_regi,all_enty,all_in,all_teEs) "share of Final energy of technology teEs in the final energy producing all_in" -p36_shFeCes_iter(iteration,ttot,all_regi,all_enty,all_in,all_teEs) "share of Final energy of technology teEs in the final energy producing all_in" -p36_shUeCes(ttot,all_regi,all_enty,all_in,all_teEs) "share of Useful energy of technology teEs in the final energy producing all_in" -p36_shUeCes_iter(iteration,ttot,all_regi,all_enty,all_in,all_teEs) "share of Useful energy of technology teEs in the final energy producing all_in" -p36_fe2es(ttot,all_regi,all_teEs) "FE to ES(UE) efficiency of technology teES" - -p36_logitLambda(all_regi,all_in) "logit parameter for homogeneity" -p36_logitLambda_load (all_regi,all_in) "logit parameter for homogeneity, loaded from GDX_ref" -p36_fePrice_load(tall,all_regi,all_enty,all_enty,all_te) "Final energy price from GDX" -p36_fePrice(tall,all_regi,all_enty) "Final energy price" -p36_fePrice_iter(iteration,tall,all_regi,all_enty) "Final energy price over iterations" -p36_marginalUtility(tall,all_regi) "Marginal utility of income: used to compute the final energy price from the marginal of balance equation" -p36_techCosts(tall,all_regi,all_enty,all_esty,all_teEs) "Relevant costs of each ES technology for the computation of the share in the multinomial logit" -p36_techCosts_iter(iteration,tall,all_regi,all_enty,all_esty,all_teEs) "Relevant costs of each ES technology for the computation of the share in the multinomial logit over iterations" -p36_logitCalibration(tall,all_regi,all_enty,all_esty,all_teEs) "calibration parameter for the multinomial logit function" -p36_logitCalibration_load(tall,all_regi,all_enty,all_esty,all_teEs) "calibration parameter for the multinomial logit function from input_ref.gdx" -p36_logitNorm(iteration,tall,all_regi,all_in) "Norm of the share vector difference between iterations" - -p36_prodUEintern(tall,all_regi,all_enty,all_esty,all_teEs) "UE production from depreciated technologies of the previous period" -p36_prodUEintern_load(tall,all_regi,all_enty,all_esty,all_teEs) "UE production from depreciated technologies of the previous period -- From GDX" -p36_demUEtotal(tall,all_regi,all_in) "Demand for UE, independent of the technology" -p36_demUEdelta(tall,all_regi,all_in) "Demand for UE, independent of the technology, and which is not covered by the depreciated technologies" -p36_shUeCesDelta(ttot,all_regi,all_enty,all_in,all_teEs) "Technological shares in UE which is not covered by former depreciated technologies" -p36_depreciationRate(all_teEs) "Depreciation rates for the indivudal conversion technologies, rouhgly derived from their lifetime parameter" - -p36_esCapCost(tall,all_regi,all_teEs) "Capital costs for each technology transforming FE into UE. Cost per unit of FE" -p36_esCapCostImplicit(tall,all_regi,all_teEs) "Capital costs for each technology transforming FE into UE, taking the implicit discount rate into account. Cost per unit of FE" -p36_kapPrice(tall,all_regi) "Macroeconomic capital price, net of depreciation" -p36_kapPriceImplicit(tall,all_regi,all_teEs) "Macroeconomic capital price, net of depreciation, to which the implicit discount rate is added" -p36_implicitDiscRateMarg(tall,all_regi,all_in) "Implicit discount rate for the choice of conversion technologies from UE to FE in buildings" - -p36_pushCalib(tall,all_teEs) "degree to which the calibration parameter should be reduced/increased for these technologies" -p36_costReduc(tall,all_teEs) "Reduction of costs for some technologies" - -f36_inconvpen(all_teEs) "maximum inconvenience penalty for traditional conversion technologies. Unit: T$/TWa" -p36_inconvpen(ttot,all_regi,all_teEs) "parameter for inconvenience penalty depending on income level. Unit: T$/TWa" - -p36_aux_lifetime(all_teEs) "auxiliary parameter for calculating life times" -p36_omegEs(all_regi,opTimeYr,all_teEs) "technical depreciation parameter, gives the share of a capacity that is still usable after tlt. [none/share, value between 0 and 1]" -; - - -Variables -v36_floorspace_delta(tall,all_regi) "increase in floorspace, million m2" -v36_putty_obj "index of the step by step variation of v36_floorspace_delta" - -v36_prodEs(ttot,all_regi,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) for technologies producing energy services and using FE" -v36_deltaProdEs(ttot,all_regi,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) addition for a year. For technologies producing energy services and using FE" -v36_vintageInfes(ttot,all_regi,all_enty,all_esty,all_teEs) "slack variable to avoid infeasibilities in the initialisation of vintages" -v36_logitInfes(tall,all_regi,all_in) "slack variable to avoid infeasibilities in case historical demand cannot be declined fast enough" -v36_costs(ttot,all_regi) "technological costs" -v36_vintage_obj "objective variable for vintage model" -v36_shares_obj "objective variable for heterogeneity preferences" -; - -Equations -q36_enerSerAdj(tall,all_regi,all_in) "adjustment costs for energy services" -q36_enerCoolAdj(tall,all_regi,all_in) "adjustment costs for energy cooling services" -q36_pathConstraint(tall,all_regi) "equation describing the relation between a variable and its variation" -q36_putty_obj "objective function" - -q36_demFeBuild(ttot,all_regi,all_enty,all_emiMkt) "buildings final energy demand" - -q36_ueTech2Total(tall,all_regi,all_in) "definition of total UE buildings demand, based on the sum of demand by technology" -q36_cap(tall,all_regi,all_enty,all_esty,all_teEs) "definition of available capacities" -q36_budget(tall,all_regi) "budget equation" -q36_vintage_obj "objective function for vintage model" - -q36_shares_obj "objective function for logit shares: heterogeneity preferences" -; - - -file testfile /""/; - -testfile.nd = 10; - - -file file_logit_buildings / "Logit_buildings.csv" /; - -file_logit_buildings.ap = 0; !! append to file is negative to overwrite former file if existing -file_logit_buildings.pc = 5; !! csv file -file_logit_buildings.lw = 0; -file_logit_buildings.nw = 20; -file_logit_buildings.nd = 15; - -*** EOF ./modules/36_buildings/services_putty/declarations.gms diff --git a/modules/36_buildings/services_putty/equations.gms b/modules/36_buildings/services_putty/equations.gms deleted file mode 100644 index 2e59fd164..000000000 --- a/modules/36_buildings/services_putty/equations.gms +++ /dev/null @@ -1,191 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_putty/equations.gms - -*** Can you please structure which equations belongs to which model? - -*** Buildings Final Energy Balance -q36_demFeBuild(ttot,regi,entyFe,emiMkt)$((ttot.val ge cm_startyear) AND (entyFe2Sector(entyFe,"build"))) .. - sum((entySe,te)$se2fe(entySe,entyFe,te), vm_demFeSector_afterTax(ttot,regi,entySe,entyFe,"build",emiMkt)) - =e= - ( - sum(fe2ppfEn36(entyFe,in), - vm_cesIO(ttot,regi,in) - + pm_cesdata(ttot,regi,in,"offset_quantity") - ) - + - sum(fe2es_dyn36(entyFe,esty,teEs), vm_demFeForEs(ttot,regi,entyFe,esty,teEs) ) - )$(sameas(emiMkt,"ES")) -; - -*** Couldn't we also formulate an ES to ppfen handover function instead of pushing this to the postsolve.gms? It would be easier to follow. - -*AL* Start of Model solved in preloop for determining the floorspace delta projections -q36_pathConstraint (ttot,regi) $((s36_switch_floor eq 1) AND (ord(ttot) lt card(ttot)) AND (ttot.val ge cm_startyear)) .. -p36_floorspace(ttot + 1,regi) =e= - (1- pm_delta_kap(regi,"esswb"))**pm_dt(ttot+1) * p36_floorspace(ttot,regi) - + (pm_cumDeprecFactor_old(ttot+1,regi,"esswb") * v36_floorspace_delta(ttot,regi)) - + (pm_cumDeprecFactor_new(ttot+1,regi,"esswb") * v36_floorspace_delta(ttot+1,regi)) - ; - - - -q36_putty_obj$(s36_switch_floor eq 1).. -v36_putty_obj =e= sum((ttot,regi,in)$((ord(ttot) lt card(ttot))) - , power( v36_floorspace_delta(ttot+1,regi) - - v36_floorspace_delta(ttot,regi) - - ,2) - - ); -*AL* End of Model solved in preloop - -q36_enerSerAdj(ttot,regi,in)$(sameas(in,"esswb") - AND ttot.val ge max(2010, cm_startyear) - AND cm_build_AdjCostActive eq 1).. - vm_enerSerAdj(ttot,regi,in) - =e= - p36_adjFactor(ttot,regi) - * sqr( - (vm_cesIOdelta(ttot,regi,in) / p36_floorspace_delta(ttot,regi) - - vm_cesIOdelta(ttot-1,regi,in) / p36_floorspace_delta(ttot-1,regi)) - / (pm_ttot_val(ttot)-pm_ttot_val(ttot-1)) - / (vm_cesIOdelta(ttot,regi,in) / p36_floorspace_delta(ttot,regi) +0.0001) - ) - * vm_cesIOdelta(ttot,regi,in) / 11 - ; - - -q36_enerCoolAdj(ttot,regi,in)$(sameas (in, "fescelb") - AND ttot.val ge max(2015, cm_startyear) - AND regi_dyn36_cooling(regi) - AND cm_build_AdjCostActive eq 1).. - vm_enerSerAdj(ttot,regi,in) - =e= - p36_adjFactor(ttot,regi) - * sum (cesOut2cesIn(out,in), - sqr ( - (vm_cesIO(ttot,regi,out) / vm_cesIO(ttot,regi,in) !! Efficiency in ttot - - vm_cesIO(ttot - 1,regi,out) / vm_cesIO(ttot - 1,regi,in) !! Efficiency in ttot -1 - ) / (pm_ttot_val(ttot) - pm_ttot_val(ttot - 1)) - - - (vm_cesIO(ttot - 1,regi,out) / vm_cesIO(ttot - 1,regi,in) !! Efficiency in ttot -1 - - vm_cesIO(ttot - 2,regi,out) / vm_cesIO(ttot - 2,regi,in) !! Efficiency in ttot -2 - ) / (pm_ttot_val(ttot - 1) - pm_ttot_val(ttot - 2)) - ) - ) -; - -******************************************* -*** Equations of the logit model ********** -******************************************* - - - -*** total UE buildings demand, based on the sum of demand by technology -q36_ueTech2Total(ttot,regi_dyn36(regi),inViaEs_dyn36(in)) $ - ( (s36_vintage_calib eq 1 AND t36_hist(ttot) ) - OR ((s36_logit eq 1) AND (ttot.val ge cm_startyear)) ) .. - p36_demUEtotal(ttot,regi,in) - + v36_logitInfes(ttot,regi,in) - =e= - sum (fe2ces_dyn36(enty,esty,teEs,in), - v36_prodEs(ttot,regi,enty,esty,teEs) - ); - -*** In what sense is this calculating capacities? Are you referring to useful energy as capacities? That should be in energy units. -*** What is the difference between v36_prodEs and v36_deltaProdEs? - -q36_cap(ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) $ - ( ((s36_vintage_calib eq 1) AND (t36_hist(ttot) )) - OR ((s36_logit eq 1) AND (ttot.val ge cm_startyear)) ) .. - - v36_prodEs(ttot,regi,enty,esty,teEs) - =e= - sum(opTimeYr2teEs(teEs,opTimeYr)$(tsu2opTimeYr(ttot,opTimeYr) AND (opTimeYr.val ge 1) ), - pm_ts(ttot-(pm_tsu2opTimeYr(ttot,opTimeYr)-1)) - * p36_omegEs(regi,opTimeYr+1,teEs) - * (v36_deltaProdEs(ttot-(pm_tsu2opTimeYr(ttot,opTimeYr)-1),regi,enty,esty,teEs) - - v36_vintageInfes(ttot-(pm_tsu2opTimeYr(ttot,opTimeYr)-1),regi,enty,esty,teEs) - ) - ) - ; - -q36_budget(t36_scen(ttot),regi_dyn36(regi)).. - v36_costs(ttot,regi) - =e= - sum ( fe2ces_dyn36(enty,esty,teEs,in), - p36_techCosts(ttot,regi,enty,esty,teEs) - * v36_deltaProdEs(ttot,regi,enty,esty,teEs) - ) - ; - -*** What is the purpose of the objetve function of the vintage model? -q36_vintage_obj $ (s36_vintage_calib eq 1 ) .. - v36_vintage_obj - =e= - sum((ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs))$( - t36_hist(ttot) - ), - - sum(opTimeYr2teEs(teEs,opTimeYr)$( - tsu2opTimeYr(ttot,opTimeYr) - ), - power ( - v36_deltaProdEs(ttot-(pm_tsu2opTimeYr(ttot,opTimeYr)),regi,enty,esty,teEs) - - v36_deltaProdEs(ttot-(pm_tsu2opTimeYr(ttot,opTimeYr)-1),regi,enty,esty,teEs) - ,2 - ) - - + - 1000 - * v36_vintageInfes(ttot-(pm_tsu2opTimeYr(ttot,opTimeYr)),regi,enty,esty,teEs) - ) - + 1000 - * v36_vintageInfes(ttot,regi,enty,esty,teEs) - ) - - ; - -*** Can you explain what this objective function is? -*** Why does its maximization give the output of the logit function -*** which should (I guess) be the UE shares based on the cost of the fe2ue technology output. -*** Also I do not recognize the logit formulation from before. -q36_shares_obj $ (s36_logit eq 1).. - v36_shares_obj - =e= - sum ((t36_scen(ttot),regi_dyn36(regi),inViaEs_dyn36(in)), - sum ( fe2ces_dyn36(enty,esty,teEs,in), - - p36_logitCalibration(ttot,regi,enty,esty,teEs) - * v36_deltaProdEs(ttot,regi,enty,esty,teEs) - ) - + 1 / p36_logitLambda(regi,in) - * sum ( fe2ces_dyn36(enty,esty,teEs,in), - v36_deltaProdEs(ttot,regi,enty,esty,teEs) - * log ( v36_deltaProdEs(ttot,regi,enty,esty,teEs) - / sum (fe2ces_dyn36_2(enty2,esty2,teEs2,in), - v36_deltaProdEs(ttot,regi,enty2,esty2,teEs2)) - ) - ) - ) - - - sum ( (t36_scen(ttot),regi_dyn36(regi)), - v36_costs(ttot,regi) - ) - - - sum ((ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)), - 1000 - * v36_vintageInfes(ttot,regi,enty,esty,teEs) - ) - - sum ((ttot,regi_dyn36(regi),inViaEs_dyn36(in)), - 1000 - * v36_logitInfes(ttot,regi,in) - ) - ; - - -*** EOF ./modules/36_buildings/services_putty/equations.gms diff --git a/modules/36_buildings/services_putty/input/files b/modules/36_buildings/services_putty/input/files deleted file mode 100644 index e5b324c14..000000000 --- a/modules/36_buildings/services_putty/input/files +++ /dev/null @@ -1,4 +0,0 @@ -p36_floorspace_scen.cs4r -p36_serviceInputs.cs4r -p36_serviceOutputs.cs4r - diff --git a/modules/36_buildings/services_putty/input/generisdata_Eff.prn b/modules/36_buildings/services_putty/input/generisdata_Eff.prn deleted file mode 100644 index dbe469464..000000000 --- a/modules/36_buildings/services_putty/input/generisdata_Eff.prn +++ /dev/null @@ -1,23 +0,0 @@ -*** SOF ./modules/36_buildings/services_putty/input/generisdata_Eff.prn -$ontext -Data adapted from EIA - Technology Forecast Updates – Residential and Commercial Building Technologies – Reference Case -Documentation of the NEMS model: https://www.eia.gov/analysis/studies/buildings/equipcosts/ -Data adapted from https://ec.europa.eu/energy/sites/ener/files/documents/2018_06_27_technology_pathways_-_finalreportmain2.pdf -IMPORTANT: all costs are now given in $2015! As long as the model runs in $2005, the values need to be converted in datainput.gms -inco0 Initial investment costs given in $(2015)/kW Useful energy power -omf Fixed operation and maintenance costs in $(2015)/kW Useful energy power -eta Conversion efficiency: UE/FE -usehr number of hours in a year when the technology is used -lifetime given in years -$offtext - - te_ueshhpb te_ueshgab te_ueshhob te_ueshelb te_ueshh2b te_ueshsob te_ueshheb te_ueshstb -eta %cm_INNOPATHS_effHP% 0.9 0.9 1 0.8 0.8 1 0.25 - - -+ te_uecwhpb te_uecwgab te_uecwhob te_uecwelb te_uecwh2b te_uecwsob te_uecwheb te_uecwstb -eta %cm_INNOPATHS_effHP% 0.9 0.9 1 0.8 0.8 1 0.25 - - - -*** EOF ./modules/36_buildings/services_putty/input/generisdata_Eff.prn diff --git a/modules/36_buildings/services_putty/input/generisdata_feCapCosts.prn b/modules/36_buildings/services_putty/input/generisdata_feCapCosts.prn deleted file mode 100644 index 1a54c1050..000000000 --- a/modules/36_buildings/services_putty/input/generisdata_feCapCosts.prn +++ /dev/null @@ -1,29 +0,0 @@ -*** SOF ./modules/36_buildings/services_putty/input/generisdata_feCapCosts.prn -$ontext -Data adapted from EIA - Technology Forecast Updates – Residential and Commercial Building Technologies – Reference Case -Documentation of the NEMS model: https://www.eia.gov/analysis/studies/buildings/equipcosts/ -Data adapted from https://ec.europa.eu/energy/sites/ener/files/documents/2018_06_27_technology_pathways_-_finalreportmain2.pdf -IMPORTANT: all costs are now given in $2015! As long as the model runs in $2005, the values need to be converted in datainput.gms -inco0 Initial investment costs given in $(2015)/kW Useful energy power -omf Fixed operation and maintenance costs in $(2015)/kW Useful energy power -eta Conversion efficiency: UE/FE -usehr number of hours in a year when the technology is used -lifetime given in years -$offtext - - te_ueshhpb te_ueshgab te_ueshhob te_ueshelb te_ueshh2b te_ueshsob te_ueshheb te_ueshstb -inco0 1000 180 180 60 180 470 110 10 -omf 7 3 3 2 13 17 2 1 -eta 3 0.9 0.8 1 0.7 0.8 0.7 0.25 -usehr 1440 1440 1440 1440 1440 1440 1440 1440 !! 60 days a year -lifetime 20 20 20 20 20 20 20 5 - -+ te_uecwhpb te_uecwgab te_uecwhob te_uecwelb te_uecwh2b te_uecwsob te_uecwheb te_uecwstb -inco0 500 190 200 110 190 250 100 10 -omf 1 2 6 0 13 17 2 1 -eta 3 1 0.8 1 0.7 0.8 0.7 0.25 -usehr 730 730 730 730 730 730 730 730 -lifetime 20 20 20 20 20 20 20 5 - - -*** EOF ./modules/36_buildings/services_putty/input/generisdata_feCapCosts.prn diff --git a/modules/36_buildings/services_putty/not_used.txt b/modules/36_buildings/services_putty/not_used.txt deleted file mode 100644 index e4071b939..000000000 --- a/modules/36_buildings/services_putty/not_used.txt +++ /dev/null @@ -1,22 +0,0 @@ -# | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | REMIND License Exception, version 1.0 (see LICENSE file). -# | Contact: remind@pik-potsdam.de -name,type,reason -vm_costAddTeInv,input,questionnaire -cm_build_H2costAddH2Inv,input,questionnaire -cm_build_H2costDecayStart,input,questionnaire -cm_build_H2costDecayEnd,input,questionnaire -pm_shGasLiq_fe_up,parameter,not needed -pm_shGasLiq_fe_lo,parameter,not needed -pm_shfe_up,parameter,not needed -pm_shfe_lo,parameter,not needed -pm_tau_fe_tax,input,questionnaire -pm_tau_fe_sub,input,questionnaire -sm_TWa_2_MWh,input,questionnaire -vm_costCESMkup,input,questionnaire -sm_trillion_2_non,input,questionnaire -sm_TWa_2_kWh,input,questionnaire -pm_tau_ces_tax,input,questionnaire diff --git a/modules/36_buildings/services_putty/postsolve.gms b/modules/36_buildings/services_putty/postsolve.gms deleted file mode 100644 index dee74e1d9..000000000 --- a/modules/36_buildings/services_putty/postsolve.gms +++ /dev/null @@ -1,54 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_putty/postsolve.gms - - -*** calculation of FE Buildings Prices (useful for internal use and reporting purposes) -pm_FEPrice(ttot,regi,entyFE,"build",emiMkt)$(abs (qm_budget.m(ttot,regi)) gt sm_eps) = - q36_demFeBuild.m(ttot,regi,entyFE,emiMkt) / qm_budget.m(ttot,regi); - -p36_fePrice(t,regi_dyn36(regi),entyFe)=pm_FEPrice(t,regi,entyFE,"build","ES"); - -loop (se2fe(entySe,entyFe,te), -p36_fePrice(t,regi_dyn36(regi),entyFe)$(abs (qm_budget.m(t,regi)) gt sm_eps) = abs ( qm_balFe.m(t,regi,entySe,entyFe,te)) / abs (qm_budget.m(t,regi)); -); -p36_fePrice_iter(iteration,t,regi_dyn36(regi),entyFe)$p36_fePrice(t,regi,entyFe) = - p36_fePrice(t,regi,entyFe); - -*** To compute the capital price, take the CES derivative and substract the depreciation rate -loop(cesOut2cesIn(out,in) $ (sameAs(out,"inco") - AND sameAs(in,"kap")), -p36_kapPrice(t,regi_dyn36(regi)) = - pm_cesdata(t,regi,in,"xi") - * pm_cesdata(t,regi,in,"eff") - * vm_effGr.l(t,regi,in) - - * (vm_cesIO.l(t,regi,out) - + vm_cesIOdelta.l(t,regi,out)$( ipf_putty(out)) - ) - ** (1 - pm_cesdata(t,regi,out,"rho")) - - * ( pm_cesdata(t,regi,in,"eff") - * vm_effGr.l(t,regi,in) - * (vm_cesIO.l(t,regi,in)$( NOT ipf_putty(out)) - + vm_cesIOdelta.l(t,regi,in)$( ipf_putty(out)) - ) - ) - ** (pm_cesdata(t,regi,out,"rho") - 1) - - - pm_delta_kap(regi,"kap"); -); - - -p36_demUEtotal(t,regi_dyn36(regi),in)$(p36_demUEtotal(t,regi,in) AND ( NOT t36_hist(t))) = vm_cesIO.L(t,regi,in) + pm_cesdata(t,regi,in,"offset_quantity") ; - -p36_prodEs_iter(iteration,t,regi,enty,esty,teEs) = - v36_prodEs.l(t,regi,enty,esty,teEs); -p36_deltaProdEs_iter(iteration,t,regi,enty,esty,teEs) = - v36_deltaProdEs.l(t,regi,enty,esty,teEs); - -*** EOF ./modules/36_buildings/services_putty/postsolve.gms diff --git a/modules/36_buildings/services_putty/preloop.gms b/modules/36_buildings/services_putty/preloop.gms deleted file mode 100644 index ebf291866..000000000 --- a/modules/36_buildings/services_putty/preloop.gms +++ /dev/null @@ -1,93 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_putty/preloop.gms - -v36_floorspace_delta.lo(tall,all_regi) = 1e-6; - -if( (cm_startyear gt 2005), - Execute_Loadpoint 'input_ref' p36_floorspace_delta_gdx = v36_floorspace_delta.L; - v36_floorspace_delta.fx(ttot,regi)$( (ttot.val ge 2005) and (ttot.val lt cm_startyear)) = p36_floorspace_delta_gdx(ttot,regi); -); - -s36_switch_floor = 1; - -model putty_paths_floor / -q36_pathConstraint -q36_putty_obj -/; - - - -if (execError > 0, - execute_unload "abort.gdx"; - abort "at least one execution error occured, abort.gdx written"; -); - -solve putty_paths_floor minimizing v36_putty_obj using nlp; - -if ( NOT ( putty_paths_floor.solvestat eq 1 AND (putty_paths_floor.modelstat eq 1 OR putty_paths_floor.modelstat eq 2)), - execute_unload "abort.gdx"; - abort "model putty_paths_floor is infeasible"; -); - -p36_floorspace_delta(ttot,regi_dyn36(regi)) $ v36_floorspace_delta.L(ttot,regi) = v36_floorspace_delta.L(ttot,regi); - -s36_switch_floor = 0; - - -*** Vintage initialisation -v36_prodEs.lo(ttot,regi,fe2es_dyn36(enty,esty,teEs)) = 0; -v36_deltaProdEs.lo(ttot,regi,fe2es_dyn36(enty,esty,teEs)) = 0; -v36_vintageInfes.lo(ttot,regi,fe2es_dyn36(enty,esty,teEs)) = 0; - - -s36_vintage_calib = 1; -v36_logitInfes.fx(ttot,regi_dyn36(regi),inViaEs_dyn36(in)) = 0; -v36_prodEs.fx(t36_hist(ttot),regi_dyn36(regi), fe2es_dyn36(entyFe,esty,teEs)) - = p36_prodEs(ttot,regi,entyFe,esty,teEs); - -model vintage_36 / -q36_ueTech2Total -q36_cap -q36_vintage_obj -/; - -if (execError > 0, - execute_unload "abort.gdx"; - abort "at least one execution error occured, abort.gdx written"; -); - -solve vintage_36 minimizing v36_vintage_obj using nlp; - -if ( NOT ( vintage_36.solvestat eq 1 AND (vintage_36.modelstat eq 1 OR vintage_36.modelstat eq 2)), -abort "model vintage_36 is infeasible"; -); - -p36_prodUEintern(t36_hist(ttot),regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) - = v36_deltaProdEs.L(ttot,regi,enty,esty,teEs); - -p36_deltaProdEs(ttot,regi,enty,esty,teEs) = v36_deltaProdEs.L(ttot,regi,enty,esty,teEs); - -s36_vintage_calib = 0; - - -*** Define model for logit shares -model logit_36 / -q36_ueTech2Total -q36_cap -q36_shares_obj -q36_budget -/ -; -*** The value of the capital price cannot be set in datainput as in calibration runs, pm_cesdata is computed in preloop.gms of module 29 -p36_kapPrice(t,regi_dyn36(regi)) = pm_cesdata(t,regi,"kap","price") - pm_delta_kap(regi,"kap"); -loop (fe2ces_dyn36(entyFe,esty,teEs,in), -p36_kapPriceImplicit(t,regi_dyn36(regi),teEs) = p36_kapPrice(t,regi) + p36_implicitDiscRateMarg(t,regi,in); -); - -*** EOF ./modules/36_buildings/services_putty/preloop.gms - diff --git a/modules/36_buildings/services_putty/presolve.gms b/modules/36_buildings/services_putty/presolve.gms deleted file mode 100644 index 4096c7378..000000000 --- a/modules/36_buildings/services_putty/presolve.gms +++ /dev/null @@ -1,358 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_putty/presolve.gms - -*** For the first iterations, avoid very high prices because of numerical reasons -if (ord(iteration) le 8, - - loop ((t,regi_dyn36(regi)), - sm_tmp = smax(fe2ces_dyn36(entyFe,esty,teEs,in), p36_fePrice(t,regi,entyFe)); - if (sm_tmp gt 3, - p36_fePrice(t,regi,entyFe) = max(0.01, - p36_fePrice(t,regi,entyFe) / sm_tmp * 3 - ); - - - ); - ); -); - - -*** Take average price over previous iterations -if (ord(iteration) ge 5, -p36_fePrice(t,regi_dyn36(regi),entyFe) $ p36_fePrice(t,regi,entyFe)= - ( p36_fePrice_iter(iteration - 1,t,regi,entyFe) - + p36_fePrice_iter(iteration - 2,t,regi,entyFe) - + p36_fePrice_iter(iteration - 3,t,regi,entyFe) - + p36_fePrice_iter(iteration - 4,t,regi,entyFe) - ) - / 4; -); -*** Beyond the 70th iteration, the prices are averaged over the prices since the 66th iteration -if (ord(iteration) ge 70, - -p36_fePrice(t,regi_dyn36(regi),entyFe) = - sum(iteration2 $ (ord(iteration2) ge 66 - AND ord(iteration2) lt ord(iteration)), - p36_fePrice_iter(iteration2,t,regi,entyFe) - ) - / - sum(iteration2 $ (ord(iteration2) ge 66 - AND ord(iteration2) lt ord(iteration)), - 1 - ) - ; - -); -*** smooth the costs - -*** Smooth 2005 prices -$offOrder -p36_kapPrice(t,regi_dyn36(regi))$(ord(t) eq 1) - = ( p36_kapPrice(t+1,regi) * 2 - + p36_kapPrice(t+2,regi) - ) - / 3; - -p36_fePrice(t,regi_dyn36(regi),entyFe)$(ord(t) eq 1) - = ( p36_fePrice(t+1,regi,entyFe) * 2 - + p36_fePrice(t+2,regi,entyFe) - ) - / 3; -$onOrder -*** Smooth non 2005 prices with moving average -$OFForder -loop (t$ ( not ((ord(t) le 1) or (ord(t) eq card(t)))), -p36_kapPrice(t,regi_dyn36(regi)) = - ( p36_kapPrice(t-1,regi) - + p36_kapPrice(t,regi) - + p36_kapPrice(t+1,regi) - ) / 3 ; - -p36_fePrice(t,regi_dyn36(regi),entyFe) = - (p36_fePrice(t-1,regi,entyFe) - + p36_fePrice(t,regi,entyFe) - + p36_fePrice(t+1,regi,entyFe) - ) / 3; - -); -$ONorder - -*** Can you explain again the purpose of adding an implicit discount rate to the capital cost of fe2ue techs? -*** Is p36_costReduc(t,teEs) assuming some exogenous learning? -loop (fe2ces_dyn36(entyFe,esty,teEs,in), -p36_kapPriceImplicit(t,regi_dyn36(regi),teEs) = p36_kapPrice(t,regi) + p36_implicitDiscRateMarg(t,regi,in); -); - - p36_esCapCost(t,regi_dyn36(regi),teEs_dyn36(teEs)) = - (f36_datafecostsglob("inco0",teEs) - * p36_costReduc(t,teEs) - * p36_kapPrice(t,regi) / (1 - (1 + p36_kapPrice(t,regi))** (-f36_datafecostsglob("lifetime",teEs))) !! annualised initial capital costs - + f36_datafecostsglob("omf",teEs) - ) - / f36_datafecostsglob("usehr",teEs) !! from T$/TW to T$/TWh - * sm_day_2_hour * sm_year_2_day !! from T$/TWh to T$/TWa - ; - - p36_esCapCostImplicit(t,regi_dyn36(regi),teEs_dyn36(teEs)) = - (f36_datafecostsglob("inco0",teEs) - * p36_costReduc(t,teEs) - * p36_kapPriceImplicit(t,regi,teEs) / (1 - (1 + p36_kapPriceImplicit(t,regi,teEs))** (-f36_datafecostsglob("lifetime",teEs))) !! annualised initial capital costs - + f36_datafecostsglob("omf",teEs) - ) - / f36_datafecostsglob("usehr",teEs) !! from T$/TW to T$/TWh - * sm_day_2_hour * sm_year_2_day !! from T$/TWh to T$/TWa - ; - -p36_inconvpen(t,regi_dyn36(regi),teEs)$f36_inconvpen(teEs) = - (1 - - min(max((20 - (vm_cesIO.L(t,regi,"inco")$( NOT sameAs(iteration,"1")) - +pm_gdp(t,regi)$ sameAs(iteration,"1")) / pm_shPPPMER(regi) - / pm_pop(t,regi)) - /(20 - 3),0),1) !! (1-lambda) = 0 if gdppop < 3000, 1 if gdppop >= 20000 - ) - * f36_inconvpen(teEs) ; - -loop ( (fe2es_dyn36(entyFe,esty,teEs)), -p36_techCosts(t,regi_dyn36(regi),entyFe,esty,teEs) = - p36_esCapCostImplicit(t,regi,teEs) - + - (p36_fePrice(t,regi,entyFe) - + p36_inconvpen(t,regi,teEs)) - / pm_fe2es(t,regi,teEs) - !! add taxes, subsidies, and later on costs - ; -); - -p36_techCosts_iter(iteration,t,regi,entyFe,esty,teEs) = - p36_techCosts(t,regi,entyFe,esty,teEs); - -*** Compute the share of UE for each technology that is needed to get the aggregate technological distribution observed -loop ((t36_hist(ttot),fe2ces_dyn36(entyFe,esty,teEs,in)), -p36_shUeCesDelta(ttot,regi_dyn36(regi),entyFe,in,teEs) - = p36_prodUEintern(ttot,regi,entyFe,esty,teEs) - / sum ( fe2ces_dyn36_2(entyFe2,esty2,teEs2,in), - p36_prodUEintern(ttot,regi,entyFe2,esty2,teEs2) - ) - ; - - loop (regi_dyn36(regi), - if ( p36_shUeCesDelta(ttot,regi,entyFe,in,teEs) lt 0, - put testfile; - put p36_shUeCesDelta.tn(ttot,regi,entyFe,in,teEs) , " = ", p36_shUeCesDelta(ttot,regi,entyFe,in,teEs) /; - put p36_demUEtotal.tn(ttot,regi,in) , " = ", p36_demUEtotal(ttot,regi,in) /; - put p36_prodEs.tn(ttot,regi,entyFe,esty,teEs) , " = ", p36_prodEs(ttot,regi,entyFe,esty,teEs) /; - put p36_prodUEintern.tn(ttot,regi,entyFe,esty,teEs), " = ", p36_prodUEintern(ttot,regi,entyFe,esty,teEs) /; - putclose; - execute_unload "abort.gdx"; - abort "some share was decreasing faster than planned. Look at the logfile for more information"; - ); - ); -); - -*** Compute the calibration factors for the historical periods -loop ((t36_hist(ttot),fe2ces_dyn36(entyFe,esty,teEs,in)), -p36_logitCalibration(ttot,regi_dyn36(regi),entyFe,esty,teEs) $ p36_shUeCesDelta(ttot,regi,entyFe,in,teEs) !! exclude shares which are zero - = - (1 / (p36_logitLambda(regi,in)) - * log ( p36_shUeCesDelta(ttot,regi,entyFe,in,teEs)) - - p36_techCosts(ttot,regi,entyFe,esty,teEs) - ) - - - (1 - / sum (fe2ces_dyn36_2(entyFe2,esty2,teEs2,in)$ p36_shUeCesDelta(ttot,regi,entyFe2,in,teEs2), - 1) - ) - * sum (fe2ces_dyn36_2(entyFe2,esty2,teEs2,in)$ p36_shUeCesDelta(ttot,regi,entyFe2,in,teEs2), !! exclude shares which are zero - 1 / ( p36_logitLambda(regi,in)) - * log ( p36_shUeCesDelta(ttot,regi,entyFe2,in,teEs2)) - - p36_techCosts(ttot,regi,entyFe2,esty2,teEs2) - ); - -); - -*** For the last historical period, attribute the last historical value of the calibration parameter to the scenario periods -*** The calibration factors are reduced towards 80% in the long term to represent the enhanced flexibility of the system -*** Long lasting non-price barriers should preferably be represented through price mark-ups -loop ( t36_hist_last(ttot), - p36_logitCalibration(ttot,regi_dyn36(regi),entyFe,esty,teEs) $ ( fe2es_dyn36(entyFe,esty,teEs) - AND NOT p36_logitCalibration(ttot,regi,entyFe,esty,teEs)) - = 5; - - loop ( t36_scen(t2), - - p36_logitCalibration(t2,regi_dyn36(regi),entyFe,esty,teEs) $ fe2es_dyn36(entyFe,esty,teEs) - = min(max((2040 - pm_ttot_val(t2))/(2040 -ttot.val),0),1) !! lambda = 1 in 2015 and 0 in 2040 - * (p36_logitCalibration(ttot,regi,entyFe,esty,teEs) - - cm_logitCal_markup_conv_b * p36_logitCalibration(ttot,regi,entyFe,esty,teEs)) - + cm_logitCal_markup_conv_b * p36_logitCalibration(ttot,regi,entyFe,esty,teEs) - ; - - !! give a high parameter value to the technologies that do not have some - p36_logitCalibration(t2,regi_dyn36(regi),entyFe,esty,teEs) $ (fe2es_dyn36(entyFe,esty,teEs) - AND NOT p36_logitCalibration(t2,regi,entyFe,esty,teEs)) - = min(max((2040 - pm_ttot_val(t2))/(2040 -ttot.val),0),1) !! lambda = 1 in 2015 and 0 in 2040 - * (3 - - cm_logitCal_markup_newtech_conv_b * 3) - + cm_logitCal_markup_newtech_conv_b * 3; - - !! Decrease the calibration factor for some technologies, based on the difference between the 2015 (ttot) Income per capita and scenario (t2) income per capita. - !! the calibration factor decreases by 90% when income reaches 30 k$ if income per capita was equal or below 5 k$ in 2015. - !! the decrease is lower if the starting income was above 10k$ and is 0 if income was above 30k$ - p36_logitCalibration(t2,regi_dyn36(regi),entyFe,esty,teEs) $ richTechs(teEs) = !! calib = calib * (1 - 0.90 * X) - p36_logitCalibration(ttot,regi,entyFe,esty,teEs) - * (1 - 0.90 - * (( max ( 5, min (30, (vm_cesIO.L(t2,regi,"inco")$( NOT sameAs(iteration,"1")) + pm_gdp(t2,regi)$ sameAs(iteration,"1")) / pm_shPPPMER(regi) / pm_pop(t2,regi) )) - - min (30, max (5, (vm_cesIO.L(ttot,regi,"inco")$( NOT sameAs(iteration,"1")) + pm_gdp(ttot,regi)$ sameAs(iteration,"1")) / pm_shPPPMER(regi) / pm_pop(ttot,regi) )) - ) - / (30 -5)) - ) - ; - - p36_logitCalibration(t2,regi_dyn36(regi),entyFe,esty,teEs) $ (fe2es_dyn36(entyFe,esty,teEs) AND teEs_pushCalib_dyn36(teEs)) = - p36_pushCalib(t2,teEs) - * p36_logitCalibration(t2,regi,entyFe,esty,teEs) - ; -); -); - -option - limrow = 10000000 - limcol = 10000000 - solprint = on -; - -s36_logit = 1; -if (execError > 0, - execute_unload "abort.gdx"; - abort "at least one execution error occured, abort.gdx written"; -); - -solve logit_36 maximizing v36_shares_obj using nlp; -s36_logit = 0; - -option - limrow = 0 - limcol = 0 - solprint = off -; - -if ( NOT ( logit_36.solvestat eq 1 AND (logit_36.modelstat eq 1 OR logit_36.modelstat eq 2)), -abort "model logit_36 is infeasible"; -); - -*** Compute the aggregate UE shares -loop (fe2ces_dyn36(entyFe,esty,teEs,in), - p36_shUeCes(t,regi_dyn36(regi),entyFe,in,teEs) - = v36_prodEs.L(t,regi,entyFe,esty,teEs) - / p36_demUEtotal(t,regi,in); -); - - -*** Set 1e-3 as a lower bound for shares -p36_shUeCes(ttot,regi_dyn36(regi),entyFe,in,teEs) $ ( t36_scen(ttot) - AND p36_shUeCes(ttot,regi,entyFe,in,teEs) lt 1e-3) - = 0 - ; -p36_shUeCes(ttot,regi_dyn36(regi),entyFe,in,teEs) $ ( t36_scen(ttot) - AND feteces_dyn36(entyFe,teEs,in) - ) - = p36_shUeCes(ttot,regi,entyFe,in,teEs) - / sum( feteces_dyn36_2(entyFe2,teEs2,in), - p36_shUeCes(ttot,regi,entyFe2,in,teEs2)) - ; - -*** Compute FE shares -p36_shFeCes(t,regi_dyn36(regi),entyFe,in,teEs)$feteces_dyn36(entyFe,teEs,in) - = (1 / p36_fe2es(t,regi,teEs)) - / sum ( (fe2ces_dyn36(entyFe2,esty2,teEs2,in)), - (1 / p36_fe2es(t,regi,teEs2)) - * p36_shUeCes(t,regi,entyFe2,in,teEs2) - ) - * p36_shUeCes(t,regi,entyFe,in,teEs) - ; - -p36_shFeCes_iter(iteration,t,regi,entyFe,in,teEs) = - p36_shFeCes(t,regi,entyFe,in,teEs); - -*** Pass on to core parameters -loop (fe2ces_dyn36(entyFe,esty,teEs,in), -pm_shFeCes(t,regi_dyn36(regi),entyFe,in,teEs)$( NOT t0(t)) - = p36_shFeCes(t,regi,entyFe,in,teEs); -); -pm_esCapCost(t,regi_dyn36(regi),teEs_dyn36(teEs)) - = p36_esCapCost(t,regi,teEs); - - -*** Diagnostics -*** Compute the norm of the difference between the share vectors of two iterations -p36_shUeCes_iter(iteration,t,regi,entyFe,in,teEs) - = p36_shUeCes(t,regi,entyFe,in,teEs) ; -if ( ord(iteration) gt 1, -loop ((t,regi_dyn36(regi),inViaEs_dyn36(in)), -p36_logitNorm(iteration,t,regi,in) = sqrt ( - sum (fe2ces_dyn36(entyFe,esty,teEs,in) , - power ( p36_shUeCes_iter(iteration,t,regi,entyFe,in,teEs) - - p36_shUeCes_iter(iteration - 1,t,regi,entyFe,in,teEs), - 2) - ) - ) -; -) -); - -*** Reporting -put file_logit_buildings; -put "scenario", "iteration", "period", "region", "variable", "tech", "ces_out", "value" /; - -*** Report on the historical shares - - loop (t36_hist(ttot), - loop (regi_dyn36(regi), - loop (fe2ces_dyn36(entyFe,esty,teEs,in), - - put "%c_expname%", "target", ttot.tl, regi.tl, "shareFE", teEs.tl, in.tl, p36_shFeCes(ttot,regi,entyFe,in,teEs) /; - - ); - ); - ); - -loop ((t,regi_dyn36(regi),fe2ces_dyn36(entyFe,esty,teEs,in)), -put "%c_expname%", iteration.tl, t.tl,regi.tl, "shareFE", teEs.tl, in.tl, p36_shFeCes(t,regi,entyFe,in,teEs) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "shareUE", teEs.tl, in.tl, p36_shUeCes(t,regi,entyFe,in,teEs) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "cost", teEs.tl, in.tl, (p36_techCosts(t,regi,entyFe,esty,teEs) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "calibfactor", teEs.tl, in.tl, (p36_logitCalibration(t,regi,entyFe,esty,teEs)* 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "FEpriceWoTax", teEs.tl, in.tl, (p36_fePrice(t,regi,entyFe) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "OM", teEs.tl, in.tl, ((p36_fePrice(t,regi,entyFe) - + p36_inconvpen(t,regi,teEs) - ) - / pm_fe2es(t,regi,teEs) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "OM_FEpriceWtax", teEs.tl, in.tl, ( - (p36_fePrice(t,regi,entyFe) - ) - / pm_fe2es(t,regi,teEs) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "OM_inconvenience", teEs.tl, in.tl, (( - p36_inconvpen(t,regi,teEs) - ) - / pm_fe2es(t,regi,teEs) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "FEpriceTax", teEs.tl, in.tl, ((p36_fePrice(t,regi,entyFe) - ) - * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "CapCosts", teEs.tl, in.tl, (p36_esCapCost(t,regi,teEs) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "CapCostsImplicit", teEs.tl, in.tl, (p36_esCapCostImplicit(t,regi,teEs) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -); - -if ( ord(iteration) gt 1, -loop ((t,regi_dyn36(regi),inViaEs_dyn36(in)), -put "%c_expname%", iteration.tl, t.tl,regi.tl, "norm_diff", "NA" ,in.tl, p36_logitNorm(iteration,t,regi,in) /; -); -); - -putclose; - -*** EOF ./modules/36_buildings/services_putty/presolve.gms - diff --git a/modules/36_buildings/services_putty/realization.gms b/modules/36_buildings/services_putty/realization.gms deleted file mode 100644 index 1e7feb29d..000000000 --- a/modules/36_buildings/services_putty/realization.gms +++ /dev/null @@ -1,36 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_putty/realization.gms - -*' @description -*' -*'The `services_putty` realization splits the representation of buildings energy demand between the CES structure -*' and a multinomial logit structure which distributes the demand across technologies. -*' Importantly, the realization distinguishes across four end-use categories (`appliances and lighting`, `water heating and cooking`, -*' `space cooling` and `space cooling` ). -*' Not only the demand for final energy is represented, but also the demand for useful energy, which is necessary to display the level of efficiency achieved. -*' In total, six energy carrier categories are included (electricity, solids, liquids, gas, district heating, hydrogen), spread across the various end-uses. -*' -*' The model can decide to invest in end-use capital (insulation, appliances, space cooling) to reduce the energy demand, -*' or it can switch to more efficient technologies to produce heat. -*' The conversion efficiencies of the individual heat technologies is prescribed exogenously however. -*' -*' In addition, inertia dynamics are integrated through a putty-clay representation. -*' In each time step, the model can only improve the efficiency of a portion of the building stock. - - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/36_buildings/services_putty/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/36_buildings/services_putty/declarations.gms" -$Ifi "%phase%" == "datainput" $include "./modules/36_buildings/services_putty/datainput.gms" -$Ifi "%phase%" == "equations" $include "./modules/36_buildings/services_putty/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/36_buildings/services_putty/preloop.gms" -$Ifi "%phase%" == "bounds" $include "./modules/36_buildings/services_putty/bounds.gms" -$Ifi "%phase%" == "presolve" $include "./modules/36_buildings/services_putty/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/36_buildings/services_putty/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### -*** EOF ./modules/36_buildings/services_putty/realization.gms diff --git a/modules/36_buildings/services_putty/sets.gms b/modules/36_buildings/services_putty/sets.gms deleted file mode 100644 index df45f6e7b..000000000 --- a/modules/36_buildings/services_putty/sets.gms +++ /dev/null @@ -1,277 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_putty/sets.gms -Sets - regi_dyn36(all_regi) "dynamic region set for compatibility with testOneRegi" - regi_dyn36_cooling(all_regi) "regions with high cooling on which we impose efficiency constraint" - teEs_dyn36(all_teEs) "technologies - buildings module additions" - / - te_ueshheb "buildings space heating district heat" - te_ueshhob "buildings space heating liquids" - te_ueshsob "buildings space heating solids" - te_ueshstb "buildings space heating traditional solids (trad biomass + coal)" - te_ueshgab "buildings space heating district heat" - te_ueshh2b "buildings space heating hydrogen" - te_ueshelb "buildings space heating electricity resistance" - te_ueshhpb "buildings space heating electricity heat pump" - - te_uecwhob "buildings cooking and water heating liquids" - te_uecwsob "buildings cooking and water heating solids" - te_uecwstb "buildings cooking and water heating traditional solids" - te_uecwgab "buildings cooking and water heating gas" - te_uecwheb "buildings cooking and water heating district heat" - te_uecwh2b "buildings cooking and water heating hydrogen" - te_uecwelb "buildings cooking and water heating electricity" - te_uecwhpb "buildings cooking and water heating heat pump" - - / - - esty_dyn36(all_esty) "Energy service types" - / - ueshheb "buildings space heating district heat" - ueshhob "buildings space heating liquids" - ueshsob "buildings space heating solids" - ueshstb "buildings space heating traditional solids" - ueshgab "buildings space heating district heat" - ueshh2b "buildings space heating hydrogen" - ueshelb "buildings space heating electricity resistance" - ueshhpb "buildings space heating electricity heat pump" - - uecwhob "buildings cooking and water heating liquids" - uecwsob "buildings cooking and water heating solids" - uecwstb "buildings cooking and water heating traditional solids" - uecwgab "buildings cooking and water heating gas" - uecwheb "buildings cooking and water heating district heat" - uecwh2b "buildings cooking and water heating hydrogen" - uecwelb "buildings cooking and water heating electricity" - uecwhpb "buildings cooking and water heating heat pump" - / - - - in_buildings_dyn36(all_in) "all inputs and outputs of the CES function - buildings" - / - enb "buildings energy use" - - esswb "buildings weatherization energy service" - - uealb "buildings appliances and light" - uecwb "buildings cooking and water heating" - ueswb "buildings weatherization" - uescb "buildings cooling" - ueshb "buildings heating" - - fescelb "buildings space cooling electricity" - - fealelb "buildings appliances and light electricity" - - kaphc "buildings capital stock insulation" - kapsc "buildings capital stock space cooling" - kapal "buildings capital stock appliances and light" - - / - - es2ppfen_dyn36(all_esty,all_in) "matching FE to ppfEn in MACRO" -/ - ueshheb.ueshb - ueshhob.ueshb - ueshsob.ueshb - ueshstb.ueshb - ueshgab.ueshb - ueshh2b.ueshb - ueshelb.ueshb - ueshhpb.ueshb - - uecwhob.uecwb - uecwsob.uecwb - uecwstb.uecwb - uecwgab.uecwb - uecwheb.uecwb - uecwh2b.uecwb - uecwelb.uecwb - uecwhpb.uecwb -/ - -fe2es_dyn36(all_enty,all_esty,all_teEs) "map FE carriers to ES via appliances" -/ - fehes.ueshheb.te_ueshheb - fehos.ueshhob.te_ueshhob - fesos.ueshsob.te_ueshsob - fesos.ueshstb.te_ueshstb - fegas.ueshgab.te_ueshgab - feh2s.ueshh2b.te_ueshh2b - feels.ueshelb.te_ueshelb - feels.ueshhpb.te_ueshhpb - - fehos.uecwhob.te_uecwhob - fesos.uecwsob.te_uecwsob - fesos.uecwstb.te_uecwstb - fegas.uecwgab.te_uecwgab - fehes.uecwheb.te_uecwheb - feh2s.uecwh2b.te_uecwh2b - feels.uecwelb.te_uecwelb - feels.uecwhpb.te_uecwhpb -/ - -buildMoBio36 (all_esty) "modern biomass in buildings" -/ -ueshsob -uecwsob -/ - - fe2ces_dyn36(all_enty,all_esty,all_teEs,all_in) "map FE carriers to CES via appliances" -// -feteces_dyn36(all_enty,all_teEs,all_in) "map FE carriers to CES without esty" -// - - -inViaEs_dyn36(all_in) "CES inputs which are provided throught the ES pathway" - - in_putty_dyn36(all_in) "putty in for buildings" - / - esswb - kaphc - ueswb - / - - ppf_putty_dyn36(all_in) "putty ppf for buildigs" - / - kaphc - ueswb - / - - in_complements_dyn36(all_in) "in complements" - / - uescb - ueshb - / - - nests_putty_dyn36(all_in,all_in) "putty nests" - / - esswb.( esswb,kaphc,ueswb) - / - - - ppfKap_dyn36(all_in) "Capital primary production factors" - / - kaphc - kapsc - kapal - / - - ppfen_buildings_dyn36(all_in) "primary production factors energy - buildings" - / - ueshb - uecwb - fescelb - fealelb - / - - cal_ppf_buildings_dyn36(all_in) "primary production factors - buildings - used for the calibration" - / uescb, ueshb, uealb, uecwb, kaphc/ - - ue_dyn36(all_in) "useful energy items" - /uescb, ueshb, uealb, uecwb/ - - ces_buildings_dyn36(all_in,all_in) "CES tree structure - buildings" - / - en . enb - enb . (esswb, uealb, uecwb) - esswb . (ueswb,kaphc) - ueswb . (uescb,ueshb) - uescb . (fescelb,kapsc) - - uealb . (fealelb,kapal) - - / - - fe2ppfEn36(all_enty,all_in) "match ESM entyFe to ppfEn" - / - feels . (fescelb,fealelb) - / - - fe_tax_sub36(all_in,all_in) "correspondence between tax and subsidy input data resolution and model sectoral resolution" - / - feelb . (fealelb,fescelb) - / - - in_enerSerAdj_dyn36(all_in) "Energy services input to be adjusted" - / - esswb - fescelb - / - - mapElHp(all_teEs,all_teEs) "correspondence between electric resistance technology and heat pump technology" - / - te_uecwelb. te_uecwhpb - te_ueshelb. te_ueshhpb - / - - richTechs(all_teEs) "technologies whose calibration decreases with income " - / - te_ueshgab - te_uecwgab - / - - t36_hist(ttot) "historic time steps" - t36_hist_last(ttot) "last historic time step" - t36_scen(ttot) "non historical scenario time step" - - teEs_pushCalib_dyn36(all_teEs) "technologies for which the Logit parameter should be modified" - - opTimeYr2teEs(all_teEs,opTimeYr) "mapping for technologies to yearly lifetime - is filled automatically from the lifetime values of technologies" -; - -loop ( fe2es_dyn36(all_enty,all_esty,all_teEs), - loop ( es2ppfen_dyn36(all_esty,all_in), - fe2ces_dyn36(all_enty,all_esty,all_teEs,all_in) = YES; - inViaEs_dyn36(all_in) = YES; - feteces_dyn36(all_enty,all_teEs,all_in) = YES; - ) - ); - - - alias (fe2ces_dyn36,fe2ces_dyn36_2); - alias (fe2es_dyn36, fe2es_dyn36_2); - alias (feteces_dyn36, feteces_dyn36_2); - - -t36_hist(ttot) = NO; -t36_hist(ttot)$(sameAs(ttot,"2005") OR sameAs(ttot,"2010") OR sameAs(ttot,"2015")) = YES; - -t36_scen(ttot) = NO; -t36_scen(ttot)$t(ttot) = YES; -t36_scen(ttot)$t36_hist(ttot) = NO; - -$offOrder - t36_hist_last(ttot) = NO; - t36_hist_last(t36_hist)$(ord(t36_hist) eq card(t36_hist)) = YES; -$offOrder - -teEs_pushCalib_dyn36(all_teEs) = NO; -regi_dyn36_cooling(all_regi) = NO; -***------------------------------------------------------------------------- -*** add module specific sets and mappings to the global sets and mappings -***------------------------------------------------------------------------- -ppfKap(ppfKap_dyn36) = YES; -in(in_buildings_dyn36) = YES; -ppfEn(ppfen_buildings_dyn36) = YES; -cesOut2cesIn(ces_buildings_dyn36) = YES; -fe2ppfEn(fe2ppfEn36) = YES; -in_putty(in_putty_dyn36) = YES; -ppf_putty(ppf_putty_dyn36) = YES; -in_complements(in_complements_dyn36) = YES; -in_enerSerAdj(in_enerSerAdj_dyn36) = YES; -nests_putty(nests_putty_dyn36) = YES; -fe_tax_sub_sbi(fe_tax_sub36) = YES; - -buildMoBio(buildMoBio36) = YES; - -teEs(teEs_dyn36) = YES; -esty(esty_dyn36) = YES; -fe2es(fe2es_dyn36) = YES; -es2ppfen(es2ppfen_dyn36) = YES; -*** EOF ./modules/36_buildings/services_putty/sets.gms diff --git a/modules/36_buildings/services_with_capital/bounds.gms b/modules/36_buildings/services_with_capital/bounds.gms deleted file mode 100644 index b82c2b603..000000000 --- a/modules/36_buildings/services_with_capital/bounds.gms +++ /dev/null @@ -1,46 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_with_capital/bounds.gms -if ((cm_noReboundEffect eq 1 ), !! Fix the upper bound of vm_cesIO to the level of input_ref if no rebound is allowed - vm_cesIO.up(t,regi,in)$(sameAs(in,"esswb") OR sameAs(in,"uealb") OR sameAs(in,"uecwb")) = (1 + 1e-14) * p36_cesIONoRebound(t,regi,in); - vm_cesIO.lo(t,regi,in)$( sameAs(in,"esswb") - OR sameAs(in,"uealb") - OR sameAs(in,"uecwb") ) - = max( - (1 - 1e-14) * p36_cesIONoRebound(t,regi,in), - abs(pm_cesdata(t,regi,in,"offset_quantity")) - ); -); - - -loop (t36_hist_last(ttot2) , - v36_deltaProdEs.lo(ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) $ ( - ttot.val le ttot2.val) - = max ( 0, - p36_deltaProdEs(ttot,regi,enty,esty,teEs) - -1e-6 - ) - ; - v36_deltaProdEs.up(ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) $ ( - ttot.val le ttot2.val) - = p36_deltaProdEs(ttot,regi,enty,esty,teEs) - +1e-6 - ; - ); -v36_deltaProdEs.lo(t36_scen(ttot),regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) = 1e-9; - -v36_vintageInfes.fx(ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) $( - v36_vintageInfes.L(ttot,regi,enty,esty,teEs)) - = v36_vintageInfes.L(ttot,regi,enty,esty,teEs); - -v36_vintageInfes.fx(ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) $( - NOT v36_vintageInfes.L(ttot,regi,enty,esty,teEs)) - = 0; - -v36_logitInfes.up(t,regi_dyn36(regi),inViaEs_dyn36(in)) = + INF ; - -*** EOF ./modules/36_buildings/services_with_capital/bounds.gms diff --git a/modules/36_buildings/services_with_capital/datainput.gms b/modules/36_buildings/services_with_capital/datainput.gms deleted file mode 100644 index b9c1d5434..000000000 --- a/modules/36_buildings/services_with_capital/datainput.gms +++ /dev/null @@ -1,323 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_with_capital/datainput.gms -*** substitution elasticities -Parameter - p36_cesdata_sigma(all_in) "substitution elasticities" - / - enb 0.3 - esswb -1 !! The Esub is estimated with technological data - ueswb INF !! all sigma equal to INF will be treated as a sum with coefficients equal to unity ie OUT = IN1+ IN2. - uescb -1 !! The Esub is estimated with technological data - uealb -1 !! The Esub is estimated with technological data - / - -; -pm_cesdata_sigma(ttot,in)$p36_cesdata_sigma(in) = p36_cesdata_sigma(in); - -pm_capital_lifetime_exp(all_regi,"kapsc") = 20; -pm_capital_lifetime_exp(all_regi,"kapal") = 12; -*** FS: ad-hoc assume the same lifetime for insulation capital than for space cooling capital to avoid division by zero -pm_capital_lifetime_exp(all_regi,"kaphc") = 20; - -pm_capital_lifetime_exp(all_regi,"esswb") = log ( 0.25) / log ( 1 -0.02 ); - -pm_delta_kap(regi,in)$((ppfKap_dyn36(in) AND NOT in_putty(in)) OR nests_putty_dyn36(in,in)) = - log (0.25) / pm_capital_lifetime_exp(regi,in); - -loop (out, -pm_delta_kap(regi,in)$nests_putty_dyn36(out,in) = pm_delta_kap(regi,out); -); - -parameter - -p36_floorspace_scen(tall,all_regi,all_demScen) "floorspace" -/ -$ondelim -$include "./modules/36_buildings/services_with_capital/input/p36_floorspace_scen.cs4r" -$offdelim -/ -; -p36_floorspace(ttot,regi) = p36_floorspace_scen(ttot,regi,"%cm_demScen%") * 1e-3; !! from million to billion m2 - -parameter -p36_demFeForEs_scen "final energy demand projections for FE-UE technologies" -/ -$ondelim -$include "./modules/36_buildings/services_with_capital/input/p36_serviceInputs.cs4r" -$offdelim -/ - -p36_prodEs_scen "useful energy demand projections for FE-UE technologies" -/ -$ondelim -$include "./modules/36_buildings/services_with_capital/input/p36_serviceOutputs.cs4r" -$offdelim -/ -; - -table f36_datafecostsglob(char,all_teEs) "end-use (final energy) technologies characteristics" -$include "./modules/36_buildings/services_with_capital/input/generisdata_feCapCosts.prn" -; - - f36_datafecostsglob("inco0",teEs) = sm_D2015_2_D2005 * f36_datafecostsglob("inco0",teEs); - f36_datafecostsglob("inco0",teEs) = sm_DpKW_2_TDpTW * f36_datafecostsglob("inco0",teEs); - f36_datafecostsglob("omf",teEs) = sm_D2015_2_D2005 * f36_datafecostsglob("omf",teEs); - f36_datafecostsglob("omf",teEs) = sm_DpKW_2_TDpTW * f36_datafecostsglob("omf",teEs); - -table f36_dataeff(char,all_teEs) "end-use (final energy) long term efficiency assumptions" -$include "./modules/36_buildings/services_with_capital/input/generisdata_Eff.prn" -; - -p36_demFeForEs(ttot,regi,entyFe,esty,teEs)$fe2es_dyn36(entyFe,esty,teEs) = p36_demFeForEs_scen(ttot,regi,"%cm_GDPscen%",entyFe,esty,teEs) * sm_EJ_2_TWa; !! from EJ to TWa; -p36_prodEs(ttot,regi,entyFe,esty,teEs)$fe2es_dyn36(entyFe,esty,teEs) = p36_prodEs_scen(ttot,regi,"%cm_GDPscen%",entyFe,esty,teEs) * sm_EJ_2_TWa; !! from EJ to TWa; - - -***_____________________________Information for the ES layer and the multinomial logit function _____________________________ -*** Price sensitivity of the logit function -p36_logitLambda(regi,in)$inViaEs_dyn36(in) = cm_priceSensiBuild; - -*** Compute efficiencies of technologies producing ES(UE) from FE -loop ( fe2es_dyn36(entyFe,esty,teEs), -p36_fe2es(ttot,regi,teEs)$p36_demFeForEs(ttot,regi,entyFe,esty,teEs) = p36_prodEs(ttot,regi,entyFe,esty,teEs) / p36_demFeForEs(ttot,regi,entyFe,esty,teEs); -); - -p36_fe2es(ttot,regi,teEs)$(teEs_dyn36(teEs) AND ( NOT p36_fe2es(ttot,regi,teEs))) = 0.5; -p36_fe2es(ttot,regi,teEs)$(sameAs(teEs, "te_ueshhpb") OR sameAs(teEs,"te_uecwhpb")) = 3; - -*** Compute share of heat pumps based on the efficiency of electricity -loop (mapElHp(teEs,teEs2), !!teEs= electric resistance. teEs2= heat pump -loop (fe2es_dyn36(entyFe,esty,teEs), -loop (fe2es_dyn36_2(entyFe,esty2,teEs2), -sm_tmp = 0.9; !! maximum assumed efficiency of electric resistance -p36_demFeForEs(ttot,regi,entyFe,esty2,teEs2)$(p36_fe2es(ttot,regi,teEs) gt sm_tmp) - = p36_demFeForEs(ttot,regi,entyFe,esty,teEs) - * (p36_fe2es(ttot,regi,teEs) - sm_tmp) - / (p36_fe2es(ttot,regi,teEs2) -sm_tmp) - ; -p36_demFeForEs(ttot,regi,entyFe,esty,teEs) = p36_demFeForEs(ttot,regi,entyFe,esty,teEs) - - p36_demFeForEs(ttot,regi,entyFe,esty2,teEs2); - -p36_fe2es(ttot,regi,teEs)$(p36_fe2es(ttot,regi,teEs) gt sm_tmp) = sm_tmp; -); -); -); - -*** Correct the UE quantities of heat pumps and electricity in accordance -p36_prodEs(ttot,regi,entyFe,esty,teEs) = p36_demFeForEs(ttot,regi,entyFe,esty,teEs) * p36_fe2es(ttot,regi,teEs); - -if (cm_startyear gt 2005, -Execute_Loadpoint 'input_ref' p36_logitCalibration_load = p36_logitCalibration, p36_logitLambda_load = p36_logitLambda; -p36_logitCalibration(ttot,regi,enty,esty,teEs) = p36_logitCalibration_load(ttot,regi,enty,esty,teEs); -p36_logitLambda(regi,in) = p36_logitLambda_load(regi,in); -); - -*** Introduce long term assumption concerning efficiencies -loop (t36_hist_last(ttot2), - -p36_fe2es(ttot,regi,teEs)$( pm_ttot_val(ttot) gt pm_ttot_val(ttot2)) = p36_fe2es(ttot2,regi,teEs); - -p36_fe2es(ttot,regi,teEs)$f36_dataeff("eta",teEs) -= -min(max((2100 - pm_ttot_val(ttot))/(2100 -ttot2.val),0),1) !! lambda = 1 in 2015 and 0 in 2100 - * ( p36_fe2es(ttot,regi,teEs) - - f36_dataeff("eta",teEs) - ) - + f36_dataeff("eta",teEs) -; -); - -*** Compute FE shares of technologies producing ES(UE) from FE -p36_shFeCes(ttot,regi,entyFe,in,teEs)$(feViaEs2ppfen(entyFe,in,teEs) - AND teEs_dyn36(teEs) - AND sum(fe2es(entyFe2,esty,teEs2)$es2ppfen(esty,in), p36_demFeForEs(ttot,regi,entyFe2,esty,teEs2))) - = - sum(fe2es(entyFe,esty,teEs)$es2ppfen(esty,in), p36_demFeForEs(ttot,regi,entyFe,esty,teEs)) - / sum(fe2es(entyFe2,esty,teEs2)$es2ppfen(esty,in), p36_demFeForEs(ttot,regi,entyFe2,esty,teEs2)) -; - -*** Compute UE shares of technologies producing ES(UE) from FE -p36_shUeCes(ttot,regi,entyFe,in,teEs)$(feViaEs2ppfen(entyFe,in,teEs) - AND teEs_dyn36(teEs) - AND sum(fe2es(entyFe2,esty,teEs2)$es2ppfen(esty,in), p36_prodEs(ttot,regi,entyFe2,esty,teEs2))) -= -sum(fe2es(entyFe,esty,teEs)$es2ppfen(esty,in), p36_prodEs(ttot,regi,entyFe,esty,teEs)) -/ sum(fe2es(entyFe2,esty,teEs2)$es2ppfen(esty,in), p36_prodEs(ttot,regi,entyFe2,esty,teEs2)) -; -display p36_shFeCes, p36_fe2es, p36_demFeForEs, p36_prodEs, p36_shUeCes; - -p36_demUEtotal(ttot,regi,in) = sum (fe2ces_dyn36(entyFe,esty,teEs,in), p36_prodEs(ttot,regi,entyFe,esty,teEs)); - -loop (t0(ttot), -p36_prodUEintern(ttot,regi,entyFe,esty,teEs) = p36_prodEs(ttot,regi,entyFe,esty,teEs); -); - -if (cm_startyear gt 2005, -Execute_Loadpoint 'input_ref' p36_prodUEintern_load = vm_prodEs.L; -p36_prodUEintern(ttot,regi,enty,esty,teEs)$(ttot.val gt 2005 and ttot.val lt cm_startyear) = p36_prodUEintern_load(ttot,regi,enty,esty,teEs); -); - -*** Compute FE prices from input.gdx -if ( execError = 0, -Execute_Loadpoint 'input' p36_marginalUtility = qm_budget.m; - if (execError gt 0, - execError = 0; - p36_marginalUtility(ttot,regi) = 1; - ); -); -if ( execError = 0, -Execute_Loadpoint 'input' p36_fePrice_load = qm_balFe.m; -loop (se2fe(entySe,entyFe,te), - p36_fePrice(ttot,regi,entyFe) = p36_fePrice_load(ttot,regi,entySe,entyFe,te); - ); -if (execError gt 0, - execError = 0; - p36_fePrice(ttot,regi,entyFe) = 1; - ); -); - -p36_marginalUtility(ttot,regi)$( abs (p36_marginalUtility(ttot,regi)) lt sm_eps) = 1; - -p36_fePrice(ttot,regi,entyFe) = abs (p36_fePrice(ttot,regi,entyFe)) / abs (p36_marginalUtility(ttot,regi)); -p36_fePrice(ttot,regi,entyFe)$ ( NOT p36_fePrice(ttot,regi,entyFe)) = 0.01; !! give a default value in case the relevant information is not available in the input.gdx - -p36_fePrice_iter(iteration,ttot,regi,entyFe) = 0; - -if ((cm_noReboundEffect eq 1 ), -Execute_Load 'input_ref' p36_cesIONoRebound = vm_cesIO.L; -); - -*** Implicit discount rates mark-ups over the normal discount rate -if ((cm_DiscRateScen eq 0), -p36_implicitDiscRateMarg(ttot,regi,all_in) = 0; - elseif (cm_DiscRateScen eq 1), - p36_implicitDiscRateMarg(ttot,regi,"ueshb") = 0.05; !! 5% for the choice of space heating technology - p36_implicitDiscRateMarg(ttot,regi,"uecwb") = 0.05; !! 5% for the choice of cooking and water heating technology - elseif (cm_DiscRateScen eq 2), - p36_implicitDiscRateMarg(ttot,regi,all_in) = 0; - p36_implicitDiscRateMarg(ttot,regi,"ueshb")$(ttot.val ge 2005 AND ttot.val lt cm_startyear) = 0.05; !! 5% for the choice of space heating technology - p36_implicitDiscRateMarg(ttot,regi,"uecwb")$(ttot.val ge 2005 AND ttot.val lt cm_startyear) = 0.05; !! 5% for the choice of cooking and water heating technology - - elseif (cm_DiscRateScen eq 3), - p36_implicitDiscRateMarg(ttot,regi,all_in) = 0; - - p36_implicitDiscRateMarg(ttot,regi,"ueshb") = 0.05; !! 5% for the choice of space heating technology - p36_implicitDiscRateMarg(ttot,regi,"uecwb") = 0.05; !! 5% for the choice of cooking and water heating technology - - p36_implicitDiscRateMarg(ttot,regi,in)$( pm_ttot_val(ttot) ge cm_startyear - AND (sameAs(in,"ueshb") - OR sameAs(in,"uecwb") - ) - ) - = 0.25 * p36_implicitDiscRateMarg(ttot,regi,in) ; - - elseif (cm_DiscRateScen eq 4), - p36_implicitDiscRateMarg(ttot,regi,all_in) = 0; - - p36_implicitDiscRateMarg(ttot,regi,"ueshb") = 0.05; !! 5% for the choice of space heating technology - p36_implicitDiscRateMarg(ttot,regi,"uecwb") = 0.05; !! 5% for the choice of cooking and water heating technology - - p36_implicitDiscRateMarg(ttot,regi,"ueshb") = min(max((2030 - pm_ttot_val(ttot))/(2030 -2020),0),1) !! lambda = 1 in 2020 and 0 in 2030; - * 0.75 * p36_implicitDiscRateMarg(ttot,regi,"ueshb") - + 0.25 * p36_implicitDiscRateMarg(ttot,regi,"ueshb"); !! Reduction of 75% of the Efficiency gap - p36_implicitDiscRateMarg(ttot,regi,"uecwb") = min(max((2030 - pm_ttot_val(ttot))/(2030 -2020),0),1) !! lambda = 1 in 2020 and 0 in 2030; - * 0.75 * p36_implicitDiscRateMarg(ttot,regi,"uecwb") - + 0.25 * p36_implicitDiscRateMarg(ttot,regi,"uecwb"); !! Reduction of 75% of the Efficiency gap - ); - -p36_kapPrice(ttot,regi) = pm_cesdata(ttot,regi,"kap","price") - pm_delta_kap(regi,"kap"); -loop (fe2ces_dyn36(entyFe,esty,teEs,in), -p36_kapPriceImplicit(ttot,regi,teEs) = p36_kapPrice(ttot,regi) + p36_implicitDiscRateMarg(ttot,regi,in); -); - -*** Inconvenience mark-up -f36_inconvpen(teEs)$(sameAs(teEs,"te_ueshstb") OR sameAs(teEs,"te_uecwstb")) = 42; !! In dollar per GJ 42$/GJ is app. eq to 0.15$/kWh -f36_inconvpen(teEs)$(sameAs(teEs,"te_ueshhob") OR sameAs(teEs,"te_uecwhob")) = 14; !! In dollar per GJ 14$/GJ is app. eq to 0.05$/kWh -f36_inconvpen(teEs)$(sameAs(teEs,"te_ueshsob") OR sameAs(teEs,"te_uecwsob")) = 14; !! In dollar per GJ 14$/GJ is app. eq to 0.05$/kWh -f36_inconvpen(teEs) = f36_inconvpen(teEs) * sm_DpGJ_2_TDpTWa; !! conversion $/GJ -> T$/TWa - -*** Compute depreciation rates for technologies -p36_depreciationRate(teEs)$f36_datafecostsglob("lifetime",teEs) = - log (0.33) / f36_datafecostsglob("lifetime",teEs); - -*** Define which technologies will have a faster reduction of their calibration parameter -p36_pushCalib(ttot,teEs_dyn36) = 0; - -$ifthen "%cm_pushCalib%" == "none" -$elseif "%cm_pushCalib%" == "hydrogen" -teEs_pushCalib_dyn36("te_ueshh2b") = YES; -teEs_pushCalib_dyn36("te_uecwh2b") = YES; -p36_pushCalib(ttot,"te_ueshh2b") = 0; -p36_pushCalib(ttot,"te_uecwh2b") = 0.5; - -p36_pushCalib(ttot,teEs_pushCalib_dyn36(teEs)) = - min(max((2050 -ttot.val)/(2050 - cm_startyear),0),1) !! lambda = 1 in startyear and 0 in 2050 - * ( 1 - p36_pushCalib(ttot,teEs)) - + p36_pushCalib(ttot,teEs) ; -$endif - - -*** Define for which technologies the investment costs will evolve -p36_costReduc(ttot,teEs_dyn36) = 1; - -$ifthen "%cm_reducCostB%" == "none" -$elseif "%cm_reducCostB%" == "hydrogen" - -p36_costReduc(ttot,"te_ueshh2b") = 0.2; -p36_costReduc(ttot,"te_uecwh2b") = 0.5; - -p36_costReduc(ttot,teEs_pushCalib_dyn36(teEs)) = - min(max((2050 -ttot.val)/(2050 - cm_startyear),0),1) !! lambda = 1 in startyear and 0 in 2050 - * ( 1 - p36_costReduc(ttot,teEs)) - + p36_costReduc(ttot,teEs) ; -$elseif "%cm_reducCostB%" == "heatpumps" -p36_costReduc(ttot,"te_ueshhpb") = 0.8; -p36_costReduc(ttot,"te_uecwhpb") = 0.8; - -p36_costReduc(ttot,teEs_pushCalib_dyn36(teEs)) = - min(max((2050 -ttot.val)/(2050 - cm_startyear),0),1) !! lambda = 1 in startyear and 0 in 2050 - * ( 1 - p36_costReduc(ttot,teEs)) - + p36_costReduc(ttot,teEs) ; -$endif - -*** Computation of omegs and opTimeYr2teEs for technology vintages -p36_omegEs(regi,opTimeYr,teEs_dyn36(teEs)) = 0; - -loop(regi, - p36_aux_lifetime(teEs_dyn36(teEs)) = 5/4 * f36_datafecostsglob("lifetime",teEs); - loop(teEs_dyn36(teEs), - - loop(opTimeYr, - p36_omegEs(regi,opTimeYr,teEs) = 1 - ((opTimeYr.val-0.5) / p36_aux_lifetime(teEs))**4 ; - opTimeYr2teEs(teEs,opTimeYr)$(p36_omegEs(regi,opTimeYr,teEs) > 0 ) = yes; - if( p36_omegEs(regi,opTimeYr,teEs) <= 0, - p36_omegEs(regi,opTimeYr,teEs) = 0; - opTimeYr2teEs(teEs,opTimeYr) = no; - ); - ) - ); -); -display p36_omegEs , opTimeYr2teEs ; -***_____________________________END OF Information for the ES layer and the multinomial logit function _____________________________ - - -*** Adjustement cost factor -p36_adjFactor(ttot,regi) = 1; - - -*** Set dynamic regional set depending on testOneRegi -$ifthen "%optimization%" == "testOneRegi" -regi_dyn36(all_regi) = regi_dyn80(all_regi); -$else -regi_dyn36(all_regi) = regi(all_regi); -$endif - -***------------------------------------------------------------------------- -*** pass on module specific parameter values to core parameters -***------------------------------------------------------------------------- - -pm_fe2es(ttot,regi,teEs_dyn36) = p36_fe2es(ttot,regi,teEs_dyn36); -pm_shFeCes(ttot,regi,entyFe,in,teEs)$p36_shFeCes(ttot,regi,entyFe,in,teEs) = p36_shFeCes(ttot,regi,entyFe,in,teEs); -*** EOF ./modules/36_buildings/services_with_capital/datainput.gms diff --git a/modules/36_buildings/services_with_capital/declarations.gms b/modules/36_buildings/services_with_capital/declarations.gms deleted file mode 100644 index da96a8796..000000000 --- a/modules/36_buildings/services_with_capital/declarations.gms +++ /dev/null @@ -1,100 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_with_capital/declarations.gms -Scalar -s36_vintage_calib "switch for the inclusion of vintage equations and restricting ttot to historical. It should exclude the equations from hybrid" /0/, -s36_logit "switch for the inclusion of vintage equations. It should exclude the equations from hybrid" /0/ -; - -Parameter -p36_floorspace(tall,all_regi) "buildings floorspace, billion m2" -p36_adjFactor(tall,all_regi) "factor applied for the adjustment costs" - -p36_cesIONoRebound(tall,all_regi,all_in) "loads the vm_cesIO values from the input_ref and sets the upper bound to vm_cesIO to forbid a rebound effect" -p36_demFeForEs_scen(tall,all_regi,all_GDPscen,all_enty,all_esty,all_teEs) "Final energy demand for technologies producing energy services (useful energy in the case of buildings)" -p36_demFeForEs(ttot,all_regi,all_enty,all_esty,all_teEs) "Final energy demand for technologies producing energy services (useful energy in the case of buildings)" - -p36_prodEs_scen(tall,all_regi,all_GDPscen,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) for technologies producing energy services and using FE" -p36_prodEs(ttot,all_regi,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) for technologies producing energy services and using FE" -p36_prodEs_iter(iteration,ttot,all_regi,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) for technologies producing energy services and using FE over iterations" -p36_deltaProdEs_iter(iteration,ttot,all_regi,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) addition for a year. For technologies producing energy services and using FE over iterations" -p36_deltaProdEs(ttot,all_regi,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) addition for a year. Result of vintage_36" - -p36_shFeCes(ttot,all_regi,all_enty,all_in,all_teEs) "share of Final energy of technology teEs in the final energy producing all_in" -p36_shFeCes_iter(iteration,ttot,all_regi,all_enty,all_in,all_teEs) "share of Final energy of technology teEs in the final energy producing all_in" -p36_shUeCes(ttot,all_regi,all_enty,all_in,all_teEs) "share of Useful energy of technology teEs in the final energy producing all_in" -p36_shUeCes_iter(iteration,ttot,all_regi,all_enty,all_in,all_teEs) "share of Useful energy of technology teEs in the final energy producing all_in" -p36_fe2es(ttot,all_regi,all_teEs) "FE to ES(UE) efficiency of technology teES" - -p36_logitLambda(all_regi,all_in) "logit parameter for homogeneity" -p36_logitLambda_load (all_regi,all_in) "logit parameter for homogeneity, loaded from GDX_ref" -p36_fePrice_load(tall,all_regi,all_enty,all_enty,all_te) "Final energy price from GDX" -p36_fePrice(tall,all_regi,all_enty) "Final energy price" -p36_fePrice_iter(iteration,tall,all_regi,all_enty) "Final energy price over iterations" -p36_marginalUtility(tall,all_regi) "Marginal utility of income: used to compute the final energy price from the marginal of balance equation" -p36_techCosts(tall,all_regi,all_enty,all_esty,all_teEs) "Relevant costs of each ES technology for the computation of the share in the multinomial logit" -p36_techCosts_iter(iteration,tall,all_regi,all_enty,all_esty,all_teEs) "Relevant costs of each ES technology for the computation of the share in the multinomial logit over iterations" -p36_logitCalibration(tall,all_regi,all_enty,all_esty,all_teEs) "calibration parameter for the multinomial logit function" -p36_logitCalibration_load(tall,all_regi,all_enty,all_esty,all_teEs) "calibration parameter for the multinomial logit function from input_ref.gdx" -p36_logitNorm(iteration,tall,all_regi,all_in) "Norm of the share vector difference between iterations" - -p36_prodUEintern(tall,all_regi,all_enty,all_esty,all_teEs) "UE production from depreciated technologies of the previous period" -p36_prodUEintern_load(tall,all_regi,all_enty,all_esty,all_teEs) "UE production from depreciated technologies of the previous period -- From GDX" -p36_demUEtotal(tall,all_regi,all_in) "Demand for UE, independent of the technology" -p36_demUEdelta(tall,all_regi,all_in) "Demand for UE, independent of the technology, and which is not covered by the depreciated technologies" -p36_shUeCesDelta(ttot,all_regi,all_enty,all_in,all_teEs) "Technological shares in UE which is not covered by former depreciated technologies" -p36_depreciationRate(all_teEs) "Depreciation rates for the indivudal conversion technologies, rouhgly derived from their lifetime parameter" - -p36_esCapCost(tall,all_regi,all_teEs) "Capital costs for each technology transforming FE into UE. Cost per unit of FE" -p36_esCapCostImplicit(tall,all_regi,all_teEs) "Capital costs for each technology transforming FE into UE, taking the implicit discount rate into account. Cost per unit of FE" -p36_kapPrice(tall,all_regi) "Macroeconomic capital price, net of depreciation" -p36_kapPriceImplicit(tall,all_regi,all_teEs) "Macroeconomic capital price, net of depreciation, to which the implicit discount rate is added" -p36_implicitDiscRateMarg(tall,all_regi,all_in) "Implicit discount rate for the choice of conversion technologies from UE to FE in buildings" -p36_depreciationRate(all_teEs) "Depreciation rates for the indivudal conversion technologies, rouhgly derived from their lifetime parameter" -p36_pushCalib(tall,all_teEs) "degree to which the calibration parameter should be reduced/increased for these technologies" -p36_costReduc(tall,all_teEs) "Reduction of costs for some technologies" -f36_inconvpen(all_teEs) "maximum inconvenience penalty for traditional conversion technologies. Unit: T$/TWa" -p36_inconvpen(ttot,all_regi,all_teEs) "parameter for inconvenience penalty depending on income level. Unit: T$/TWa" - -p36_aux_lifetime(all_teEs) "auxiliary parameter for calculating life times" -p36_omegEs(all_regi,opTimeYr,all_teEs) "technical depreciation parameter, gives the share of a capacity that is still usable after tlt. [none/share, value between 0 and 1]" -; - -Variables -v36_prodEs(ttot,all_regi,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) for technologies producing energy services and using FE" -v36_deltaProdEs(ttot,all_regi,all_enty,all_esty,all_teEs) "Energy service demand (UE in the case of buildings) addition for a year. For technologies producing energy services and using FE" -v36_vintageInfes(ttot,all_regi,all_enty,all_esty,all_teEs) "slack variable to avoid infeasibilities in the initialisation of vintages" -v36_logitInfes(tall,all_regi,all_in) "slack variable to avoid infeasibilities in case historical demand cannot be declined fast enough" -v36_costs(ttot,all_regi) "technological costs" -v36_vintage_obj "objective variable for vintage model" -v36_shares_obj "objective variable for heterogeneity preferences" -; - -Equations -q36_demFeBuild(ttot,all_regi,all_enty,all_emiMkt) "buildings final energy demand" -q36_ueTech2Total(tall,all_regi,all_in) "definition of total UE buildings demand, based on the sum of demand by technology" -q36_cap(tall,all_regi,all_enty,all_esty,all_teEs) "definition of available capacities" -q36_budget(tall,all_regi) "budget equation" -q36_vintage_obj "objective function for vintage model" -q36_shares_obj "objective function for logit shares: heterogeneity preferences" -; - - -file testfile /""/; - -testfile.nd = 10; - - -file file_logit_buildings / "Logit_buildings.csv" /; - -file_logit_buildings.ap = 0; !! append to file is negative to overwrite former file if existing -file_logit_buildings.pc = 5; !! csv file -file_logit_buildings.lw = 0; -file_logit_buildings.nw = 20; -file_logit_buildings.nd = 15; - -*** EOF ./modules/36_buildings/services_with_capital/declarations.gms diff --git a/modules/36_buildings/services_with_capital/equations.gms b/modules/36_buildings/services_with_capital/equations.gms deleted file mode 100644 index f78725554..000000000 --- a/modules/36_buildings/services_with_capital/equations.gms +++ /dev/null @@ -1,116 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_with_capital/equations.gms - -*** Buildings Final Energy Balance -q36_demFeBuild(ttot,regi,entyFe,emiMkt)$((ttot.val ge cm_startyear) AND (entyFe2Sector(entyFe,"build"))) .. - sum((entySe,te)$se2fe(entySe,entyFe,te), vm_demFeSector_afterTax(ttot,regi,entySe,entyFe,"build",emiMkt)) - =e= - ( - sum(fe2ppfEn36(entyFe,in), - vm_cesIO(ttot,regi,in) - + pm_cesdata(ttot,regi,in,"offset_quantity") - ) - + - sum(fe2es_dyn36(entyFe,esty,teEs), vm_demFeForEs(ttot,regi,entyFe,esty,teEs) ) - )$(sameas(emiMkt,"ES")) -; -q36_ueTech2Total(ttot,regi_dyn36(regi),inViaEs_dyn36(in)) $ - ( (s36_vintage_calib eq 1 AND t36_hist(ttot) ) - OR ((s36_logit eq 1) AND (ttot.val ge cm_startyear)) ) .. - p36_demUEtotal(ttot,regi,in) - + v36_logitInfes(ttot,regi,in) - =e= - sum (fe2ces_dyn36(enty,esty,teEs,in), - v36_prodEs(ttot,regi,enty,esty,teEs) - ); - - -q36_cap(ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) $ - ( ((s36_vintage_calib eq 1) AND (t36_hist(ttot) )) - OR ((s36_logit eq 1) AND (ttot.val ge cm_startyear)) ) .. - - v36_prodEs(ttot,regi,enty,esty,teEs) - =e= - sum(opTimeYr2teEs(teEs,opTimeYr)$(tsu2opTimeYr(ttot,opTimeYr) AND (opTimeYr.val ge 1) ), - pm_ts(ttot-(pm_tsu2opTimeYr(ttot,opTimeYr)-1)) - * p36_omegEs(regi,opTimeYr+1,teEs) - * (v36_deltaProdEs(ttot-(pm_tsu2opTimeYr(ttot,opTimeYr)-1),regi,enty,esty,teEs) - - v36_vintageInfes(ttot-(pm_tsu2opTimeYr(ttot,opTimeYr)-1),regi,enty,esty,teEs) - ) - ) - ; - -q36_budget(t36_scen(ttot),regi_dyn36(regi)).. - v36_costs(ttot,regi) - =e= - sum ( fe2ces_dyn36(enty,esty,teEs,in), - p36_techCosts(ttot,regi,enty,esty,teEs) - * v36_deltaProdEs(ttot,regi,enty,esty,teEs) - ) - ; - -q36_vintage_obj $ (s36_vintage_calib eq 1 ) .. - v36_vintage_obj - =e= - sum((ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs))$( - t36_hist(ttot) - ), - - sum(opTimeYr2teEs(teEs,opTimeYr)$( - tsu2opTimeYr(ttot,opTimeYr) - ), - power ( - v36_deltaProdEs(ttot-(pm_tsu2opTimeYr(ttot,opTimeYr)),regi,enty,esty,teEs) - - v36_deltaProdEs(ttot-(pm_tsu2opTimeYr(ttot,opTimeYr)-1),regi,enty,esty,teEs) - ,2 - ) - - + - 1000 - * v36_vintageInfes(ttot-(pm_tsu2opTimeYr(ttot,opTimeYr)),regi,enty,esty,teEs) - ) - + 1000 - * v36_vintageInfes(ttot,regi,enty,esty,teEs) - ) - - ; - -q36_shares_obj $ (s36_logit eq 1).. - v36_shares_obj - =e= - sum ((t36_scen(ttot),regi_dyn36(regi),inViaEs_dyn36(in)), - sum ( fe2ces_dyn36(enty,esty,teEs,in), - - p36_logitCalibration(ttot,regi,enty,esty,teEs) - * v36_deltaProdEs(ttot,regi,enty,esty,teEs) - ) - + 1 / p36_logitLambda(regi,in) - * sum ( fe2ces_dyn36(enty,esty,teEs,in), - v36_deltaProdEs(ttot,regi,enty,esty,teEs) - * log ( v36_deltaProdEs(ttot,regi,enty,esty,teEs) - / sum (fe2ces_dyn36_2(enty2,esty2,teEs2,in), - v36_deltaProdEs(ttot,regi,enty2,esty2,teEs2)) - ) - ) - ) - - - sum ( (t36_scen(ttot),regi_dyn36(regi)), - v36_costs(ttot,regi) - ) - - - sum ((ttot,regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)), - 1000 - * v36_vintageInfes(ttot,regi,enty,esty,teEs) - ) - - sum ((ttot,regi_dyn36(regi),inViaEs_dyn36(in)), - 1000 - * v36_logitInfes(ttot,regi,in) - ) - ; - - -*** EOF ./modules/36_buildings/services_with_capital/equations.gms diff --git a/modules/36_buildings/services_with_capital/input/files b/modules/36_buildings/services_with_capital/input/files deleted file mode 100644 index e5b324c14..000000000 --- a/modules/36_buildings/services_with_capital/input/files +++ /dev/null @@ -1,4 +0,0 @@ -p36_floorspace_scen.cs4r -p36_serviceInputs.cs4r -p36_serviceOutputs.cs4r - diff --git a/modules/36_buildings/services_with_capital/input/generisdata_Eff.prn b/modules/36_buildings/services_with_capital/input/generisdata_Eff.prn deleted file mode 100644 index cdda91535..000000000 --- a/modules/36_buildings/services_with_capital/input/generisdata_Eff.prn +++ /dev/null @@ -1,23 +0,0 @@ -*** SOF ./modules/36_buildings/services_with_capital/input/generisdata_Eff.prn -$ontext -Data adapted from EIA - Technology Forecast Updates – Residential and Commercial Building Technologies – Reference Case -Documentation of the NEMS model: https://www.eia.gov/analysis/studies/buildings/equipcosts/ -Data adapted from https://ec.europa.eu/energy/sites/ener/files/documents/2018_06_27_technology_pathways_-_finalreportmain2.pdf -IMPORTANT: all costs are now given in $2015! As long as the model runs in $2005, the values need to be converted in datainput.gms -inco0 Initial investment costs given in $(2015)/kW Useful energy power -omf Fixed operation and maintenance costs in $(2015)/kW Useful energy power -eta Conversion efficiency: UE/FE -usehr number of hours in a year when the technology is used -lifetime given in years -$offtext - - te_ueshhpb te_ueshgab te_ueshhob te_ueshelb te_ueshh2b te_ueshsob te_ueshheb te_ueshstb -eta %cm_INNOPATHS_effHP% 0.9 0.9 1 0.8 0.8 1 0.25 - - -+ te_uecwhpb te_uecwgab te_uecwhob te_uecwelb te_uecwh2b te_uecwsob te_uecwheb te_uecwstb -eta %cm_INNOPATHS_effHP% 0.9 0.9 1 0.8 0.8 1 0.25 - - - -*** EOF ./modules/36_buildings/services_with_capital/input/generisdata_Eff.prn diff --git a/modules/36_buildings/services_with_capital/input/generisdata_feCapCosts.prn b/modules/36_buildings/services_with_capital/input/generisdata_feCapCosts.prn deleted file mode 100644 index 247c11fcb..000000000 --- a/modules/36_buildings/services_with_capital/input/generisdata_feCapCosts.prn +++ /dev/null @@ -1,29 +0,0 @@ -*** SOF ./modules/36_buildings/services_with_capital/input/generisdata_feCapCosts.prn -$ontext -Data adapted from EIA - Technology Forecast Updates – Residential and Commercial Building Technologies – Reference Case -Documentation of the NEMS model: https://www.eia.gov/analysis/studies/buildings/equipcosts/ -Data adapted from https://ec.europa.eu/energy/sites/ener/files/documents/2018_06_27_technology_pathways_-_finalreportmain2.pdf -IMPORTANT: all costs are now given in $2015! As long as the model runs in $2005, the values need to be converted in datainput.gms -inco0 Initial investment costs given in $(2015)/kW Useful energy power -omf Fixed operation and maintenance costs in $(2015)/kW Useful energy power -eta Conversion efficiency: UE/FE -usehr number of hours in a year when the technology is used -lifetime given in years -$offtext - - te_ueshhpb te_ueshgab te_ueshhob te_ueshelb te_ueshh2b te_ueshsob te_ueshheb te_ueshstb -inco0 1000 180 180 60 10000 470 110 10 -omf 7 3 3 2 13 17 2 1 -eta 3 0.9 0.8 1 0.7 0.8 0.7 0.25 -usehr 1440 1440 1440 1440 1440 1440 1440 1440 !! 60 days a year -lifetime 20 20 20 20 20 20 20 5 - -+ te_uecwhpb te_uecwgab te_uecwhob te_uecwelb te_uecwh2b te_uecwsob te_uecwheb te_uecwstb -inco0 500 190 200 110 10000 250 100 10 -omf 1 2 6 0 13 17 2 1 -eta 3 1 0.8 1 0.7 0.8 0.7 0.25 -usehr 730 730 730 730 730 730 730 730 -lifetime 20 20 20 20 20 20 20 5 - - -*** EOF ./modules/36_buildings/services_with_capital/input/generisdata_feCapCosts.prn diff --git a/modules/36_buildings/services_with_capital/not_used.txt b/modules/36_buildings/services_with_capital/not_used.txt deleted file mode 100644 index a97a66cc8..000000000 --- a/modules/36_buildings/services_with_capital/not_used.txt +++ /dev/null @@ -1,28 +0,0 @@ -# | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | REMIND License Exception, version 1.0 (see LICENSE file). -# | Contact: remind@pik-potsdam.de -name,type,reason -vm_enerSerAdj,input,questionnaire -pm_cumDeprecFactor_old,input,questionnaire -pm_cumDeprecFactor_new,input,questionnaire -vm_costAddTeInv,input,questionnaire -cm_build_H2costAddH2Inv,input,questionnaire -cm_build_H2costDecayStart,input,questionnaire -cm_build_H2costDecayEnd,input,questionnaire -cm_logitCal_markup_conv_b,input,questionnaire -cm_logitCal_markup_newtech_conv_b,input,questionnaire -cm_build_AdjCostActive,input,questionnaire -pm_shGasLiq_fe_up,parameter,not needed -pm_shGasLiq_fe_lo,parameter,not needed -pm_shfe_up,parameter,not needed -pm_shfe_lo,parameter,not needed -qm_balFe,input,questionnaire -sm_TWa_2_MWh,input,questionnaire -vm_costCESMkup,input,questionnaire -sm_trillion_2_non,input,questionnaire -sm_TWa_2_kWh,input,questionnaire -pm_tau_ces_tax,input,questionnaire -pm_dt,parameter,??? diff --git a/modules/36_buildings/services_with_capital/postsolve.gms b/modules/36_buildings/services_with_capital/postsolve.gms deleted file mode 100644 index 6cbf3eb77..000000000 --- a/modules/36_buildings/services_with_capital/postsolve.gms +++ /dev/null @@ -1,50 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_with_capital/postsolve.gms - -*** calculation of FE Buildings Prices (useful for internal use and reporting purposes) -pm_FEPrice(ttot,regi,entyFE,"build",emiMkt)$(abs (qm_budget.m(ttot,regi)) gt sm_eps) = - q36_demFeBuild.m(ttot,regi,entyFE,emiMkt) / qm_budget.m(ttot,regi); - -p36_fePrice(t,regi_dyn36(regi),entyFe)=pm_FEPrice(t,regi,entyFE,"build","ES"); - -p36_fePrice_iter(iteration,t,regi_dyn36(regi),entyFe)$p36_fePrice(t,regi,entyFe) = - p36_fePrice(t,regi,entyFe); - -*** To compute the capital price, take the CES derivative and substract the depreciation rate -loop(cesOut2cesIn(out,in) $ (sameAs(out,"inco") - AND sameAs(in,"kap")), -p36_kapPrice(t,regi_dyn36(regi)) = - pm_cesdata(t,regi,in,"xi") - * pm_cesdata(t,regi,in,"eff") - * vm_effGr.l(t,regi,in) - - * (vm_cesIO.l(t,regi,out) - + vm_cesIOdelta.l(t,regi,out)$( ipf_putty(out)) - ) - ** (1 - pm_cesdata(t,regi,out,"rho")) - - * ( pm_cesdata(t,regi,in,"eff") - * vm_effGr.l(t,regi,in) - * (vm_cesIO.l(t,regi,in)$( NOT ipf_putty(out)) - + vm_cesIOdelta.l(t,regi,in)$( ipf_putty(out)) - ) - ) - ** (pm_cesdata(t,regi,out,"rho") - 1) - - - pm_delta_kap(regi,"kap"); -); - - -p36_demUEtotal(t,regi_dyn36(regi),in)$(p36_demUEtotal(t,regi,in) AND ( NOT t36_hist(t))) = vm_cesIO.L(t,regi,in) + pm_cesdata(t,regi,in,"offset_quantity") ; - -p36_prodEs_iter(iteration,t,regi,enty,esty,teEs) = - v36_prodEs.l(t,regi,enty,esty,teEs); -p36_deltaProdEs_iter(iteration,t,regi,enty,esty,teEs) = - v36_deltaProdEs.l(t,regi,enty,esty,teEs); - -*** EOF ./modules/36_buildings/services_with_capital/postsolve.gms diff --git a/modules/36_buildings/services_with_capital/preloop.gms b/modules/36_buildings/services_with_capital/preloop.gms deleted file mode 100644 index 1206d4cf7..000000000 --- a/modules/36_buildings/services_with_capital/preloop.gms +++ /dev/null @@ -1,61 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_with_capital/preloop.gms - -*** Vintage initialisation -v36_prodEs.lo(ttot,regi,fe2es_dyn36(enty,esty,teEs)) = 0; -v36_deltaProdEs.lo(ttot,regi,fe2es_dyn36(enty,esty,teEs)) = 0; -v36_vintageInfes.lo(ttot,regi,fe2es_dyn36(enty,esty,teEs)) = 0; - - -s36_vintage_calib = 1; -v36_logitInfes.fx(ttot,regi_dyn36(regi),inViaEs_dyn36(in)) = 0; -v36_prodEs.fx(t36_hist(ttot),regi_dyn36(regi), fe2es_dyn36(entyFe,esty,teEs)) - = p36_prodEs(ttot,regi,entyFe,esty,teEs); - -model vintage_36 / -q36_ueTech2Total -q36_cap -q36_vintage_obj -/; - -if (execError > 0, - execute_unload "abort.gdx"; - abort "at least one execution error occured, abort.gdx written"; -); - -solve vintage_36 minimizing v36_vintage_obj using nlp; - -if ( NOT ( vintage_36.solvestat eq 1 AND (vintage_36.modelstat eq 1 OR vintage_36.modelstat eq 2)), -abort "model vintage_36 is infeasible"; -); - -p36_prodUEintern(t36_hist(ttot),regi_dyn36(regi),fe2es_dyn36(enty,esty,teEs)) - = v36_deltaProdEs.L(ttot,regi,enty,esty,teEs); - -*** Save result from vintage_36 for later bound setting -p36_deltaProdEs(ttot,regi,enty,esty,teEs) = v36_deltaProdEs.L(ttot,regi,enty,esty,teEs); - -s36_vintage_calib = 0; - - -*** Define model for logit shares -model logit_36 / -q36_ueTech2Total -q36_cap -q36_shares_obj -q36_budget -/ -; -*** The value of the capital price cannot be set in datainput as in calibration runs, pm_cesdata is computed in preloop.gms of module 29 -p36_kapPrice(t,regi_dyn36(regi)) = pm_cesdata(t,regi,"kap","price") - pm_delta_kap(regi,"kap"); -loop (fe2ces_dyn36(entyFe,esty,teEs,in), -p36_kapPriceImplicit(t,regi_dyn36(regi),teEs) = p36_kapPrice(t,regi) + p36_implicitDiscRateMarg(t,regi,in); -); - -*** EOF ./modules/36_buildings/services_with_capital/preloop.gms - diff --git a/modules/36_buildings/services_with_capital/presolve.gms b/modules/36_buildings/services_with_capital/presolve.gms deleted file mode 100644 index 4cc77b9bd..000000000 --- a/modules/36_buildings/services_with_capital/presolve.gms +++ /dev/null @@ -1,365 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_with_capital/presolve.gms - -*** For the first iterations, avoid very high prices because of numerical reasons -if (ord(iteration) le 8, - - loop ((t,regi_dyn36(regi)), - sm_tmp = smax(fe2ces_dyn36(entyFe,esty,teEs,in), p36_fePrice(t,regi,entyFe)); - if (sm_tmp gt 3, - p36_fePrice(t,regi,entyFe) = max(0.01, - p36_fePrice(t,regi,entyFe) / sm_tmp * 3 - ); - - - ); - ); -); - - -*** Take average price over previous iterations -if (ord(iteration) ge 5, -p36_fePrice(t,regi_dyn36(regi),entyFe) $ p36_fePrice(t,regi,entyFe)= - ( p36_fePrice_iter(iteration - 1,t,regi,entyFe) - + p36_fePrice_iter(iteration - 2,t,regi,entyFe) - + p36_fePrice_iter(iteration - 3,t,regi,entyFe) - + p36_fePrice_iter(iteration - 4,t,regi,entyFe) - ) - / 4; -); -*** Beyond the 70th iteration, the prices are averaged over the prices since the 66th iteration -if (ord(iteration) ge 70, - -p36_fePrice(t,regi_dyn36(regi),entyFe) = - sum(iteration2 $ (ord(iteration2) ge 66 - AND ord(iteration2) lt ord(iteration)), - p36_fePrice_iter(iteration2,t,regi,entyFe) - ) - / - sum(iteration2 $ (ord(iteration2) ge 66 - AND ord(iteration2) lt ord(iteration)), - 1 - ) - ; - -); -*** smooth the costs - -*** Smooth 2005 prices -$offOrder -p36_kapPrice(t,regi_dyn36(regi))$(ord(t) eq 1) - = ( p36_kapPrice(t+1,regi) * 2 - + p36_kapPrice(t+2,regi) - ) - / 3; - -p36_fePrice(t,regi_dyn36(regi),entyFe)$(ord(t) eq 1) - = ( p36_fePrice(t+1,regi,entyFe) * 2 - + p36_fePrice(t+2,regi,entyFe) - ) - / 3; -$onOrder -*** Smooth non 2005 prices with moving average -$OFForder -loop (t$ ( not ((ord(t) le 1) or (ord(t) eq card(t)))), -p36_kapPrice(t,regi_dyn36(regi)) = - ( p36_kapPrice(t-1,regi) - + p36_kapPrice(t,regi) - + p36_kapPrice(t+1,regi) - ) / 3 ; - -p36_fePrice(t,regi_dyn36(regi),entyFe) = - (p36_fePrice(t-1,regi,entyFe) - + p36_fePrice(t,regi,entyFe) - + p36_fePrice(t+1,regi,entyFe) - ) / 3; - -); -$ONorder - -loop (fe2ces_dyn36(entyFe,esty,teEs,in), -p36_kapPriceImplicit(t,regi_dyn36(regi),teEs) = p36_kapPrice(t,regi) + p36_implicitDiscRateMarg(t,regi,in); -); - - p36_esCapCost(t,regi_dyn36(regi),teEs_dyn36(teEs)) = - (f36_datafecostsglob("inco0",teEs) - * p36_costReduc(t,teEs) - * p36_kapPrice(t,regi) / (1 - (1 + p36_kapPrice(t,regi))** (-f36_datafecostsglob("lifetime",teEs))) !! annualised initial capital costs - + f36_datafecostsglob("omf",teEs) - ) - / f36_datafecostsglob("usehr",teEs) !! from T$/TW to T$/TWh - * sm_day_2_hour * sm_year_2_day !! from T$/TWh to T$/TWa - ; - - p36_esCapCostImplicit(t,regi_dyn36(regi),teEs_dyn36(teEs)) = - (f36_datafecostsglob("inco0",teEs) - * p36_costReduc(t,teEs) - * p36_kapPriceImplicit(t,regi,teEs) / (1 - (1 + p36_kapPriceImplicit(t,regi,teEs))** (-f36_datafecostsglob("lifetime",teEs))) !! annualised initial capital costs - + f36_datafecostsglob("omf",teEs) - ) - / f36_datafecostsglob("usehr",teEs) !! from T$/TW to T$/TWh - * sm_day_2_hour * sm_year_2_day !! from T$/TWh to T$/TWa - ; - -p36_inconvpen(t,regi_dyn36(regi),teEs)$f36_inconvpen(teEs) = - (1 - - min(max((20 - (vm_cesIO.L(t,regi,"inco")$( NOT sameAs(iteration,"1")) - +pm_gdp(t,regi)$ sameAs(iteration,"1")) / pm_shPPPMER(regi) - / pm_pop(t,regi)) - /(20 - 3),0),1) !! (1-lambda) = 0 if gdppop < 3000, 1 if gdppop >= 20000 - ) - * f36_inconvpen(teEs) ; - -loop ( (fe2es_dyn36(entyFe,esty,teEs)), -p36_techCosts(t,regi_dyn36(regi),entyFe,esty,teEs) = - p36_esCapCostImplicit(t,regi,teEs) - + - (p36_fePrice(t,regi,entyFe) - + p36_inconvpen(t,regi,teEs) - + pm_tau_fe_tax(t,regi,"build",entyFe) - + pm_tau_fe_sub(t,regi,"build",entyFe) - ) - / pm_fe2es(t,regi,teEs) - !! add taxes, subsidies, and later on costs - ; -); - -p36_techCosts_iter(iteration,t,regi,entyFe,esty,teEs) = - p36_techCosts(t,regi,entyFe,esty,teEs); - -*** Compute the share of UE for each technology that is needed to get the aggregate technological distribution observed -loop ((t36_hist(ttot),fe2ces_dyn36(entyFe,esty,teEs,in)), -p36_shUeCesDelta(ttot,regi_dyn36(regi),entyFe,in,teEs) - = p36_prodUEintern(ttot,regi,entyFe,esty,teEs) - / sum ( fe2ces_dyn36_2(entyFe2,esty2,teEs2,in), - p36_prodUEintern(ttot,regi,entyFe2,esty2,teEs2) - ) - ; - - loop (regi_dyn36(regi), - if ( p36_shUeCesDelta(ttot,regi,entyFe,in,teEs) lt 0, - put testfile; - put p36_shUeCesDelta.tn(ttot,regi,entyFe,in,teEs) , " = ", p36_shUeCesDelta(ttot,regi,entyFe,in,teEs) /; - put p36_demUEtotal.tn(ttot,regi,in) , " = ", p36_demUEtotal(ttot,regi,in) /; - put p36_prodEs.tn(ttot,regi,entyFe,esty,teEs) , " = ", p36_prodEs(ttot,regi,entyFe,esty,teEs) /; - put p36_prodUEintern.tn(ttot,regi,entyFe,esty,teEs), " = ", p36_prodUEintern(ttot,regi,entyFe,esty,teEs) /; - putclose; - execute_unload "abort.gdx"; - abort "some share was decreasing faster than planned. Look at the logfile for more information"; - ); - ); -); - -*** Compute the calibration factors for the historical periods -loop ((t36_hist(ttot),fe2ces_dyn36(entyFe,esty,teEs,in)), -p36_logitCalibration(ttot,regi_dyn36(regi),entyFe,esty,teEs) $ p36_shUeCesDelta(ttot,regi,entyFe,in,teEs) !! exclude shares which are zero - = - (1 / (p36_logitLambda(regi,in)) - * log ( p36_shUeCesDelta(ttot,regi,entyFe,in,teEs)) - - p36_techCosts(ttot,regi,entyFe,esty,teEs) - ) - - - (1 - / sum (fe2ces_dyn36_2(entyFe2,esty2,teEs2,in)$ p36_shUeCesDelta(ttot,regi,entyFe2,in,teEs2), - 1) - ) - * sum (fe2ces_dyn36_2(entyFe2,esty2,teEs2,in)$ p36_shUeCesDelta(ttot,regi,entyFe2,in,teEs2), !! exclude shares which are zero - 1 / ( p36_logitLambda(regi,in)) - * log ( p36_shUeCesDelta(ttot,regi,entyFe2,in,teEs2)) - - p36_techCosts(ttot,regi,entyFe2,esty2,teEs2) - ); - -); - -*** For the last historical period, attribute the last historical value of the calibration parameter to the scenario periods -*** The calibration factors are reduced towards 80% in the long term to represent the enhanced flexibility of the system -*** Long lasting non-price barriers should preferably be represented through price mark-ups -loop ( t36_hist_last(ttot), - p36_logitCalibration(ttot,regi_dyn36(regi),entyFe,esty,teEs) $ ( fe2es_dyn36(entyFe,esty,teEs) - AND NOT p36_logitCalibration(ttot,regi,entyFe,esty,teEs)) - = 5; - - loop ( t36_scen(t2), - - p36_logitCalibration(t2,regi_dyn36(regi),entyFe,esty,teEs) $ fe2es_dyn36(entyFe,esty,teEs) - = min(max((2100 - pm_ttot_val(t2))/(2100 -ttot.val),0),1) !! lambda = 1 in 2015 and 0 in 2100 - * (p36_logitCalibration(ttot,regi,entyFe,esty,teEs) - - 0.80 * p36_logitCalibration(ttot,regi,entyFe,esty,teEs)) - + 0.80 * p36_logitCalibration(ttot,regi,entyFe,esty,teEs) - ; - - !! give a high parameter value to the technologies that do not have some - p36_logitCalibration(t2,regi_dyn36(regi),entyFe,esty,teEs) $ (fe2es_dyn36(entyFe,esty,teEs) - AND NOT p36_logitCalibration(t2,regi,entyFe,esty,teEs)) - = min(max((2100 - pm_ttot_val(t2))/(2100 -ttot.val),0),1) !! lambda = 1 in 2015 and 0 in 2100 - * (5 - - 0.3 * 5) - + 0.3 * 5; - - !! Decrease the calibration factor for some technologies, based on the difference between the 2015 (ttot) Income per capita and scenario (t2) income per capita. - !! the calibration factor decreases by 90% when income reaches 30 k$ if income per capita was equal or below 5 k$ in 2015. - !! the decrease is lower if the starting income was above 10k$ and is 0 if income was above 30k$ - p36_logitCalibration(t2,regi_dyn36(regi),entyFe,esty,teEs) $ richTechs(teEs) = !! calib = calib * (1 - 0.90 * X) - p36_logitCalibration(ttot,regi,entyFe,esty,teEs) - * (1 - 0.90 - * (( max ( 5, min (30, (vm_cesIO.L(t2,regi,"inco")$( NOT sameAs(iteration,"1")) + pm_gdp(t2,regi)$ sameAs(iteration,"1")) / pm_shPPPMER(regi) / pm_pop(t2,regi) )) - - min (30, max (5, (vm_cesIO.L(ttot,regi,"inco")$( NOT sameAs(iteration,"1")) + pm_gdp(ttot,regi)$ sameAs(iteration,"1")) / pm_shPPPMER(regi) / pm_pop(ttot,regi) )) - ) - / (30 -5)) - ) - ; - - p36_logitCalibration(t2,regi_dyn36(regi),entyFe,esty,teEs) $ (fe2es_dyn36(entyFe,esty,teEs) AND teEs_pushCalib_dyn36(teEs)) = - p36_pushCalib(t2,teEs) - * p36_logitCalibration(t2,regi,entyFe,esty,teEs) - ; -); -); - -option - limrow = 10000000 - limcol = 10000000 - solprint = on -; - -s36_logit = 1; -if (execError > 0, - execute_unload "abort.gdx"; - abort "at least one execution error occured, abort.gdx written"; -); - -solve logit_36 maximizing v36_shares_obj using nlp; -s36_logit = 0; - -option - limrow = 0 - limcol = 0 - solprint = off -; - -if ( NOT ( logit_36.solvestat eq 1 AND (logit_36.modelstat eq 1 OR logit_36.modelstat eq 2)), -abort "model logit_36 is infeasible"; -); - -*** Compute the aggregate UE shares -loop (fe2ces_dyn36(entyFe,esty,teEs,in), - p36_shUeCes(t,regi_dyn36(regi),entyFe,in,teEs) - = v36_prodEs.L(t,regi,entyFe,esty,teEs) - / p36_demUEtotal(t,regi,in); -); - - -*** Set 1e-3 as a lower bound for shares -p36_shUeCes(ttot,regi_dyn36(regi),entyFe,in,teEs) $ ( t36_scen(ttot) - AND p36_shUeCes(ttot,regi,entyFe,in,teEs) lt 1e-3) - = 0 - ; -p36_shUeCes(ttot,regi_dyn36(regi),entyFe,in,teEs) $ ( t36_scen(ttot) - AND feteces_dyn36(entyFe,teEs,in) - ) - = p36_shUeCes(ttot,regi,entyFe,in,teEs) - / sum( feteces_dyn36_2(entyFe2,teEs2,in), - p36_shUeCes(ttot,regi,entyFe2,in,teEs2)) - ; - -*** Compute FE shares -p36_shFeCes(t,regi_dyn36(regi),entyFe,in,teEs)$feteces_dyn36(entyFe,teEs,in) - = (1 / p36_fe2es(t,regi,teEs)) - / sum ( (fe2ces_dyn36(entyFe2,esty2,teEs2,in)), - (1 / p36_fe2es(t,regi,teEs2)) - * p36_shUeCes(t,regi,entyFe2,in,teEs2) - ) - * p36_shUeCes(t,regi,entyFe,in,teEs) - ; - -p36_shFeCes_iter(iteration,t,regi,entyFe,in,teEs) = - p36_shFeCes(t,regi,entyFe,in,teEs); - -*** Pass on to core parameters -loop (fe2ces_dyn36(entyFe,esty,teEs,in), -pm_shFeCes(t,regi_dyn36(regi),entyFe,in,teEs)$( NOT t0(t)) - = p36_shFeCes(t,regi,entyFe,in,teEs); -); -pm_esCapCost(t,regi_dyn36(regi),teEs_dyn36(teEs)) - = p36_esCapCost(t,regi,teEs); - - -*** Diagnostics -*** Compute the norm of the difference between the share vectors of two iterations -p36_shUeCes_iter(iteration,t,regi,entyFe,in,teEs) - = p36_shUeCes(t,regi,entyFe,in,teEs) ; -if ( ord(iteration) gt 1, -loop ((t,regi_dyn36(regi),inViaEs_dyn36(in)), -p36_logitNorm(iteration,t,regi,in) = sqrt ( - sum (fe2ces_dyn36(entyFe,esty,teEs,in) , - power ( p36_shUeCes_iter(iteration,t,regi,entyFe,in,teEs) - - p36_shUeCes_iter(iteration - 1,t,regi,entyFe,in,teEs), - 2) - ) - ) -; -) -); - -*** Reporting -put file_logit_buildings; -put "scenario", "iteration", "period", "region", "variable", "tech", "ces_out", "value" /; - -*** Report on the historical shares - - loop (t36_hist(ttot), - loop (regi_dyn36(regi), - loop (fe2ces_dyn36(entyFe,esty,teEs,in), - - put "%c_expname%", "target", ttot.tl, regi.tl, "shareFE", teEs.tl, in.tl, p36_shFeCes(ttot,regi,entyFe,in,teEs) /; - - ); - ); - ); - -loop ((t,regi_dyn36(regi),fe2ces_dyn36(entyFe,esty,teEs,in)), -put "%c_expname%", iteration.tl, t.tl,regi.tl, "shareFE", teEs.tl, in.tl, p36_shFeCes(t,regi,entyFe,in,teEs) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "shareUE", teEs.tl, in.tl, p36_shUeCes(t,regi,entyFe,in,teEs) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "cost", teEs.tl, in.tl, (p36_techCosts(t,regi,entyFe,esty,teEs) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "calibfactor", teEs.tl, in.tl, (p36_logitCalibration(t,regi,entyFe,esty,teEs)* 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "FEpriceWoTax", teEs.tl, in.tl, (p36_fePrice(t,regi,entyFe) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "OM", teEs.tl, in.tl, ((p36_fePrice(t,regi,entyFe) - + p36_inconvpen(t,regi,teEs) - + pm_tau_fe_tax(t,regi,"build",entyFe) - + pm_tau_fe_sub(t,regi,"build",entyFe) - ) - / pm_fe2es(t,regi,teEs) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "OM_FEpriceWtax", teEs.tl, in.tl, ( - (p36_fePrice(t,regi,entyFe) - + pm_tau_fe_tax(t,regi,"build",entyFe) - + pm_tau_fe_sub(t,regi,"build",entyFe) - ) - / pm_fe2es(t,regi,teEs) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "OM_inconvenience", teEs.tl, in.tl, (( - p36_inconvpen(t,regi,teEs) - ) - / pm_fe2es(t,regi,teEs) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "FEpriceTax", teEs.tl, in.tl, ((p36_fePrice(t,regi,entyFe) - + pm_tau_fe_tax(t,regi,"build",entyFe) - + pm_tau_fe_sub(t,regi,"build",entyFe) - ) - * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "CapCosts", teEs.tl, in.tl, (p36_esCapCost(t,regi,teEs) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -put "%c_expname%", iteration.tl, t.tl,regi.tl, "CapCostsImplicit", teEs.tl, in.tl, (p36_esCapCostImplicit(t,regi,teEs) * 1000 / (sm_day_2_hour * sm_year_2_day)) /; -); - -if ( ord(iteration) gt 1, -loop ((t,regi_dyn36(regi),inViaEs_dyn36(in)), -put "%c_expname%", iteration.tl, t.tl,regi.tl, "norm_diff", "NA" ,in.tl, p36_logitNorm(iteration,t,regi,in) /; -); -); - -putclose; - -*** EOF ./modules/36_buildings/services_with_capital/presolve.gms - diff --git a/modules/36_buildings/services_with_capital/realization.gms b/modules/36_buildings/services_with_capital/realization.gms deleted file mode 100644 index 83f506039..000000000 --- a/modules/36_buildings/services_with_capital/realization.gms +++ /dev/null @@ -1,35 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_with_capital/realization.gms - -*' @description -*' -*'The `services_with_capital` realization splits the representation of buildings energy demand between the CES structure -*' and a multinomial logit structure which distributes the demand across technologies. -*' Importantly, the realization distinguishes across four end-use categories (`appliances and lighting`, `water heating and cooking`, -*' `space cooling` and `space cooling` ). -*' Not only the demand for final energy is represented, but also the demand for useful energy, which is necessary to display the level of efficiency achieved. -*' In total, six energy carrier categories are included (electricity, solids, liquids, gas, district heating, hydrogen), spread across the various end-uses. -*' -*' The model can decide to invest in end-use capital (insulation, appliances, space cooling) to reduce the energy demand, -*' or it can switch to more efficient technologies to produce heat. -*' The conversion efficiencies of the individual heat technologies is prescribed exogenously however. -*' -*' @limitations This realization does not represent inertia dynamics in the renovation of buildings. -* - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/36_buildings/services_with_capital/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/36_buildings/services_with_capital/declarations.gms" -$Ifi "%phase%" == "datainput" $include "./modules/36_buildings/services_with_capital/datainput.gms" -$Ifi "%phase%" == "equations" $include "./modules/36_buildings/services_with_capital/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/36_buildings/services_with_capital/preloop.gms" -$Ifi "%phase%" == "bounds" $include "./modules/36_buildings/services_with_capital/bounds.gms" -$Ifi "%phase%" == "presolve" $include "./modules/36_buildings/services_with_capital/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/36_buildings/services_with_capital/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### -*** EOF ./modules/36_buildings/services_with_capital/realization.gms diff --git a/modules/36_buildings/services_with_capital/sets.gms b/modules/36_buildings/services_with_capital/sets.gms deleted file mode 100644 index caf2a30f0..000000000 --- a/modules/36_buildings/services_with_capital/sets.gms +++ /dev/null @@ -1,259 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/36_buildings/services_with_capital/sets.gms -Sets - regi_dyn36(all_regi) "dynamic region set for compatibility with testOneRegi" - teEs_dyn36(all_teEs) "technologies - buildings module additions" - / - te_ueshheb "buildings space heating district heat" - te_ueshhob "buildings space heating liquids" - te_ueshsob "buildings space heating solids" - te_ueshstb "buildings space heating traditional solids (trad biomass + coal)" - te_ueshgab "buildings space heating district heat" - te_ueshh2b "buildings space heating hydrogen" - te_ueshelb "buildings space heating electricity resistance" - te_ueshhpb "buildings space heating electricity heat pump" - - te_uecwhob "buildings cooking and water heating liquids" - te_uecwsob "buildings cooking and water heating solids" - te_uecwstb "buildings cooking and water heating traditional solids" - te_uecwgab "buildings cooking and water heating gas" - te_uecwheb "buildings cooking and water heating district heat" - te_uecwh2b "buildings cooking and water heating hydrogen" - te_uecwelb "buildings cooking and water heating electricity" - te_uecwhpb "buildings cooking and water heating heat pump" - - / - - esty_dyn36(all_esty) "Energy service types" - / - ueshheb "buildings space heating district heat" - ueshhob "buildings space heating liquids" - ueshsob "buildings space heating solids" - ueshstb "buildings space heating traditional solids" - ueshgab "buildings space heating district heat" - ueshh2b "buildings space heating hydrogen" - ueshelb "buildings space heating electricity resistance" - ueshhpb "buildings space heating electricity heat pump" - - uecwhob "buildings cooking and water heating liquids" - uecwsob "buildings cooking and water heating solids" - uecwstb "buildings cooking and water heating traditional solids" - uecwgab "buildings cooking and water heating gas" - uecwheb "buildings cooking and water heating district heat" - uecwh2b "buildings cooking and water heating hydrogen" - uecwelb "buildings cooking and water heating electricity" - uecwhpb "buildings cooking and water heating heat pump" - / - - in_buildings_dyn36(all_in) "all inputs and outputs of the CES function - buildings" - / - enb "buildings energy use" - - esswb "buildings weatherization energy service" - - uealb "buildings appliances and light" - uecwb "buildings cooking and water heating" - ueswb "buildings weatherization" - uescb "buildings cooling" - ueshb "buildings heating" - - fescelb "buildings space cooling electricity" - - fealelb "buildings appliances and light electricity" - - kaphc "buildings capital stock insulation" - kapsc "buildings capital stock space cooling" - kapal "buildings capital stock appliances and light" - - / - - - - es2ppfen_dyn36(all_esty,all_in) "matching FE to ppfEn in MACRO" -/ - ueshheb.ueshb - ueshhob.ueshb - ueshsob.ueshb - ueshstb.ueshb - ueshgab.ueshb - ueshh2b.ueshb - ueshelb.ueshb - ueshhpb.ueshb - - uecwhob.uecwb - uecwsob.uecwb - uecwstb.uecwb - uecwgab.uecwb - uecwheb.uecwb - uecwh2b.uecwb - uecwelb.uecwb - uecwhpb.uecwb -/ - -fe2es_dyn36(all_enty,all_esty,all_teEs) "map FE carriers to ES via appliances" -/ - fehes.ueshheb.te_ueshheb - fehos.ueshhob.te_ueshhob - fesos.ueshsob.te_ueshsob - fesos.ueshstb.te_ueshstb - fegas.ueshgab.te_ueshgab - feh2s.ueshh2b.te_ueshh2b - feels.ueshelb.te_ueshelb - feels.ueshhpb.te_ueshhpb - - fehos.uecwhob.te_uecwhob - fesos.uecwsob.te_uecwsob - fesos.uecwstb.te_uecwstb - fegas.uecwgab.te_uecwgab - fehes.uecwheb.te_uecwheb - feh2s.uecwh2b.te_uecwh2b - feels.uecwelb.te_uecwelb - feels.uecwhpb.te_uecwhpb -/ - -buildMoBio36 (all_esty) "modern biomass in buildings" -/ -ueshsob -uecwsob -/ - - fe2ces_dyn36(all_enty,all_esty,all_teEs,all_in) "map FE carriers to CES via appliances" -// -feteces_dyn36(all_enty,all_teEs,all_in) "map FE carriers to CES without esty" -// - - -inViaEs_dyn36(all_in) "CES inputs which are provided throught the ES pathway" - - in_putty_dyn36(all_in) "putty in for buildings" - / - / - ppf_putty_dyn36(all_in) "putty ppf for buildings" - // - - in_complements_dyn36(all_in) "in complements" - / - uescb - ueshb - / - - nests_putty_dyn36(all_in,all_in) "putty nests" - // - - ppfKap_dyn36(all_in) "Capital primary production factors" - / - kaphc - kapsc - kapal - - / - - ppfen_buildings_dyn36(all_in) "primary production factors energy - buildings" - / - ueshb - uecwb - fescelb - fealelb - / - - cal_ppf_buildings_dyn36(all_in) "primary production factors - buildings - used for the calibration" - / uescb, ueshb, uealb, uecwb, kaphc/ - - ue_dyn36(all_in) "useful energy items" - /uescb, ueshb, uealb, uecwb/ - - ces_buildings_dyn36(all_in,all_in) "CES tree structure - buildings" - / - en . enb - enb . (esswb, uealb, uecwb) - esswb . (ueswb,kaphc) - ueswb . (uescb,ueshb) - uescb . (fescelb,kapsc) - - uealb . (fealelb,kapal) - - / - - fe2ppfEn36(all_enty,all_in) "match ESM entyFe to ppfEn" - / - feels . (fescelb,fealelb) - / - - fe_tax_sub36(all_in,all_in) "correspondence between tax and subsidy input data resolution and model sectoral resolution" - / - feelb . (fealelb,fescelb) - / - - mapElHp(all_teEs,all_teEs) "correspondence between electric resistance technology and heat pump technology" - / - te_uecwelb. te_uecwhpb - te_ueshelb. te_ueshhpb - / - - richTechs(all_teEs) "technologies whose calibration decreases with income " - / - te_ueshgab - te_uecwgab - / - - t36_hist(ttot) "historic time steps" - t36_hist_last(ttot) "last historic time step" - t36_scen(ttot) "non historical scenario time step" - - teEs_pushCalib_dyn36(all_teEs) "technologies for which the Logit parameter should be modified" - - opTimeYr2teEs(all_teEs,opTimeYr) "mapping for technologies to yearly lifetime - is filled automatically from the lifetime values of technologies" -; - -loop ( fe2es_dyn36(all_enty,all_esty,all_teEs), - loop ( es2ppfen_dyn36(all_esty,all_in), - fe2ces_dyn36(all_enty,all_esty,all_teEs,all_in) = YES; - inViaEs_dyn36(all_in) = YES; - feteces_dyn36(all_enty,all_teEs,all_in) = YES; - ) - ); - - - alias (fe2ces_dyn36,fe2ces_dyn36_2); - alias (fe2es_dyn36, fe2es_dyn36_2); - alias (feteces_dyn36, feteces_dyn36_2); - - -t36_hist(ttot) = NO; -t36_hist(ttot)$(sameAs(ttot,"2005") OR sameAs(ttot,"2010") OR sameAs(ttot,"2015")) = YES; - -t36_scen(ttot) = NO; -t36_scen(ttot)$t(ttot) = YES; -t36_scen(ttot)$t36_hist(ttot) = NO; - -$offOrder - t36_hist_last(ttot) = NO; - t36_hist_last(t36_hist)$(ord(t36_hist) eq card(t36_hist)) = YES; -$offOrder - -teEs_pushCalib_dyn36(all_teEs) = NO; -***------------------------------------------------------------------------- -*** add module specific sets and mappings to the global sets and mappings -***------------------------------------------------------------------------- -ppfKap(ppfKap_dyn36) = YES; -in(in_buildings_dyn36) = YES; -ppfEn(ppfen_buildings_dyn36) = YES; -cesOut2cesIn(ces_buildings_dyn36) = YES; -fe2ppfEn(fe2ppfEn36) = YES; -in_putty(in_putty_dyn36) = YES; -ppf_putty(ppf_putty_dyn36) = YES; -in_complements(in_complements_dyn36) = YES; -fe_tax_sub_sbi(fe_tax_sub36) = YES; - -buildMoBio(buildMoBio36) = YES; - -teEs(teEs_dyn36) = YES; -esty(esty_dyn36) = YES; -fe2es(fe2es_dyn36) = YES; -es2ppfen(es2ppfen_dyn36) = YES; -*** EOF ./modules/36_buildings/services_with_capital/sets.gms From fb8dbe1ec058e26c65b713f922e8be2c23b4f0a9 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Tue, 12 Dec 2023 10:37:46 +0100 Subject: [PATCH 02/35] delete switches which where only needed in the deleted realizations --- main.gms | 17 ----------------- modules/36_buildings/simple/not_used.txt | 3 --- standalone/MOFEX/MOFEX.gms | 8 -------- standalone/trade/trade.gms | 5 ----- 4 files changed, 33 deletions(-) diff --git a/main.gms b/main.gms index 37c6e6bf8..2bd09e566 100755 --- a/main.gms +++ b/main.gms @@ -327,8 +327,6 @@ $setglobal transport edge_esm !! def = edge_esm *'--------------------- 36_buildings --------------------------------- *' *' * (simple): representation of final energy demand via a CES function calibrated to EDGE-Buildings' demand trajectories -*' * (services_with_capital): representation of the demand by energy service with capital -*' * (services_putty): representation of the demand by energy service with capital and with putty-clay for buildings insulation $setglobal buildings simple !! def = simple *'--------------------- 37_industry ---------------------------------- *' @@ -1062,11 +1060,6 @@ parameter ; cm_build_H2costDecayEnd = 0.1; !! def = 0.1 *' -parameter - cm_build_AdjCostActive "Activate adjustment cost to penalise inter-temporal variation of area-specific weatherisation demand and space cooling efficiency slope (only in putty)" -; - cm_build_AdjCostActive = 0; !! def = 0: Adjustment cost deactivated (set to 1 to activate) !! regexp = 0|1 -*' parameter cm_indst_H2costAddH2Inv "additional h2 distribution costs for low diffusion levels (default value: 3.25$kg = 0.1 $/kWh)" ; @@ -1101,16 +1094,6 @@ parameter *' * (0) none *' * (1) no fossil carbon and capture in Germany *' -parameter - cm_logitCal_markup_conv_b "value to which logit calibration markup of standard fe2ue technologies in detailed buildings module converges to" -; - cm_logitCal_markup_conv_b = 0.8; !! def = 0.8 -*' long-term convergence value of detailed buildings fe2ue conventional techs price markup -parameter - cm_logitCal_markup_newtech_conv_b "value to which logit calibration markup of new fe2ue technologies in detailed buildings module converges to" -; - cm_logitCal_markup_newtech_conv_b = 0.3; !! def = 0.3 -*' long-term convergence value of detailed buildings fe2ue new techs price markup parameter cm_startIter_EDGET "starting iteration of EDGE-T" ; diff --git a/modules/36_buildings/simple/not_used.txt b/modules/36_buildings/simple/not_used.txt index 083a7a400..7b0f0ae8d 100644 --- a/modules/36_buildings/simple/not_used.txt +++ b/modules/36_buildings/simple/not_used.txt @@ -32,9 +32,6 @@ sm_day_2_hour,input,questionnaire pm_tsu2opTimeYr,input,questionnaire vm_demFeForEs,input,questionnaire cm_priceSensiBuild,input,questionnaire -cm_logitCal_markup_conv_b,input,questionnaire -cm_logitCal_markup_newtech_conv_b,input,questionnaire -cm_build_AdjCostActive,input,questionnaire qm_balFe,input,questionnaire pm_tau_fe_tax,input,questionnaire pm_tau_fe_sub,input,questionnaire diff --git a/standalone/MOFEX/MOFEX.gms b/standalone/MOFEX/MOFEX.gms index 72d1d5264..71f546fbb 100644 --- a/standalone/MOFEX/MOFEX.gms +++ b/standalone/MOFEX/MOFEX.gms @@ -209,15 +209,12 @@ cm_VRE_supply_assumptions "default (0), optimistic (1), sombre (2), or bl cm_build_H2costAddH2Inv "additional h2 distribution costs for low diffusion levels (default value: 6.5$/ 100 /Kwh)" cm_build_H2costDecayStart "simplified logistic function end of full value (ex. 5% -> between 0 and 5% the function will have the value 1). [%]" cm_build_H2costDecayEnd "simplified logistic function start of null value (ex. 10% -> after 10% the function will have the value 0). [%]" -cm_build_AdjCostActive "Activate adjustment cost to penalise inter-temporal variation of area-specific weatherisation demand and space cooling efficiency slope (only in putty)" cm_indst_H2costAddH2Inv "additional h2 distribution costs for low diffusion levels. [3.25$/ 0.1 /kWh]" cm_indst_costDecayStart "simplified logistic function end of full value (ex. 5% -> between 0 and 5% the simplified logistic function will have the value 1). [%]" cm_indst_H2costDecayEnd "simplified logistic function start of null value (ex. 10% -> between 10% and 100% the simplified logistic function will have the value 0). [%]" cm_BioSupply_Adjust_EU "factor for scaling sub-EU bioenergy supply curves" cm_BioImportTax_EU "factor for EU bioenergy import tax" cm_import_EU "EU switch for different scenarios of EU SE import assumptions" -cm_logitCal_markup_conv_b "value to which logit calibration markup of standard fe2ue technologies in detailed buildings module converges to" -cm_logitCal_markup_newtech_conv_b "value to which logit calibration markup of new fe2ue technologies in detailed buildings module converges to" cm_noPeFosCCDeu "switch to suppress Pe2Se Fossil Carbon Capture in Germany" cm_HeatLim_b "switch to set maximum share of district heating in FE buildings" cm_ElLim_b "switch to set maximum share of electricity in FE buildings" @@ -372,11 +369,6 @@ cm_H2targets = 0; !! def 0 *** EU import switches $setGlobal cm_import_EU off !! def off -*** buildings services_putty switches -cm_logitCal_markup_conv_b = 0.8; !! def 0.8 -cm_logitCal_markup_newtech_conv_b = 0.3; !! def 0.3 -cm_build_AdjCostActive = 0; !! def 0 = Adjustment cost deactivated (set to 1 to activate) - *** flex tax switches cm_flex_tax = 0; !! def 0 cm_PriceDurSlope_elh2 = 20; !! def 10 diff --git a/standalone/trade/trade.gms b/standalone/trade/trade.gms index caf01c4cc..5c47c4516 100644 --- a/standalone/trade/trade.gms +++ b/standalone/trade/trade.gms @@ -219,8 +219,6 @@ cm_indst_H2costDecayEnd "simplified logistic function start of null value (e cm_BioSupply_Adjust_EU "factor for scaling sub-EU bioenergy supply curves" cm_BioImportTax_EU "factor for EU bioenergy import tax" cm_import_EU "EU switch for different scenarios of EU SE import assumptions" -cm_logitCal_markup_conv_b "value to which logit calibration markup of standard fe2ue technologies in detailed buildings module converges to" -cm_logitCal_markup_newtech_conv_b "value to which logit calibration markup of new fe2ue technologies in detailed buildings module converges to" cm_demTcomplex "switch used to select the source of demand trends for the complex transport realization. By default, temporary handmade trajectories; if set to fromEDGET, EDGE-T based mrremind results." cm_noPeFosCCDeu "switch to suppress Pe2Se Fossil Carbon Capture in Germany" cm_HeatLim_b "switch to set maximum share of district heating in FE buildings" @@ -378,9 +376,6 @@ cm_H2targets = 0; !! def 0 *** EU import switches $setGlobal cm_import_EU off !! def off -*** buildings services_putty switches -cm_logitCal_markup_conv_b = 0.8; !! def 0.8 -cm_logitCal_markup_newtech_conv_b = 0.3; !! def 0.3 *** flex tax switches cm_flex_tax = 0; !! def 0 From af5fc91bb227eaa2c4ef5d0654738ac7a0db5412 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Tue, 12 Dec 2023 11:46:52 +0100 Subject: [PATCH 03/35] adjust interfaces of the deleted realizations --- core/datainput.gms | 23 ++++------- core/declarations.gms | 13 ++----- core/equations.gms | 2 +- main.gms | 10 ----- .../01_macro/singleSectorGr/declarations.gms | 4 +- modules/01_macro/singleSectorGr/equations.gms | 2 +- modules/21_tax/off/not_used.txt | 4 +- modules/21_tax/on/datainput.gms | 8 ++-- modules/21_tax/on/declarations.gms | 2 + modules/21_tax/on/equations.gms | 2 +- modules/21_tax/on/postsolve.gms | 2 +- modules/21_tax/on/preloop.gms | 38 +++++++++---------- modules/21_tax/on/presolve.gms | 2 +- modules/32_power/DTcoup/datainput.gms | 2 +- modules/32_power/IntC/datainput.gms | 2 +- modules/36_buildings/simple/not_used.txt | 30 --------------- scripts/utils/gdx_rename.sh | 2 +- standalone/MOFEX/MOFEX.gms | 4 -- standalone/template.gms | 2 - standalone/trade/trade.gms | 4 -- 20 files changed, 48 insertions(+), 110 deletions(-) diff --git a/core/datainput.gms b/core/datainput.gms index c90db1e80..e015713aa 100644 --- a/core/datainput.gms +++ b/core/datainput.gms @@ -189,10 +189,10 @@ $if not "%cm_learnRate%" == "off" parameter p_new_learnRate(all_te) / %cm_learnR $if not "%cm_learnRate%" == "off" fm_dataglob("learn",te)$p_new_learnRate(te)=p_new_learnRate(te); *RP* the new cost data in generisdata_tech is now in $2015. As long as the model runs in $2005, these values have first to be converted to D2005 by dividing by 1.2 downwards -fm_dataglob("inco0",te) = sm_D2015_2_D2005 * fm_dataglob("inco0",te); -fm_dataglob("incolearn",te) = sm_D2015_2_D2005 * fm_dataglob("incolearn",te); -fm_dataglob("omv",te) = sm_D2015_2_D2005 * fm_dataglob("omv",te); -p_inco0(ttot,regi,te) = sm_D2015_2_D2005 * p_inco0(ttot,regi,te); +fm_dataglob("inco0",te) = s_D2015_2_D2005 * fm_dataglob("inco0",te); +fm_dataglob("incolearn",te) = s_D2015_2_D2005 * fm_dataglob("incolearn",te); +fm_dataglob("omv",te) = s_D2015_2_D2005 * fm_dataglob("omv",te); +p_inco0(ttot,regi,te) = s_D2015_2_D2005 * p_inco0(ttot,regi,te); *RP* rescale the global CSP investment costs in REMIND: Originally we assume a SM3/12h setup, while the cost data from IEA for the short term seems rather based on a SM2/6h setup (with 40% average CF) *** Accordingly, also decrease long-term costs in REMIND to 0.7 of the current values @@ -226,10 +226,10 @@ $ENDIF.WindOff *** inco0 (and incolearn) are given in $/kW (or $/(tC/a) for dac) *** convert to REMIND units, i.e., T$/TW (or T$/(GtC/a) for dac) *** note that factor for $/kW -> T$/TW is the same as for $/(tC/a) -> T$/(GtC/a) -fm_dataglob("inco0",te) = sm_DpKW_2_TDpTW * fm_dataglob("inco0",te); -fm_dataglob("incolearn",te) = sm_DpKW_2_TDpTW * fm_dataglob("incolearn",te); +fm_dataglob("inco0",te) = s_DpKW_2_TDpTW * fm_dataglob("inco0",te); +fm_dataglob("incolearn",te) = s_DpKW_2_TDpTW * fm_dataglob("incolearn",te); fm_dataglob("omv",te) = s_DpKWa_2_TDpTWa * fm_dataglob("omv",te); -p_inco0(ttot,regi,te) = sm_DpKW_2_TDpTW * p_inco0(ttot,regi,te); +p_inco0(ttot,regi,te) = s_DpKW_2_TDpTW * p_inco0(ttot,regi,te); table fm_dataemiglob(all_enty,all_enty,all_te,all_enty) "read-in of emissions factors co2,cco2" @@ -1240,15 +1240,6 @@ loop (teNoLearn(te)$( sameas(te,"igcc") ), ); $endif.REG_techcosts -*** rename f_datafecostsglob -* p_esCapCost(regi,in)$f_datafecostsglob("lifetime",in) -* = (f_datafecostsglob("inco0",in) -* + f_datafecostsglob("omf",in) * f_datafecostsglob("lifetime",in) -* ) * f_datafecostsglob("eta",in) !! from cost per UE power to cost per FE power -* / (f_datafecostsglob("lifetime",in) * f_datafecostsglob("usehr",in)) !! capital costs are levelled over the yearly use -* * sm_day_2_hour * sm_year_2_day !! from $/TWh to $/TWa. -* ; - *** ----------------------------------------------------------------------------- *** ------------ emission budgets and their time periods ------------------------ *** ----------------------------------------------------------------------------- diff --git a/core/declarations.gms b/core/declarations.gms index ef2ad7489..1f8a578f8 100644 --- a/core/declarations.gms +++ b/core/declarations.gms @@ -39,7 +39,6 @@ pm_emissionsForeign(tall,all_regi,all_enty) "total emissions of other r pm_co2eqForeign(tall,all_regi) "emissions, which are part of the climate policy, of other regions (nash relevant)" pm_cesdata(tall,all_regi,all_in,cesParameter) "parameters of the CES function" pm_cesdata_putty(tall,all_regi,all_in,cesParameter) "quantities for the putty clay factors" -pm_capital_lifetime_exp(all_regi,all_in) "number of years for which 25% of the CES capital stocks remains" f_pop(tall,all_regi,all_POPscen) "population data for all possible scenarios" pm_pop(tall,all_regi) "population data [bn people]" pm_gdp(tall,all_regi) "GDP data [trn US$ 2005]" @@ -256,9 +255,6 @@ p_FEPrice_by_Sector_iter(iteration,ttot,all_regi,all_enty,sector) p_FEPrice_by_EmiMkt_iter(iteration,ttot,all_regi,all_enty,emiMkt) "parameter to save iteration FE marginal price per emission market (tr$2005/TWa)" p_FEPrice_by_FE_iter(iteration,ttot,all_regi,all_enty) "parameter to save iteration FE marginal price (tr$2005/TWa)" -pm_tau_fe_tax(ttot,all_regi,emi_sectors,all_enty) "tax path for final energy" -pm_tau_fe_sub(ttot,all_regi,emi_sectors,all_enty) "subsidy path for final energy" - *** climate related pm_globalMeanTemperature(tall) "global mean temperature anomaly" pm_globalMeanTemperatureZeroed1900(tall) "global mean temperature anomaly, zeroed around 1900" @@ -367,7 +363,6 @@ v_changeProdStartyearSlack(ttot,all_regi,all_te) "slack variable to allow a positive variables ***---------------------------------------------------------------------------------------- ***-------------------------------------------------MACRO module--------------------------- -vm_enerSerAdj(tall,all_regi,all_in) "adjustment costs for energy service transformations" vm_esCapInv(ttot,all_regi,all_teEs) "investment for energy end-use capital at the energy service level" ***---------------------------------------------------------------------------------------- *-----------------------------------------------ESM module--------------------------------- @@ -463,7 +458,7 @@ q_costTeCapital(tall,all_regi,all_te) "calculation of investment q_balPe(ttot,all_regi,all_enty) "balance of primary energy (pe)" q_balSe(ttot,all_regi,all_enty) "balance of secondary energy (se)" -qm_balFe(ttot,all_regi,all_enty,all_enty,all_te) "balance of final energy (fe)" +q_balFe(ttot,all_regi,all_enty,all_enty,all_te) "balance of final energy (fe)" q_balFeAfterTax(ttot,all_regi,all_enty,all_enty,emi_sectors,all_emiMkt) "balance of final energy after considering FE sectoral taxes (fe)" q_transPe2se(ttot,all_regi,all_enty,all_enty,all_te) "energy tranformation pe to se" @@ -563,8 +558,6 @@ o_modelstat "critical solver status fo pm_conv_TWa_EJ "conversion from TWa to EJ" /31.536/, sm_c_2_co2 "conversion from c to co2" /3.666666666667/, *** conversion factors of time units -sm_year_2_day "days per year" /365/, -sm_day_2_hour "hours per day" /24/, sm_mega_2_non "mega to non" /1e+6/, sm_giga_2_non "giga to non" /1e+9/, sm_trillion_2_non "trillion to non" /1e+12/, @@ -579,7 +572,7 @@ sm_TWa_2_kWh "tera Watt year to kilo Wa *RP* multiply this number by the conversion factor s_xxx_2_yyy to get the new value in Unit yyy. s_NO2_2_N "convert NO2 to N [14 / (14 + 2 * 16)]" / .304 / s_DpKWa_2_TDpTWa "convert Dollar per kWa to TeraDollar per TeraWattYear" /0.001/ -sm_DpKW_2_TDpTW "convert Dollar per kW to TeraDollar per TeraWatt" /0.001/ +s_DpKW_2_TDpTW "convert Dollar per kW to TeraDollar per TeraWatt" /0.001/ sm_DpGJ_2_TDpTWa "multipl. factor to convert (Dollar per GJoule) to (TerraDollar per TWyear)" / 31.54e-03/ s_gwpCH4 "Global Warming Potentials of CH4, AR5 WG1 CH08 Table 8.7" /28/ s_gwpN2O "Global Warming Potentials of N2O, AR5 WG1 CH08 Table 8.7" /265/ @@ -590,7 +583,7 @@ sm_tgch4_2_pgc "conversion factor 100-yr s_MtCH4_2_TWa "Energy content of methane. MtCH4 --> TWa: 1 MtCH4 = 1.23 * 10^6 toe * 42 GJ/toe * 10^-9 EJ/GJ * 1 TWa/31.536 EJ = 0.001638 TWa (BP statistical review)" /0.001638/ -sm_D2015_2_D2005 "Convert $2015 to $2005 by dividing by 1.2: 1/1.2 = 0.8333" /0.8333/ +s_D2015_2_D2005 "Convert $2015 to $2005 by dividing by 1.2: 1/1.2 = 0.8333" /0.8333/ sm_DptCO2_2_TDpGtC "Conversion multiplier to go from $/tCO2 to T$/GtC: 44/12/1000" /0.00366667/ s_co2pipe_leakage "Leakage rate of CO2 pipelines. [0..1]" diff --git a/core/equations.gms b/core/equations.gms index 755f9baf4..d5bc4c5f5 100644 --- a/core/equations.gms +++ b/core/equations.gms @@ -211,7 +211,7 @@ q_transSe2se(t,regi,se2se(enty,enty2,te)).. ***--------------------------------------------------------------------------- *** FE Balance ***--------------------------------------------------------------------------- -qm_balFe(t,regi,entySe,entyFe,te)$se2fe(entySe,entyFe,te).. +q_balFe(t,regi,entySe,entyFe,te)$se2fe(entySe,entyFe,te).. vm_prodFe(t,regi,entySe,entyFe,te) =e= sum((sector2emiMkt(sector,emiMkt),entyFE2sector(entyFE,sector)), diff --git a/main.gms b/main.gms index 2bd09e566..4ab81c578 100755 --- a/main.gms +++ b/main.gms @@ -959,21 +959,11 @@ parameter *' * (3) Energy Efficiency policy: higher discount rate until cm_start_year and 25% of the initial value afterwards. *' * (4) Energy Efficiency policy: higher discount rate until cm_start_year, decreasing to 25% value linearly until 2030. *' -parameter - cm_noReboundEffect "Switch for allowing a rebound effect when closing the efficiency gap (cm_DiscRateScen)" -; - cm_noReboundEffect = 0; -*' price sensitivity of logit function for heating and cooking technological choice parameter c_H2InBuildOnlyAfter "Switch to fix H2 in buildings to zero until given year" ; c_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_priceSensiBuild "Price sensitivity of energy carrier choice in buildings" -; - cm_priceSensiBuild = -3; -*' price sensitivity of logit function for heating and cooking technological choice parameter c_peakBudgYr "date of net-zero CO2 emissions for peak budget runs without overshoot" ; diff --git a/modules/01_macro/singleSectorGr/declarations.gms b/modules/01_macro/singleSectorGr/declarations.gms index a766e3600..ea46cdae5 100644 --- a/modules/01_macro/singleSectorGr/declarations.gms +++ b/modules/01_macro/singleSectorGr/declarations.gms @@ -34,7 +34,9 @@ vm_invMacro(ttot,all_regi,all_in) "Investment for v01_invMacroAdj(ttot,all_regi,all_in) "Adjustment costs of macro economic investments" vm_invRD(ttot,all_regi,all_in) "R&D investments" vm_invInno(ttot,all_regi,all_in) "Investment into innovation" -vm_invImi(ttot, all_regi,all_in) "Investment into imitation" +vm_invImi(ttot, all_regi,all_in) "Investment into imitation" +v01_enerSerAdj(tall,all_regi,all_in) "adjustment costs for energy service transformations" + *** putty-clay variables vm_cesIOdelta(tall,all_regi,all_in) "Putty-clay production factor" diff --git a/modules/01_macro/singleSectorGr/equations.gms b/modules/01_macro/singleSectorGr/equations.gms index 17630c3b7..ed6181ec5 100644 --- a/modules/01_macro/singleSectorGr/equations.gms +++ b/modules/01_macro/singleSectorGr/equations.gms @@ -46,7 +46,7 @@ qm_budget(ttot,regi)$( ttot.val ge cm_startyear ) .. + sum(tradeCap, vm_costTradeCap(ttot,regi,tradeCap)) + vm_taxrev(ttot,regi)$(ttot.val ge 2010) + vm_costAdjNash(ttot,regi) - + sum(in_enerSerAdj(in), vm_enerSerAdj(ttot,regi,in)) + + sum(in_enerSerAdj(in), v01_enerSerAdj(ttot,regi,in)) + sum(teEs, vm_esCapInv(ttot,regi,teEs)) + vm_costpollution(ttot,regi) + pm_totLUcosts(ttot,regi) diff --git a/modules/21_tax/off/not_used.txt b/modules/21_tax/off/not_used.txt index 47b68d492..813333554 100644 --- a/modules/21_tax/off/not_used.txt +++ b/modules/21_tax/off/not_used.txt @@ -14,8 +14,8 @@ vm_prodSe, variable, ??? vm_prodPe, variable, ??? vm_Xport, variable, ??? pm_taxCO2eq, parameter, ??? -pm_tau_fe_sub, parameter, ??? -pm_tau_fe_tax, parameter, ??? +p21_tau_fe_sub, parameter, ??? +p21_tau_fe_tax, parameter, ??? pm_ts, parameter, ??? cm_bioenergy_SustTax,input,questionnaire cm_bioenergy_EF_for_tax,input,questionnaire diff --git a/modules/21_tax/on/datainput.gms b/modules/21_tax/on/datainput.gms index a8547089c..413213bf8 100644 --- a/modules/21_tax/on/datainput.gms +++ b/modules/21_tax/on/datainput.gms @@ -82,16 +82,16 @@ $endIf.vehiclesSubsidies *** transfer data to parameters and rescaling of FE parameters from $/GJ to trillion $ / TWa (subsidies also get adjusted in preloop.gms to avoid neg. prices) - pm_tau_fe_tax(ttot,all_regi,emi_sectors,entyFe)$f21_tau_fe_tax(ttot,all_regi,emi_sectors,entyFe) = f21_tau_fe_tax(ttot,all_regi,emi_sectors,entyFe)*0.001/sm_EJ_2_TWa; - pm_tau_fe_sub(ttot,all_regi,emi_sectors,entyFe)$f21_tau_fe_sub(ttot,all_regi,emi_sectors,entyFe) = f21_tau_fe_sub(ttot,all_regi,emi_sectors,entyFe)*0.001/sm_EJ_2_TWa; + p21_tau_fe_tax(ttot,all_regi,emi_sectors,entyFe)$f21_tau_fe_tax(ttot,all_regi,emi_sectors,entyFe) = f21_tau_fe_tax(ttot,all_regi,emi_sectors,entyFe)*0.001/sm_EJ_2_TWa; + p21_tau_fe_sub(ttot,all_regi,emi_sectors,entyFe)$f21_tau_fe_sub(ttot,all_regi,emi_sectors,entyFe) = f21_tau_fe_sub(ttot,all_regi,emi_sectors,entyFe)*0.001/sm_EJ_2_TWa; p21_tau_fuEx_sub(ttot,regi,entyPE)$f21_tau_fuEx_sub(ttot,regi,entyPE) = f21_tau_fuEx_sub(ttot,regi,entyPE)*0.001/sm_EJ_2_TWa; p21_max_fe_sub(ttot,all_regi,entyFe)$f21_max_fe_sub(ttot,all_regi,entyFe) = f21_max_fe_sub(ttot,all_regi,entyFe)*0.001/sm_EJ_2_TWa; p21_prop_fe_sub(ttot,all_regi,entyFe)$f21_prop_fe_sub(ttot,all_regi,entyFe) = f21_prop_fe_sub(ttot,all_regi,entyFe); if(cm_fetaxscen eq 0, - pm_tau_fe_tax(ttot,all_regi,emi_sectors,entyFe) = 0; - pm_tau_fe_sub(ttot,all_regi,emi_sectors,entyFe) = 0; + p21_tau_fe_tax(ttot,all_regi,emi_sectors,entyFe) = 0; + p21_tau_fe_sub(ttot,all_regi,emi_sectors,entyFe) = 0; p21_tau_fuEx_sub(ttot,regi,all_enty) = 0; ); diff --git a/modules/21_tax/on/declarations.gms b/modules/21_tax/on/declarations.gms index 91b1de7c3..6d22a08b5 100644 --- a/modules/21_tax/on/declarations.gms +++ b/modules/21_tax/on/declarations.gms @@ -20,6 +20,8 @@ p21_bio_EF(ttot,all_regi) "bioenergy emission factor, which p21_tau_Import(ttot,all_regi,all_enty) "tax on energy imports, currently only works on primary energy levels as those are traded on nash markets [trUSD/TWa]" pm_tau_pe_tax(ttot,all_regi,all_enty) "pe tax path" pm_tau_ces_tax(ttot,all_regi,all_in) "ces production tax to implement CES mark-up cost in a budget-neutral way" +p21_tau_fe_tax(ttot,all_regi,emi_sectors,all_enty) "tax path for final energy" +p21_tau_fe_sub(ttot,all_regi,emi_sectors,all_enty) "subsidy path for final energy" pm_taxrevGHG0(ttot,all_regi) "reference level value of GHG emission tax" pm_taxrevCO2Sector0(ttot,all_regi,emi_sectors) "reference level value of CO2 sector markup tax" diff --git a/modules/21_tax/on/equations.gms b/modules/21_tax/on/equations.gms index f8e2ae5e1..51d0001e4 100644 --- a/modules/21_tax/on/equations.gms +++ b/modules/21_tax/on/equations.gms @@ -131,7 +131,7 @@ q21_taxrevFE(t,regi)$(t.val ge max(2010,cm_startyear)).. v21_taxrevFE(t,regi) =e= sum((entyFe,sector)$entyFe2Sector(entyFe,sector), - ( pm_tau_fe_tax(t,regi,sector,entyFe) + pm_tau_fe_sub(t,regi,sector,entyFe) ) + ( p21_tau_fe_tax(t,regi,sector,entyFe) + p21_tau_fe_sub(t,regi,sector,entyFe) ) * sum(emiMkt$sector2emiMkt(sector,emiMkt), sum(se2fe(entySe,entyFe,te), diff --git a/modules/21_tax/on/postsolve.gms b/modules/21_tax/on/postsolve.gms index c547d27b2..7479c7cb4 100644 --- a/modules/21_tax/on/postsolve.gms +++ b/modules/21_tax/on/postsolve.gms @@ -29,7 +29,7 @@ p21_taxrevCCS0(ttot,regi) = cm_frac_CCS * pm_data(regi,"omf","ccsinje") * pm_inc * (1/pm_ccsinjecrate(regi)) * sum(teCCS2rlf(te,rlf), sum(ccs2te(ccsCO2(enty),enty2,te), vm_co2CCS.l(ttot,regi,enty,enty2,te,rlf) ) ) / pm_dataccs(regi,"quan","1"); pm_taxrevNetNegEmi0(ttot,regi) = cm_frac_NetNegEmi * pm_taxCO2eqSum(ttot,regi) * v21_emiALLco2neg.l(ttot,regi); p21_taxrevFE0(ttot,regi) = sum((entyFe,sector)$entyFe2Sector(entyFe,sector), - ( pm_tau_fe_tax(ttot,regi,sector,entyFe) + pm_tau_fe_sub(ttot,regi,sector,entyFe) ) + ( p21_tau_fe_tax(ttot,regi,sector,entyFe) + p21_tau_fe_sub(ttot,regi,sector,entyFe) ) * sum(emiMkt$sector2emiMkt(sector,emiMkt), sum(se2fe(entySe,entyFe,te), diff --git a/modules/21_tax/on/preloop.gms b/modules/21_tax/on/preloop.gms index 6c9481400..a0cc8d6f9 100644 --- a/modules/21_tax/on/preloop.gms +++ b/modules/21_tax/on/preloop.gms @@ -39,45 +39,45 @@ display pm_taxCO2eq; *** Adjustment of final energy subsidies to avoid neg. implicit 2005 prices that result in huge demand increases in 2010 and 2015 *** Maximum final energy subsidy levels (in $/Gj) from REMIND version prior to rev. 5429 -pm_tau_fe_sub(ttot,regi,sector,entyFe)$p21_max_fe_sub(ttot,regi,entyFe) = max(pm_tau_fe_sub(ttot,regi,sector,entyFe),-p21_max_fe_sub(ttot,regi,entyFe)); +p21_tau_fe_sub(ttot,regi,sector,entyFe)$p21_max_fe_sub(ttot,regi,entyFe) = max(p21_tau_fe_sub(ttot,regi,sector,entyFe),-p21_max_fe_sub(ttot,regi,entyFe)); *** Subsidy proportional cap to avoid liquids increasing dramatically -pm_tau_fe_sub(ttot,regi,sector,entyFe)$p21_prop_fe_sub(ttot,regi,entyFe) = pm_tau_fe_sub(ttot,regi,sector,entyFe) * p21_prop_fe_sub(ttot,regi,entyFe); +p21_tau_fe_sub(ttot,regi,sector,entyFe)$p21_prop_fe_sub(ttot,regi,entyFe) = p21_tau_fe_sub(ttot,regi,sector,entyFe) * p21_prop_fe_sub(ttot,regi,entyFe); *** Maximum primary energy subsidy levels (in $/Gj) to provide plausible upper bound: 40$/barrel ~ 8 $/GJ" p21_tau_fuEx_sub(ttot,regi,enty)$f21_max_pe_sub(ttot,regi,enty) = max(p21_tau_fuEx_sub(ttot,regi,enty),-f21_max_pe_sub(ttot,regi,enty)*0.001/sm_EJ_2_TWa); *** ------------------------- Temporal development of final energy TAXES and SUBSIDIES, depending on cm_fetaxscen *** Set time path for: -*** - final energy taxes (pm_tau_fe_tax) +*** - final energy taxes (p21_tau_fe_tax) *** - subsidies (p21_tau_fe_sub) if(cm_fetaxscen ne 0, *----- TAXES ---------------------------------- ***CASE 1: constant TAXES if((cm_fetaxscen eq 1) or (cm_fetaxscen eq 3) or (cm_fetaxscen eq 4), - loop(ttot$(ttot.val ge 2005), pm_tau_fe_tax(ttot,regi,sector,entyFe) = pm_tau_fe_tax("2005",regi,sector,entyFe)); + loop(ttot$(ttot.val ge 2005), p21_tau_fe_tax(ttot,regi,sector,entyFe) = p21_tau_fe_tax("2005",regi,sector,entyFe)); ); ***CASE 2: constant TAXES except for the final energies and regions defined at the f21_tax_convergence.cs4r file if(cm_fetaxscen eq 2, - loop(ttot$(ttot.val ge 2005), pm_tau_fe_tax(ttot,regi,sector,entyFe) = pm_tau_fe_tax("2005",regi,sector,entyFe)); + loop(ttot$(ttot.val ge 2005), p21_tau_fe_tax(ttot,regi,sector,entyFe) = p21_tau_fe_tax("2005",regi,sector,entyFe)); s21_tax_time = 2050; - pm_tau_fe_tax(ttot,regi,sector,entyFe)$(f21_tax_convergence("2050",regi,entyFe) AND ttot.val > 2015 AND ttot.val<(s21_tax_time + 1)) + p21_tau_fe_tax(ttot,regi,sector,entyFe)$(f21_tax_convergence("2050",regi,entyFe) AND ttot.val > 2015 AND ttot.val<(s21_tax_time + 1)) = - pm_tau_fe_tax("2005",regi,sector,entyFe)+((f21_tax_convergence("2050",regi,entyFe)*0.001/sm_EJ_2_TWa-pm_tau_fe_tax("2005",regi,sector,entyFe))*((ttot.val-2015)/(s21_tax_time-2015))); - pm_tau_fe_tax(ttot,regi,sector,entyFe)$(f21_tax_convergence("2050",regi,entyFe) AND ttot.val >(s21_tax_time)) = f21_tax_convergence("2050",regi,entyFe)*0.001/sm_EJ_2_TWa; + p21_tau_fe_tax("2005",regi,sector,entyFe)+((f21_tax_convergence("2050",regi,entyFe)*0.001/sm_EJ_2_TWa-p21_tau_fe_tax("2005",regi,sector,entyFe))*((ttot.val-2015)/(s21_tax_time-2015))); + p21_tau_fe_tax(ttot,regi,sector,entyFe)$(f21_tax_convergence("2050",regi,entyFe) AND ttot.val >(s21_tax_time)) = f21_tax_convergence("2050",regi,entyFe)*0.001/sm_EJ_2_TWa; ); ***----- SUBSIDIES ---------------------------------- ***global subsidies phase-out until 2030 for SSP1 (CASE 2) & SDP (CASE 4), until 2050 for SSP2 (CASE 3), no phaseout for SSP5 (CASE 1) *** CASE 1: Constant subsidy (SSP5) if(cm_fetaxscen eq 1, - loop(ttot$(ttot.val ge 2005), pm_tau_fe_sub(ttot,regi,sector,entyFe)=pm_tau_fe_sub("2005",regi,sector,entyFe)); + loop(ttot$(ttot.val ge 2005), p21_tau_fe_sub(ttot,regi,sector,entyFe)=p21_tau_fe_sub("2005",regi,sector,entyFe)); loop(ttot$(ttot.val ge 2005), p21_tau_pe2se_sub(ttot,regi,te)=p21_tau_pe2se_sub("2005",regi,te)); loop(ttot$(ttot.val ge 2005), p21_tau_fuEx_sub(ttot,regi,entyPE)=p21_tau_fuEx_sub("2005",regi,entyPE)); ); *** CASE 2 and 3 and 4: Global subsidies phase-out by 2030 (SSP1, SDP) and 2050 (SSP2) respectively if(cm_fetaxscen eq 2 OR cm_fetaxscen eq 3 OR cm_fetaxscen eq 4, - pm_tau_fe_sub(ttot,regi,sector,entyFe)$(ttot.val eq 2010 OR ttot.val eq 2015)=pm_tau_fe_sub("2005",regi,sector,entyFe); + p21_tau_fe_sub(ttot,regi,sector,entyFe)$(ttot.val eq 2010 OR ttot.val eq 2015)=p21_tau_fe_sub("2005",regi,sector,entyFe); p21_tau_pe2se_sub(ttot,regi,te)$(ttot.val eq 2010 OR ttot.val eq 2015)=p21_tau_pe2se_sub("2005",regi,te); p21_tau_fuEx_sub(ttot,regi,entyPE)$(ttot.val eq 2010 OR ttot.val eq 2015)=p21_tau_fuEx_sub("2005",regi,entyPE); if(cm_fetaxscen eq 2 OR cm_fetaxscen eq 4, s21_tax_time = 2030); @@ -85,10 +85,10 @@ if(cm_fetaxscen ne 0, s21_tax_value = 0; *** Calculate phase-out loop(ttot, - pm_tau_fe_sub(ttot,regi,sector,entyFe)$(ttot.val > 2015 AND ttot.val<(s21_tax_time + 1)) + p21_tau_fe_sub(ttot,regi,sector,entyFe)$(ttot.val > 2015 AND ttot.val<(s21_tax_time + 1)) = - pm_tau_fe_sub("2015",regi,sector,entyFe)+((s21_tax_value-pm_tau_fe_sub("2015",regi,sector,entyFe))*(ttot.val-2015)/(s21_tax_time-2015)); - pm_tau_fe_sub(ttot,regi,sector,entyFe)$(ttot.val>(s21_tax_time)) = s21_tax_value; + p21_tau_fe_sub("2015",regi,sector,entyFe)+((s21_tax_value-p21_tau_fe_sub("2015",regi,sector,entyFe))*(ttot.val-2015)/(s21_tax_time-2015)); + p21_tau_fe_sub(ttot,regi,sector,entyFe)$(ttot.val>(s21_tax_time)) = s21_tax_value; p21_tau_pe2se_sub(ttot,regi,te)$(ttot.val > 2015 AND ttot.val<(s21_tax_time + 1)) = @@ -111,11 +111,11 @@ $ifthen.fetax not "%cm_FEtax_trajectory_abs%" == "off" loop((ttot,sector,entyFe)$p21_FEtax_trajectory_abs(ttot,sector,entyFe), *** set FE tax to cm_FEtax_trajectory_abs to year given in cm_FEtax_trajectory_abs and after loop(ttot2$(ttot2.val ge ttot.val), - pm_tau_fe_tax(ttot2,regi,sector,entyFe) = p21_FEtax_trajectory_abs(ttot,sector,entyFe) * sm_TWa_2_MWh * 1e-12; + p21_tau_fe_tax(ttot2,regi,sector,entyFe) = p21_FEtax_trajectory_abs(ttot,sector,entyFe) * sm_TWa_2_MWh * 1e-12; ); *** phase-in(out) FE tax linearly before from startyear to year given in cm_FEtax_trajectory_abs loop(ttot2$(ttot2.val eq cm_startyear), - pm_tau_fe_tax(t,regi,sector,entyFe)$(t.val lt ttot.val and t.val ge cm_startyear) = (pm_tau_fe_tax(ttot,regi,sector,entyFe) - pm_tau_fe_tax(ttot2,regi,sector,entyFe))/(ttot.val - ttot2.val) * (t.val - ttot2.val) + pm_tau_fe_tax(ttot2,regi,sector,entyFe); + p21_tau_fe_tax(t,regi,sector,entyFe)$(t.val lt ttot.val and t.val ge cm_startyear) = (p21_tau_fe_tax(ttot,regi,sector,entyFe) - p21_tau_fe_tax(ttot2,regi,sector,entyFe))/(ttot.val - ttot2.val) * (t.val - ttot2.val) + p21_tau_fe_tax(ttot2,regi,sector,entyFe); ); ); $endif.fetax @@ -127,16 +127,16 @@ $ifthen.fetaxRel not "%cm_FEtax_trajectory_rel%" == "off" loop(ttot2$(ttot2.val eq cm_startyear), *** set FE tax to cm_FEtax_trajectory_rel * FE tax level of cm_startyear in year given in cm_FEtax_trajectory_rel and after loop(ttot3$(ttot3.val ge ttot.val), - pm_tau_fe_tax(ttot3,regi,sector,entyFe) = p21_FEtax_trajectory_rel(ttot,sector,entyFe) * pm_tau_fe_tax(ttot2,regi,sector,entyFe); + p21_tau_fe_tax(ttot3,regi,sector,entyFe) = p21_FEtax_trajectory_rel(ttot,sector,entyFe) * p21_tau_fe_tax(ttot2,regi,sector,entyFe); ); *** increase or decrease FE tax level linearily before - pm_tau_fe_tax(t,regi,sector,entyFe)$(t.val lt ttot.val and t.val ge cm_startyear) = (pm_tau_fe_tax(ttot,regi,sector,entyFe) - pm_tau_fe_tax(ttot2,regi,sector,entyFe))/(ttot.val - ttot2.val) * (t.val - ttot2.val) + pm_tau_fe_tax(ttot2,regi,sector,entyFe); + p21_tau_fe_tax(t,regi,sector,entyFe)$(t.val lt ttot.val and t.val ge cm_startyear) = (p21_tau_fe_tax(ttot,regi,sector,entyFe) - p21_tau_fe_tax(ttot2,regi,sector,entyFe))/(ttot.val - ttot2.val) * (t.val - ttot2.val) + p21_tau_fe_tax(ttot2,regi,sector,entyFe); ); ); $endif.fetaxRel -display pm_tau_fe_sub; -display pm_tau_fe_tax; +display p21_tau_fe_sub; +display p21_tau_fe_tax; display p21_tau_pe2se_sub, p21_tau_fuEx_sub; *LB* initialization of vm_emiMac diff --git a/modules/21_tax/on/presolve.gms b/modules/21_tax/on/presolve.gms index 57ac621bd..591b446cf 100644 --- a/modules/21_tax/on/presolve.gms +++ b/modules/21_tax/on/presolve.gms @@ -28,7 +28,7 @@ p21_taxrevCCS0(ttot,regi) = cm_frac_CCS * pm_data(regi,"omf","ccsinje") * pm_inc pm_taxrevNetNegEmi0(ttot,regi) = cm_frac_NetNegEmi * pm_taxCO2eqSum(ttot,regi) * v21_emiALLco2neg.l(ttot,regi); p21_emiALLco2neg0(ttot,regi) = v21_emiALLco2neg.l(ttot,regi); p21_taxrevFE0(ttot,regi) = sum((entyFe,sector)$entyFe2Sector(entyFe,sector), - ( pm_tau_fe_tax(ttot,regi,sector,entyFe) + pm_tau_fe_sub(ttot,regi,sector,entyFe) ) + ( p21_tau_fe_tax(ttot,regi,sector,entyFe) + p21_tau_fe_sub(ttot,regi,sector,entyFe) ) * sum(emiMkt$sector2emiMkt(sector,emiMkt), sum(se2fe(entySe,entyFe,te), diff --git a/modules/32_power/DTcoup/datainput.gms b/modules/32_power/DTcoup/datainput.gms index 6c2c2ddb7..b0012b590 100644 --- a/modules/32_power/DTcoup/datainput.gms +++ b/modules/32_power/DTcoup/datainput.gms @@ -81,7 +81,7 @@ $offdelim / ; *** convert from USD2015/MWh to trUSD2005/TWa -p32_flex_maxdiscount(regi,te) = p32_flex_maxdiscount(regi,te) * sm_TWa_2_MWh * sm_D2015_2_D2005 * 1e-12; +p32_flex_maxdiscount(regi,te) = p32_flex_maxdiscount(regi,te) * sm_TWa_2_MWh * s_D2015_2_D2005 * 1e-12; display p32_flex_maxdiscount; $offtext diff --git a/modules/32_power/IntC/datainput.gms b/modules/32_power/IntC/datainput.gms index 61fbbb44f..b443ec499 100644 --- a/modules/32_power/IntC/datainput.gms +++ b/modules/32_power/IntC/datainput.gms @@ -92,7 +92,7 @@ $offdelim / ; *** convert from USD2015/MWh to trUSD2005/TWa -p32_flex_maxdiscount(regi,te) = p32_flex_maxdiscount(regi,te) * sm_TWa_2_MWh * sm_D2015_2_D2005 * 1e-12; +p32_flex_maxdiscount(regi,te) = p32_flex_maxdiscount(regi,te) * sm_TWa_2_MWh * s_D2015_2_D2005 * 1e-12; display p32_flex_maxdiscount; $offtext diff --git a/modules/36_buildings/simple/not_used.txt b/modules/36_buildings/simple/not_used.txt index 7b0f0ae8d..ad14a32d8 100644 --- a/modules/36_buildings/simple/not_used.txt +++ b/modules/36_buildings/simple/not_used.txt @@ -5,33 +5,3 @@ # | REMIND License Exception, version 1.0 (see LICENSE file). # | Contact: remind@pik-potsdam.de name,type,reason -vm_cesIOdelta,input,questionnaire -vm_enerSerAdj,input,questionnaire -pm_capital_lifetime_exp,input,questionnaire -pm_dt,input,questionnaire -pm_ts,input,questionnaire -pm_cumDeprecFactor_old,input,questionnaire -pm_cumDeprecFactor_new,input,questionnaire -pm_delta_kap,input,questionnaire -sm_EJ_2_TWa,input,questionnaire -sm_DpKW_2_TDpTW,input,questionnaire -sm_DpGJ_2_TDpTWa,input,questionnaire -sm_D2015_2_D2005,input,questionnaire -sm_tmp,input,questionnaire -vm_effGr,input,questionnaire -pm_shPPPMER,input,questionnaire -pm_pop,input,questionnaire -pm_gdp,input,questionnaire -pm_esCapCost,input,questionnaire -pm_fe2es,input,questionnaire -pm_shFeCes,input,questionnaire -cm_DiscRateScen,input,questionnaire -cm_noReboundEffect,input,questionnaire -sm_year_2_day,input,questionnaire -sm_day_2_hour,input,questionnaire -pm_tsu2opTimeYr,input,questionnaire -vm_demFeForEs,input,questionnaire -cm_priceSensiBuild,input,questionnaire -qm_balFe,input,questionnaire -pm_tau_fe_tax,input,questionnaire -pm_tau_fe_sub,input,questionnaire diff --git a/scripts/utils/gdx_rename.sh b/scripts/utils/gdx_rename.sh index 7005fb745..4e52bae5a 100644 --- a/scripts/utils/gdx_rename.sh +++ b/scripts/utils/gdx_rename.sh @@ -91,7 +91,7 @@ if (length(args) == 1) { q_co2eq = 'q_co2eq', pm_costsPEtradeMp = 'pm_costsPEtradeMp', vm_welfare = 'v_welfare', - pm_tau_fe_sub = 'p21_tau_fe_sub', + p21_tau_fe_sub = 'p21_tau_fe_sub', pm_datapop = 'pm_pop', p_datalab = 'pm_lab', p80_pvp = 'pm_pvp', diff --git a/standalone/MOFEX/MOFEX.gms b/standalone/MOFEX/MOFEX.gms index 71f546fbb..e819ebb38 100644 --- a/standalone/MOFEX/MOFEX.gms +++ b/standalone/MOFEX/MOFEX.gms @@ -189,8 +189,6 @@ cm_frac_CCS "tax on CCS to reflect risk of leakage, formulated as fract cm_frac_NetNegEmi "tax on CDR to reflect risk of overshooting, formulated as fraction of carbon price" cm_DiscRateScen "Scenario for the implicit discount rate applied to the energy efficiency capital" -cm_noReboundEffect "Switch for allowing a rebound effect when closing the efficiency gap (cm_DiscRateScen)" -cm_priceSensiBuild "Price sensitivity of energy carrier choice in buildings" c_peakBudgYr "date of net-zero CO2 emissions for peak budget runs without overshoot" c_taxCO2inc_after_peakBudgYr "annual increase of CO2 price after the Peak Budget Year in $ per tCO2" cm_CO2priceRegConvEndYr "Year at which regional CO2 prices converge in module 45 realization diffCurvPhaseIn2Lin" @@ -344,8 +342,6 @@ cm_carbonprice_temperatureLimit = 1.8; !! def = 1.8 cm_DiscRateScen = 0;!! def = 0 -cm_noReboundEffect = 0; -cm_priceSensiBuild = -3; $setGlobal c_scaleEmiHistorical on !! def = on $setGlobal cm_pushCalib none !! def = none $setGlobal cm_reducCostB none !! def = none diff --git a/standalone/template.gms b/standalone/template.gms index 071c4f826..f03a28ab4 100644 --- a/standalone/template.gms +++ b/standalone/template.gms @@ -183,7 +183,6 @@ cm_frac_CCS "tax on CCS to reflect risk of leakage, formulated as fract cm_frac_NetNegEmi "tax on CDR to reflect risk of overshooting, formulated as fraction of carbon price" cm_DiscRateScen "Scenario for the implicit discount rate applied to the energy efficiency capital" -cm_noReboundEffect "Switch for allowing a rebound effect when closing the efficiency gap (cm_DiscRateScen)" ; *** -------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -279,7 +278,6 @@ cm_carbonprice_temperatureLimit = 1.8; !! def = 1.8 cm_DiscRateScen = 0;!! def = 0 -cm_noReboundEffect = 0; *** -------------------------------------------------------------------------------------------------------------------------------------------------------------------- *** YOU ARE IN THE WARNING ZONE (DON'T DO CHANGES HERE) *** -------------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/standalone/trade/trade.gms b/standalone/trade/trade.gms index 5c47c4516..273704052 100644 --- a/standalone/trade/trade.gms +++ b/standalone/trade/trade.gms @@ -193,8 +193,6 @@ cm_frac_CCS "tax on CCS to reflect risk of leakage, formulated as fract cm_frac_NetNegEmi "tax on CDR to reflect risk of overshooting, formulated as fraction of carbon price" cm_DiscRateScen "Scenario for the implicit discount rate applied to the energy efficiency capital" -cm_noReboundEffect "Switch for allowing a rebound effect when closing the efficiency gap (cm_DiscRateScen)" -cm_priceSensiBuild "Price sensitivity of energy carrier choice in buildings" c_peakBudgYr "date of net-zero CO2 emissions for peak budget runs without overshoot" c_taxCO2inc_after_peakBudgYr "annual increase of CO2 price after the Peak Budget Year in $ per tCO2" cm_CO2priceRegConvEndYr "Year at which regional CO2 prices converge in module 45 realization diffCurvPhaseIn2Lin" @@ -351,8 +349,6 @@ cm_carbonprice_temperatureLimit = 1.8; !! def = 1.8 cm_DiscRateScen = 0;!! def = 0 -cm_noReboundEffect = 0; -cm_priceSensiBuild = -3; $setGlobal c_scaleEmiHistorical on !! def = on $setGlobal cm_pushCalib none !! def = none $setGlobal cm_reducCostB none !! def = none From 6e60cfb4ecce02fca8e660f216ed3278c8e82711 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Tue, 12 Dec 2023 13:40:40 +0100 Subject: [PATCH 04/35] delete model esubs --- .../calibrate/declarations.gms | 8 -- .../29_CES_parameters/calibrate/equations.gms | 45 ---------- .../29_CES_parameters/calibrate/preloop.gms | 90 ------------------- .../calibrate/realization.gms | 12 +-- 4 files changed, 1 insertion(+), 154 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/declarations.gms b/modules/29_CES_parameters/calibrate/declarations.gms index 4adcdc310..516dfa3ba 100644 --- a/modules/29_CES_parameters/calibrate/declarations.gms +++ b/modules/29_CES_parameters/calibrate/declarations.gms @@ -32,7 +32,6 @@ $endif.transpmodule f29_capitalUnitProjections(all_regi,all_in,index_Nr,capUnitType) "Capital cost per unit of consumed energy and FE per unit of UE (or UE per unit of ES) used to calibrate some Esubs. kap is in $/kWh; UE and FE in kWh. Data for new investments and for standing capital" p29_capitalUnitProjections(all_regi,all_in,index_Nr) "Capital cost per unit of consumed energy and final energy per unit of useful energy (or UE per unit of ES) used to calibrate some elasticities of substitution. kap is in $/kWh; UE and FE in kWh" - p29_output_estimation(all_regi,all_in) "scaling of the target quantity for comparability with technological data" p29_esubGrowth "long term growth of the elasticity of substitution" @@ -53,9 +52,6 @@ v29_puttyTechDiff(tall,all_regi,all_in) "Difference to be minimised between the v29_putty_obj "index of the step by step variation of v29_cesdata_putty" v29_ratioTotalPutty(tall,all_regi,all_in,all_in,all_in) "Ratio of the ratio between input quantities for total and putty quantities" -v29_esub_err "sum of errors to be minimized" -v29_outputtech(all_regi,all_in,index_Nr) "CES output from the technological data" -v29_rho(all_regi,all_in) "parameter to be calibrated, related to the esub through: rho = 1 - 1/esub" ; Equations @@ -63,10 +59,6 @@ q29_pathConstraint(tall,all_regi,all_in) "equation describing the relation betw q29_esubsConstraint(tall,all_regi,all_in,all_in,all_in) "constraint ensuring that the ratio between capital and energy in putty for the last historical region will be close to the technological data used for the ESUB estimation" q29_ratioTotalPutty (tall,all_regi,all_in,all_in,all_in) "Computation of the ratio between the two putty inputs of a same CES nestand the the ratio of pm_cesdata" q29_putty_obj "objective function" - -q29_esub_obj "objective function of esub estimation" -q29_outputtech(all_regi,all_in,index_Nr) "CES equation for technological data" - ; *** Load calibration iteration number from environment variable diff --git a/modules/29_CES_parameters/calibrate/equations.gms b/modules/29_CES_parameters/calibrate/equations.gms index 08f0c2f5b..11ee27e59 100644 --- a/modules/29_CES_parameters/calibrate/equations.gms +++ b/modules/29_CES_parameters/calibrate/equations.gms @@ -80,50 +80,5 @@ v29_putty_obj =e= 5e-1 * sum ((t_29,regi_dyn29(regi),in)$(putty_compute_in(in) $onOrder - - -q29_outputtech(regi_dyn29(regi),ipf(out),index_Nr)$( (pm_cesdata_sigma("2015",out) eq -1) AND p29_capitalUnitProjections(regi,out,index_Nr)).. - - v29_outputtech(regi,out,index_Nr) - =e= - sum ((cesOut2cesIn(out,in), t_29hist_last(t)), - pm_cesdata(t,regi,in,"xi") - * ( - pm_cesdata(t,regi,in,"eff") - * p29_capitalUnitProjections(regi,in,index_Nr) - ) - ** v29_rho(regi,out) - ) - ** (1 / v29_rho(regi,out)) -; - -q29_esub_obj.. - - v29_esub_err - =e= - sum ((out,regi_dyn29(regi),index_Nr, t_29hist_last(t))$((pm_cesdata_sigma("2015",out) eq -1) AND p29_capitalUnitProjections(regi,out,index_Nr)), - (1 + pm_cesdata(t,regi,out,"quantity")) **2 !! weight by regional size of the service demand - * - ( - power ( - ( p29_output_estimation(regi,out) - / v29_outputtech(regi,out,index_Nr) - ) - - 1 - , 2 - ) - + - power ( - ( v29_outputtech(regi,out,index_Nr) - / p29_output_estimation(regi,out) - ) - -1 - ,2 - ) - ) - ); - - - *** EOF ./modules/29_CES_parameters/calibrate/equations.gms diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index a4c19961e..dc3301e5c 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -1167,92 +1167,6 @@ $endif.subsectors ***_____________________________ END OF: BEYOND CALIB ________________________________________ -***_____________________________ START OF: COMPUTE ELASTICITIES OF SUBSTITUTION ________________________________________ - -*** Elasticities of substitution are normally prescribed manually. -*** However, they can also be estimated from technological data. This is done here. -*** At the time of documentation, the nodes for which this is done are in the services_with_capital realization of the -*** buildings module. - -*** Compute the rho parameter from the elasticity of substitution -pm_cesdata(ttot,regi,ipf(out),"rho")$( ttot.val ge 2005 - AND pm_cesdata_sigma(ttot,out) - AND pm_cesdata_sigma(ttot,out) ne -1 ) - !! Do not compute it if sigma = 0, because these should be estimated - = 1 - (1 / pm_cesdata_sigma(ttot,out)); - -*** Check whether all sigma = INF correspond to complementary factors -*** while it seems contradictory, the model currently only supports -*** complementary factors which add up to yield their output (therefore the perfect substituability). -*** OUT = IN1 + IN2 + IN3 +... -*** The complementarity is ensured by the production constraints on the relations between IN1, IN2, etc - -loop (cesOut2cesIn(out,in) $ (pm_cesdata_sigma("2015",out) eq INF ), - if ( NOT in_complements(in), - execute_unload "abort.gdx"; - abort "the model only supports perfect substituability for complementary factors. Please read the comments in calibration/preloop.gms" - ); - ); - - -*** For the estimation of Esubs: set the CES out to 1 if the CES inputs are in the data -loop (cesOut2cesIn(out,in) $ (pm_cesdata_sigma("2015",out) eq -1), - p29_capitalUnitProjections(all_regi,out,index_Nr) $p29_capitalUnitProjections(all_regi,in,index_Nr) = 1; -); - - model esubs / -q29_outputtech, -q29_esub_obj, -/; - -v29_outputtech.L(regi_dyn29,ipf(out),index_Nr) = 1; -v29_outputtech.lo(regi_dyn29,ipf(out),index_Nr) = 0; -v29_rho.L(regi,out)$( pm_cesdata_sigma("2015",out) eq -1) = 0.5; -v29_rho.up(regi,out) = 0.8; !! corresponds to sigma = 5 -v29_rho.lo(regi,out) = -9; !! corresponds to sigma = 0.1 - -loop ((cesOut2cesIn(out,in), t_29hist_last(t))$((pm_cesdata_sigma(t,out) eq -1) AND ppfKap(in)), - - p29_output_estimation(regi_dyn29(regi),out) = ( pm_cesdata(t,regi,out,"quantity") $ ( NOT ipf_putty(out)) - + pm_cesdata_putty(t,regi,out,"quantity") $ ( ipf_putty(out)) - ) - / ( pm_cesdata(t,regi,in,"quantity") $ ( NOT ipf_putty(out)) - + pm_cesdata_putty(t,regi,in,"quantity") $ ( ipf_putty(out)) - ) - * p29_capitalUnitProjections(regi,in,"0") !! index = 0, is the typical technology - -); -if (execError > 0, - execute_unload "abort.gdx"; - abort "at least one execution error occured, abort.gdx written"; -); - -solve esubs minimizing v29_esub_err using nlp; - -if ( NOT ( esubs.solvestat eq 1 AND (esubs.modelstat eq 1 OR esubs.modelstat eq 2)), - execute_unload "abort.gdx"; - abort "model esubs is infeasible"; -); - -display "esubs results", p29_capitalUnitProjections; - -pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1) = v29_rho.L(regi,in); - -pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1) = - 1 - (1 - pm_cesdata(t,regi,in,"rho")) - / ( 1 + min(max((pm_ttot_val(t) - 2015)/(2050 -2015),0),1) - * p29_esubGrowth - ) -; - -pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1 AND pm_cesdata(t,regi,in,"rho") lt 0) = min(pm_cesdata(t,regi,in,"rho"), 1 - 1/0.8); !! If complementary factors, sigma should be below 0.8 -pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1 AND pm_cesdata(t,regi,in,"rho") ge 0) = max(pm_cesdata(t,regi,in,"rho"), 1 - 1/1.2); !! If substitution factors, sigma should be above 1.2 -pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1 ) = max ( v29_rho.lo(regi,in), pm_cesdata(t,regi,in,"rho")); -pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1 ) = min ( v29_rho.up(regi,in), pm_cesdata(t,regi,in,"rho")); - -***_____________________________ END OF: COMPUTE ELASTICITIES OF SUBSTITUTION ________________________________________ - - ***_____________________________ START OF: PASS EFF TIME EVOLUTION TO EFFGR ________________________________________ *** Finally, we take the evolution of xi and eff, and pass it on to effGr. @@ -1537,10 +1451,6 @@ loop ((out,in,in2,t)$((pm_cesdata_sigma(t,out) eq -1) AND ( ppfKap(in) AND ( NOT ppfKap(in2))) AND (sameAs(t, "2015") OR sameAs(t, "2050") OR sameAs(t, "2100"))) , - if ( sameAs(t,"2015"), - put sm_CES_calibration_iteration:0:0, "remind" ,"2015", out.tl , "output_scale", regi.tl, p29_output_estimation(regi,out) /; - ); - put sm_CES_calibration_iteration:0:0, "remind" , t.tl, out.tl , "quantity", regi.tl, ( pm_cesdata(t,regi,out,"quantity") $ ( NOT ipf_putty(out)) + pm_cesdata_putty(t,regi,out,"quantity") $ ( ipf_putty(out))) /; put sm_CES_calibration_iteration:0:0, "remind" , t.tl, in.tl , "quantity", regi.tl, ( pm_cesdata(t,regi,in,"quantity") $ ( NOT ipf_putty(out)) + pm_cesdata_putty(t,regi,in,"quantity") $ ( ipf_putty(out))) /; put sm_CES_calibration_iteration:0:0, "remind" , t.tl, in2.tl , "quantity", regi.tl, ( pm_cesdata(t,regi,in2,"quantity") $ ( NOT ipf_putty(out)) + pm_cesdata_putty(t,regi,in2,"quantity") $ ( ipf_putty(out))) /; diff --git a/modules/29_CES_parameters/calibrate/realization.gms b/modules/29_CES_parameters/calibrate/realization.gms index 1518e6d82..69daa3774 100644 --- a/modules/29_CES_parameters/calibrate/realization.gms +++ b/modules/29_CES_parameters/calibrate/realization.gms @@ -270,17 +270,7 @@ *' each variable is computed by multiplying a key variable of the CES function by a given factor. The calibration computes *' this factor for each period. *' -*' ##### Compute elasticities of substitution -*' -*' Normally, the elasticities of substitution are prescribed as an ad-hoc guess in the according modules. -*' -*' However, for some CES nodes (currently only in the `services_with_capital` realization of the buildings module), it is -*' estimated with technological data instead. -*' -*' To this end, equations are defined in the file `equations.gms`, and a corresponding model minimizing an error is solved -*' in `preloop.gms` to best fit the data. The according section is labeled "compute elasticities of substitution" in the -*' source code. -*' + *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "sets" $include "./modules/29_CES_parameters/calibrate/sets.gms" From 063bbbd19a6c57a260b0adce413dc86c0e744eb1 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Tue, 12 Dec 2023 16:39:15 +0100 Subject: [PATCH 05/35] start deleting module putty_paths --- .../calibrate/declarations.gms | 21 -- .../29_CES_parameters/calibrate/preloop.gms | 296 ------------------ 2 files changed, 317 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/declarations.gms b/modules/29_CES_parameters/calibrate/declarations.gms index 516dfa3ba..4f899aad6 100644 --- a/modules/29_CES_parameters/calibrate/declarations.gms +++ b/modules/29_CES_parameters/calibrate/declarations.gms @@ -40,27 +40,6 @@ $endif.transpmodule p29_share_H2HTH_traj_indst(ttot,all_regi,all_in) "H2 and electricity HTH baseline trajectories as share of gas (for H2) and low-temperature electricity (for HTH electricity) trajectories in industry" ; -*** in case of a putty formulation, the model putty_paths will try to -*** find a pathway of variations which fits approximately the exogenous trajectories -*** the underlying variables (e.g. the consumption of useful energy in the whole buildings stock) -*** may vary but this is very costly in the objective function (we allow for these variations -*** because EDGE does not have a vintage structure and the projections might not fit the putty formulation -Variables -v29_cesdata(tall,all_regi,all_in) "underlying variables to the putty variations" -v29_cesdata_putty(tall,all_regi,all_in) "variation in the underlying variable" -v29_puttyTechDiff(tall,all_regi,all_in) "Difference to be minimised between the K/E ratio of putty and the K/E ratio from the technological data" -v29_putty_obj "index of the step by step variation of v29_cesdata_putty" -v29_ratioTotalPutty(tall,all_regi,all_in,all_in,all_in) "Ratio of the ratio between input quantities for total and putty quantities" - -; - -Equations -q29_pathConstraint(tall,all_regi,all_in) "equation describing the relation between a variable and its variation" -q29_esubsConstraint(tall,all_regi,all_in,all_in,all_in) "constraint ensuring that the ratio between capital and energy in putty for the last historical region will be close to the technological data used for the ESUB estimation" -q29_ratioTotalPutty (tall,all_regi,all_in,all_in,all_in) "Computation of the ratio between the two putty inputs of a same CES nestand the the ratio of pm_cesdata" -q29_putty_obj "objective function" -; - *** Load calibration iteration number from environment variable *** cm_CES_calibration_iteration put_utility "shell" / "exit $cm_CES_calibration_iteration"; diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index dc3301e5c..1a4d494a4 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -391,303 +391,7 @@ display "after price smoothing", cesOut2cesIn_below, pm_cesdata; ***_____________________________ END OF: GET PRICES _____________________________ -***_____________________________ START OF: CALCULATE IPF _____________________________ -display "start consistency", pm_cesdata; - -*** All effGr, are set to one, so that we can focus on efficiencies -*** we will split xi and eff evolutions later and pass it on to effGr -pm_cesdata(t,regi_dyn29,in_29,"effGr") = 1; - -*** First, using the prices and quantities of the ppfEn, the prices of ipf -*** we compute thanks to the Euler equation the quantities of the ipf. - -***This is done in two steps:first (A) for everything below ppf_putty, so that we can compute -***the first pm_cesdata_putty by taking into account the growth of pm_cesdata -***second (B) we compute quantities for everything up to the last CES level inco.(lab,kap,en) - -***(A) -loop (cesRev2cesIO(counter,ipf_29(out))$( in_below_putty(out) - OR ppf_putty(out) ), - pm_cesdata(t_29,regi_dyn29,out,"quantity") - = sum(cesOut2cesIn(out,in), - pm_cesdata(t_29,regi_dyn29,in,"price") - * pm_cesdata(t_29,regi_dyn29,in,"quantity") - ); -); -display "compute putty" , pm_cesdata; - -v29_cesdata_putty.lo(t_29,regi_dyn29(regi),in) $ putty_compute_in(in) - = 1e-6; -v29_cesdata_putty.L(t_29,regi_dyn29(regi),in) $ putty_compute_in(in) - = pm_cesdata(t_29,regi,in,"quantity") - / 30; -v29_cesdata.l(t_29,regi_dyn29(regi),in) $ putty_compute_in(in) - = pm_cesdata(t_29,regi,in,"quantity"); -v29_cesdata.lo(t_29,regi_dyn29(regi),in) - = 0.90 - * v29_cesdata.l(t_29,regi,in); -v29_cesdata.up(t_29,regi_dyn29(regi),in) - = 1.10 - * v29_cesdata.l(t_29,regi,in); -v29_cesdata.fx(t_29,regi_dyn29(regi),in) $ (putty_compute_in(in) - AND (sameAs(t_29,"2010") - OR sameAs(t_29,"2005") - ) - ) - = pm_cesdata(t_29,regi,in,"quantity"); - -loop ((regi_dyn29(regi),cesOut2cesIn(out,in),cesOut2cesIn2(out,in2)) $ ( - putty_compute_in(in) AND putty_compute_in(in2) ), - v29_ratioTotalPutty.l(t_29,regi,out,in,in2) = 1; - v29_ratioTotalPutty.up(t_29,regi,out,in,in2) = 100; -); - -model putty_paths / -q29_pathConstraint -q29_ratioTotalPutty -q29_putty_obj -q29_esubsConstraint -/; - -if (execError > 0, - execute_unload "abort.gdx"; - abort "at least one execution error occured, abort.gdx written"; -); - -solve putty_paths minimizing v29_putty_obj using nlp; - -if ( NOT (( putty_paths.solvestat eq 1 - AND (putty_paths.modelstat eq 1 OR putty_paths.modelstat eq 2)) - OR (putty_paths.solvestat eq 4 - AND putty_paths.modelstat eq 7) - ), - execute_unload "abort.gdx"; - abort "model putty_paths is infeasible"; -); - -pm_cesdata_putty(t_29,regi_dyn29(regi),in,"quantity") $ v29_cesdata_putty.L(t_29,regi,in) - = v29_cesdata_putty.L(t_29,regi,in); - - -loop ( cesOut2cesIn_below(out,in)$putty_compute_in(out), - pm_cesdata(t_29,regi_dyn29(regi),in,"quantity") - = v29_cesdata.L(t_29,regi,out) - / pm_cesdata(t_29,regi,out,"quantity") - * pm_cesdata(t_29,regi,in,"quantity") - ; -); - -pm_cesdata(t_29,regi_dyn29(regi),in,"quantity") $ putty_compute_in(in) - = v29_cesdata.L(t_29,regi,in); - - -!! Write to file -if (sm_CES_calibration_iteration eq 1, !! first CES calibration iteration - put file_CES_calibration; - - loop ((t,regi_dyn29(regi),in)$( ppf_29(in) - OR sameas(in,"inco") - OR ppf_beyondcalib_29(in) - OR sameas(in,"enhb") - OR sameas(in,"enhgab") ), - if (NOT in_putty(in) AND (ppf_29(in) OR sameas(in,"inco")), - put "%c_expname%", "target", t.tl, regi.tl, "quantity", in.tl; - put pm_cesdata(t,regi,in,"quantity") /; - ); - - if (in_putty(in) AND ppf_29(in), - put "%c_expname%", "target", t.tl, regi.tl, "quantity_putty", in.tl; - put pm_cesdata_putty(t,regi,in,"quantity") /; - ); - ); - - loop ((t_29hist(t),regi_dyn29(regi),ppf_beyondcalib_29(in)), - put "%c_expname%", "target", t.tl, regi.tl, "quantity", in.tl; - put pm_cesdata(t,regi,in,"quantity") /; - ); - -$ifthen.subsectors "%industry%" == "subsectors" -$ifthen.industry_FE_target "%c_CES_calibration_industry_FE_target%" == "1" - loop((t_29scen(t),regi_dyn29(regi),in)$( ppfen_industry_dyn37(in) - OR ppfKap_industry_dyn37(in) ), - put "%c_expname%", "target", t.tl, regi.tl, "quantity", in.tl; - put pm_cesdata(t,regi,in,"quantity") /; - ); -$endif.industry_FE_target -$endif.subsectors - - putclose file_CES_calibration; -); - - -***(B) -loop ((t,cesRev2cesIO(counter,ipf_29(out)))$( NOT ( sameas(out,"inco") - OR in_below_putty(out) - OR ppf_putty(out)) ), - pm_cesdata(t,regi_dyn29,out,"quantity")$( NOT ipf_putty(out) ) - = sum(cesOut2cesIn(out,in), - pm_cesdata(t,regi_dyn29,in,"price") - * pm_cesdata(t,regi_dyn29,in,"quantity") - ); - - pm_cesdata_putty(t,regi_dyn29,out,"quantity")$( ipf_putty(out) ) - = sum(cesOut2cesIn(out,in), - pm_cesdata(t,regi_dyn29,in,"price") - * pm_cesdata_putty(t,regi_dyn29,in,"quantity") - ); - - !! compute the total for factors that are ppf in the CES and ipf in the - !! putty. For the first period, we assume that pm_cesdata stays constant - pm_cesdata(t,regi_dyn29,out,"quantity")$( t0(t) AND ppfIO_putty(out) ) - = pm_cesdata_putty(t,regi_dyn29,out,"quantity") - / pm_delta_kap(regi_dyn29,out); - - !! compute the total for factors that are ppf in the CES and ipf in the putty - pm_cesdata(t,regi_dyn29,out,"quantity")$( - NOT t0(t) AND ppfIO_putty(out) ) - = ( pm_cesdata(t-1,regi_dyn29,out,"quantity") - * (1 - pm_delta_kap(regi_dyn29,out)) ** pm_dt(t) - ) - + ( pm_cumDeprecFactor_old(t,regi_dyn29,out) - * pm_cesdata_putty(t-1,regi_dyn29,out,"quantity") - ) - + ( pm_cumDeprecFactor_new(t,regi_dyn29,out) - * pm_cesdata_putty(t,regi_dyn29,out,"quantity") - ); -); - - -*** Ensure that the labour share in GDP is at least 20 % for historical periods -*** and 0.5 % for others. -sm_tmp = 0; -sm_tmp2 = 0; - -put logfile; -loop ((t_29hist(t),regi_dyn29(regi)), - sm_tmp - = sum(in$(sameAs(in, "kap") OR sameAs(in,"en")), - pm_cesdata(t,regi,in,"quantity") - * pm_cesdata(t,regi,in,"price") - ) - / pm_cesdata(t,regi,"inco","quantity"); - - - if ( (0.8$( t_29hist(t) ) + 0.995$( NOT t_29hist(t) )) lt sm_tmp, - - put t.tl, " ", regi.tl, " labour share in GDP: ", (1 - sm_tmp); - - pm_cesdata(t,regi,ppf_29(in),"price") $ ( NOT ( sameAs(in, "lab") - OR in_complements(in)) ) - = pm_cesdata(t,regi,in,"price") - * (0.8$( t_29hist(t) ) + 0.995$( NOT t_29hist(t) )) - / sm_tmp; - - loop (cesOut2cesIn(in2,in)$( ppf_29(in) AND in_complements(in) ), - pm_cesdata(t,regi,in2,"price") - = pm_cesdata(t,regi,in2,"price") - * (0.8$( t_29hist(t) ) + 0.995$( NOT t_29hist(t) )) - / sm_tmp; - ); - - put " -> ", (1 - (0.8$( t_29hist(t) ) + 0.995$( NOT t_29hist(t) ))) /; - sm_tmp2 = sm_tmp2 + 1; - ); -); -putclose logfile; - -!! If there has been a rescaling for historical steps, repeat previous steps with new prices -if ( sm_tmp2 gt 0, !! If there has been a rescaling - - loop (cesRev2cesIO(counter,ipf_29(out))$( in_below_putty(out) - OR ppf_putty(out) ), - pm_cesdata(t_29,regi_dyn29,out,"quantity") - = sum(cesOut2cesIn(out,in), - pm_cesdata(t_29,regi_dyn29,in,"price") - * pm_cesdata(t_29,regi_dyn29,in,"quantity") - ); - ); - - if (execError > 0, - execute_unload "abort.gdx"; - abort "at least one execution error occured, abort.gdx written"; - ); - - solve putty_paths minimizing v29_putty_obj using nlp; - - - if ( NOT (( putty_paths.solvestat eq 1 - AND (putty_paths.modelstat eq 1 OR putty_paths.modelstat eq 2)) - OR (putty_paths.solvestat eq 4 - AND putty_paths.modelstat eq 7) - ), - execute_unload "abort.gdx"; - abort "model putty_paths is infeasible"; - ); - - pm_cesdata_putty(t_29,regi_dyn29(regi),in,"quantity") $ v29_cesdata_putty.L(t_29,regi,in) - = v29_cesdata_putty.L(t_29,regi,in); - - - loop ( cesOut2cesIn_below(out,in)$putty_compute_in(out), - pm_cesdata(t_29,regi_dyn29(regi),in,"quantity") - = v29_cesdata.L(t_29,regi,out) - / pm_cesdata(t_29,regi,out,"quantity") - * pm_cesdata(t_29,regi,in,"quantity") - ; - ); - - pm_cesdata(t_29,regi_dyn29(regi),in,"quantity") $ putty_compute_in(in) - = v29_cesdata.L(t_29,regi,in); - - - loop ((t,cesRev2cesIO(counter,ipf_29(out)))$( NOT ( sameas(out,"inco") - OR in_below_putty(out) - OR ppf_putty(out)) ), - pm_cesdata(t,regi_dyn29,out,"quantity")$( NOT ipf_putty(out) ) - = sum(cesOut2cesIn(out,in), - pm_cesdata(t,regi_dyn29,in,"price") - * pm_cesdata(t,regi_dyn29,in,"quantity") - ); - - pm_cesdata_putty(t,regi_dyn29,out,"quantity")$( ipf_putty(out) ) - = sum(cesOut2cesIn(out,in), - pm_cesdata(t,regi_dyn29,in,"price") - * pm_cesdata_putty(t,regi_dyn29,in,"quantity") - ); - - !! compute the total for factors that are ppf in the CES and ipf in the - !! putty. For the first period, we assume that pm_cesdata stays constant - pm_cesdata(t,regi_dyn29,out,"quantity")$( t0(t) AND ppfIO_putty(out) ) - = pm_cesdata_putty(t,regi_dyn29,out,"quantity") - / pm_delta_kap(regi_dyn29,out); - - !! compute the total for factors that are ppf in the CES and ipf in the putty - pm_cesdata(t,regi_dyn29,out,"quantity")$( - NOT t0(t) AND ppfIO_putty(out) ) - = ( pm_cesdata(t-1,regi_dyn29,out,"quantity") - * (1 - pm_delta_kap(regi_dyn29,out)) ** pm_dt(t) - ) - + ( pm_cumDeprecFactor_old(t,regi_dyn29,out) - * pm_cesdata_putty(t-1,regi_dyn29,out,"quantity") - ) - + ( pm_cumDeprecFactor_new(t,regi_dyn29,out) - * pm_cesdata_putty(t,regi_dyn29,out,"quantity") - ); - ); -); - -*** Abort if any quantities in pm_cesdata_putty are negative. -if (smin((t_29,regi_dyn29(regi),in)$(in_putty(in)), pm_cesdata_putty(t_29,regi,in,"quantity")) lt 0, - put logfile; - loop ((t_29,regi_dyn29(regi),in)$(in_putty(in) AND pm_cesdata_putty(t_29,regi,in,"quantity") lt 0 ), - put pm_cesdata_putty.tn(t_29,regi,in,"quantity"), " = ", pm_cesdata_putty(t_29,regi,in,"quantity") /; - ); - execute_unload "abort.gdx"; - abort "Some pm_cesdata_putty are <= 0. Check logfile!"; -); - -***_____________________________ END OF: CALCULATE IPF _____________________________ ***_____________________________ START OF: CHANGE EFFICIENCIES TO FULFILL ECONOMIC CONSTRAINT _____________________________ From cd753edace99d9b73575b9ff24f78fabdc804289 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Wed, 13 Dec 2023 16:38:19 +0100 Subject: [PATCH 06/35] delete model putty_paths and further parameters and equations --- core/declarations.gms | 1 - core/sets_calculations.gms | 15 +- modules/01_macro/singleSectorGr/bounds.gms | 6 - .../01_macro/singleSectorGr/declarations.gms | 11 +- modules/01_macro/singleSectorGr/equations.gms | 50 +-- modules/01_macro/singleSectorGr/preloop.gms | 8 +- modules/01_macro/singleSectorGr/sets.gms | 13 - .../29_CES_parameters/calibrate/datainput.gms | 21 +- .../calibrate/declarations.gms | 3 +- .../29_CES_parameters/calibrate/equations.gms | 84 ----- .../29_CES_parameters/calibrate/output.gms | 34 +- .../29_CES_parameters/calibrate/preloop.gms | 306 ++---------------- .../calibrate/realization.gms | 19 +- modules/29_CES_parameters/calibrate/sets.gms | 1 - modules/29_CES_parameters/load/not_used.txt | 1 - scripts/output/single/plotIterations.R | 6 - scripts/output/single/reportCEScalib.R | 62 ---- scripts/start/run.R | 14 - 18 files changed, 36 insertions(+), 619 deletions(-) delete mode 100644 modules/29_CES_parameters/calibrate/equations.gms diff --git a/core/declarations.gms b/core/declarations.gms index 1f8a578f8..7aad32751 100644 --- a/core/declarations.gms +++ b/core/declarations.gms @@ -38,7 +38,6 @@ pm_taxemiMkt_iteration(iteration,ttot,all_regi,all_emiMkt) "CO2 or CO2eq region pm_emissionsForeign(tall,all_regi,all_enty) "total emissions of other regions (nash relevant)" pm_co2eqForeign(tall,all_regi) "emissions, which are part of the climate policy, of other regions (nash relevant)" pm_cesdata(tall,all_regi,all_in,cesParameter) "parameters of the CES function" -pm_cesdata_putty(tall,all_regi,all_in,cesParameter) "quantities for the putty clay factors" f_pop(tall,all_regi,all_POPscen) "population data for all possible scenarios" pm_pop(tall,all_regi) "population data [bn people]" pm_gdp(tall,all_regi) "GDP data [trn US$ 2005]" diff --git a/core/sets_calculations.gms b/core/sets_calculations.gms index 17d029b8e..91aba1973 100644 --- a/core/sets_calculations.gms +++ b/core/sets_calculations.gms @@ -68,12 +68,7 @@ ppf("lab") = YES; *** calculate intermediate production factors ipf(all_in) = in(all_in) - ppf(all_in); -ipf_putty(all_in) = in_putty(all_in) - ppf_putty(all_in); -loop ( out, -ppfIO_putty(in)$(cesOut2cesIn(out,in) - AND ipf_putty(in) - AND NOT in_putty(out)) = YES; -); + *** Initialise cesLevel2cesIO and cesRev2cesIO loop (counter$( ord(counter) eq 1 ), cesLevel2cesIO(counter,"inco") = YES; !! the root is at the lowest level @@ -114,18 +109,10 @@ loop ((cesRev2cesIO(counter,in),cesOut2cesIn(in,in2)), cesOut2cesIn_below(in,in2) = YES; ); -in_below_putty(in) = NO; -loop (ppf_putty, -in_below_putty(in)$cesOut2cesIn_below(ppf_putty,in) = YES; -); - - *** Aliasing of mappings is not available in all GAMS versions cesOut2cesIn2(out,in) = cesOut2cesIn(out,in); - *** Computing the reference complentary factors - $offOrder sm_tmp = 0; loop (cesOut2cesIn(out,in) $ in_complements(in), diff --git a/modules/01_macro/singleSectorGr/bounds.gms b/modules/01_macro/singleSectorGr/bounds.gms index 9a8483ed7..3e394d4d9 100644 --- a/modules/01_macro/singleSectorGr/bounds.gms +++ b/modules/01_macro/singleSectorGr/bounds.gms @@ -10,18 +10,12 @@ vm_cons.lo(t,regi) = 1e-3; vm_cesIO.lo(t,regi,in)$( NOT in_industry_dyn37(in) ) = max(1e-6, abs(pm_cesdata(t,regi,in,"offset_quantity"))); -vm_cesIOdelta.lo(t,regi,in_putty) = 1e-6; *** fix energy inputs to CES structure in t0 to the parameter values vm_cesIO.fx(t0(tall),regi,in)$( ppfEn(in) - OR ppfIO_putty(in) OR industry_ue_calibration_target_dyn37(in) ) = pm_cesdata(tall,regi,in,"quantity"); -vm_cesIOdelta.fx(t0(tall),regi,in)$( ppfEn(in) OR in_putty(in) ) - = pm_cesdata_putty(tall,regi,in,"quantity"); - - *** set macro investments to bound in 2005 vm_invMacro.fx("2005",regi,"kap") = p01_boundInvMacro(regi); *cb 2012-05-23 lower bound for capital investment to avoid "zero investment" problem for the conopt solver diff --git a/modules/01_macro/singleSectorGr/declarations.gms b/modules/01_macro/singleSectorGr/declarations.gms index ea46cdae5..21aa84791 100644 --- a/modules/01_macro/singleSectorGr/declarations.gms +++ b/modules/01_macro/singleSectorGr/declarations.gms @@ -36,11 +36,7 @@ vm_invRD(ttot,all_regi,all_in) "R&D investments vm_invInno(ttot,all_regi,all_in) "Investment into innovation" vm_invImi(ttot, all_regi,all_in) "Investment into imitation" v01_enerSerAdj(tall,all_regi,all_in) "adjustment costs for energy service transformations" - - -*** putty-clay variables -vm_cesIOdelta(tall,all_regi,all_in) "Putty-clay production factor" -; +; ***------------------------------------------------------------ ------------------- *** EQUATIONS ***------------------------------------------------------------ ------------------- @@ -55,10 +51,5 @@ q01_invMacroAdj(ttot,all_regi,all_in) "Adjustment cost q01_limitShPpfen(ttot,all_regi,all_in,all_in) "Limit the share of one ppfEn in total CES nest inputs" q01_limtRatioPpfen(ttot,all_regi,all_in,all_in) "Limit the ratio of two ppfEn" -*** putty-clay equations -q01_cesIO_puttyclay(ttot,all_regi,all_in) "Putty-clay production function" -q01_puttyclay(ttot,all_regi,all_in) "Putty-clay Correspondance between variations in input and past stocks of input" -q01_prodCompl_putty(ttot,all_regi,all_in,all_in) "Putty-Clay constraints for perfect complements in the CES tree" -q01_kapMo_putty(ttot,all_regi,all_in) "Putty-clay capital motion equation" ; *** EOF ./modules/01_macro/singleSectorGr/declarations.gms diff --git a/modules/01_macro/singleSectorGr/equations.gms b/modules/01_macro/singleSectorGr/equations.gms index ed6181ec5..be72507dd 100644 --- a/modules/01_macro/singleSectorGr/equations.gms +++ b/modules/01_macro/singleSectorGr/equations.gms @@ -88,7 +88,7 @@ q01_balLab(t,regi).. *** Keep in mind to adjust the calculation of derivatives and shares *** in ./core/reswrite.inc if you change the structure of this function. ***--------------------------------------------------------------------------- -q01_cesIO(t,regi,ipf(out))$( NOT ipf_putty(out) ) .. +q01_cesIO(t,regi,ipf(out)).. vm_cesIO(t,regi,out) =e= !! use exp(log(a) * b) = a ** b because the latter is not accurate in GAMS for @@ -115,7 +115,7 @@ q01_cesIO(t,regi,ipf(out))$( NOT ipf_putty(out) ) .. ***--------------------------------------------------------------------------- *' Constraints for perfect complements in the CES tree ***--------------------------------------------------------------------------- -q01_prodCompl(t,regi,in,in2) $ (complements_ref(in,in2) AND (( NOT in_putty(in2)) OR ppfIO_putty(in2))) .. +q01_prodCompl(t,regi,in,in2) $ (complements_ref(in,in2) ) .. vm_cesIO(t,regi,in) =e= pm_cesdata(t,regi,in2,"compl_coef") @@ -131,7 +131,6 @@ q01_prodCompl(t,regi,in,in2) $ (complements_ref(in,in2) AND (( NOT in_putty(in2) *' so the time step length is taken into account. ***--------------------------------------------------------------------------- q01_kapMo(ttot,regi,ppfKap(in))$( - NOT in_putty(in) AND ord(ttot) lt card(ttot) AND pm_ttot_val(ttot+1) ge max(2010, cm_startyear) AND pm_cesdata("2005",regi,in,"quantity") gt 0 ) .. @@ -183,49 +182,4 @@ q01_limtRatioPpfen(t,regi,in,in2)$( p01_ppfen_ratios(t,regi,in,in2) ) .. * (vm_cesIO(t,regi,in2) + pm_cesdata(t,regi,in,"offset_quantity")) ; - -***--------------------------------------------------------------------------- -*** Start of Putty-Clay equations -*' Putty-Clay production function: -***--------------------------------------------------------------------------- -q01_cesIO_puttyclay(t,regi,ipf_putty(out)) .. - vm_cesIOdelta(t,regi,out) - =e= - sum(cesOut2cesIn(out,in), - pm_cesdata(t,regi,in,"xi") - * ( - pm_cesdata(t,regi,in,"eff") - * vm_effGr(t,regi,in) - * vm_cesIOdelta(t,regi,in) - ) - ** pm_cesdata(t,regi,out,"rho") - ) - ** (1 / pm_cesdata(t,regi,out,"rho")) -; - -*' Putty-Clay constraints for perfect complements in the CES tree: -q01_prodCompl_putty(t,regi,in,in2) $ (complements_ref(in,in2) - AND ( in_putty(in2) AND ( NOT ppfIO_putty(in2)))) .. - vm_cesIOdelta(t,regi,in) =e= - pm_cesdata(t,regi,in2,"compl_coef") - * vm_cesIOdelta(t,regi,in2); - -*' Correspondance between vm_cesIO and vm_cesIOdelta: -q01_puttyclay(ttot,regi,in_putty(in))$(ord(ttot) lt card(ttot) AND (pm_ttot_val(ttot+1) ge max(2010, cm_startyear))).. - vm_cesIO(ttot+1,regi,in) - =e= - vm_cesIO(ttot,regi,in)*(1- pm_delta_kap(regi,in))**(pm_ttot_val(ttot+1)-pm_ttot_val(ttot)) - + pm_cumDeprecFactor_old(ttot+1,regi,in)* vm_cesIOdelta(ttot,regi,in) - + pm_cumDeprecFactor_new(ttot+1,regi,in)* vm_cesIOdelta(ttot+1,regi,in) -; - -*' Capital motion equation for putty clay capital: -q01_kapMo_putty(ttot,regi,in_putty(in))$(ppfKap(in) AND (ord(ttot) le card(ttot)) AND (pm_ttot_val(ttot) ge max(2005, cm_startyear)) AND (pm_cesdata("2005",regi,in,"quantity") gt 0)).. - vm_cesIOdelta(ttot,regi,in) - =e= - vm_invMacro(ttot,regi,in) -; -***--------------------------------------------------------------------------- -*** End of Putty-Clay equations -***--------------------------------------------------------------------------- *** EOF ./modules/01_macro/singleSectorGr/equations.gms diff --git a/modules/01_macro/singleSectorGr/preloop.gms b/modules/01_macro/singleSectorGr/preloop.gms index 50c044a6b..da1d919f8 100644 --- a/modules/01_macro/singleSectorGr/preloop.gms +++ b/modules/01_macro/singleSectorGr/preloop.gms @@ -9,13 +9,13 @@ *** Calculate cummulative depreciation factors loop ((t,counter), if ( pm_dt(t) eq 2 * counter.val, -pm_cumDeprecFactor_old(t,regi,in)$(ppfKap(in) OR in_putty(in)) +pm_cumDeprecFactor_old(t,regi,in)$(ppfKap(in)) = ((1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 ) - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t) )) / pm_delta_kap(regi,in) ; -pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in) OR in_putty(in)) +pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in) ) = ( 1 - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2) ) @@ -24,14 +24,14 @@ pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in) OR in_putty(in)) ); if ( pm_dt(t) eq (2 * counter.val -1), -pm_cumDeprecFactor_old(t,regi,in)$(ppfKap(in) OR in_putty(in)) +pm_cumDeprecFactor_old(t,regi,in)$(ppfKap(in)) = ((1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5) - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t))) / pm_delta_kap(regi,in) - 1/2 * (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5 ) ; -pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in) OR in_putty(in)) +pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in)) = ( 1 - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5 + 1) ) diff --git a/modules/01_macro/singleSectorGr/sets.gms b/modules/01_macro/singleSectorGr/sets.gms index 2476da257..3a00944d5 100644 --- a/modules/01_macro/singleSectorGr/sets.gms +++ b/modules/01_macro/singleSectorGr/sets.gms @@ -16,7 +16,6 @@ cesOut2cesIn(all_in,all_in) "CES tree structure" cesLevel2cesIO(counter,all_in) "CES tree structure by level" cesRev2cesIO(counter,all_in) "CES tree structure by level - descending order" cesOut2cesIn_below(all_in,all_in) "All elements of the CES below located below the first item given" -in_below_putty(all_in) "All elements of the CES below ppf_putty, excluding ppf_putty. Only meaningful in case putty structures are not intertwined" in(all_in) "All inputs and outputs of the CES function" @@ -30,23 +29,11 @@ ppf(all_in) "All primary production factors" ipf(all_in) "All intermediate production factors" ppfKap(all_in) "Primary production factors capital" / kap / ppfEn(all_in) "Primary production factors energy" -in_putty(all_in) "Production factors subject to putty-clay dynamics" -ppf_putty(all_in) "All putty-clay primary production factors" -ipf_putty(all_in) "All putty-clay intermediate production factors" -ppfIO_putty(all_in) "Factors treated in the normal CES as ppf and in putty-clay as output" -nests_putty(all_in,all_in) "Defines factors which are in the same putty subnest. The first all_in gives the higher factors of the subnest" in_enerSerAdj(all_in) "Energy services factors which should be constrained by adjustment costs" // in_complements(all_in) "Factors which are perfect complements" // complements_ref(all_in,all_in) "Correspondence between complementary factors. Necessary to have a reference factor for the constraints equations" ; - - -in_putty(all_in) = NO; -ppf_putty(all_in) = NO; -ipf_putty(all_in) = NO; -ppfIO_putty(all_in) = NO; - alias(cesOut2cesIn,cesOut2cesIn2,cesOut2cesIn3); alias(in,out); alias(in,in2,in3); diff --git a/modules/29_CES_parameters/calibrate/datainput.gms b/modules/29_CES_parameters/calibrate/datainput.gms index 7b2f4011b..caf18695f 100644 --- a/modules/29_CES_parameters/calibrate/datainput.gms +++ b/modules/29_CES_parameters/calibrate/datainput.gms @@ -141,11 +141,6 @@ loop (cesOut2cesIn(out,in)$(in_beyond_calib_29(in) AND ppf(in)), ipf_beyond_last(out) = YES; ); -putty_compute_in(in)$((in_29(in) AND ppf_putty(in)) - OR (ppf_29(in) and in_putty(in)) - ) - = YES; - *** End of Sets calculation Parameter @@ -257,8 +252,7 @@ $endif.indst_H2_penetration display pm_fedemand; *** Attribute technological data to p29_capitalUnitProjections according to putty-clay - p29_capitalUnitProjections(all_regi,all_in,index_Nr) = f29_capitalUnitProjections(all_regi,all_in,index_Nr,"cap") $ ( NOT in_putty(all_in)) - + f29_capitalUnitProjections(all_regi,all_in,index_Nr,"inv") $ ( in_putty(all_in)); + p29_capitalUnitProjections(all_regi,all_in,index_Nr) = f29_capitalUnitProjections(all_regi,all_in,index_Nr,"cap") ; loop (cesOut2cesIn(out,in)$ppfKap(in), loop (cesOut2cesIn2(out,in2), p29_capitalUnitProjections(all_regi,all_in,index_Nr)$(p29_capitalUnitProjections(all_regi,all_in,index_Nr) @@ -315,12 +309,6 @@ p29_cesdata_load(t,regi,in,"rho")$( p29_cesdata_load(t,regi,in,"rho") eq 0) = 0. *** Load quantities and efficiency growth from the last run Execute_Loadpoint 'input' p29_cesIO_load = vm_cesIO.l, p29_effGr = vm_effGr.l; -*** Load putty-clay quantities if relevant (initialise to 0 in case it is not) -p29_cesIOdelta_load(t,regi,in) = 0; -if ( (sm_CES_calibration_iteration gt 1 OR s29_CES_calibration_new_structure eq 0) AND (card(in_putty) gt 0), -Execute_Loadpoint 'input' p29_cesIOdelta_load = vm_cesIOdelta.l; -); - *** DEBUG: Load vm_deltacap Execute_Loadpoint 'input' vm_deltacap; @@ -443,13 +431,6 @@ loop (ue_fe_kap_29(out), ); ); -*** -loop ( (t0(t),regi, ppfIO_putty(in)), - if (pm_cesdata(t,regi,in,"quantity") eq 0, - abort "ppfIO_putty must have an exogenous value for the first period"; - ); -); - p29_esubGrowth = 0.3; *** EOF ./modules/29_CES_parameters/calibrate/datainput.gms diff --git a/modules/29_CES_parameters/calibrate/declarations.gms b/modules/29_CES_parameters/calibrate/declarations.gms index 4f899aad6..4bd20ea28 100644 --- a/modules/29_CES_parameters/calibrate/declarations.gms +++ b/modules/29_CES_parameters/calibrate/declarations.gms @@ -27,8 +27,7 @@ $endif.transpmodule p29_capitalQuantity(tall,all_regi,all_in) "capital quantities" p29_capitalPrice(tall,all_regi) "capital prices" - p29_test_CES_recursive(tall,all_regi,all_in) "test the technological consistency of pm_cesdata" - p29_test_CES_putty_recursive(tall,all_regi,all_in) "test the technological consistency of pm_cesdata_putty" + p29_test_CES_recursive(tall,all_regi,all_in) "test the technological consistency of pm_cesdata" f29_capitalUnitProjections(all_regi,all_in,index_Nr,capUnitType) "Capital cost per unit of consumed energy and FE per unit of UE (or UE per unit of ES) used to calibrate some Esubs. kap is in $/kWh; UE and FE in kWh. Data for new investments and for standing capital" p29_capitalUnitProjections(all_regi,all_in,index_Nr) "Capital cost per unit of consumed energy and final energy per unit of useful energy (or UE per unit of ES) used to calibrate some elasticities of substitution. kap is in $/kWh; UE and FE in kWh" diff --git a/modules/29_CES_parameters/calibrate/equations.gms b/modules/29_CES_parameters/calibrate/equations.gms deleted file mode 100644 index 11ee27e59..000000000 --- a/modules/29_CES_parameters/calibrate/equations.gms +++ /dev/null @@ -1,84 +0,0 @@ -*** | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | REMIND License Exception, version 1.0 (see LICENSE file). -*** | Contact: remind@pik-potsdam.de -*** SOF ./modules/29_CES_parameters/calibrate/equations.gms -$offOrder -q29_pathConstraint (t_29,regi_dyn29(regi),in) $(putty_compute_in(in) - AND (ord(t_29) lt card(t_29))) .. -v29_cesdata(t_29 + 1,regi,in) =e= - (1- pm_delta_kap(regi,in))**pm_dt(t_29+1) * v29_cesdata(t_29,regi,in) - + (pm_cumDeprecFactor_old(t_29+1,regi,in) * v29_cesdata_putty(t_29,regi,in)) - + (pm_cumDeprecFactor_new(t_29+1,regi,in) * v29_cesdata_putty(t_29+1,regi,in)) - ; -q29_ratioTotalPutty (t_29,regi_dyn29(regi),out,in,in2) $ (putty_compute_in(in) - AND putty_compute_in(in2) - AND cesOut2cesIn(out,in) - AND cesOut2cesIn2(out,in2) - AND ( NOT sameAs(in,in2)) - ) .. - - v29_ratioTotalPutty(t_29,regi,out,in,in2) - =e= - (v29_cesdata_putty(t_29,regi,in) - )/v29_cesdata_putty(t_29,regi,in2) - / - (pm_cesdata(t_29,regi,in,"quantity") - /pm_cesdata(t_29,regi,in2,"quantity") - ) - ; - - -q29_esubsConstraint(t,regi_dyn29(regi),out,in,in2) $ ( ipf_putty(out) - AND putty_compute_in(in) - AND putty_compute_in(in2) - AND t_29hist_last(t) - AND pm_cesdata_sigma(t,out) eq -1 - AND cesOut2cesIn(out,in) - AND cesOut2cesIn2(out,in2) - AND ppfKap(in) - AND ( NOT ppfKap(in2))) .. - v29_puttyTechDiff(t,regi,out) =e= p29_capitalUnitProjections(regi,in2,"0") - / p29_capitalUnitProjections(regi,in,"0") - - - v29_cesdata_putty(t,regi,in2) - /v29_cesdata_putty(t,regi,in) - ; - - - -q29_putty_obj.. -v29_putty_obj =e= 5e-1 * sum ((t_29,regi_dyn29(regi),in)$(putty_compute_in(in) - AND (ord(t_29) lt card(t_29))) - , power( v29_cesdata_putty(t_29+1,regi,in) !! Limit the variations from one period to another - - v29_cesdata_putty(t_29,regi,in) - - ,2) - ) - + - sum((t_29,regi_dyn29(regi),in)$putty_compute_in(in) - ,power( v29_cesdata(t_29,regi,in) !! Be as close as possible as the aggregate trajectory - - pm_cesdata(t_29,regi,in,"quantity") - ,6) - ) - + sum ((t_29hist_last(t),regi_dyn29(regi), out), - power ( v29_puttyTechDiff(t,regi,out), - 2) - ) - + 1e-6 * sum ((t_29, regi_dyn29(regi),out, in,in2) $(putty_compute_in(in) - AND putty_compute_in(in2) - AND cesOut2cesIn(out,in) - AND cesOut2cesIn2(out,in2) - AND ( NOT sameAs(in,in2)) - ), !! penalise the large differences in ratios between inputs for Total quantities (pm_cesdata) and putty quantities (pm_cesdata_putty) - power ( v29_ratioTotalPutty(t_29,regi,out,in,in2), - 2) - ) - ; - -$onOrder - -*** EOF ./modules/29_CES_parameters/calibrate/equations.gms - diff --git a/modules/29_CES_parameters/calibrate/output.gms b/modules/29_CES_parameters/calibrate/output.gms index 96175f996..ed948fe59 100644 --- a/modules/29_CES_parameters/calibrate/output.gms +++ b/modules/29_CES_parameters/calibrate/output.gms @@ -11,15 +11,13 @@ p29_CESderivative(t,regi_dyn29(regi),cesOut2cesIn(out,in))$( vm_cesIO.l(t,regi,i * pm_cesdata(t,regi,in,"eff") * vm_effGr.l(t,regi,in) - * (vm_cesIO.l(t,regi,out)$( NOT ipf_putty(out)) - + vm_cesIOdelta.l(t,regi,out)$( ipf_putty(out)) + * (vm_cesIO.l(t,regi,out) ) ** (1 - pm_cesdata(t,regi,out,"rho")) * ( pm_cesdata(t,regi,in,"eff") * vm_effGr.l(t,regi,in) - * (vm_cesIO.l(t,regi,in)$( NOT ipf_putty(out)) - + vm_cesIOdelta.l(t,regi,in)$( ipf_putty(out)) + * (vm_cesIO.l(t,regi,in) ) ) ** (pm_cesdata(t,regi,out,"rho") - 1); @@ -44,8 +42,7 @@ put file_CES_calibration; loop ((t,regi_dyn29(regi),in)$( ppf_29(in) OR ppf_beyondcalib_29(in) - OR sameas(in,"inco") - OR ppf_putty(in) ), + OR sameas(in,"inco")), put "%c_expname%", sm_CES_calibration_iteration:0:0, t.tl, regi.tl; put "efficiency", in.tl; put (pm_cesdata("2005",regi,in,"eff") * vm_effGr.l(t,regi,in)) /; @@ -57,8 +54,7 @@ loop ((t,regi_dyn29(regi),in)$( ppf_29(in) put in.tl, pm_cesdata(t,regi,in,"xi") /; ); -loop ((t,regi_dyn29(regi),in)$( NOT in_putty(in) - AND ( ppf_29(in) +loop ((t,regi_dyn29(regi),in)$( ( ppf_29(in) OR ppf_beyondcalib_29(in) OR sameas(in,"inco")) ), put "%c_expname%", sm_CES_calibration_iteration:0:0, t.tl, regi.tl; @@ -78,28 +74,6 @@ loop ((t,regi_dyn29(regi),in)$( NOT in_putty(in) ) /; ); -loop ((t,regi_dyn29(regi),in)$( in_putty(in) - AND ( ppf_29(in) - OR ppf_beyondcalib_29(in) - OR sameas(in,"inco")) - OR ppf_putty(in) ), - put "%c_expname%", sm_CES_calibration_iteration:0:0, t.tl, regi.tl; - put "quantity_putty", in.tl, vm_cesIOdelta.l(t,regi,in) /; - - put "%c_expname%", sm_CES_calibration_iteration:0:0, t.tl, regi.tl, "price_putty"; - put in.tl, pm_cesdata(t,regi,in,"price") /; - - put "%c_expname%", sm_CES_calibration_iteration:0:0, t.tl, regi.tl; - put "total efficiency putty", in.tl; - put sum(cesOut2cesIn(out,in), - pm_cesdata(t,regi,in,"xi") - ** (1 / pm_cesdata(t,regi,out,"rho")) - * ( pm_cesdata("2005",regi,in,"eff") - * vm_effGr.l(t,regi,in) - ) - ) /; -); - loop ((ttot,regi_dyn29(regi),te_29_report), put "%c_expname%", sm_CES_calibration_iteration:0:0, ttot.tl, regi.tl; put "vm_deltaCap", te_29_report.tl; diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 1a4d494a4..dd5a945d1 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -74,8 +74,7 @@ else * p29_cesdata_load(t,regi,in,"eff") * p29_effGr(t,regi,in) - * ( p29_cesIO_load(t,regi,out)$( NOT ipf_putty(out)) - + p29_cesIOdelta_load(t,regi,out)$( ipf_putty(out)) + * ( p29_cesIO_load(t,regi,out) ) ** (1 - p29_cesdata_load(t,regi,out,"rho")) @@ -83,8 +82,7 @@ else log( p29_cesdata_load(t,regi,in,"eff") * p29_effGr(t,regi,in) - * ( p29_cesIO_load(t,regi,in)$( NOT ipf_putty(out)) - + p29_cesIOdelta_load(t,regi,in)$( ipf_putty(out))) + * ( p29_cesIO_load(t,regi,in) ) * (p29_cesdata_load(t,regi,out,"rho") - 1)); @@ -186,7 +184,7 @@ if (sm_CES_calibration_iteration eq 1, !! first CES calibration iteration OR ppf_beyondcalib_29(in) OR sameas(in,"enhb") OR sameas(in,"enhgab") ), - if (NOT in_putty(in) AND (ppf_29(in) OR sameas(in,"inco")), + if ((ppf_29(in) OR sameas(in,"inco")), put "%c_expname%", "origin", t.tl, regi.tl, "quantity", in.tl; put p29_cesIO_load(t,regi,in) /; @@ -206,27 +204,6 @@ if (sm_CES_calibration_iteration eq 1, !! first CES calibration iteration ); ); - if (in_putty(in) AND ppf_29(in), - put "%c_expname%", "origin", t.tl, regi.tl, "quantity_putty", in.tl; - put p29_cesIOdelta_load(t,regi,in) /; - - put "%c_expname%", "origin", t.tl, regi.tl, "price_putty", in.tl; - put pm_cesdata(t,regi,in,"price") /; - - if (p29_cesdata_load("2005",regi,in,"eff") AND p29_effGr(t,regi,in), - put "%c_expname%", "origin", t.tl, regi.tl, "total efficiency putty"; - put in.tl; - put ( sum(cesOut2cesIn(out,in), - p29_cesdata_load(t,regi,in,"xi") - ** (1 / p29_cesdata_load(t,regi,out,"rho")) - * ( p29_cesdata_load("2005",regi,in,"eff") - * p29_effGr(t,regi,in) - ) - ) - ) /; - ); - ); - put "%c_expname%", "origin", t.tl, regi.tl, "efficiency", in.tl; put (p29_cesdata_load("2005",regi,in,"eff") * p29_effGr(t,regi,in)) /; @@ -371,22 +348,6 @@ loop (ttot$( ttot.val ge 2005), display "after all but entrp_frgt_lo smoothening", pm_cesdata; -*** Smooth prices for the whole period for elements in or below the putty-clay -*** structure. Problem if there are several ppfIO_putty below each other, -*** prices are then smoothed twice. -loop ((t_29,cesOut2cesIn_below(out,in))$( ppfIO_putty(out) ), - pm_cesdata(t_29,regi_dyn29(regi),in,"price") - = sum(t2_29$( t2_29.val ge t_29.val ), - (1 - pm_delta_kap(regi,out)) - ** (t2_29.val - t_29.val) - * pm_cesdata(t2_29,regi,in,"price") - ) - / sum(t2_29$( t2_29.val ge t_29.val ), - (1 - pm_delta_kap(regi,out)) - ** (t2_29.val - t_29.val) - ); -); - display "after price smoothing", cesOut2cesIn_below, pm_cesdata; ***_____________________________ END OF: GET PRICES _____________________________ @@ -400,7 +361,6 @@ display "after price smoothing", cesOut2cesIn_below, pm_cesdata; *** prices equal derivatives. loop ((cesRev2cesIO(counter,ipf_29(out)),ces_29(out,in))$( NOT sameas(out,"inco") ), - if (NOT ipf_putty(out), pm_cesdata(t,regi_dyn29, in,"xi") = pm_cesdata(t,regi_dyn29,in,"price") * pm_cesdata(t,regi_dyn29,in,"quantity") @@ -409,18 +369,6 @@ loop ((cesRev2cesIO(counter,ipf_29(out)),ces_29(out,in))$( pm_cesdata(t,regi_dyn29,in,"eff") = pm_cesdata(t,regi_dyn29,out, "quantity") / pm_cesdata(t,regi_dyn29,in, "quantity"); - ); - - if (ipf_putty(out), - pm_cesdata(t_29,regi_dyn29, in,"xi") - = pm_cesdata(t_29,regi_dyn29,in,"price") - * pm_cesdata_putty(t_29,regi_dyn29,in,"quantity") - / pm_cesdata_putty(t_29,regi_dyn29,out,"quantity"); - - pm_cesdata(t_29,regi_dyn29,in,"eff") - = pm_cesdata_putty(t_29,regi_dyn29,out, "quantity") - / pm_cesdata_putty(t_29,regi_dyn29,in, "quantity"); - ); ); display "after change up to en consistency", pm_cesdata; @@ -441,7 +389,7 @@ pm_cesdata(t,regi_dyn29,"kap","eff") = pm_cesdata(t,regi_dyn29,"inco", "quantity") / pm_cesdata(t,regi_dyn29,"kap", "quantity"); -display "after change cap eff consistency", pm_cesdata, pm_cesdata_putty; +display "after change cap eff consistency", pm_cesdata; *** If the value (quantity x price) of either en or kap, or the sum of both, *** exceed the quantity of inco (all of which would result in negative labour @@ -630,8 +578,7 @@ if (card(ppf_beyondcalib_29) >= 1, !! if there are any nodes in beyond calib * p29_cesdata_load(t,regi,in,"eff") * p29_effGr(t,regi,in) - * ( p29_cesIO_load(t,regi,out)$( NOT ipf_putty(out) ) - + p29_cesIOdelta_load(t,regi,out)$( ipf_putty(out) ) + * ( p29_cesIO_load(t,regi,out) ) ** (1 - p29_cesdata_load(t,regi,out,"rho")) @@ -639,8 +586,7 @@ if (card(ppf_beyondcalib_29) >= 1, !! if there are any nodes in beyond calib log( p29_cesdata_load(t,regi,in,"eff") * p29_effGr(t,regi,in) - * ( p29_cesIO_load(t,regi,in)$( NOT ipf_putty(out)) - + p29_cesIOdelta_load(t,regi,in)$( ipf_putty(out)) + * ( p29_cesIO_load(t,regi,in) ) ) * (p29_cesdata_load(t,regi,out,"rho") - 1)); @@ -735,8 +681,7 @@ $endif.subsectors !! First, we compute the quantity for the root deriving from the ppf !! quantities and prices and we adjust the ppf prices so that it matches the - !! root quantity. The current formulation does not support putty in beyond - !! and complements. + !! root quantity. loop ((t_29hist(t),regi_dyn29(regi),root_beyond_calib_29(out)), sm_tmp @@ -760,17 +705,11 @@ $endif.subsectors put " " /; loop (cesOut2cesIn(out,in), - if ( NOT ipf_putty(out), put pm_cesdata.tn(t,regi,in,"quantity"), " = "; put pm_cesdata(t,regi,in,"quantity") /; - ); - if ( ipf_putty(out), - put pm_cesdata_putty.tn(t,regi,in,"quantity"), " = "; - put pm_cesdata_putty(t,regi,in,"quantity") /; - ); - put pm_cesdata.tn(t,regi,in,"price"), " = "; - put pm_cesdata(t,regi,in,"price") /; + put pm_cesdata.tn(t,regi,in,"price"), " = "; + put pm_cesdata(t,regi,in,"price") /; ); execute_unload "abort.gdx"; @@ -793,59 +732,14 @@ $endif.subsectors loop ((t_29,cesRev2cesIO(counter,ipf_beyond_29_excludeRoot(out)))$( NOT sameas(out,"inco") ), - pm_cesdata(t_29,regi_dyn29,out,"quantity")$( NOT ipf_putty(out) ) + pm_cesdata(t_29,regi_dyn29,out,"quantity") = sum(cesOut2cesIn(out,in), pm_cesdata(t_29,regi_dyn29,in,"price") * pm_cesdata(t_29,regi_dyn29,in,"quantity") ); - - pm_cesdata_putty(t_29,regi_dyn29,out,"quantity")$( ipf_putty(out) ) - = sum(cesOut2cesIn(out,in), - pm_cesdata(t_29,regi_dyn29,in,"price") - * pm_cesdata_putty(t_29,regi_dyn29,in, "quantity") - ); - - !! compute the total for factors that are ppf in the CES and ipf in the putty - pm_cesdata(t0(t_29),regi_dyn29,ppfIO_putty(out),"quantity") - = pm_cesdata_putty(t_29,regi_dyn29,out,"quantity") - / pm_delta_kap(regi_dyn29,out); - - !! compute the delta for factors that are ipf in the CES and ppf in the putty - pm_cesdata_putty(t0(t_29),regi_dyn29,ppf_putty(out),"quantity") - = pm_cesdata(t_29,regi_dyn29,out,"quantity") - - ( pm_cesdata(t_29,regi_dyn29,out,"quantity") - * (1 - pm_delta_kap(regi_dyn29,out)) - ); - - !! compute the total for factors that are ppf in the CES and ipf in the putty - pm_cesdata(t_29,regi_dyn29,ppfIO_putty(out),"quantity")$( NOT t0(t_29) ) - = ( pm_cesdata(t_29-1,regi_dyn29,out,"quantity") - * (1 - pm_delta_kap(regi_dyn29,out)) - ** pm_dt(t_29) - ) - + ( pm_cumDeprecFactor_old(t_29,regi_dyn29,out) - * pm_cesdata_putty(t_29-1,regi_dyn29,out,"quantity") - ) - + ( pm_cumDeprecFactor_new(t_29,regi_dyn29,out) - * pm_cesdata_putty(t_29,regi_dyn29,out,"quantity") - ); - - !! compute the delta for factors that are ipf in the CES and ppf in the putty - pm_cesdata_putty(t_29,regi_dyn29,ppf_putty(out),"quantity")$( NOT t0(t_29) ) - = 1 /pm_cumDeprecFactor_new(t_29,regi_dyn29,out) - * ( pm_cesdata(t_29,regi_dyn29,out,"quantity") - - ( pm_cesdata(t_29-1,regi_dyn29,out,"quantity") - * (1 - pm_delta_kap(regi_dyn29,out)) - ** pm_dt(t_29) - ) - - ( pm_cumDeprecFactor_old(t_29,regi_dyn29,out) - * pm_cesdata_putty(t_29-1,regi_dyn29,out,"quantity") - ) - ); ); loop ((t_29hist(t_29),cesOut2cesIn(out,in_beyond_calib_29_excludeRoot(in))), - if (NOT ipf_putty(out), pm_cesdata(t_29,regi_dyn29,in,"xi") = pm_cesdata(t_29,regi_dyn29,in,"price") * pm_cesdata(t_29,regi_dyn29,in,"quantity") @@ -854,18 +748,6 @@ $endif.subsectors pm_cesdata(t_29,regi_dyn29,in,"eff") = pm_cesdata(t_29,regi_dyn29,out,"quantity") / pm_cesdata(t_29,regi_dyn29,in,"quantity"); - ); - - if (ipf_putty(out), - pm_cesdata(t_29,regi_dyn29,in,"xi") - = pm_cesdata(t_29,regi_dyn29,in,"price") - * pm_cesdata_putty(t_29,regi_dyn29,in,"quantity") - / pm_cesdata_putty(t_29,regi_dyn29,out,"quantity"); - - pm_cesdata(t_29,regi_dyn29,in,"eff") - = pm_cesdata_putty(t_29,regi_dyn29,out,"quantity") - / pm_cesdata_putty(t_29,regi_dyn29,in,"quantity"); - ); ); ); @@ -1116,15 +998,9 @@ display "after long term efficiencies", pm_cesdata, p29_efficiency_growth; *** FIXME: In case in_complements are in beyond, quantity data is needed for *** the assignment below loop (complements_ref(in, in2), - pm_cesdata(t,regi_dyn29(regi),in2,"compl_coef")$( - ( NOT in_putty(in2)) OR ppfIO_putty(in2) ) + pm_cesdata(t,regi_dyn29(regi),in2,"compl_coef") = pm_cesdata(t,regi,in,"quantity") / pm_cesdata(t,regi,in2,"quantity"); - - pm_cesdata(t,regi_dyn29(regi),in2,"compl_coef")$( - in_putty(in2) AND (NOT ppfIO_putty(in2)) ) - = pm_cesdata_putty(t,regi,in,"quantity") - / pm_cesdata_putty(t,regi,in2,"quantity"); ); ***_______________________ END COMPLEMENTARY CONSTRAINTS _____________________________ @@ -1155,9 +1031,9 @@ loop ((out,in,in2,t)$((pm_cesdata_sigma(t,out) eq -1) AND ( ppfKap(in) AND ( NOT ppfKap(in2))) AND (sameAs(t, "2015") OR sameAs(t, "2050") OR sameAs(t, "2100"))) , - put sm_CES_calibration_iteration:0:0, "remind" , t.tl, out.tl , "quantity", regi.tl, ( pm_cesdata(t,regi,out,"quantity") $ ( NOT ipf_putty(out)) + pm_cesdata_putty(t,regi,out,"quantity") $ ( ipf_putty(out))) /; - put sm_CES_calibration_iteration:0:0, "remind" , t.tl, in.tl , "quantity", regi.tl, ( pm_cesdata(t,regi,in,"quantity") $ ( NOT ipf_putty(out)) + pm_cesdata_putty(t,regi,in,"quantity") $ ( ipf_putty(out))) /; - put sm_CES_calibration_iteration:0:0, "remind" , t.tl, in2.tl , "quantity", regi.tl, ( pm_cesdata(t,regi,in2,"quantity") $ ( NOT ipf_putty(out)) + pm_cesdata_putty(t,regi,in2,"quantity") $ ( ipf_putty(out))) /; + put sm_CES_calibration_iteration:0:0, "remind" , t.tl, out.tl , "quantity", regi.tl, ( pm_cesdata(t,regi,out,"quantity") ) /; + put sm_CES_calibration_iteration:0:0, "remind" , t.tl, in.tl , "quantity", regi.tl, ( pm_cesdata(t,regi,in,"quantity") ) /; + put sm_CES_calibration_iteration:0:0, "remind" , t.tl, in2.tl , "quantity", regi.tl, ( pm_cesdata(t,regi,in2,"quantity") ) /; put sm_CES_calibration_iteration:0:0,"remind" , t.tl, in.tl , "eff", regi.tl, pm_cesdata(t,regi,in,"eff") /; put sm_CES_calibration_iteration:0:0,"remind" , t.tl, in2.tl , "eff", regi.tl, pm_cesdata(t,regi,in2,"eff") /; @@ -1189,33 +1065,15 @@ p29_test_CES_recursive(t_29,regi,in) = 0; p29_test_CES_recursive(t_29hist,regi_dyn29,ppf(in)) = pm_cesdata(t_29hist,regi_dyn29,in,"quantity"); -p29_test_CES_recursive(t_29,regi_dyn29,ppf_29(in))$( NOT ppf_putty(in) ) +p29_test_CES_recursive(t_29,regi_dyn29,ppf_29(in)) = pm_cesdata(t_29,regi_dyn29,in,"quantity"); -p29_test_CES_putty_recursive(t_29,regi_dyn29,ppf_29(in))$( ppf_putty(in) ) -= pm_cesdata_putty(t_29,regi_dyn29,in,"quantity"); - -p29_test_CES_putty_recursive(t_29hist,regi_dyn29,ppf_putty(in))$( - NOT ppf_29(in) ) -= pm_cesdata_putty(t_29hist,regi_dyn29,in,"quantity"); - -display "consistency beyond 1", p29_test_CES_recursive, - p29_test_CES_putty_recursive; +display "consistency beyond 1", p29_test_CES_recursive; *** test for the historical periods, where beyond_calib is also taken into account loop ((t_29hist(t),regi_dyn29(regi),cesRev2cesIO(counter,ipf(out))), - p29_test_CES_putty_recursive(t,regi,out)$( ipf_putty(out) ) - = sum(cesOut2cesIn(out,in), - pm_cesdata(t,regi,in,"xi") - * ( pm_cesdata(t,regi,in,"eff") - * pm_cesdata(t,regi,in,"effGr") - * p29_test_CES_putty_recursive(t,regi,in) - ) - ** pm_cesdata(t,regi,out,"rho") - ) - ** (1 / pm_cesdata(t,regi,out,"rho")); - p29_test_CES_recursive(t,regi,out)$( NOT ipf_putty(out) ) + p29_test_CES_recursive(t,regi,out) = sum(cesOut2cesIn(out,in), pm_cesdata(t,regi,in,"xi") * ( pm_cesdata(t,regi,in,"eff") @@ -1226,57 +1084,16 @@ loop ((t_29hist(t),regi_dyn29(regi),cesRev2cesIO(counter,ipf(out))), ) ** (1 / pm_cesdata(t,regi,out,"rho")); -!! compute the total for factors that are ppf in the CES and ipf in the putty -p29_test_CES_recursive(t0(t),regi,ppfIO_putty(out)) - = p29_test_CES_putty_recursive(t,regi,out) - / pm_delta_kap(regi,out); - -!! compute the total for factors that are ppf in the CES and ipf in the putty -p29_test_CES_recursive(t,regi_dyn29,ppfIO_putty(out))$( NOT t0(t) ) - = ( p29_test_CES_recursive(t-1,regi_dyn29,out) - * (1- pm_delta_kap(regi_dyn29,out)) - ** pm_dt(t) - ) - + ( pm_cumDeprecFactor_old(t,regi_dyn29,out) - * p29_test_CES_putty_recursive(t-1,regi_dyn29,out) - ) - + ( pm_cumDeprecFactor_new(t,regi_dyn29,out) - * p29_test_CES_putty_recursive(t,regi_dyn29,out) - ); - -!! compute the delta for factors that are ipf in the CES and ppf in the putty -p29_test_CES_putty_recursive(t,regi_dyn29,ppf_putty(out))$( NOT t0(t) ) - = 1 / pm_cumDeprecFactor_new(t,regi_dyn29,out) - * ( p29_test_CES_recursive(t,regi_dyn29,out) - - ( p29_test_CES_recursive(t-1,regi_dyn29,out) - * (1 - pm_delta_kap(regi_dyn29,out)) - ** pm_dt(t) - ) - - ( pm_cumDeprecFactor_old(t,regi_dyn29,out) - * p29_test_CES_putty_recursive(t-1,regi_dyn29,out) - ) - ); ); putclose logfile; -display "consistency beyond 2", p29_test_CES_recursive, - p29_test_CES_putty_recursive; +display "consistency beyond 2", p29_test_CES_recursive; *** test for the other periods, and restrict to in_29 loop ((t_29(t),regi_dyn29(regi),cesRev2cesIO(counter,ipf_29(out)))$( NOT t_29hist(t) ), - p29_test_CES_putty_recursive(t,regi,out)$( ipf_putty(out) ) - = sum(cesOut2cesIn(out,in), - pm_cesdata(t,regi,in,"xi") - * ( pm_cesdata(t,regi,in,"eff") - * pm_cesdata(t,regi,in,"effGr") - * p29_test_CES_putty_recursive(t,regi,in) - ) - ** pm_cesdata(t,regi,out,"rho") - ) - ** (1 / pm_cesdata(t,regi,out,"rho")); - p29_test_CES_recursive(t,regi,out)$( NOT ipf_putty(out) ) + p29_test_CES_recursive(t,regi,out) !! use exp(log(a) * b) = a ** b because the latter is not accurate in GAMS = exp( log( @@ -1295,81 +1112,14 @@ loop ((t_29(t),regi_dyn29(regi),cesRev2cesIO(counter,ipf_29(out)))$( ) * (1 / pm_cesdata(t,regi,out,"rho")) ); - - !! compute the total for factors that are ppf in the CES and ipf in the putty - p29_test_CES_recursive(t,regi_dyn29,out)$( ppfIO_putty(out) ) - = ( p29_test_CES_recursive(t-1,regi_dyn29,out) - * (1 - pm_delta_kap(regi_dyn29,out)) - ** pm_dt(t) - ) - + ( pm_cumDeprecFactor_old(t,regi_dyn29,out) - * p29_test_CES_putty_recursive(t-1,regi_dyn29,out) - ) - + ( pm_cumDeprecFactor_new(t,regi_dyn29,out) - * p29_test_CES_putty_recursive(t,regi_dyn29,out) - ); - - !! compute the delta for factors that are ipf in the CES and ppf in the putty - p29_test_CES_putty_recursive(t,regi_dyn29,out)$( ppf_putty(out) ) - = 1 / pm_cumDeprecFactor_new(t,regi_dyn29,out) - * ( p29_test_CES_recursive(t,regi_dyn29,out) - - ( p29_test_CES_recursive(t-1,regi_dyn29,out) - * (1 - pm_delta_kap(regi_dyn29,out)) - ** pm_dt(t) - ) - - ( pm_cumDeprecFactor_old(t,regi_dyn29,out) - * p29_test_CES_putty_recursive(t-1,regi_dyn29,out) - ) - ); ); -display "consistency beyond 3", p29_test_CES_recursive, - p29_test_CES_putty_recursive; +display "consistency beyond 3", p29_test_CES_recursive; option p29_test_CES_recursive:8; display "check technological consistency beyond calibration", pm_cesdata, p29_test_CES_recursive; -put logfile; -sm_tmp = 0; -loop ((t_29(t),regi_dyn29(Regi)), - if ( ( card(putty_compute_in) eq 0 - AND abs( p29_test_CES_recursive(t,regi,"inco") - - pm_cesdata(t,regi,"inco","quantity")) gt 1e-6) - OR ( card(putty_compute_in) gt 0 - AND abs( p29_test_CES_recursive(t,regi,"inco") - - pm_cesdata(t,regi,"inco","quantity")) gt 1e-2), - - put "consistency check failed for ", t.tl, ", ", regi.tl /; - sm_tmp = 0; - loop (cesLevel2cesIO(counter,ipf)$( pm_cesdata(t,regi,ipf,"quantity") - ne p29_test_CES_recursive(t,regi,ipf) ), - sm_tmp = max(sm_tmp, card(ipf.tl) + counter.val); - ); - put "ipf", @(sm_tmp + 2) "pm_cesdata"; - put @(sm_tmp + 15) "p29_test_CES_recursive" /; - loop (cesLevel2cesIO(counter,ipf)$( - ( pm_cesdata(t,regi,ipf,"quantity") - ne p29_test_CES_recursive(t,regi,ipf)) - AND p29_test_CES_recursive(t,regi,ipf) ne 0 ), - put @(counter.val - 1) ipf.tl; - put @(sm_tmp + 3) pm_cesdata(t,regi,ipf,"quantity"); - put @(sm_tmp + 16) p29_test_CES_recursive(t,regi,ipf); - put @(sm_tmp + 41) "[", ( p29_test_CES_recursive(t,regi,ipf) - - pm_cesdata(t,regi,ipf,"quantity")), "]" /; - ); - put " " /; - - sm_tmp = 1; - ); -); -putclose logfile; - -if (sm_tmp, - execute_unload "abort.gdx"; - abort "something is wrong with the consistency of pm_cesdata, see logfile"; -); - sm_tmp = 0; loop ((t_29(t),regi_dyn29(regi),cesOut2cesIn(out,in))$( NOT sameas(in,"inco") ), if ( pm_cesdata(t,regi,in,"effGr") lt 1e-10 @@ -1412,23 +1162,9 @@ putclose logfile; ***_____________________________ END OF: CONSISTENCY CHECKS ________________________________________ -*** Add information on ppf_putty quantities which are not in ppf_29 -if (sm_CES_calibration_iteration eq 1, - put file_CES_calibration; - - loop ((t,regi_dyn29(regi),in)$(( NOT ppf_29(in)) AND ppf_putty(in)), - - put "%c_expname%", "target", t.tl, regi.tl, "quantity_putty", in.tl; - put pm_cesdata_putty(t,regi,in,"quantity") /; - - - ); - putclose file_CES_calibration; - ); - $ONorder -* Assert that q37_energy_limits is feasible for calibration runs +*** Assert that q37_energy_limits is feasible for calibration runs sm_tmp = 0; loop ((ttot(t),regi_dyn29(regi),industry_ue_calibration_target_dyn37(out))$( t.val gt 2015 AND pm_energy_limit(out) ), diff --git a/modules/29_CES_parameters/calibrate/realization.gms b/modules/29_CES_parameters/calibrate/realization.gms index 69daa3774..a7a32f662 100644 --- a/modules/29_CES_parameters/calibrate/realization.gms +++ b/modules/29_CES_parameters/calibrate/realization.gms @@ -241,23 +241,6 @@ *' approach is taken: All ppfen (not ppfkap) input prices are mutliplied with the same factor (the ratio of prescribed *' to computed UE quantity, minus the ppfkap share), such that the quantity trajectories are met for UE. *' -*' ##### Putty-Clay -*' -*' Putty-Clay is currently mainly used in the buildings module. -*' -*' It is possible to introduce segments of the CES tree which are subject to putty-clay dynamics, _i.e._ the model at -*' time `t` will substitute between _increments_ of the variables. The _aggregate_ level of the variable will be the -*' sum of the _increment_ from the CES and the depreciated past _aggregate_ level. This mechanism limits the extent -*' to which the energy demand can be reduced in response to higher energy prices. -*' -*' To treat some CES sections as putty-clay, the set items should be included to `in_putty` and `ppf_putty` for the lowest -*' level of the putty-clay section. In addition, depreciation rates should be defined for the putty variables. For -*' consistency, it is advisable to use identical depreciation rates for inputs and outputs in the same CES function. -*' -*' Currently, the calibration script has not been tested for a putty-clay structure that is in the `beyond_calib` part. -*' -*' The Powerpoint file attached gives some more explanations. -*' *' ##### Perfectly complementary factors *' *' To implement perfectly complementary factors, you should include the factors in the set `in_complements`. In addition, @@ -266,7 +249,7 @@ *' elasticity should be INF), which makes sense for energetic entities. It would however be possible to change this *' (by choosing another elasticity of substitution) without harming the calibration. *' -*' In the model, the complementary factors are subject to a constraint (`q01_prodCompl` or `q01_prodCompl_putty`), so that +*' In the model, the complementary factors are subject to a constraint (`q01_prodCompl`), so that *' each variable is computed by multiplying a key variable of the CES function by a given factor. The calibration computes *' this factor for each period. *' diff --git a/modules/29_CES_parameters/calibrate/sets.gms b/modules/29_CES_parameters/calibrate/sets.gms index a4329589b..7990f1e34 100644 --- a/modules/29_CES_parameters/calibrate/sets.gms +++ b/modules/29_CES_parameters/calibrate/sets.gms @@ -30,7 +30,6 @@ ppf_29(all_in) "primary production factors to calibrate for" in_29(all_in) "calibration production factors" ue_29(all_in) "useful energy variables" ue_fe_kap_29(all_in) "useful energy items which are the direct output of one FE and one Kap, and which is calibrated to. The CES efficiencies need specific treatment" -putty_compute_in(all_in) "factors inside putty which should be computed from non-putty values" in_beyond_calib_29(all_in) "all factors which are outside of the calibration, including the ones which are ppf_29" in_beyond_calib_29_excludeRoot(all_in) "all factors which are outside of the calibration, excluding the ones which are ppf_29" root_beyond_calib_29(all_in) "all factors which operate the junction between the calibrated CES and the CES which is not calibrated" diff --git a/modules/29_CES_parameters/load/not_used.txt b/modules/29_CES_parameters/load/not_used.txt index 6018f1fd7..785aa9082 100644 --- a/modules/29_CES_parameters/load/not_used.txt +++ b/modules/29_CES_parameters/load/not_used.txt @@ -15,7 +15,6 @@ pm_lab,parameter,??? sm_EJ_2_TWa,input,questionnaire pm_cesdata_sigma,input,questionnaire vm_cesIOdelta,input,questionnaire -pm_cesdata_putty,input,questionnaire pm_dt,input,questionnaire pm_cumDeprecFactor_old,input,questionnaire pm_cumDeprecFactor_new,input,questionnaire diff --git a/scripts/output/single/plotIterations.R b/scripts/output/single/plotIterations.R index a87ee5378..ce541d5b1 100644 --- a/scripts/output/single/plotIterations.R +++ b/scripts/output/single/plotIterations.R @@ -11,14 +11,8 @@ plotMapping <- list() generateHtml <- "y" combineDims <- list() -if (!exists("source_include")) { - outputdir <- file.path("output", "B-putty_SSP2-NDC_restartWithAllIterationResults") - lucode2::readArgs("outputdir", "symbolNames", "generateHtml") -} - outputdir <- normalizePath(outputdir) - getLineCoerce <- function() { # gets characters (line) from the user and always returns a string s <- gms::getLine() diff --git a/scripts/output/single/reportCEScalib.R b/scripts/output/single/reportCEScalib.R index 236cba534..2dc6c8cf5 100644 --- a/scripts/output/single/reportCEScalib.R +++ b/scripts/output/single/reportCEScalib.R @@ -269,71 +269,9 @@ for (s in levels(CES.cal.report$scenario)) { ggtitle(paste("total efficiency (1 = iteration 1)", r, s)) -> p plot(p) - - # plot Putty quantities - if ( dim(CES.cal.report %>% filter(variable == "quantity_putty"))[1] > 0){ - CES.cal.report %>% - filter(scenario == s, - t <= 2100, - regi == r, - variable == "quantity_putty") %>% - order.levels(pf = getElement(.pf,"structure" )) %>% - ggplot(aes(x = t, y = value, colour = iteration, - linetype = iteration)) + - geom_line() + - facet_wrap(~ pf, scales = "free", as.table = FALSE) + - expand_limits(y = 0) + - scale_colour_manual(values = col) + - scale_linetype_manual(values = lns) + - ggtitle(paste("Putty quantities", r, s)) -> p - - plot(p) - - # plot prices putty - CES.cal.report %>% - filter(scenario == s, - t <= 2100, - regi == r, - variable == "price_putty") %>% - order.levels(pf = getElement(.pf,"structure" )) %>% - ggplot(aes(x = t, y = value, colour = iteration, - linetype = iteration)) + - geom_line() + - facet_wrap(~ pf, scales = "free", as.table = FALSE) + - expand_limits(y = 0) + - scale_colour_manual(values = col) + - scale_linetype_manual(values = lns) + - ggtitle(paste("prices", r, s)) -> p - plot(p) - - # plot efficiencies - CES.cal.report %>% - filter(scenario == s, - t <= 2100, - regi == r, - variable == "total efficiency putty", - iteration != "origin") %>% - group_by(scenario,t,regi,pf,variable) %>% - mutate(value = value / value[as.character(iteration) == "1"]) %>% - ungroup() %>% - order.levels(pf = getElement(.pf,"structure" )) %>% - ggplot(aes(x = t, y = value, colour = iteration, - linetype = iteration)) + - geom_line() + - facet_wrap(~ pf, scales = "free", as.table = FALSE) + - expand_limits(y = 0) + - scale_colour_manual(values = col) + - scale_linetype_manual(values = lns) + - ggtitle(paste("total efficiency (1 = iteration 1)", r, s)) -> p - plot(p) - } - - - - # plot delta_cap if ('vm_deltaCap' %in% unique(CES.cal.report$variable)) { CES.cal.report %>% diff --git a/scripts/start/run.R b/scripts/start/run.R index 4ea61f915..8ea468643 100644 --- a/scripts/start/run.R +++ b/scripts/start/run.R @@ -79,20 +79,6 @@ run <- function() { "pm_cesdata(\"\\1\",\"\\2\",\"\\3\",\"\\4\") = \\5;", x = .) %>% write(file_name) - - pm_cesdata_putty = system("gdxdump fulldata.gdx symb=pm_cesdata_putty", intern = TRUE) - if (length(pm_cesdata_putty) == 2){ - tmp_putty = gsub("^Parameter *([A-z_(,)])+cesParameters\\).*$",'\\1"quantity") = 0;', pm_cesdata_putty[2]) - } else { - tmp_putty = pm_cesdata_putty[-(1:2)] %>% - grep("quantity", x = ., value = TRUE) %>% - grep(expr_ces_in,x = ., value = T) - } - tmp_putty %>% - sub("'([^']*)'.'([^']*)'.'([^']*)'.'([^']*)' (.*)[ ,][ /];?", - "pm_cesdata_putty(\"\\1\",\"\\2\",\"\\3\",\"\\4\") = \\5;", x = .)%>% write(file_name,append =T) - } - getLoadFile() # Store all the interesting output From 041d6f41765da5ea685cb6bc304c7278b4c5487c Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Wed, 13 Dec 2023 16:50:23 +0100 Subject: [PATCH 07/35] adjust interfaces --- modules/01_macro/singleSectorGr/declarations.gms | 4 ++-- modules/01_macro/singleSectorGr/equations.gms | 4 ++-- modules/01_macro/singleSectorGr/preloop.gms | 10 +++++----- modules/29_CES_parameters/calibrate/declarations.gms | 1 - modules/29_CES_parameters/calibrate/not_used.txt | 2 -- modules/29_CES_parameters/calibrate/realization.gms | 1 - modules/29_CES_parameters/load/not_used.txt | 6 +----- 7 files changed, 10 insertions(+), 18 deletions(-) diff --git a/modules/01_macro/singleSectorGr/declarations.gms b/modules/01_macro/singleSectorGr/declarations.gms index 21aa84791..ebf3bdec5 100644 --- a/modules/01_macro/singleSectorGr/declarations.gms +++ b/modules/01_macro/singleSectorGr/declarations.gms @@ -10,8 +10,8 @@ ***------------------------------------------------------------------------------- parameters pm_delta_kap(all_regi,all_in) "Depreciation rate of capital." -pm_cumDeprecFactor_old(ttot,all_regi,all_in) "Investment depreciation within a period, applied to the investment of t -1." -pm_cumDeprecFactor_new(ttot,all_regi,all_in) "Investment depreciation within a period, applied to the investment of t." +p01_cumDeprecFactor_old(ttot,all_regi,all_in) "Investment depreciation within a period, applied to the investment of t -1." +p01_cumDeprecFactor_new(ttot,all_regi,all_in) "Investment depreciation within a period, applied to the investment of t." p01_ppfen_ratios(ttot,all_regi,all_in,all_in) "Limit ratio of two primary production factors of energy (ppfEn)." pm_ppfen_shares(ttot,all_regi,all_in,all_in) "Limit the share of one ppfEn in total CES nest inputs." pm_consPC(tall,all_regi) "Consumption per capita" diff --git a/modules/01_macro/singleSectorGr/equations.gms b/modules/01_macro/singleSectorGr/equations.gms index be72507dd..f398f18e9 100644 --- a/modules/01_macro/singleSectorGr/equations.gms +++ b/modules/01_macro/singleSectorGr/equations.gms @@ -139,8 +139,8 @@ q01_kapMo(ttot,regi,ppfKap(in))$( vm_cesIO(ttot,regi,in) * (1 - pm_delta_kap(regi,in)) ** (pm_ttot_val(ttot+1) - pm_ttot_val(ttot)) - + pm_cumDeprecFactor_old(ttot+1,regi,in) * vm_invMacro(ttot,regi,in) - + pm_cumDeprecFactor_new(ttot+1,regi,in) * vm_invMacro(ttot+1,regi,in) + + p01_cumDeprecFactor_old(ttot+1,regi,in) * vm_invMacro(ttot,regi,in) + + p01_cumDeprecFactor_new(ttot+1,regi,in) * vm_invMacro(ttot+1,regi,in) ; ***--------------------------------------------------------------------------- diff --git a/modules/01_macro/singleSectorGr/preloop.gms b/modules/01_macro/singleSectorGr/preloop.gms index da1d919f8..f790aea26 100644 --- a/modules/01_macro/singleSectorGr/preloop.gms +++ b/modules/01_macro/singleSectorGr/preloop.gms @@ -9,13 +9,13 @@ *** Calculate cummulative depreciation factors loop ((t,counter), if ( pm_dt(t) eq 2 * counter.val, -pm_cumDeprecFactor_old(t,regi,in)$(ppfKap(in)) +p01_cumDeprecFactor_old(t,regi,in)$(ppfKap(in)) = ((1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 ) - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t) )) / pm_delta_kap(regi,in) ; -pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in) ) +p01_cumDeprecFactor_new(t,regi,in)$(ppfKap(in) ) = ( 1 - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2) ) @@ -24,14 +24,14 @@ pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in) ) ); if ( pm_dt(t) eq (2 * counter.val -1), -pm_cumDeprecFactor_old(t,regi,in)$(ppfKap(in)) +p01_cumDeprecFactor_old(t,regi,in)$(ppfKap(in)) = ((1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5) - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t))) / pm_delta_kap(regi,in) - 1/2 * (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5 ) ; -pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in)) +p01_cumDeprecFactor_new(t,regi,in)$(ppfKap(in)) = ( 1 - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5 + 1) ) @@ -41,6 +41,6 @@ pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in)) ); ); -display "test Deprec", pm_cumDeprecFactor_new,pm_cumDeprecFactor_old; +display "test Deprec", p01_cumDeprecFactor_new,p01_cumDeprecFactor_old; *** EOF ./modules/01_macro/singleSectorGr/preloop.gms diff --git a/modules/29_CES_parameters/calibrate/declarations.gms b/modules/29_CES_parameters/calibrate/declarations.gms index 4bd20ea28..d39c19083 100644 --- a/modules/29_CES_parameters/calibrate/declarations.gms +++ b/modules/29_CES_parameters/calibrate/declarations.gms @@ -17,7 +17,6 @@ Parameters p29_beta(all_regi,all_in) "XXX" p29_cesdata_load(tall,all_regi,all_in,cesParameter) "pm_cesdata from the gdx file" p29_cesIO_load(tall,all_regi,all_in) "production factor vm_cesIO from input.gdx" - p29_cesIOdelta_load(tall,all_regi,all_in) "production factor vm_cesIOdelta from input.gdx" p29_effGr(tall,all_regi,all_in) "growth of factor efficiency from input.gdx" $ifthen.transpmodule "%transport%" == "edge_esm" p29_trpdemand(tall,all_regi,all_GDPscen,all_demScen,EDGE_scenario_all,all_in) "transport demand for the edge_esm transport module, unit: trillion passenger/ton km" diff --git a/modules/29_CES_parameters/calibrate/not_used.txt b/modules/29_CES_parameters/calibrate/not_used.txt index 83165a436..ad14a32d8 100644 --- a/modules/29_CES_parameters/calibrate/not_used.txt +++ b/modules/29_CES_parameters/calibrate/not_used.txt @@ -5,5 +5,3 @@ # | REMIND License Exception, version 1.0 (see LICENSE file). # | Contact: remind@pik-potsdam.de name,type,reason - - diff --git a/modules/29_CES_parameters/calibrate/realization.gms b/modules/29_CES_parameters/calibrate/realization.gms index a7a32f662..c5dbded67 100644 --- a/modules/29_CES_parameters/calibrate/realization.gms +++ b/modules/29_CES_parameters/calibrate/realization.gms @@ -259,7 +259,6 @@ $Ifi "%phase%" == "sets" $include "./modules/29_CES_parameters/calibrate/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/29_CES_parameters/calibrate/declarations.gms" $Ifi "%phase%" == "datainput" $include "./modules/29_CES_parameters/calibrate/datainput.gms" -$Ifi "%phase%" == "equations" $include "./modules/29_CES_parameters/calibrate/equations.gms" $Ifi "%phase%" == "preloop" $include "./modules/29_CES_parameters/calibrate/preloop.gms" $Ifi "%phase%" == "bounds" $include "./modules/29_CES_parameters/calibrate/bounds.gms" $Ifi "%phase%" == "output" $include "./modules/29_CES_parameters/calibrate/output.gms" diff --git a/modules/29_CES_parameters/load/not_used.txt b/modules/29_CES_parameters/load/not_used.txt index 785aa9082..04ecdcca1 100644 --- a/modules/29_CES_parameters/load/not_used.txt +++ b/modules/29_CES_parameters/load/not_used.txt @@ -14,10 +14,6 @@ pm_gdp,parameter,??? pm_lab,parameter,??? sm_EJ_2_TWa,input,questionnaire pm_cesdata_sigma,input,questionnaire -vm_cesIOdelta,input,questionnaire -pm_dt,input,questionnaire -pm_cumDeprecFactor_old,input,questionnaire -pm_cumDeprecFactor_new,input,questionnaire sm_mega_2_non,input,questionnaire pm_delta_kap,input,questionnaire sm_tmp2,input,questionnaire @@ -27,5 +23,5 @@ sm_TWa_2_kWh,input,questionnaire pm_ue_eff_target,parameter,not needed pm_calibrate_eff_scale,parameter,not needed pm_fedemand,parameter,not needed -pm_energy_limit +pm_energy_limit,, sm_CES_calibration_iteration,scalar,only applicable during calibration From 00fe2a7d36048f41c60658bd61f8bd570f6d7d94 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Thu, 14 Dec 2023 10:51:47 +0100 Subject: [PATCH 08/35] some cleaning --- .../29_CES_parameters/calibrate/preloop.gms | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index dd5a945d1..0900ee577 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -376,10 +376,10 @@ display "after change up to en consistency", pm_cesdata; ***_____________________________ START OF: ENSURE GDP CONSISTENCY VIA LABOUR PRICE _____________________________ -* Then, we consider the bottom level of the CES tree, where capital and labor -* have specific restrictions. Capital works as for the other ppfen, Labour -* will be the adjustment variable to meet inco. xi will not be equal to the -* income share of capital (from equation price = derivative) +*** Then, we consider the bottom level of the CES tree, where capital and labor +*** have specific restrictions. Capital works as for the other ppfen, Labour +*** will be the adjustment variable to meet inco. xi will not be equal to the +*** income share of capital (from equation price = derivative) pm_cesdata(t,regi_dyn29,"kap","xi") = pm_cesdata(t,regi_dyn29,"kap","price") * pm_cesdata(t,regi_dyn29,"kap","quantity") @@ -407,33 +407,33 @@ if (smax((t,regi_dyn29(regi)), sm_tmp !! by how much does en + kap exceed inco? = ( ( pm_cesdata(t,regi,"en","quantity") * pm_cesdata(t,regi,"en","price") - ) + ) + ( pm_cesdata(t,regi,"kap","quantity") * pm_cesdata(t,regi,"kap","price") - ) + ) ) / pm_cesdata(t,regi,"inco","quantity"); if (sm_tmp > 1, put " ", t.tl, " ", regi.tl, " ", pm_cesdata(t,regi,"en","quantity"), " x ", - pm_cesdata(t,regi,"en","price"), " + ", - pm_cesdata(t,regi,"kap","quantity"), " x ", - pm_cesdata(t,regi,"kap","price"), " > ", - pm_cesdata(t,regi,"inco","quantity"), " -> "; + pm_cesdata(t,regi,"en","price"), " + ", + pm_cesdata(t,regi,"kap","quantity"), " x ", + pm_cesdata(t,regi,"kap","price"), " > ", + pm_cesdata(t,regi,"inco","quantity"), " -> "; sm_tmp2 = ( pm_cesdata(t,regi,"inco","quantity") - ( pm_cesdata(t,regi,"lab","quantity") * pm_cesdata(t,regi,"lab","price") - ) + ) ) / ( ( pm_cesdata(t,regi,"en","quantity") * pm_cesdata(t,regi,"en","price") - ) + ) + ( pm_cesdata(t,regi,"kap","quantity") * pm_cesdata(t,regi,"kap","price") - ) + ) ); pm_cesdata(t,regi,"en","price") @@ -468,20 +468,20 @@ loop (cesOut2cesIn("inco",in)$( NOT sameas(in,"lab") ), if (sm_tmp gt 1, put " ", t.tl, " ", regi.tl, in.tl:>4, " ", - pm_cesdata(t,regi,in,"quantity"), " x ", - pm_cesdata(t,regi,in,"price"), " > ", - pm_cesdata(t,regi,"inco","quantity"), " -> "; + pm_cesdata(t,regi,in,"quantity"), " x ", + pm_cesdata(t,regi,in,"price"), " > ", + pm_cesdata(t,regi,"inco","quantity"), " -> "; pm_cesdata(t,regi,in,"price") - = ( pm_cesdata(t,regi,"inco","quantity") - - sum(cesOut2cesIn2("inco",in2)$( NOT sameas(in,in2) ), - pm_cesdata(t,regi,in2,"quantity") - * pm_cesdata(t,regi,in2,"price") - ) - ) - / pm_cesdata(t,regi,in,"quantity"); - - put pm_cesdata(t,regi,in,"price") /; + = ( pm_cesdata(t,regi,"inco","quantity") + - sum(cesOut2cesIn2("inco",in2)$( NOT sameas(in,in2) ), + pm_cesdata(t,regi,in2,"quantity") + * pm_cesdata(t,regi,in2,"price") + ) + ) + / pm_cesdata(t,regi,in,"quantity"); + + put pm_cesdata(t,regi,in,"price") /; ); ); putclose logfile, " " /; @@ -823,11 +823,11 @@ $ifthen.industry_FE_target "%c_CES_calibration_industry_FE_target%" == "1" *** Abort if any industry EEK value is lower than subsector output quantity sm_tmp = smin((t,regi_dyn29(regi), cesOut2cesIn(ue_industry_dyn37(out),ppfKap(in))), - pm_cesdata(t,regi,out,"quantity") - - ( pm_cesdata(t,regi,in,"quantity") - * pm_cesdata(t,regi,in,"price") - ) - ); + pm_cesdata(t,regi,out,"quantity") + - ( pm_cesdata(t,regi,in,"quantity") + * pm_cesdata(t,regi,in,"price") + ) + ); if (0 gt sm_tmp, put logfile, "Error in industry FE price rescaling: ", "EEK value exceeds subsector output quantity" /; @@ -836,13 +836,13 @@ if (0 gt sm_tmp, cesOut2cesIn(ue_industry_dyn37(out),ppfKap(in))), sm_tmp = pm_cesdata(t,regi,out,"quantity") - ( pm_cesdata(t,regi,in,"quantity") - * pm_cesdata(t,regi,in,"price") - ); + * pm_cesdata(t,regi,in,"price") + ); if (0 gt sm_tmp, put t.tl, ".", regi.tl, " ", out.tl:>20, pm_cesdata(t,regi,out,"quantity"):>10:4, " < ", - pm_cesdata(t,regi,in,"quantity"):>8:4, " x ", - pm_cesdata(t,regi,in,"price"):<8:4, " ", + pm_cesdata(t,regi,in,"quantity"):>8:4, " x ", + pm_cesdata(t,regi,in,"price"):<8:4, " ", in.tl:<0 /; ); ); @@ -1188,7 +1188,7 @@ if (sm_tmp eq 1, put " > ", sm_tmp /; loop (ces_eff_target_dyn37(out,in)$( pm_cesdata(t,regi,in,"quantity") ), put @3 pm_cesdata.tn(t,regi,in,"quantity"), @73 " = "; - put pm_cesdata(t,regi,in,"quantity") /; + put pm_cesdata(t,regi,in,"quantity") /; ); put " " /; ); From 0165e833b5c6aef9c95f3f43850f3c7ef46cbe7f Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Thu, 14 Dec 2023 16:56:29 +0100 Subject: [PATCH 09/35] add missing } --- scripts/start/run.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/start/run.R b/scripts/start/run.R index 8ea468643..c493a3d96 100644 --- a/scripts/start/run.R +++ b/scripts/start/run.R @@ -78,7 +78,7 @@ run <- function() { sub("'([^']*)'.'([^']*)'.'([^']*)'.'([^']*)' (.*)[ ,][ /];?", "pm_cesdata(\"\\1\",\"\\2\",\"\\3\",\"\\4\") = \\5;", x = .) %>% write(file_name) - + } getLoadFile() # Store all the interesting output From 882a4babe2f2af3017b2961ed0a7b023f2c0a4bc Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Thu, 14 Dec 2023 17:04:20 +0100 Subject: [PATCH 10/35] fix equation condition --- modules/01_macro/singleSectorGr/equations.gms | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/01_macro/singleSectorGr/equations.gms b/modules/01_macro/singleSectorGr/equations.gms index f398f18e9..30ecf92ac 100644 --- a/modules/01_macro/singleSectorGr/equations.gms +++ b/modules/01_macro/singleSectorGr/equations.gms @@ -130,8 +130,7 @@ q01_prodCompl(t,regi,in,in2) $ (complements_ref(in,in2) ) .. *' Both depreciation and investments are expressed as annual values, *' so the time step length is taken into account. ***--------------------------------------------------------------------------- -q01_kapMo(ttot,regi,ppfKap(in))$( - AND ord(ttot) lt card(ttot) +q01_kapMo(ttot,regi,ppfKap(in))$(ord(ttot) lt card(ttot) AND pm_ttot_val(ttot+1) ge max(2010, cm_startyear) AND pm_cesdata("2005",regi,in,"quantity") gt 0 ) .. vm_cesIO(ttot+1,regi,in) From 487b92cc23d13952ec4e84220f8c03f083df1c10 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Mon, 18 Dec 2023 10:25:37 +0100 Subject: [PATCH 11/35] add missing ) --- modules/29_CES_parameters/calibrate/preloop.gms | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 0900ee577..d07030bb0 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -68,8 +68,7 @@ else !! Compute prices of each node from CES derivatives of previous run: !! d(V_o)/d(V_i) = pi_i = xi_i * eff_i * effGr_i * V_o**(1-rho_o) * (eff_i * effGr_i * V_i)**(rho_o-1) - p29_CESderivative(t,regi_dyn29(regi),ces_29(out,in))$( - p29_cesIO_load(t,regi,in)) + p29_CESderivative(t,regi_dyn29(regi),ces_29(out,in))$(p29_cesIO_load(t,regi,in)) = p29_cesdata_load(t,regi,in,"xi") * p29_cesdata_load(t,regi,in,"eff") * p29_effGr(t,regi,in) @@ -79,12 +78,13 @@ else ** (1 - p29_cesdata_load(t,regi,out,"rho")) * exp( - log( - p29_cesdata_load(t,regi,in,"eff") - * p29_effGr(t,regi,in) - * ( p29_cesIO_load(t,regi,in) - ) - * (p29_cesdata_load(t,regi,out,"rho") - 1)); + log( + p29_cesdata_load(t,regi,in,"eff") + * p29_effGr(t,regi,in) + * p29_cesIO_load(t,regi,in) + * (p29_cesdata_load(t,regi,out,"rho") - 1) + ) + ); !! Propagate price down the CES tree to get prices in terms of inco, !! i.e. calc d(inco)/d(in) by applying the chain rule (product of node derivatives) From 6a059c7ff2d0bfc37c888317d9e6c7574da3b846 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Wed, 20 Dec 2023 08:50:31 +0100 Subject: [PATCH 12/35] bugfix, move one ) --- modules/29_CES_parameters/calibrate/preloop.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index d07030bb0..480c8e2be 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -82,8 +82,8 @@ else p29_cesdata_load(t,regi,in,"eff") * p29_effGr(t,regi,in) * p29_cesIO_load(t,regi,in) - * (p29_cesdata_load(t,regi,out,"rho") - 1) ) + * (p29_cesdata_load(t,regi,out,"rho") - 1) ); !! Propagate price down the CES tree to get prices in terms of inco, From 4a8b9e88c3728b7885e6336c7efbf6c4884a4ab0 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Wed, 3 Jan 2024 11:50:37 +0100 Subject: [PATCH 13/35] fix calibration calculations --- .../29_CES_parameters/calibrate/preloop.gms | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 480c8e2be..67293ec57 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -352,7 +352,26 @@ display "after price smoothing", cesOut2cesIn_below, pm_cesdata; ***_____________________________ END OF: GET PRICES _____________________________ +***_____________________________ START OF: CALCULATE IPF _____________________________ +*** All effGr, are set to one, so that we can focus on efficiencies +*** we will split xi and eff evolutions later and pass it on to effGr +pm_cesdata(t,regi_dyn29,in_29,"effGr") = 1; + +*** First, using the prices and quantities of the ppfEn, the prices of ipf +*** we compute thanks to the Euler equation the quantities of the ipf. + +*** we compute quantities for everything up to the last CES level inco.(lab,kap,en) + +loop ((t,cesRev2cesIO(counter,ipf_29(out)))$( NOT ( sameas(out,"inco")) ), + pm_cesdata(t,regi_dyn29,out,"quantity") + = sum(cesOut2cesIn(out,in), + pm_cesdata(t,regi_dyn29,in,"price") + * pm_cesdata(t,regi_dyn29,in,"quantity") + ); +); + +***_____________________________ END OF: CALCULATE IPF _____________________________ ***_____________________________ START OF: CHANGE EFFICIENCIES TO FULFILL ECONOMIC CONSTRAINT _____________________________ From da8d2b2b9b4ced553883ac27f3a17f28936e9f25 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Mon, 8 Jan 2024 13:27:45 +0100 Subject: [PATCH 14/35] further fixing calibration --- .../29_CES_parameters/calibrate/preloop.gms | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 67293ec57..27aa2f8db 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -363,12 +363,63 @@ pm_cesdata(t,regi_dyn29,in_29,"effGr") = 1; *** we compute quantities for everything up to the last CES level inco.(lab,kap,en) + loop ((t,cesRev2cesIO(counter,ipf_29(out)))$( NOT ( sameas(out,"inco")) ), pm_cesdata(t,regi_dyn29,out,"quantity") = sum(cesOut2cesIn(out,in), pm_cesdata(t,regi_dyn29,in,"price") * pm_cesdata(t,regi_dyn29,in,"quantity") ); +*** Ensure that the labour share in GDP is at least 20 % for historical periods +*** and 0.5 % for others. +sm_tmp = 0; +sm_tmp2 = 0; + +put logfile; +loop ((t_29hist(t),regi_dyn29(regi)), + sm_tmp + = sum(in$(sameAs(in, "kap") OR sameAs(in,"en")), + pm_cesdata(t,regi,in,"quantity") + * pm_cesdata(t,regi,in,"price") + ) + / pm_cesdata(t,regi,"inco","quantity"); + + + if ( (0.8$( t_29hist(t) ) + 0.995$( NOT t_29hist(t) )) lt sm_tmp, + + put t.tl, " ", regi.tl, " labour share in GDP: ", (1 - sm_tmp); + + pm_cesdata(t,regi,ppf_29(in),"price") $ ( NOT ( sameAs(in, "lab") + OR in_complements(in)) ) + = pm_cesdata(t,regi,in,"price") + * (0.8$( t_29hist(t) ) + 0.995$( NOT t_29hist(t) )) + / sm_tmp; + + loop (cesOut2cesIn(in2,in)$( ppf_29(in) AND in_complements(in) ), + pm_cesdata(t,regi,in2,"price") + = pm_cesdata(t,regi,in2,"price") + * (0.8$( t_29hist(t) ) + 0.995$( NOT t_29hist(t) )) + / sm_tmp; + ); + + put " -> ", (1 - (0.8$( t_29hist(t) ) + 0.995$( NOT t_29hist(t) ))) /; + sm_tmp2 = sm_tmp2 + 1; + ); +); +putclose logfile; +!! If there has been a rescaling for historical steps, repeat previous steps with new prices +if ( sm_tmp2 gt 0, !! If there has been a rescaling + + loop ((t,cesRev2cesIO(counter,ipf_29(out)))$( NOT ( sameas(out,"inco") + OR in_below_putty(out) + OR ppf_putty(out)) ), + pm_cesdata(t,regi_dyn29,out,"quantity")$( NOT ipf_putty(out) ) + = sum(cesOut2cesIn(out,in), + pm_cesdata(t,regi_dyn29,in,"price") + * pm_cesdata(t,regi_dyn29,in,"quantity") + ); + ); + ); ***_____________________________ END OF: CALCULATE IPF _____________________________ @@ -772,6 +823,48 @@ $endif.subsectors ***_____________________________ END OF: BEYOND CALIB ________________________________________ +***_____________________________ START OF: COMPUTE ELASTICITIES OF SUBSTITUTION ________________________________________ + +*** Elasticities of substitution are normally prescribed manually. +*** However, they can also be estimated from technological data. This is done here. +*** At the time of documentation, the nodes for which this is done are in the services_with_capital realization of the +*** buildings module. + +*** Compute the rho parameter from the elasticity of substitution +pm_cesdata(ttot,regi,ipf(out),"rho")$( ttot.val ge 2005 + AND pm_cesdata_sigma(ttot,out) + AND pm_cesdata_sigma(ttot,out) ne -1 ) + !! Do not compute it if sigma = 0, because these should be estimated + = 1 - (1 / pm_cesdata_sigma(ttot,out)); + +*** Check whether all sigma = INF correspond to complementary factors +*** while it seems contradictory, the model currently only supports +*** complementary factors which add up to yield their output (therefore the perfect substituability). +*** OUT = IN1 + IN2 + IN3 +... +*** The complementarity is ensured by the production constraints on the relations between IN1, IN2, etc +*** For the estimation of Esubs: set the CES out to 1 if the CES inputs are in the data +loop (cesOut2cesIn(out,in) $ (pm_cesdata_sigma("2015",out) eq -1), + p29_capitalUnitProjections(all_regi,out,index_Nr) $p29_capitalUnitProjections(all_regi,in,index_Nr) = 1; +); +loop ((cesOut2cesIn(out,in), t_29hist_last(t))$((pm_cesdata_sigma(t,out) eq -1) AND ppfKap(in)), + + p29_output_estimation(regi_dyn29(regi),out) = ( pm_cesdata(t,regi,out,"quantity") ) + / ( pm_cesdata(t,regi,in,"quantity") ) + * p29_capitalUnitProjections(regi,in,"0") !! index = 0, is the typical technology + +); +pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1) = + 1 - (1 - pm_cesdata(t,regi,in,"rho")) + / ( 1 + min(max((pm_ttot_val(t) - 2015)/(2050 -2015),0),1) + * p29_esubGrowth + ) +; +pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1 AND pm_cesdata(t,regi,in,"rho") lt 0) = min(pm_cesdata(t,regi,in,"rho"), 1 - 1/0.8); !! If complementary factors, sigma should be below 0.8 +pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1 AND pm_cesdata(t,regi,in,"rho") ge 0) = max(pm_cesdata(t,regi,in,"rho"), 1 - 1/1.2); !! If substitution factors, sigma should be above 1.2 +pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1 ) = max ( v29_rho.lo(regi,in), pm_cesdata(t,regi,in,"rho")); +pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1 ) = min ( v29_rho.up(regi,in), pm_cesdata(t,regi,in,"rho")); + +***_____________________________ END OF: COMPUTE ELASTICITIES OF SUBSTITUTION ________________________________________ ***_____________________________ START OF: PASS EFF TIME EVOLUTION TO EFFGR ________________________________________ *** Finally, we take the evolution of xi and eff, and pass it on to effGr. From a210cfda64e23c685eb9b7bf8e558037e207c31a Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Thu, 18 Jan 2024 11:15:12 +0100 Subject: [PATCH 15/35] documentation --- modules/29_CES_parameters/calibrate/preloop.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 27aa2f8db..c8ec12a0a 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -46,7 +46,7 @@ if (sm_tmp, $endif.old_structure -***_____________________________ START OF: GET PRICES _____________________________ +***_____________________________ START OF: CALCULATE PRICES _____________________________ *** In the first iteration with a changed CES structure, ppf prices can't be loaded from file, so they have to be set to an initial default. if( sm_CES_calibration_iteration eq 1 and s29_CES_calibration_new_structure eq 1, !! Set CES prices to the value specified by cm_CES_calibration_default_prices @@ -350,7 +350,7 @@ display "after all but entrp_frgt_lo smoothening", pm_cesdata; display "after price smoothing", cesOut2cesIn_below, pm_cesdata; -***_____________________________ END OF: GET PRICES _____________________________ +***_____________________________ END OF: CALCULATE PRICES _____________________________ ***_____________________________ START OF: CALCULATE IPF _____________________________ From 67c05c413d122ef98151cda34a14cf88ce0fd526 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Fri, 19 Jan 2024 16:57:12 +0100 Subject: [PATCH 16/35] documentation --- .../29_CES_parameters/calibrate/preloop.gms | 79 ++++--------------- 1 file changed, 15 insertions(+), 64 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index d1731a38d..5c072f854 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -46,7 +46,7 @@ if (sm_tmp, $endif.old_structure -***_____________________________ START OF: CALCULATE PRICES _____________________________ +***_____________________________START OF: 1 - CALCULATE PRICES _____________________________ *** In the first iteration with a changed CES structure, ppf prices are set to an initial default. if( sm_CES_calibration_iteration eq 1 and s29_CES_calibration_new_structure eq 1, !! Set CES prices to the value specified by cm_CES_calibration_default_prices @@ -127,15 +127,15 @@ else pm_cesdata:3:3:1 ; - !! The calibration of elasticities of substitution takes - !! much longer to converge if it starts from a high elasticity of - !! substitution. To avoid this situation, the price of the capital stock - !! is increased - if (sm_CES_calibration_iteration eq 1, - loop (cesOut2cesIn(out,in)$(pm_cesdata_sigma("2015",out) eq -1 AND ppfKap(in) AND in_29(in)), - pm_cesdata(t,regi,in,"price") = pm_cesdata(t,regi,in,"price") *1.3; - ); - ); +*** !! The calibration of elasticities of substitution takes +*** !! much longer to converge if it starts from a high elasticity of +*** !! substitution. To avoid this situation, the price of the capital stock +*** !! is increased +*** if (sm_CES_calibration_iteration eq 1, +*** loop (cesOut2cesIn(out,in)$(pm_cesdata_sigma("2015",out) eq -1 AND ppfKap(in) AND in_29(in)), +*** pm_cesdata(t,regi,in,"price") = pm_cesdata(t,regi,in,"price") *1.3; +*** ); +*** ); display "derivatives", p29_CESderivative, p29_effGr, p29_cesIO_load; @@ -163,7 +163,6 @@ $ifthen.write_prices %c_CES_calibration_write_prices% == "1" $endif.write_prices ) - *** Abort if any ppf prices are <= 0 if (smin((t,regi_dyn29(regi),ppf_29(in)), pm_cesdata(t,regi,in,"price")) le 0, put logfile; @@ -174,7 +173,6 @@ if (smin((t,regi_dyn29(regi),ppf_29(in)), pm_cesdata(t,regi,in,"price")) le 0, abort "Some ppf prices are <= 0. Check ./modules/29_CES_parameters/calibrate/input/pm_cesdata_price_XXX.inc!"; ); - *** Write prices to file if (sm_CES_calibration_iteration eq 1, !! first CES calibration iteration put file_CES_calibration; @@ -350,9 +348,9 @@ display "after all but entrp_frgt_lo smoothening", pm_cesdata; display "after price smoothing", cesOut2cesIn_below, pm_cesdata; -***_____________________________ END OF: CALCULATE PRICES _____________________________ +***_____________________________ END OF: 1 - CALCULATE PRICES _____________________________ -***_____________________________ START OF: CALCULATE IPF _____________________________ +***_____________________________ START OF: 2 - CALCULATE QUANTITIES_____________________________ *** All effGr, are set to one, so that we can focus on efficiencies *** we will split xi and eff evolutions later and pass it on to effGr @@ -360,10 +358,8 @@ pm_cesdata(t,regi_dyn29,in_29,"effGr") = 1; *** First, using the prices and quantities of the ppfEn, the prices of ipf *** we compute thanks to the Euler equation the quantities of the ipf. - *** we compute quantities for everything up to the last CES level inco.(lab,kap,en) - loop ((t,cesRev2cesIO(counter,ipf_29(out)))$( NOT ( sameas(out,"inco")) ), pm_cesdata(t,regi_dyn29,out,"quantity") = sum(cesOut2cesIn(out,in), @@ -410,19 +406,16 @@ putclose logfile; !! If there has been a rescaling for historical steps, repeat previous steps with new prices if ( sm_tmp2 gt 0, !! If there has been a rescaling - loop ((t,cesRev2cesIO(counter,ipf_29(out)))$( NOT ( sameas(out,"inco") - OR in_below_putty(out) - OR ppf_putty(out)) ), - pm_cesdata(t,regi_dyn29,out,"quantity")$( NOT ipf_putty(out) ) + loop ((t,cesRev2cesIO(counter,ipf_29(out)))$( NOT ( sameas(out,"inco"))), + pm_cesdata(t,regi_dyn29,out,"quantity") = sum(cesOut2cesIn(out,in), pm_cesdata(t,regi_dyn29,in,"price") * pm_cesdata(t,regi_dyn29,in,"quantity") ); ); - ); -***_____________________________ END OF: CALCULATE IPF _____________________________ +***_____________________________ END OF: 2 - CALCULATE QUANTITIES_____________________________ ***_____________________________ START OF: CHANGE EFFICIENCIES TO FULFILL ECONOMIC CONSTRAINT _____________________________ @@ -823,48 +816,6 @@ $endif.subsectors ***_____________________________ END OF: BEYOND CALIB ________________________________________ -***_____________________________ START OF: COMPUTE ELASTICITIES OF SUBSTITUTION ________________________________________ - -*** Elasticities of substitution are normally prescribed manually. -*** However, they can also be estimated from technological data. This is done here. -*** At the time of documentation, the nodes for which this is done are in the services_with_capital realization of the -*** buildings module. - -*** Compute the rho parameter from the elasticity of substitution -pm_cesdata(ttot,regi,ipf(out),"rho")$( ttot.val ge 2005 - AND pm_cesdata_sigma(ttot,out) - AND pm_cesdata_sigma(ttot,out) ne -1 ) - !! Do not compute it if sigma = 0, because these should be estimated - = 1 - (1 / pm_cesdata_sigma(ttot,out)); - -*** Check whether all sigma = INF correspond to complementary factors -*** while it seems contradictory, the model currently only supports -*** complementary factors which add up to yield their output (therefore the perfect substituability). -*** OUT = IN1 + IN2 + IN3 +... -*** The complementarity is ensured by the production constraints on the relations between IN1, IN2, etc -*** For the estimation of Esubs: set the CES out to 1 if the CES inputs are in the data -loop (cesOut2cesIn(out,in) $ (pm_cesdata_sigma("2015",out) eq -1), - p29_capitalUnitProjections(all_regi,out,index_Nr) $p29_capitalUnitProjections(all_regi,in,index_Nr) = 1; -); -loop ((cesOut2cesIn(out,in), t_29hist_last(t))$((pm_cesdata_sigma(t,out) eq -1) AND ppfKap(in)), - - p29_output_estimation(regi_dyn29(regi),out) = ( pm_cesdata(t,regi,out,"quantity") ) - / ( pm_cesdata(t,regi,in,"quantity") ) - * p29_capitalUnitProjections(regi,in,"0") !! index = 0, is the typical technology - -); -pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1) = - 1 - (1 - pm_cesdata(t,regi,in,"rho")) - / ( 1 + min(max((pm_ttot_val(t) - 2015)/(2050 -2015),0),1) - * p29_esubGrowth - ) -; -pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1 AND pm_cesdata(t,regi,in,"rho") lt 0) = min(pm_cesdata(t,regi,in,"rho"), 1 - 1/0.8); !! If complementary factors, sigma should be below 0.8 -pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1 AND pm_cesdata(t,regi,in,"rho") ge 0) = max(pm_cesdata(t,regi,in,"rho"), 1 - 1/1.2); !! If substitution factors, sigma should be above 1.2 -pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1 ) = max ( v29_rho.lo(regi,in), pm_cesdata(t,regi,in,"rho")); -pm_cesdata(t,regi_dyn29(regi),in,"rho")$( pm_cesdata_sigma(t,in) eq -1 ) = min ( v29_rho.up(regi,in), pm_cesdata(t,regi,in,"rho")); - -***_____________________________ END OF: COMPUTE ELASTICITIES OF SUBSTITUTION ________________________________________ ***_____________________________ START OF: PASS EFF TIME EVOLUTION TO EFFGR ________________________________________ *** Finally, we take the evolution of xi and eff, and pass it on to effGr. From d29be518a4008076b10f5e21225812504f873609 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Mon, 22 Jan 2024 08:57:36 +0100 Subject: [PATCH 17/35] further cleaning preloop.gms --- .../29_CES_parameters/calibrate/preloop.gms | 31 +++---------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 5c072f854..709c3d5c2 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -57,7 +57,6 @@ $endif.default_prices pm_cesdata(t,regi,all_in,"price") = %cm_CES_calibration_default_prices%; pm_cesdata(t,regi,ipf_29,"price") = 1; - pm_cesdata(t,regi,in_complements(in),"price") = 1; pm_cesdata(t,regi,industry_ue_calibration_target_dyn37(in),"price")$( pm_cesdata(t,regi,in,"price") eq 1 ) @@ -103,19 +102,12 @@ else !! To account for the chain rule multiplication above. !! except on the level above the perfect substitutes if they are ppf_29. !! Here, the level above gets the price, while the perfect substitutes below get 1. - loop ( cesOut2cesIn(in2,in) $ ( - NOT ( ppf_29(in) AND in_complements(in)) - ), + loop ( cesOut2cesIn(in2,in) $ (NOT ppf_29(in)), p29_CESderivative(t,regi_dyn29(regi),out,ipf_29(in2))$( p29_CESderivative(t,regi,out,in2) ) = 1; ); - - !! Prices of perfect substitutes factors are all 1 - p29_CESderivative(t,regi_dyn29(regi),out,ppf_29(in2))$( - p29_CESderivative(t,regi,out,in2) AND in_complements(in2) ) - = 1; - !! Price of inco is 1, too + !! Price of inco is 1 p29_cesdata_load(t,regi_dyn29(regi),"inco","price") = 1; !! unit price !! Transfer prices @@ -238,7 +230,6 @@ if (sm_tmp eq 1, abort "some prices are negative. See log file"; ); - display "before price smoothing", cesOut2cesIn_below, pm_cesdata; *** Smooth 2005 prices pm_cesdata("2005",regi_dyn29(regi),in_29,"price")$( ppf_29(in_29) ) @@ -385,19 +376,11 @@ loop ((t_29hist(t),regi_dyn29(regi)), put t.tl, " ", regi.tl, " labour share in GDP: ", (1 - sm_tmp); - pm_cesdata(t,regi,ppf_29(in),"price") $ ( NOT ( sameAs(in, "lab") - OR in_complements(in)) ) + pm_cesdata(t,regi,ppf_29(in),"price") $ ( NOT sameAs(in, "lab")) = pm_cesdata(t,regi,in,"price") * (0.8$( t_29hist(t) ) + 0.995$( NOT t_29hist(t) )) / sm_tmp; - loop (cesOut2cesIn(in2,in)$( ppf_29(in) AND in_complements(in) ), - pm_cesdata(t,regi,in2,"price") - = pm_cesdata(t,regi,in2,"price") - * (0.8$( t_29hist(t) ) + 0.995$( NOT t_29hist(t) )) - / sm_tmp; - ); - put " -> ", (1 - (0.8$( t_29hist(t) ) + 0.995$( NOT t_29hist(t) ))) /; sm_tmp2 = sm_tmp2 + 1; ); @@ -664,18 +647,12 @@ if (card(ppf_beyondcalib_29) >= 1, !! if there are any nodes in beyond calib !! Prices of intermediate production factors are all 1, except on the level !! above the perfect substitutes if they are ppf_29 - loop (cesOut2cesIn(in2,in)$( - NOT (ppf_beyondcalib_29(in) AND in_complements(in)) ), + loop (cesOut2cesIn(in2,in)$(NOT ppf_beyondcalib_29(in) ), p29_CESderivative(t,regi_dyn29(regi),out,ipf_beyond_29_excludeRoot(in2))$( p29_CESderivative(t,regi,out,in2) ) = 1; ); - !! Prices of perfect substitutes factors are all 1 - p29_CESderivative(t,regi_dyn29(regi),out,ppf_beyondcalib_29(in2))$( - p29_CESderivative(t,regi,out,in2) AND in_complements(in2) ) - = 1; - display "check p29_CESderivative", p29_CESderivative; loop ((regi_dyn29(regi), From d50c44069305e521f930006667ca044d51ac7ae5 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Mon, 22 Jan 2024 09:54:59 +0100 Subject: [PATCH 18/35] further cleaning --- .../29_CES_parameters/calibrate/preloop.gms | 30 ++++++------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 709c3d5c2..ab5442d01 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -400,7 +400,7 @@ if ( sm_tmp2 gt 0, !! If there has been a rescaling ***_____________________________ END OF: 2 - CALCULATE QUANTITIES_____________________________ -***_____________________________ START OF: CHANGE EFFICIENCIES TO FULFILL ECONOMIC CONSTRAINT _____________________________ +***_____________________________ START OF: 3 - CALCULATE EFFICIENCIES _____________________________ *** We ensure that the prices correspond to the derivatives, because *** the Euler equation holds for derivatives. Using prices makes only sense if @@ -418,12 +418,12 @@ loop ((cesRev2cesIO(counter,ipf_29(out)),ces_29(out,in))$( ); display "after change up to en consistency", pm_cesdata; -***_____________________________ END OF: CHANGE EFFICIENCIES TO FULFILL ECONOMIC CONSTRAINT _____________________________ +***_____________________________ END OF: 3 - CALCULATE EFFICIENCIES _____________________________ -***_____________________________ START OF: ENSURE GDP CONSISTENCY VIA LABOUR PRICE _____________________________ +***_____________________________ START OF: 4 - ADJUST LABOUR PRICE to GDP _____________________________ -*** Then, we consider the bottom level of the CES tree, where capital and labor -*** have specific restrictions. Capital works as for the other ppfen, Labour +*** Then, we consider the top level of the CES tree, where capital and labor +*** have specific restrictions. Capital works as for the other ppfen, Labour *** will be the adjustment variable to meet inco. xi will not be equal to the *** income share of capital (from equation price = derivative) pm_cesdata(t,regi_dyn29,"kap","xi") @@ -594,12 +594,12 @@ if (sm_tmp, abort "assertion xi gt 0 failed, see .log file for details"; ); -***_____________________________ END OF: ENSURE GDP CONSISTENCY VIA LABOUR PRICE _____________________________ - display " end consistency", pm_cesdata; *** End of the part ensuring consistency given the ppfEn prices and quantities, the ipf prices, *** the labor quantities, and the capital efficiency growth. +***_____________________________ END OF: 4 - ADJUST LABOUR PRICE to GDP _____________________________ + ***_____________________________ START OF: BEYOND CALIB _________________________________________________ *** Beyond calib allows for calibration of intermediate levels. @@ -793,7 +793,7 @@ $endif.subsectors ***_____________________________ END OF: BEYOND CALIB ________________________________________ -***_____________________________ START OF: PASS EFF TIME EVOLUTION TO EFFGR ________________________________________ +***_____________________________ START OF: 5 - PASS EFF TIME EVOLUTION TO EFFGR ________________________________________ *** Finally, we take the evolution of xi and eff, and pass it on to effGr. *** (a) for items in ces_29 @@ -849,7 +849,7 @@ loop ((t_29hist_last(t2),cesOut2cesIn(out,in))$( ue_fe_kap_29(out) ), / p29_efficiency_growth(t2,regi,in); ); -***_____________________________ END OF: PASS EFF TIME EVOLUTION TO EFFGR ________________________________________ +***_____________________________ END OF: 5 - PASS EFF TIME EVOLUTION TO EFFGR ________________________________________ ***_____________________________ START OF: BEYOND CALIBRATION PART II ________________________________________ @@ -1033,18 +1033,6 @@ $endif.subsectors option p29_efficiency_growth:8; display "after long term efficiencies", pm_cesdata, p29_efficiency_growth; -***_______________________ COMPLEMENTARY CONSTRAINTS _____________________________ -*** Compute the coefficients for the complementarity constraints -*** FIXME: In case in_complements are in beyond, quantity data is needed for -*** the assignment below -loop (complements_ref(in, in2), - pm_cesdata(t,regi_dyn29(regi),in2,"compl_coef") - = pm_cesdata(t,regi,in,"quantity") - / pm_cesdata(t,regi,in2,"quantity"); -); -***_______________________ END COMPLEMENTARY CONSTRAINTS _____________________________ - - *** All efficiences after t_29_last are set to their t_29_last values. This is *** done in order to avoid xi negative in the latest periods. Should not be *** necessary to split pre and post-t_29_last with reasonable FE pathways From d6c3cfd90d995f4d9fa6649743b7731dd3fa741c Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Mon, 22 Jan 2024 10:53:37 +0100 Subject: [PATCH 19/35] documentation --- modules/29_CES_parameters/calibrate/preloop.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index ab5442d01..7b2bf97a1 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -600,7 +600,7 @@ display " end consistency", pm_cesdata; ***_____________________________ END OF: 4 - ADJUST LABOUR PRICE to GDP _____________________________ -***_____________________________ START OF: BEYOND CALIB _________________________________________________ +***_____________________________ START OF: BEYOND CALIBRATION PART I _________________________________________________ *** Beyond calib allows for calibration of intermediate levels. *** At the time of documentation, this was mainly used for the industry module subsectors realization. @@ -791,7 +791,7 @@ $endif.subsectors ); ); -***_____________________________ END OF: BEYOND CALIB ________________________________________ +***_____________________________ END OF: BEYOND CALIBRATION PART I ________________________________________ ***_____________________________ START OF: 5 - PASS EFF TIME EVOLUTION TO EFFGR ________________________________________ From 1b23b78e38b8647ce12d2a71ffa6181f39ec1f80 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Tue, 23 Jan 2024 10:07:36 +0100 Subject: [PATCH 20/35] add missing ; --- modules/29_CES_parameters/calibrate/preloop.gms | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 7b2bf97a1..0fb9f04be 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -357,6 +357,7 @@ loop ((t,cesRev2cesIO(counter,ipf_29(out)))$( NOT ( sameas(out,"inco")) ), pm_cesdata(t,regi_dyn29,in,"price") * pm_cesdata(t,regi_dyn29,in,"quantity") ); +); *** Ensure that the labour share in GDP is at least 20 % for historical periods *** and 0.5 % for others. sm_tmp = 0; From 2bfc3331a49b4253f2608a68e1fe7c3c0cba122f Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Fri, 26 Jan 2024 15:23:02 +0100 Subject: [PATCH 21/35] add calculation of sigma --- modules/29_CES_parameters/calibrate/preloop.gms | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 0fb9f04be..e53292446 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -794,6 +794,21 @@ $endif.subsectors ***_____________________________ END OF: BEYOND CALIBRATION PART I ________________________________________ +***_____________________________ START OF: COMPUTE ELASTICITIES OF SUBSTITUTION ________________________________________ + +*** Elasticities of substitution are normally prescribed manually. +*** However, they can also be estimated from technological data. This is done here. +*** At the time of documentation, the nodes for which this is done are in the services_with_capital realization of the +*** buildings module. + +*** Compute the rho parameter from the elasticity of substitution +pm_cesdata(ttot,regi,ipf(out),"rho")$( ttot.val ge 2005 + AND pm_cesdata_sigma(ttot,out) + AND pm_cesdata_sigma(ttot,out) ne -1 ) + !! Do not compute it if sigma = 0, because these should be estimated + = 1 - (1 / pm_cesdata_sigma(ttot,out)); +***_____________________________ END OF: COMPUTE ELASTICITIES OF SUBSTITUTION ________________________________________ + ***_____________________________ START OF: 5 - PASS EFF TIME EVOLUTION TO EFFGR ________________________________________ *** Finally, we take the evolution of xi and eff, and pass it on to effGr. From 0c66dec90473fa1f50e127399b9aa03953683dbc Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Wed, 31 Jan 2024 10:34:26 +0100 Subject: [PATCH 22/35] further cleaning, delete p29_capitalUnitProjections and f29_capitalUnitProjections --- .../29_CES_parameters/calibrate/datainput.gms | 29 ------------------- .../calibrate/declarations.gms | 3 -- .../29_CES_parameters/calibrate/input/files | 1 - .../29_CES_parameters/calibrate/preloop.gms | 27 ++++++++--------- 4 files changed, 12 insertions(+), 48 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/datainput.gms b/modules/29_CES_parameters/calibrate/datainput.gms index 81823b522..499207f78 100644 --- a/modules/29_CES_parameters/calibrate/datainput.gms +++ b/modules/29_CES_parameters/calibrate/datainput.gms @@ -173,15 +173,6 @@ $offdelim ; p29_efficiency_growth(t,regi,in) = f29_efficiency_growth(t,regi,"%cm_demScen%",in); -Parameter -f29_capitalUnitProjections "Capital cost per unit of consumed energy and final energy per unit of useful energy (or UE per unit of ES) used to calibrate some elasticities of substitution" -/ -$ondelim -$include "./modules/29_CES_parameters/calibrate/input/f29_capitalUnitProjections.cs4r" -$offdelim -/ -; - parameter f29_capitalQuantity(tall,all_regi,all_demScen,all_in) "capital quantities" / @@ -251,27 +242,11 @@ $endif.indst_H2_penetration display pm_fedemand; -*** Attribute technological data to p29_capitalUnitProjections according to putty-clay - p29_capitalUnitProjections(all_regi,all_in,index_Nr) = f29_capitalUnitProjections(all_regi,all_in,index_Nr,"cap") ; -loop (cesOut2cesIn(out,in)$ppfKap(in), -loop (cesOut2cesIn2(out,in2), -p29_capitalUnitProjections(all_regi,all_in,index_Nr)$(p29_capitalUnitProjections(all_regi,all_in,index_Nr) - AND (sameAs(all_in,out) OR sameAs(all_in,in2)) - ) - = p29_capitalUnitProjections(all_regi,all_in,index_Nr)$(p29_capitalUnitProjections(all_regi,in,index_Nr) ge p29_capitalUnitProjections(all_regi,in,"0") - ); -); -); - *** Change PPP for MER. p29_capitalQuantity(tall,all_regi,all_in) = p29_capitalQuantity(tall,all_regi,all_in) * pm_shPPPMER(all_regi); -p29_capitalUnitProjections(all_regi,all_in,index_Nr)$ppfKap(all_in) - = p29_capitalUnitProjections(all_regi,all_in,index_Nr) - * pm_shPPPMER(all_regi); - *** Subtract "special" capital stocks from gross economy capital stock p29_capitalQuantity(tall,all_regi,"kap") = p29_capitalQuantity(tall,all_regi,"kap") @@ -281,10 +256,6 @@ p29_capitalQuantity(tall,all_regi,"kap") *** Substract the end-use capital quantities from the aggregate capital -*** Change $/kWh to Trillion$/TWa; -p29_capitalUnitProjections(all_regi,all_in,index_Nr)$ppfKap(all_in) = p29_capitalUnitProjections(all_regi,all_in,index_Nr) * sm_TWa_2_kWh / sm_trillion_2_non; - - *** Load CES parameters from the last run Execute_Load 'input' p29_cesdata_load = pm_cesdata; $ifthen.testOneRegi "%optimization%" == "testOneRegi" !! optimization diff --git a/modules/29_CES_parameters/calibrate/declarations.gms b/modules/29_CES_parameters/calibrate/declarations.gms index d39c19083..d430266b3 100644 --- a/modules/29_CES_parameters/calibrate/declarations.gms +++ b/modules/29_CES_parameters/calibrate/declarations.gms @@ -28,9 +28,6 @@ $endif.transpmodule p29_test_CES_recursive(tall,all_regi,all_in) "test the technological consistency of pm_cesdata" - f29_capitalUnitProjections(all_regi,all_in,index_Nr,capUnitType) "Capital cost per unit of consumed energy and FE per unit of UE (or UE per unit of ES) used to calibrate some Esubs. kap is in $/kWh; UE and FE in kWh. Data for new investments and for standing capital" - p29_capitalUnitProjections(all_regi,all_in,index_Nr) "Capital cost per unit of consumed energy and final energy per unit of useful energy (or UE per unit of ES) used to calibrate some elasticities of substitution. kap is in $/kWh; UE and FE in kWh" - p29_esubGrowth "long term growth of the elasticity of substitution" p29_t_tmp(tall) "tmp value for calculations over t" diff --git a/modules/29_CES_parameters/calibrate/input/files b/modules/29_CES_parameters/calibrate/input/files index 1e33aca7d..08cac811b 100644 --- a/modules/29_CES_parameters/calibrate/input/files +++ b/modules/29_CES_parameters/calibrate/input/files @@ -1,4 +1,3 @@ -f29_capitalUnitProjections.cs4r f29_capitalQuantity.cs4r f29_efficiency_growth.cs4r f29_esdemand.cs4r diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 392887566..c66e680ec 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -119,15 +119,15 @@ else pm_cesdata:3:3:1 ; -*** !! The calibration of elasticities of substitution takes -*** !! much longer to converge if it starts from a high elasticity of -*** !! substitution. To avoid this situation, the price of the capital stock -*** !! is increased -*** if (sm_CES_calibration_iteration eq 1, -*** loop (cesOut2cesIn(out,in)$(pm_cesdata_sigma("2015",out) eq -1 AND ppfKap(in) AND in_29(in)), -*** pm_cesdata(t,regi,in,"price") = pm_cesdata(t,regi,in,"price") *1.3; -*** ); -*** ); + !! The calibration of elasticities of substitution takes + !! much longer to converge if it starts from a high elasticity of + !! substitution. To avoid this situation, the price of the capital stock + !! is increased + if (sm_CES_calibration_iteration eq 1, + loop (cesOut2cesIn(out,in)$(pm_cesdata_sigma("2015",out) eq -1 AND ppfKap(in) AND in_29(in)), + pm_cesdata(t,regi,in,"price") = pm_cesdata(t,regi,in,"price") *1.3; + ); + ); display "derivatives", p29_CESderivative, p29_effGr, p29_cesIO_load; @@ -391,12 +391,13 @@ putclose logfile; if ( sm_tmp2 gt 0, !! If there has been a rescaling loop ((t,cesRev2cesIO(counter,ipf_29(out)))$( NOT ( sameas(out,"inco"))), + pm_cesdata(t,regi_dyn29,out,"quantity") = sum(cesOut2cesIn(out,in), pm_cesdata(t,regi_dyn29,in,"price") * pm_cesdata(t,regi_dyn29,in,"quantity") ); - ); + ); ); ***_____________________________ END OF: 2 - CALCULATE QUANTITIES_____________________________ @@ -794,12 +795,8 @@ $endif.subsectors ***_____________________________ END OF: BEYOND CALIBRATION PART I ________________________________________ -***_____________________________ START OF: COMPUTE ELASTICITIES OF SUBSTITUTION ________________________________________ +***_____________________________ START OF: 5 - COMPUTE ELASTICITIES OF SUBSTITUTION ________________________________________ -*** Elasticities of substitution are normally prescribed manually. -*** However, they can also be estimated from technological data. This is done here. -*** At the time of documentation, the nodes for which this is done are in the services_with_capital realization of the -*** buildings module. *** Compute the rho parameter from the elasticity of substitution pm_cesdata(ttot,regi,ipf(out),"rho")$( ttot.val ge 2005 From 5fbe92509696960d75ca06d2d9499668aa171735 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Wed, 31 Jan 2024 11:35:49 +0100 Subject: [PATCH 23/35] bugfix --- modules/29_CES_parameters/calibrate/preloop.gms | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index c66e680ec..2c1b621c5 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -1094,10 +1094,6 @@ loop ((out,in,in2,t)$((pm_cesdata_sigma(t,out) eq -1) put sm_CES_calibration_iteration:0:0,"remind" , t.tl,out.tl , "rho", regi.tl, pm_cesdata(t,regi,out,"rho") /; ); - - loop ((index_Nr,in)$p29_capitalUnitProjections(regi, in, index_Nr), - put sm_CES_calibration_iteration:0:0,index_Nr.tl, "2015", in.tl , "quantity", regi.tl, p29_capitalUnitProjections(regi,in,index_Nr) /; - ); ); putclose; From df05abca0e85d24480a33e85599abef625dfa0de Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Thu, 1 Feb 2024 10:41:40 +0100 Subject: [PATCH 24/35] cleaning --- modules/01_macro/singleSectorGr/equations.gms | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/01_macro/singleSectorGr/equations.gms b/modules/01_macro/singleSectorGr/equations.gms index bc193df59..5c1cd1489 100644 --- a/modules/01_macro/singleSectorGr/equations.gms +++ b/modules/01_macro/singleSectorGr/equations.gms @@ -99,13 +99,13 @@ q01_cesIO(t,regi,ipf(out)).. pm_cesdata(t,regi,in,"xi") * exp( log( - pm_cesdata(t,regi,in,"eff") - * vm_effGr(t,regi,in) - * vm_damageProdFactor(t,regi,in) - * vm_cesIO(t,regi,in) - ) - * pm_cesdata(t,regi,out,"rho") - ) + pm_cesdata(t,regi,in,"eff") + * vm_effGr(t,regi,in) + * vm_damageProdFactor(t,regi,in) + * vm_cesIO(t,regi,in) + ) + * pm_cesdata(t,regi,out,"rho") + ) ) ) * (1 / pm_cesdata(t,regi,out,"rho")) From f39531de0962274c3154fb7b5516c703dcf4bda7 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Thu, 1 Feb 2024 15:05:23 +0100 Subject: [PATCH 25/35] fix if-condition --- modules/29_CES_parameters/calibrate/preloop.gms | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 2c1b621c5..be3185cf8 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -100,9 +100,7 @@ else !! Prices of intermediate production factors are all set to 1, !! To account for the chain rule multiplication above. - !! except on the level above the perfect substitutes if they are ppf_29. - !! Here, the level above gets the price, while the perfect substitutes below get 1. - loop ( cesOut2cesIn(in2,in) $ (NOT ppf_29(in)), + loop ( cesOut2cesIn(in2,in), p29_CESderivative(t,regi_dyn29(regi),out,ipf_29(in2))$( p29_CESderivative(t,regi,out,in2) ) = 1; @@ -647,9 +645,8 @@ if (card(ppf_beyondcalib_29) >= 1, !! if there are any nodes in beyond calib ); - !! Prices of intermediate production factors are all 1, except on the level - !! above the perfect substitutes if they are ppf_29 - loop (cesOut2cesIn(in2,in)$(NOT ppf_beyondcalib_29(in) ), + !! Prices of intermediate production factors are all 1 + loop (cesOut2cesIn(in2,in), p29_CESderivative(t,regi_dyn29(regi),out,ipf_beyond_29_excludeRoot(in2))$( p29_CESderivative(t,regi,out,in2) ) = 1; From 16077ec5f525075e7ccdd9c996b25c11623495a2 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Thu, 1 Feb 2024 16:49:55 +0100 Subject: [PATCH 26/35] reactivate writing of diagnostic file --- .../29_CES_parameters/calibrate/preloop.gms | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index be3185cf8..0ba649677 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -349,6 +349,39 @@ pm_cesdata(t,regi_dyn29,in_29,"effGr") = 1; *** we compute thanks to the Euler equation the quantities of the ipf. *** we compute quantities for everything up to the last CES level inco.(lab,kap,en) +!! Write to file +if (sm_CES_calibration_iteration eq 1, !! first CES calibration iteration + put file_CES_calibration; + + loop ((t,regi_dyn29(regi),in)$( ppf_29(in) + OR sameas(in,"inco") + OR ppf_beyondcalib_29(in) + OR sameas(in,"enhb") + OR sameas(in,"enhgab") ), + if ((ppf_29(in) OR sameas(in,"inco")), + put "%c_expname%", "target", t.tl, regi.tl, "quantity", in.tl; + put pm_cesdata(t,regi,in,"quantity") /; + ); + ); + + loop ((t_29hist(t),regi_dyn29(regi),ppf_beyondcalib_29(in)), + put "%c_expname%", "target", t.tl, regi.tl, "quantity", in.tl; + put pm_cesdata(t,regi,in,"quantity") /; + ); + +$ifthen.subsectors "%industry%" == "subsectors" +$ifthen.industry_FE_target "%c_CES_calibration_industry_FE_target%" == "1" + loop((t_29scen(t),regi_dyn29(regi),in)$( ppfen_industry_dyn37(in) + OR ppfKap_industry_dyn37(in) ), + put "%c_expname%", "target", t.tl, regi.tl, "quantity", in.tl; + put pm_cesdata(t,regi,in,"quantity") /; + ); +$endif.industry_FE_target +$endif.subsectors + + putclose file_CES_calibration; +); + loop ((t,cesRev2cesIO(counter,ipf_29(out)))$( NOT ( sameas(out,"inco")) ), pm_cesdata(t,regi_dyn29,out,"quantity") = sum(cesOut2cesIn(out,in), From f5e646c9929deeae49c9307513e04f09935b5289 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Fri, 2 Feb 2024 08:27:56 +0100 Subject: [PATCH 27/35] adjust CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eca8fb655..59607715e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **45_carbonprice** remove outdated realizations: NDC2constant, NPi2018, diffPhaseIn2Constant, diffPhaseIn2Lin, diffPhaseInLin2LinFlex, diffPriceSameCost [[#1480](https://github.com/remindmodel/remind/pull/1480)] +- **36_buildings** remove outdated realizations: services_putty, services_with_capital + [[#1509] (https://github.com/remindmodel/remind/pull/1509)] ## [3.2.1] - 2023-07-13 (incomplete) From a53c366c52a28d305181571a111fc388e82d9774 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Mon, 5 Feb 2024 10:59:44 +0100 Subject: [PATCH 28/35] cleaning --- modules/29_CES_parameters/calibrate/datainput.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/datainput.gms b/modules/29_CES_parameters/calibrate/datainput.gms index 499207f78..35a814c81 100644 --- a/modules/29_CES_parameters/calibrate/datainput.gms +++ b/modules/29_CES_parameters/calibrate/datainput.gms @@ -344,7 +344,7 @@ $ifthen.indst_H2_offset "%industry%" == "fixed_shares" *** Assuming feh2i minimun levels as 1% of fegai to avoid CES numerical calibration issues and allow more aligned efficiencies between gas and h2 loop ((t,regi)$(pm_cesdata(t,regi,"feh2i","quantity") lt (0.01 * pm_cesdata(t,regi,"fegai","quantity"))), - pm_cesdata(t,regi,"feh2i","offset_quantity") = - (0.01 * pm_cesdata(t,regi,"fegai","quantity") - pm_cesdata(t,regi,"feh2i","quantity")); + pm_cesdata(t,regi,"feh2i","offset_quantity") = - (0.01 * pm_cesdata(t,regi,"fegai","quantity") - pm_cesdata(t,regi,"feh2i","quantity")); pm_cesdata(t,regi,"feh2i","quantity") = 0.01 * pm_cesdata(t,regi,"fegai","quantity"); ); @@ -369,7 +369,7 @@ loop ((t,regi), = - (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") + 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"); ); From 0767f93c48809c1fa4539b2debd631bb91930e63 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Mon, 5 Feb 2024 13:57:27 +0100 Subject: [PATCH 29/35] delete q01_prodCompl which was only needed for complements --- core/sets_calculations.gms | 12 ------------ modules/01_macro/singleSectorGr/declarations.gms | 1 - modules/01_macro/singleSectorGr/equations.gms | 12 ------------ modules/01_macro/singleSectorGr/sets.gms | 2 -- modules/29_CES_parameters/calibrate/realization.gms | 12 ------------ 5 files changed, 39 deletions(-) diff --git a/core/sets_calculations.gms b/core/sets_calculations.gms index 1528aab86..65d23b534 100644 --- a/core/sets_calculations.gms +++ b/core/sets_calculations.gms @@ -112,18 +112,6 @@ loop ((cesRev2cesIO(counter,in),cesOut2cesIn(in,in2)), *** Aliasing of mappings is not available in all GAMS versions cesOut2cesIn2(out,in) = cesOut2cesIn(out,in); -*** Computing the reference complentary factors -$offOrder -sm_tmp = 0; -loop (cesOut2cesIn(out,in) $ in_complements(in), - if ( NOT ord(out) eq sm_tmp, - sm_tmp = ord(out); - loop (cesOut2cesIn2(out,in2), - complements_ref(in,in2) = YES; - ); - ); - ); - $onOrder *** TODO this should be reworked with Robert when revising the transport module loop(ue2ppfen(enty,ppfEn), diff --git a/modules/01_macro/singleSectorGr/declarations.gms b/modules/01_macro/singleSectorGr/declarations.gms index f2a67d9d9..19abfa479 100644 --- a/modules/01_macro/singleSectorGr/declarations.gms +++ b/modules/01_macro/singleSectorGr/declarations.gms @@ -43,7 +43,6 @@ equations qm_budget(ttot,all_regi) "Budget balance" q01_balLab(ttot,all_regi) "Labour balance" q01_cesIO(ttot,all_regi,all_in) "Production function" -q01_prodCompl(ttot,all_regi,all_in,all_in) "Constraints for perfect complements in the CES tree" q01_kapMo(ttot,all_regi,all_in) "Capital motion equation" q01_kapMo0(t0,all_regi,all_in) "Initial condition for capital" q01_invMacroAdj(ttot,all_regi,all_in) "Adjustment costs for macro economic investments" diff --git a/modules/01_macro/singleSectorGr/equations.gms b/modules/01_macro/singleSectorGr/equations.gms index 5c1cd1489..9712992d2 100644 --- a/modules/01_macro/singleSectorGr/equations.gms +++ b/modules/01_macro/singleSectorGr/equations.gms @@ -112,18 +112,6 @@ q01_cesIO(t,regi,ipf(out)).. ) ; -***--------------------------------------------------------------------------- -*' Constraints for perfect complements in the CES tree -***--------------------------------------------------------------------------- -q01_prodCompl(t,regi,in,in2) $ (complements_ref(in,in2) ) .. - vm_cesIO(t,regi,in) - =e= - pm_cesdata(t,regi,in2,"compl_coef") - * vm_cesIO(t,regi,in2) -; - - - ***--------------------------------------------------------------------------- *' The capital stock is calculated recursively. Its amount in the previous time *' step is devaluated by an annual depreciation factor and enlarged by investments. diff --git a/modules/01_macro/singleSectorGr/sets.gms b/modules/01_macro/singleSectorGr/sets.gms index fb62b32f6..f61927d52 100644 --- a/modules/01_macro/singleSectorGr/sets.gms +++ b/modules/01_macro/singleSectorGr/sets.gms @@ -31,8 +31,6 @@ ppfKap(all_in) "Primary production factors capital" / k ppfEn(all_in) "Primary production factors energy" in_enerSerAdj(all_in) "Energy services factors which should be constrained by adjustment costs" // -in_complements(all_in) "Factors which are perfect complements" // -complements_ref(all_in,all_in) "Correspondence between complementary factors. Necessary to have a reference factor for the constraints equations" ; alias(cesOut2cesIn,cesOut2cesIn2,cesOut2cesIn3); diff --git a/modules/29_CES_parameters/calibrate/realization.gms b/modules/29_CES_parameters/calibrate/realization.gms index c5dbded67..dfe63ccd3 100644 --- a/modules/29_CES_parameters/calibrate/realization.gms +++ b/modules/29_CES_parameters/calibrate/realization.gms @@ -241,18 +241,6 @@ *' approach is taken: All ppfen (not ppfkap) input prices are mutliplied with the same factor (the ratio of prescribed *' to computed UE quantity, minus the ppfkap share), such that the quantity trajectories are met for UE. *' -*' ##### Perfectly complementary factors -*' -*' To implement perfectly complementary factors, you should include the factors in the set `in_complements`. In addition, -*' the elasticity of substitution between these factors should be set to `INF` (which is counter-intuitive). Prices of -*' complementary inputs are set to 1, so that the output is equal to the sum of inputs (reason why the substitution -*' elasticity should be INF), which makes sense for energetic entities. It would however be possible to change this -*' (by choosing another elasticity of substitution) without harming the calibration. -*' -*' In the model, the complementary factors are subject to a constraint (`q01_prodCompl`), so that -*' each variable is computed by multiplying a key variable of the CES function by a given factor. The calibration computes -*' this factor for each period. -*' *####################### R SECTION START (PHASES) ############################## From 58d295dfd5cb517e22a2b04830f2420380657d13 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Mon, 5 Feb 2024 14:39:50 +0100 Subject: [PATCH 30/35] cleaning preloop.gms --- .../29_CES_parameters/calibrate/preloop.gms | 98 +++++++++---------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 0ba649677..76fb6dba5 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -335,7 +335,7 @@ loop (ttot$( ttot.val ge 2005), display "after all but entrp_frgt_lo smoothening", pm_cesdata; -display "after price smoothing", cesOut2cesIn_below, pm_cesdata; +display "after price smoothing", cesOut2cesIn_below; ***_____________________________ END OF: 1 - CALCULATE PRICES _____________________________ @@ -484,14 +484,14 @@ if (smax((t,regi_dyn29(regi)), "value exceeds inco <<<" /; loop ((t,regi_dyn29(regi)), sm_tmp !! by how much does en + kap exceed inco? - = ( ( pm_cesdata(t,regi,"en","quantity") - * pm_cesdata(t,regi,"en","price") - ) - + ( pm_cesdata(t,regi,"kap","quantity") - * pm_cesdata(t,regi,"kap","price") - ) + = ( ( pm_cesdata(t,regi,"en","quantity") + * pm_cesdata(t,regi,"en","price") + ) + + ( pm_cesdata(t,regi,"kap","quantity") + * pm_cesdata(t,regi,"kap","price") + ) ) - / pm_cesdata(t,regi,"inco","quantity"); + / pm_cesdata(t,regi,"inco","quantity"); if (sm_tmp > 1, put " ", t.tl, " ", regi.tl, " ", @@ -505,14 +505,14 @@ if (smax((t,regi_dyn29(regi)), = ( pm_cesdata(t,regi,"inco","quantity") - ( pm_cesdata(t,regi,"lab","quantity") * pm_cesdata(t,regi,"lab","price") - ) + ) ) / ( ( pm_cesdata(t,regi,"en","quantity") * pm_cesdata(t,regi,"en","price") - ) + ) + ( pm_cesdata(t,regi,"kap","quantity") * pm_cesdata(t,regi,"kap","price") - ) + ) ); pm_cesdata(t,regi,"en","price") @@ -540,28 +540,28 @@ loop (cesOut2cesIn("inco",in)$( NOT sameas(in,"lab") ), put logfile, ">>> Warning: Rescaling ", in.tl, " prices as its value ", "exceedes inco <<<" /; loop ((t,regi_dyn29(regi)), - sm_tmp - = pm_cesdata(t,regi,in,"quantity") - * pm_cesdata(t,regi,in,"price") - / pm_cesdata(t,regi,"inco","quantity"); - - if (sm_tmp gt 1, - put " ", t.tl, " ", regi.tl, in.tl:>4, " ", - pm_cesdata(t,regi,in,"quantity"), " x ", - pm_cesdata(t,regi,in,"price"), " > ", - pm_cesdata(t,regi,"inco","quantity"), " -> "; - - pm_cesdata(t,regi,in,"price") - = ( pm_cesdata(t,regi,"inco","quantity") - - sum(cesOut2cesIn2("inco",in2)$( NOT sameas(in,in2) ), - pm_cesdata(t,regi,in2,"quantity") - * pm_cesdata(t,regi,in2,"price") - ) - ) - / pm_cesdata(t,regi,in,"quantity"); + sm_tmp + = pm_cesdata(t,regi,in,"quantity") + * pm_cesdata(t,regi,in,"price") + / pm_cesdata(t,regi,"inco","quantity"); + + if (sm_tmp gt 1, + put " ", t.tl, " ", regi.tl, in.tl:>4, " ", + pm_cesdata(t,regi,in,"quantity"), " x ", + pm_cesdata(t,regi,in,"price"), " > ", + pm_cesdata(t,regi,"inco","quantity"), " -> "; + + pm_cesdata(t,regi,in,"price") + = ( pm_cesdata(t,regi,"inco","quantity") + - sum(cesOut2cesIn2("inco",in2)$( NOT sameas(in,in2) ), + pm_cesdata(t,regi,in2,"quantity") + * pm_cesdata(t,regi,in2,"price") + ) + ) + / pm_cesdata(t,regi,in,"quantity"); - put pm_cesdata(t,regi,in,"price") /; - ); + put pm_cesdata(t,regi,in,"price") /; + ); ); putclose logfile, " " /; ); @@ -662,13 +662,13 @@ if (card(ppf_beyondcalib_29) >= 1, !! if there are any nodes in beyond calib ** (1 - p29_cesdata_load(t,regi,out,"rho")) * exp( - log( - p29_cesdata_load(t,regi,in,"eff") - * p29_effGr(t,regi,in) - * ( p29_cesIO_load(t,regi,in) - ) - ) - * (p29_cesdata_load(t,regi,out,"rho") - 1)); + log( + p29_cesdata_load(t,regi,in,"eff") + * p29_effGr(t,regi,in) + * p29_cesIO_load(t,regi,in) + ) + * (p29_cesdata_load(t,regi,out,"rho") - 1) + ); !! Propagate price down the CES tree loop ((cesLevel2cesIO(counter,in),cesOut2cesIn(in,in2),cesOut2cesIn2(in2,in3)), @@ -906,11 +906,11 @@ $ifthen.industry_FE_target "%c_CES_calibration_industry_FE_target%" == "1" *** Abort if any industry EEK value is lower than subsector output quantity sm_tmp = smin((t,regi_dyn29(regi), cesOut2cesIn(ue_industry_dyn37(out),ppfKap(in))), - pm_cesdata(t,regi,out,"quantity") - - ( pm_cesdata(t,regi,in,"quantity") - * pm_cesdata(t,regi,in,"price") - ) - ); + pm_cesdata(t,regi,out,"quantity") + - ( pm_cesdata(t,regi,in,"quantity") + * pm_cesdata(t,regi,in,"price") + ) + ); if (0 gt sm_tmp, put logfile, "Error in industry FE price rescaling: ", "EEK value exceeds subsector output quantity" /; @@ -919,8 +919,8 @@ if (0 gt sm_tmp, cesOut2cesIn(ue_industry_dyn37(out),ppfKap(in))), sm_tmp = pm_cesdata(t,regi,out,"quantity") - ( pm_cesdata(t,regi,in,"quantity") - * pm_cesdata(t,regi,in,"price") - ); + * pm_cesdata(t,regi,in,"price") + ); if (0 gt sm_tmp, put t.tl, ".", regi.tl, " ", out.tl:>20, pm_cesdata(t,regi,out,"quantity"):>10:4, " < ", @@ -1106,9 +1106,9 @@ loop ((out,in,in2,t)$((pm_cesdata_sigma(t,out) eq -1) AND ( ppfKap(in) AND ( NOT ppfKap(in2))) AND (sameAs(t, "2015") OR sameAs(t, "2050") OR sameAs(t, "2100"))) , - put sm_CES_calibration_iteration:0:0, "remind" , t.tl, out.tl , "quantity", regi.tl, ( pm_cesdata(t,regi,out,"quantity") ) /; - put sm_CES_calibration_iteration:0:0, "remind" , t.tl, in.tl , "quantity", regi.tl, ( pm_cesdata(t,regi,in,"quantity") ) /; - put sm_CES_calibration_iteration:0:0, "remind" , t.tl, in2.tl , "quantity", regi.tl, ( pm_cesdata(t,regi,in2,"quantity") ) /; + put sm_CES_calibration_iteration:0:0, "remind" , t.tl, out.tl , "quantity", regi.tl, pm_cesdata(t,regi,out,"quantity") /; + put sm_CES_calibration_iteration:0:0, "remind" , t.tl, in.tl , "quantity", regi.tl, pm_cesdata(t,regi,in,"quantity") /; + put sm_CES_calibration_iteration:0:0, "remind" , t.tl, in2.tl , "quantity", regi.tl, pm_cesdata(t,regi,in2,"quantity") /; put sm_CES_calibration_iteration:0:0,"remind" , t.tl, in.tl , "eff", regi.tl, pm_cesdata(t,regi,in,"eff") /; put sm_CES_calibration_iteration:0:0,"remind" , t.tl, in2.tl , "eff", regi.tl, pm_cesdata(t,regi,in2,"eff") /; From b4f7de0f5df83dfc50b1ce742a40678fecba5c05 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Mon, 5 Feb 2024 15:16:06 +0100 Subject: [PATCH 31/35] cleaning --- modules/29_CES_parameters/calibrate/preloop.gms | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 76fb6dba5..821854462 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -711,10 +711,8 @@ $endif.subsectors ); else - !! complements are not treated in the first iteration pm_cesdata(t,regi,ipf_beyond_29(in),"price")$( NOT ue_industry_dyn37(in) ) = 1; - ); !! The calibration of elasticities of substitution takes much longer to @@ -906,9 +904,9 @@ $ifthen.industry_FE_target "%c_CES_calibration_industry_FE_target%" == "1" *** Abort if any industry EEK value is lower than subsector output quantity sm_tmp = smin((t,regi_dyn29(regi), cesOut2cesIn(ue_industry_dyn37(out),ppfKap(in))), - pm_cesdata(t,regi,out,"quantity") - - ( pm_cesdata(t,regi,in,"quantity") - * pm_cesdata(t,regi,in,"price") + pm_cesdata(t,regi,out,"quantity") + - ( pm_cesdata(t,regi,in,"quantity") + * pm_cesdata(t,regi,in,"price") ) ); if (0 gt sm_tmp, From c4b4c324706a71976146a5319a8740db3357fce2 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Tue, 6 Feb 2024 09:31:34 +0100 Subject: [PATCH 32/35] cleaning --- .../29_CES_parameters/calibrate/preloop.gms | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 821854462..fa4d2ac3b 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -775,11 +775,10 @@ $endif.subsectors put " " /; loop (cesOut2cesIn(out,in), - put pm_cesdata.tn(t,regi,in,"quantity"), " = "; - put pm_cesdata(t,regi,in,"quantity") /; - - put pm_cesdata.tn(t,regi,in,"price"), " = "; - put pm_cesdata(t,regi,in,"price") /; + put pm_cesdata.tn(t,regi,in,"quantity"), " = "; + put pm_cesdata(t,regi,in,"quantity") /; + put pm_cesdata.tn(t,regi,in,"price"), " = "; + put pm_cesdata(t,regi,in,"price") /; ); execute_unload "abort.gdx"; @@ -903,11 +902,12 @@ $ifthen.industry_FE_target "%c_CES_calibration_industry_FE_target%" == "1" *** Abort if any industry EEK value is lower than subsector output quantity sm_tmp = smin((t,regi_dyn29(regi), - cesOut2cesIn(ue_industry_dyn37(out),ppfKap(in))), - pm_cesdata(t,regi,out,"quantity") - - ( pm_cesdata(t,regi,in,"quantity") - * pm_cesdata(t,regi,in,"price") - ) + cesOut2cesIn(ue_industry_dyn37(out),ppfKap(in)) + ), + pm_cesdata(t,regi,out,"quantity") + - ( pm_cesdata(t,regi,in,"quantity") + * pm_cesdata(t,regi,in,"price") + ) ); if (0 gt sm_tmp, put logfile, "Error in industry FE price rescaling: ", From ee35aaba41d4de94f2d3c2589dc3a71ed4ccbe39 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Tue, 6 Feb 2024 11:00:35 +0100 Subject: [PATCH 33/35] cleaning --- .../29_CES_parameters/calibrate/preloop.gms | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index fa4d2ac3b..ea6d87600 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -78,11 +78,11 @@ else * exp( log( - p29_cesdata_load(t,regi,in,"eff") - * p29_effGr(t,regi,in) - * p29_cesIO_load(t,regi,in) - ) - * (p29_cesdata_load(t,regi,out,"rho") - 1) + p29_cesdata_load(t,regi,in,"eff") + * p29_effGr(t,regi,in) + * p29_cesIO_load(t,regi,in) + ) + * (p29_cesdata_load(t,regi,out,"rho") - 1) ); !! Propagate price down the CES tree to get prices in terms of inco, @@ -904,10 +904,10 @@ $ifthen.industry_FE_target "%c_CES_calibration_industry_FE_target%" == "1" sm_tmp = smin((t,regi_dyn29(regi), cesOut2cesIn(ue_industry_dyn37(out),ppfKap(in)) ), - pm_cesdata(t,regi,out,"quantity") - - ( pm_cesdata(t,regi,in,"quantity") - * pm_cesdata(t,regi,in,"price") - ) + pm_cesdata(t,regi,out,"quantity") + - ( pm_cesdata(t,regi,in,"quantity") + * pm_cesdata(t,regi,in,"price") + ) ); if (0 gt sm_tmp, put logfile, "Error in industry FE price rescaling: ", From 1303f9327296a024e2af1a302edd9a44c38e3e88 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Tue, 6 Feb 2024 11:17:12 +0100 Subject: [PATCH 34/35] cleaning --- modules/29_CES_parameters/calibrate/preloop.gms | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index ea6d87600..916fa6b94 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -71,9 +71,8 @@ else = p29_cesdata_load(t,regi,in,"xi") * p29_cesdata_load(t,regi,in,"eff") * p29_effGr(t,regi,in) + * p29_cesIO_load(t,regi,out) - * ( p29_cesIO_load(t,regi,out) - ) ** (1 - p29_cesdata_load(t,regi,out,"rho")) * exp( @@ -656,9 +655,8 @@ if (card(ppf_beyondcalib_29) >= 1, !! if there are any nodes in beyond calib = p29_cesdata_load(t,regi,in,"xi") * p29_cesdata_load(t,regi,in,"eff") * p29_effGr(t,regi,in) + * p29_cesIO_load(t,regi,out) - * ( p29_cesIO_load(t,regi,out) - ) ** (1 - p29_cesdata_load(t,regi,out,"rho")) * exp( From 2529ef9f86d38c2d626feaaef1f6c46b6fd1417d Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Tue, 6 Feb 2024 11:55:45 +0100 Subject: [PATCH 35/35] cleaning --- modules/29_CES_parameters/calibrate/preloop.gms | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index 916fa6b94..98aa3fb41 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -553,10 +553,10 @@ loop (cesOut2cesIn("inco",in)$( NOT sameas(in,"lab") ), pm_cesdata(t,regi,in,"price") = ( pm_cesdata(t,regi,"inco","quantity") - sum(cesOut2cesIn2("inco",in2)$( NOT sameas(in,in2) ), - pm_cesdata(t,regi,in2,"quantity") - * pm_cesdata(t,regi,in2,"price") + pm_cesdata(t,regi,in2,"quantity") + * pm_cesdata(t,regi,in2,"price") ) - ) + ) / pm_cesdata(t,regi,in,"quantity"); put pm_cesdata(t,regi,in,"price") /;