Skip to content

Commit

Permalink
Merge pull request #1909 from laurinks/45-postsolve
Browse files Browse the repository at this point in the history
Cleaning and harmonization of postsolve algorithm for end-of-century budgets
  • Loading branch information
laurinks authored Dec 5, 2024
2 parents cc3b118 + cf49386 commit 6591756
Show file tree
Hide file tree
Showing 17 changed files with 265 additions and 316 deletions.
4 changes: 2 additions & 2 deletions main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ $setglobal emicapregi none !! def = none
*' * (NPi): National Policies Implemented, extrapolation of historical (until 2020) carbon prices
*' * (none): no tax policy (combined with all emiscens except emiscen = 9)

*** (exponential) is superseded by (functionalForm): For a globally uniform, exponentially increasing carbonprice path until end of century [in combination with cm_iterative_target_adj = 0 or 5], set cm_taxCO2_functionalForm = exponential, cm_taxCO2_regiDiff = none, cm_taxCO2_interpolation = off, cm_taxCO2_lowerBound_path_gdx_ref = off, cm_peakBudgYr = 2110, and choose the initial carbonprice in cm_startyear via cm_taxCO2_startyear.
*** (linear) is superseded by (functionalForm): For a globally uniform, linearly increasing carbonprice path until end of century [in combination with cm_iterative_target_adj = 0 or 5], set cm_taxCO2_functionalForm = linear, cm_taxCO2_regiDiff = none, cm_taxCO2_interpolation = off, cm_taxCO2_lowerBound_path_gdx_ref = off, cm_peakBudgYr = 2110, and choose the initial carbonprice in cm_startyear via cm_taxCO2_startyear. [Adjust historical reference point (cm_taxCO2_historicalYr, cm_taxCO2_historical) if needed.]
*** (exponential) is superseded by (functionalForm): For a globally uniform, exponentially increasing carbonprice path until end of century [in combination with cm_iterative_target_adj = 0 or 5], set cm_taxCO2_functionalForm = exponential, cm_taxCO2_regiDiff = none, cm_taxCO2_interpolation = off, cm_taxCO2_lowerBound_path_gdx_ref = off, cm_peakBudgYr = 2100, and choose the initial carbonprice in cm_startyear via cm_taxCO2_startyear.
*** (linear) is superseded by (functionalForm): For a globally uniform, linearly increasing carbonprice path until end of century [in combination with cm_iterative_target_adj = 0 or 5], set cm_taxCO2_functionalForm = linear, cm_taxCO2_regiDiff = none, cm_taxCO2_interpolation = off, cm_taxCO2_lowerBound_path_gdx_ref = off, cm_peakBudgYr = 2100, and choose the initial carbonprice in cm_startyear via cm_taxCO2_startyear. [Adjust historical reference point (cm_taxCO2_historicalYr, cm_taxCO2_historical) if needed.]

$setglobal carbonprice none !! def = none
*'--------------------- 46_carbonpriceRegi ---------------------------------
Expand Down
2 changes: 1 addition & 1 deletion modules/45_carbonprice/NDC/not_used.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pm_gdp,input,questionnaire
cm_peakBudgYr,input,added by codeCheck
fm_taxCO2eqHist,input,not needed
sm_budgetCO2eqGlob,input,no iterative target adjustment
sm_globalBudget_dev,input,no iterative target adjustment
vm_emiTe,input,no iterative target adjustment
vm_emiCdr,input,no iterative target adjustment
vm_emiMac,input,no iterative target adjustment
Expand All @@ -35,3 +34,4 @@ cm_taxCO2_IncAfterPeakBudgYr,input,added by codeCheck
cm_budgetCO2from2020,input,no iterative target adjustment
pm_taxCO2eq_anchor_iterationdiff,input,no iterative target adjustment
pm_taxCO2eq_anchor_iterationdiff_tmp,input,no iterative target adjustment
sm_globalBudget_dev,input,no target adjustement
2 changes: 1 addition & 1 deletion modules/45_carbonprice/NPi/not_used.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ cm_startyear,input,added by codeCheck
cm_peakBudgYr,input,added by codeCheck
fm_taxCO2eqHist,input,not needed
sm_budgetCO2eqGlob,input,no iterative target adjustment
sm_globalBudget_dev,input,no iterative target adjustment
vm_emiTe,input,no iterative target adjustment
vm_emiCdr,input,no iterative target adjustment
vm_emiMac,input,no iterative target adjustment
Expand All @@ -43,3 +42,4 @@ cm_taxCO2_IncAfterPeakBudgYr,input,added by codeCheck
cm_budgetCO2from2020,input,no iterative target adjustment
pm_taxCO2eq_anchor_iterationdiff,input,no iterative target adjustment
pm_taxCO2eq_anchor_iterationdiff_tmp,input,no iterative target adjustment
sm_globalBudget_dev,input,no target adjustement
2 changes: 1 addition & 1 deletion modules/45_carbonprice/NPi2025/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ loop(ext_regi$sameas(ext_regi, "EUR_regi"),
pm_taxCO2eq(t,regi)$(t.val ge 2030 AND regi_group(ext_regi,regi)) = (fm_taxCO2eqHist("2030",regi)+ (t.val - 2030) * (20/75)) * sm_DptCO2_2_TDpGtC;
);

