diff --git a/main.gms b/main.gms index 365b8bd76..e7051c75d 100755 --- a/main.gms +++ b/main.gms @@ -1309,6 +1309,8 @@ $setglobal c_CES_calibration_new_structure 0 !! def = 0 !! regexp = 0|1 $setglobal c_CES_calibration_write_prices 0 !! def = 0 !! regexp = 0|1 *** cm_CES_calibration_default_prices <- 0.01 # def <- 0.01 lower value if input factors get negative shares (xi), CES prices in the first calibration iteration $setglobal cm_CES_calibration_default_prices 0.01 !! def = 0.01 +*** c29_in_limit_price_change sets production factors that have their price changes limited to a factor of two during calibration" +$setglobal c29_in_limit_price_change "ue_steel_primary, kap_steel_primary" !! def = "" *** cm_calibration_string "def = off, else = additional string to include in the calibration name to be used" label for your calibration run to keep calibration files with different setups apart (e.g. with low elasticities, high elasticities) $setglobal cm_calibration_string off !! def = off *** cm_techcosts - use regionalized or globally homogenous technology costs for certain technologies diff --git a/modules/29_CES_parameters/calibrate/preloop.gms b/modules/29_CES_parameters/calibrate/preloop.gms index dcff9634b..f69e0b30d 100644 --- a/modules/29_CES_parameters/calibrate/preloop.gms +++ b/modules/29_CES_parameters/calibrate/preloop.gms @@ -162,6 +162,37 @@ 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!"; ); +*** Limit changes in prices for susceptible pf +if (sum((t,regi_dyn29(regi),in_limit_price_change_29(ppf_29(in))), + (pm_cesdata(t,regi,in,"price") > 2 * p29_cesdata_load(t,regi,in,"price")) + + (pm_cesdata(t,regi,in,"price") < 0.5 * p29_cesdata_load(t,regi,in,"price")) + ), + put logfile, " " / "limiting pf price changes" /; + loop ((t,regi_dyn29(regi),in_limit_price_change_29(ppf_29(in))), + sm_tmp + = pm_cesdata(t,regi,in,"price") + / p29_cesdata_load(t,regi,in,"price"); + + if (sm_tmp < 0.5 OR 2 < sm_tmp, + put pm_cesdata.tn(t,regi,in,"price"), " [", + p29_cesdata_load(t,regi,in,"price"), " -> ", + pm_cesdata(t,regi,in,"price"), "] -> "; + + pm_cesdata(t,regi,in,"price") + = min( + max( + pm_cesdata(t,regi,in,"price"), + 0.5 * p29_cesdata_load(t,regi,in,"price") + ), + 2 * p29_cesdata_load(t,regi,in,"price") + ); + + put pm_cesdata(t,regi,in,"price") /; + ); + ); + putclose logfile, " " /; +); + *** Write prices to file if (sm_CES_calibration_iteration eq 1, !! first CES calibration iteration put file_CES_calibration; @@ -890,7 +921,38 @@ $ifthen.industry_FE_target "%c_CES_calibration_industry_FE_target%" == "1" *** c_CES_calibration_industry_FE_target == 1 means that *** industry ppfen input prices are scaled to make the Euler identity hold -*** Abort if any industry EEK value is lower than subsector output quantity +*** Limit changes in prices for industry EEK +if (sum((t,regi_dyn29(regi),in_limit_price_change_29(ppfKap_industry_dyn37(in))), + (pm_cesdata(t,regi,in,"price") > 2 * p29_cesdata_load(t,regi,in,"price")) + + (pm_cesdata(t,regi,in,"price") < 0.5 * p29_cesdata_load(t,regi,in,"price")) + ), + put logfile, " " / "limiting pf price changes" /; + loop ((t,regi_dyn29(regi),in_limit_price_change_29(ppfKap_industry_dyn37(in))), + sm_tmp + = pm_cesdata(t,regi,in,"price") + / p29_cesdata_load(t,regi,in,"price"); + + if (sm_tmp < 0.5 OR 2 < sm_tmp, + put pm_cesdata.tn(t,regi,in,"price"), " [", + p29_cesdata_load(t,regi,in,"price"), " -> ", + pm_cesdata(t,regi,in,"price"), "] -> "; + + pm_cesdata(t,regi,in,"price") + = min( + max( + pm_cesdata(t,regi,in,"price"), + 0.5 * p29_cesdata_load(t,regi,in,"price") + ), + 2 * p29_cesdata_load(t,regi,in,"price") + ); + + put pm_cesdata(t,regi,in,"price") /; + ); + ); + putclose logfile, " " /; +); + +*** Abort if any industry EEK value is higher than subsector output quantity sm_tmp = smin((t,regi_dyn29(regi), cesOut2cesIn(ue_industry_dyn37(out),ppfKap(in)) ), diff --git a/modules/29_CES_parameters/calibrate/sets.gms b/modules/29_CES_parameters/calibrate/sets.gms index 0c489230e..cceb98ef7 100644 --- a/modules/29_CES_parameters/calibrate/sets.gms +++ b/modules/29_CES_parameters/calibrate/sets.gms @@ -89,6 +89,11 @@ eff_scale_par "parameters for scaling certain efficiencies during calibration" CES_tp(all_in) "CES tree traversal pending nodes" CES_ts(all_in) "CES tree traversal swap node" / / + + in_limit_price_change_29(all_in) "production factors that have their price changes limited to a factor of two during calibration" + / + %c29_in_limit_price_change% + / ; alias(cesOut2cesIn_below,cesOut2cesIn_below2);