pm_taxCO2eq(t,regi)$(t.val gt 2110) = pm_taxCO2eq("2110",regi); !! to prevent huge taxes after 2110 and the resulting convergence problems, set taxes after 2110 equal to 2110 value
pm_taxCO2eq(t,regi)$(t.val gt 2100) = pm_taxCO2eq("2100",regi); !! to prevent huge taxes after 2100 and the resulting convergence problems, set taxes after 2100 equal to 2100 value

*** EOF ./modules/45_carbonprice/NPi2025/datainput.gms
2 changes: 1 addition & 1 deletion modules/45_carbonprice/NPi2025/not_used.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pm_emifac,input,questionnaire
cm_peakBudgYr,input,not needed
sm_D2005_2_D2017,input,not needed
sm_budgetCO2eqGlob,input,added by codeCheck
sm_globalBudget_dev,input,added by codeCheck
vm_emiTe,input,added by codeCheck
vm_emiCdr,input,added by codeCheck
vm_emiMac,input,added by codeCheck
Expand All @@ -43,3 +42,4 @@ cm_taxCO2_startyear,input,added by codeCheck
cm_taxCO2_expGrowth,input,added by codeCheck
cm_budgetCO2from2020,input,added by codeCheck
cm_taxCO2_IncAfterPeakBudgYr,input,added by codeCheck
sm_globalBudget_dev,input,no target adjustement
2 changes: 1 addition & 1 deletion modules/45_carbonprice/NPi2025expo/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ loop(ext_regi$sameas(ext_regi, "EUR_regi"),
pm_taxCO2eq(t,regi)$(t.val ge 2030 AND regi_group(ext_regi,regi)) = fm_taxCO2eqHist("2030",regi) * sm_DptCO2_2_TDpGtC * cm_taxCO2_expGrowth**(t.val - 2030);
);

pm_taxCO2eq(t,regi)$(t.val gt 2110) = pm_taxCO2eq("2110",regi); !! to prevent huge taxes after 2110 and the resulting convergence problems, set taxes after 2110 equal to 2110 value
pm_taxCO2eq(t,regi)$(t.val gt 2100) = pm_taxCO2eq("2100",regi); !! to prevent huge taxes after 2100 and the resulting convergence problems, set taxes after 2100 equal to 2100 value

*** EOF ./modules/45_carbonprice/NPi2025expo/datainput.gms
2 changes: 1 addition & 1 deletion modules/45_carbonprice/NPi2025expo/not_used.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pm_emifac,input,questionnaire
cm_peakBudgYr,input,not needed
sm_D2005_2_D2017,input,not needed
sm_budgetCO2eqGlob,input,no iterative target adjustment
sm_globalBudget_dev,input,no iterative target adjustment
vm_emiTe,input,no iterative target adjustment
vm_emiCdr,input,no iterative target adjustment
vm_emiMac,input,no iterative target adjustment
Expand All @@ -42,3 +41,4 @@ cm_taxCO2_IncAfterPeakBudgYr,input,added by codeCheck
cm_budgetCO2from2020,input,no iterative target adjustment
pm_taxCO2eq_anchor_iterationdiff,input,no iterative target adjustment
pm_taxCO2eq_anchor_iterationdiff_tmp,input,no iterative target adjustment
sm_globalBudget_dev,input,no target adjustement
2 changes: 1 addition & 1 deletion modules/45_carbonprice/NPiexpo/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Execute_Loadpoint "input_ref" pm_taxCO2eq = pm_taxCO2eq;

*** calculate pm_taxCO2eq for year before startyear
pm_taxCO2eq(t,regi) = sum(ttot, pm_taxCO2eq(ttot,regi)$(ttot.val eq smax(ttot2$( ttot2.val lt cm_startyear ), ttot2.val))) * cm_taxCO2_expGrowth**(t.val-smax(ttot2$( ttot2.val lt cm_startyear ), ttot2.val));
pm_taxCO2eq(t,regi)$(t.val gt 2110) = pm_taxCO2eq("2110",regi); !! to prevent huge taxes after 2110 and the resulting convergence problems, set taxes after 2110 equal to 2110 value
pm_taxCO2eq(t,regi)$(t.val gt 2100) = pm_taxCO2eq("2100",regi); !! to prevent huge taxes after 2100 and the resulting convergence problems, set taxes after 2100 equal to 2100 value


*** EOF ./modules/45_carbonprice/NPiexpo/datainput.gms
2 changes: 1 addition & 1 deletion modules/45_carbonprice/NPiexpo/not_used.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ cm_peakBudgYr,input,added by codeCheck
fm_taxCO2eqHist,input,not needed
sm_D2005_2_D2017,input,not needed
sm_budgetCO2eqGlob,input,no iterative target adjustment
sm_globalBudget_dev,input,no iterative target adjustment
vm_emiTe,input,no iterative target adjustment
vm_emiCdr,input,no iterative target adjustment
vm_emiMac,input,no iterative target adjustment
Expand All @@ -43,3 +42,4 @@ cm_taxCO2_IncAfterPeakBudgYr,input,added by codeCheck
cm_budgetCO2from2020,input,no iterative target adjustment
pm_taxCO2eq_anchor_iterationdiff,input,no iterative target adjustment
pm_taxCO2eq_anchor_iterationdiff_tmp,input,no iterative target adjustment
sm_globalBudget_dev,input,no target adjustement
2 changes: 1 addition & 1 deletion modules/45_carbonprice/exogenous/not_used.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ cm_peakBudgYr,input,added by codeCheck
sm_D2005_2_D2017,input,not needed
fm_taxCO2eqHist,input,not needed
sm_budgetCO2eqGlob,input,no iterative target adjustment
sm_globalBudget_dev,input,no iterative target adjustment
vm_emiTe,input,no iterative target adjustment
vm_emiCdr,input,no iterative target adjustment
vm_emiMac,input,no iterative target adjustment
Expand All @@ -43,3 +42,4 @@ cm_taxCO2_IncAfterPeakBudgYr,input,added by codeCheck
cm_budgetCO2from2020,input,no iterative target adjustment
pm_taxCO2eq_anchor_iterationdiff,input,no iterative target adjustment
pm_taxCO2eq_anchor_iterationdiff_tmp,input,no iterative target adjustment
sm_globalBudget_dev,input,no target adjustement
2 changes: 1 addition & 1 deletion modules/45_carbonprice/expoLinear/not_used.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ cm_peakBudgYr,input,added by codeCheck
sm_D2005_2_D2017,input,not needed
fm_taxCO2eqHist,input,not needed
sm_budgetCO2eqGlob,input,no iterative target adjustment
sm_globalBudget_dev,input,no iterative target adjustment
vm_emiTe,input,no iterative target adjustment
vm_emiCdr,input,no iterative target adjustment
vm_emiMac,input,no iterative target adjustment
Expand All @@ -38,3 +37,4 @@ cm_taxCO2_IncAfterPeakBudgYr,input,added by codeCheck
cm_budgetCO2from2020,input,no iterative target adjustment
pm_taxCO2eq_anchor_iterationdiff,input,no iterative target adjustment
pm_taxCO2eq_anchor_iterationdiff_tmp,input,no iterative target adjustment
sm_globalBudget_dev,input,no target adjustement
6 changes: 3 additions & 3 deletions modules/45_carbonprice/functionalForm/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ $endIf.taxCO2globalAnchor
*** Part II (Post-peak behaviour): The global anchor trajectory can be adjusted after reaching the peak of global CO2 emissions in cm_peakBudgYr.
*** The (initial) choice of cm_peakBudgYr is endogenously adjusted if cm_iterative_target_adj is set to 7 or 9.
*** (with iterative_target_adj = 0): after cm_peakBudgYr, the global anchor trajectory increases linearly with fixed annual increase given by cm_taxCO2_IncAfterPeakBudgYr (default = 0, i.e. constant),
*** set cm_peakBudgYr = 2110 to avoid adjustment
*** set cm_peakBudgYr = 2100 to avoid adjustment
*** (with iterative_target_adj = 5): no adjustment to the functional form after cm_peakBudgYr
*** (with iterative_target_adj = 7): after cm_peakBudgYr, the global anchor trajectory is adjusted so that global net CO2 emissions stay close to zero
*** (with iterative_target_adj = 9): after cm_peakBudgYr, the global anchor trajectory increases linearly with fixed annual increase given by cm_taxCO2_IncAfterPeakBudgYr (default = 0, i.e. constant)
Expand All @@ -98,8 +98,8 @@ if((cm_iterative_target_adj = 0) or (cm_iterative_target_adj = 9),
+ (t.val - cm_peakBudgYr) * cm_taxCO2_IncAfterPeakBudgYr * sm_DptCO2_2_TDpGtC; !! increase by cm_taxCO2inc_after_peakBudgYr per year
);

*** Always set carbon price constant after 2110 to prevent huge taxes after 2110 and the resulting convergence problems
p45_taxCO2eq_anchor(t)$(t.val gt 2110) = p45_taxCO2eq_anchor("2110");
*** Always set carbon price constant after 2100 to prevent huge taxes after 2100 and the resulting convergence problems
p45_taxCO2eq_anchor(t)$(t.val gt 2100) = p45_taxCO2eq_anchor("2100");
display p45_taxCO2eq_anchor_until2150, p45_taxCO2eq_anchor;

***-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Expand Down
8 changes: 5 additions & 3 deletions modules/45_carbonprice/functionalForm/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ $endIf.taxCO2interpolation1
scalars
s45_actualbudgetco2 "actual level of 2020-2100 cumulated emissions, including all CO2 for last iteration"
s45_actualbudgetco2_last "actual level of 2020-2100 cumulated emissions for previous iteration" /0/
s45_factorRescale_taxCO2_exponent_before10 "exponent determining sensitivity before iteration 10"
s45_factorRescale_taxCO2_exponent_from10 "exponent determining sensitivity of CO2 price adjustment to CO2 budget deviation from iteration 10"
;

*** Parameters only used in functionForm/postsolve.gms
parameters
p45_actualbudgetco2(ttot) "actual level of cumulated emissions starting from 2020 [GtCO2]"

p45_taxCO2eq_iteration(iteration,ttot,all_regi) "save pm_taxCO2eq from each iteration for debugging"
p45_taxCO2eq_anchor_iteration(iteration,ttot) "save p45_taxCO2eq_anchor from each iteration for debugging"
o45_taxCO2eq_anchor_iterDiff_Itr(iteration) "track pm_taxCO2eq_anchor_iterationdiff over iterations"
p45_taxCO2eq_iteration(iteration,ttot,all_regi) "save pm_taxCO2eq in each iteration (before entering functionalForm/postsolve.gms) for debugging"
p45_taxCO2eq_anchor_iteration(iteration,ttot) "save p45_taxCO2eq_anchor in each iteration (before entering functionalForm/postsolve.gms) for debugging"
o45_taxCO2eq_anchor_iterDiff_Itr(iteration) "track pm_taxCO2eq_anchor_iterationdiff in 2100 over iterations"

o45_diff_to_Budg(iteration) "Difference between actual CO2 budget and target CO2 budget"
o45_totCO2emi_peakBudgYr(iteration) "Total CO2 emissions in the peakBudgYr"
Expand Down
Loading

0 comments on commit 6591756

Please sign in to comment.