Skip to content

Commit

Permalink
cleaning up code
Browse files Browse the repository at this point in the history
  • Loading branch information
fpiontek committed Jul 5, 2024
1 parent 7d024d1 commit 8a6fcd6
Show file tree
Hide file tree
Showing 28 changed files with 97 additions and 111 deletions.
2 changes: 1 addition & 1 deletion main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ $setGlobal cm_magicc_config OLDDEFAULT !! def = OLDDEFAULT ; {OLDDEFAULT, RC
*' climate damages (HowardNonCatastrophic, DICE2013R, DICE2016, HowardNonCatastrophic, HowardInclCatastrophic, KWcross, KWpanelPop}
$setGlobal cm_damage_DiceLike_specification HowardNonCatastrophic !! def = HowardNonCatastrophic
***cfg$gms$cm_KotzWenzPerc <- mean #def = mean; {low,med,mean,high} the percentile of the damage distribution from Kotz et al. (2024), low = 5th, high = 95th percentile
$setGlobal cm_KotzWenzPerc mean !! def = mean
$setGlobal cm_KotzWenzPerc mean !! def = mean !! regexp = low|med|mean|high
*** cfg$gms$cm_damage_Labor_exposure <- "low" # def = "low"; {low,high}
$setGlobal cm_damage_Labor_exposure low !! def = low !! regexp = low|high
*** cfg$gms$cm_TCssp <- "SSP2" #def = "SSP2"; {SSP2,SSP5} the scenario for which the damage function is specified - currently only SSP2 and SSP5 are available
Expand Down
15 changes: 1 addition & 14 deletions modules/50_damages/KotzWenz/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,11 @@ $ondelim
$include "./modules/50_damages/KotzWenz/input/f50_gdp.cs3r"
$offdelim
;
*p50_isoGDP(tall,iso)=f50_countryGDP(tall,iso,"%cm_GDPscen%");

*interpolate to annual time steps
*loop(ttot$(ttot.val ge 2005),
* loop(tall$(pm_tall_2_ttot(tall,ttot)),
* p50_isoGDP(tall,iso) =
* (1-pm_interpolWeight_ttot_tall(tall))*p50_isoGDP(ttot,iso)
* + pm_interpolWeight_ttot_tall(tall)*p50_isoGDP(ttot+1,iso);
*))
*;

*keep constant after 2150 as it is needed until 2300 for SCC calculation
*p50_isoGDP(tall,iso)$(tall.val ge 2150) = p50_isoGDP("2150",iso);

* initialize
pm_damage(tall,regi) = 1;

*calculate and interpolate country GDP fraction of regional GDP for SSP2EU scenario, country GDP is in PPP, regional GDP in trl MER!
*calculate and interpolate country GDP fraction of regional GDP, country GDP is in PPP, regional GDP in trl MER!
pm_GDPfrac(tall,iso)=f50_countryGDP(tall,iso,"%cm_GDPscen%")/1000000/(sum(regi2iso(regi,iso),pm_gdp(tall,regi)/pm_shPPPMER(regi))+1e-9);
loop(ttot$(ttot.val ge 2005),
loop(tall$(pm_tall_2_ttot(tall,ttot)),
Expand Down
22 changes: 22 additions & 0 deletions modules/50_damages/KotzWenz/realization.gms
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
*** | (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: [email protected]
*** SOF ./modules/50_damages/KotzWenz/realization.gms

*' @description Aggregate GDP damages based on Kotz et al. (2024). They are calculated on country level for 1000 Monte Carlo realizations, then the chosen percentile of this damage distribution is used in the further calculations. The damages are calculated with respect to temperature changes compared to 2020, assuming that the 2020 GDP already includes all climate damages.

*' @limitations: Unless the realization "KotzWenzItr" is used for module 51_internalizeDamages, the damages are not actually part of the optimization, but just enter as a fixed variable reducing output, updated in between iterations.

*####################### R SECTION START (PHASES) ##############################
$Ifi "%phase%" == "sets" $include "./modules/50_damages/TC/sets.gms"
$Ifi "%phase%" == "declarations" $include "./modules/50_damages/TC/declarations.gms"
$Ifi "%phase%" == "datainput" $include "./modules/50_damages/TC/datainput.gms"
$Ifi "%phase%" == "bounds" $include "./modules/50_damages/TC/bounds.gms"
$Ifi "%phase%" == "postsolve" $include "./modules/50_damages/TC/postsolve.gms"
*######################## R SECTION END (PHASES) ###############################

*** EOF ./modules/50_damages/TC/realization.gms
*####################### R SECTION START (PHASES) ##############################
$Ifi "%phase%" == "sets" $include "./modules/50_damages/KotzWenz/sets.gms"
$Ifi "%phase%" == "declarations" $include "./modules/50_damages/KotzWenz/declarations.gms"
$Ifi "%phase%" == "datainput" $include "./modules/50_damages/KotzWenz/datainput.gms"
$Ifi "%phase%" == "bounds" $include "./modules/50_damages/KotzWenz/bounds.gms"
$Ifi "%phase%" == "postsolve" $include "./modules/50_damages/KotzWenz/postsolve.gms"
*######################## R SECTION END (PHASES) ###############################

*** EOF ./modules/50_damages/KotzWenz/realization.gms
10 changes: 2 additions & 8 deletions modules/50_damages/TC/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,22 @@ p50_damageFuncCoefTC2(isoTC) = 0;

*** load TC damage parameter data (Krichene et al. 2022)

*parameter f50_TCconst(iso,all_TCpers,all_TCspec) "damage parameter for TC, constant"
parameter f50_TCconst(iso,all_TCspec) "damage parameter for TC, constant"
/
$ondelim
*$include "./modules/50_damages/TC/input/f50_TC_df_const.cs4r"
$include "./modules/50_damages/TC/input/f50_TC_df_const_new.csv"
$include "./modules/50_damages/TC/input/f50_TC_df_const.cs4r"
$offdelim
/
;

*parameter f50_TCtasK(iso,all_TCpers,all_TCspec) "damage parameter for TC, linear with temperature"
parameter f50_TCtasK(iso,all_TCspec) "damage parameter for TC, linear with temperature"
/
$ondelim
*$include "./modules/50_damages/TC/input/f50_TC_df_tasK.cs4r"
$include "./modules/50_damages/TC/input/f50_TC_df_tasK_new.csv"
$include "./modules/50_damages/TC/input/f50_TC_df_tasK.cs4r"
$offdelim
/
;

*p50_damageFuncCoefTC0(iso) = f50_TCconst(iso,"%cm_TCpers%","%cm_TCspec%")/100;
*p50_damageFuncCoefTC1(iso) = f50_TCtasK(iso,"%cm_TCpers%","%cm_TCspec%")/100;
p50_damageFuncCoefTC0(iso) = f50_TCconst(iso,"%cm_TCspec%");
p50_damageFuncCoefTC1(iso) = f50_TCtasK(iso,"%cm_TCspec%");

Expand Down
7 changes: 4 additions & 3 deletions modules/51_internalizeDamages/BurkeLikeItr/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ $ifi not %cm_magicc_temperatureImpulseResponse% == 'on' abort "module internaliz


*inital guess carbon tax for 1st iter. Does not influence solution point.
p51_scc("2020") = 20;
p51_scc(tall)$(tall.val ge 2010 and tall.val le 2150) = p51_scc("2020")*(1+0.02*(tall.val-2020));
p51_scc(tall,regi) = 0;
p51_scc("2025",regi) = 20;
p51_scc(tall,regi)$(tall.val ge 2025 and tall.val le 2150) = p51_scc("2025",regi)*(1+0.025*(tall.val-2025));

pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot) * (44/12)/1000;
pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot) * sm_c_2_co2/1000;

*** EOF ./modules/51_internalizeDamages/BurkeLikeItr/datainput.gms
8 changes: 2 additions & 6 deletions modules/51_internalizeDamages/BurkeLikeItr/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ p51_sccParts(tall,tall2,regi2)$((tall.val ge 2010) and (tall.val le 2150) and (t
* p51_marginalDamageCumul(tall,tall2,regi2)
;

p51_scc(tall)$((tall.val ge 2020) and (tall.val le 2150)) = 1000 *
*p51_welf(tall)**(-1) *
p51_scc(tall)$((tall.val ge 2025) and (tall.val le 2150)) = 1000 *
sum(regi2,
sum(tall2$( (tall2.val ge tall.val) and (tall2.val le (tall.val + cm_damages_SccHorizon))), !! add this for limiting horizon of damage consideration: and (tall2.val le 2150)
p51_sccParts(tall,tall2,regi2)
Expand All @@ -35,14 +34,11 @@ p51_scc(tall)$((tall.val ge 2020) and (tall.val le 2150)) = 1000 *
;

*if(cm_iterative_target_adj eq 10 and cm_emiscen eq 9 and mod(iteration.val,2) eq 1, !! update only every uneven iteration to prevent zig-zagging

*display "proposed new scc tax:";
*display p51_scc;
*p51_scc(tall) = p51_sccLastItr(tall) * max(0, min(1.4,max(0.6, (p51_scc(tall)/max(p51_sccLastItr(tall),1e-8))**0.7 )));
p51_scc(tall) = p51_sccLastItr(tall) * min(max( (p51_scc(tall)/max(p51_sccLastItr(tall),1e-8)),1 - 0.5*0.95**iteration.val),1 + 0.95**iteration.val);

pm_taxCO2eqSCC(ttot,regi) = 0;
pm_taxCO2eqSCC(t,regi)$(t.val ge 2025) = max(0, p51_scc(t) * (44/12)/1000);
pm_taxCO2eqSCC(t,regi)$(t.val ge 2025) = max(0, p51_scc(t) * sm_c_2_co2/1000);

*);

Expand Down
7 changes: 4 additions & 3 deletions modules/51_internalizeDamages/DiceLikeItr/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ $ifi not %damages% == 'DiceLike' abort "module internalizeDamages=DiceLikeItr re
$ifi not %cm_magicc_temperatureImpulseResponse% == 'on' abort "module internalizeDamages=DiceLikeItr requires cm_magicc_temperatureImpulseResponse=on";

*init carbon tax for 1st iter
p51_scc("2020") = 20;
p51_scc(tall)$(tall.val ge 2010 and tall.val le 2150) = p51_scc("2020")*(1+0.025*(tall.val-2020));
p51_scc(tall,regi) = 0;
p51_scc("2025",regi) = 20;
p51_scc(tall,regi)$(tall.val ge 2025 and tall.val le 2150) = p51_scc("2025",regi)*(1+0.025*(tall.val-2025));

pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot) * (44/12)/1000;
pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot) * sm_c_2_co2/1000;

*** EOF ./modules/51_internalizeDamages/DiceLikeItr/datainput.gms
4 changes: 2 additions & 2 deletions modules/51_internalizeDamages/DiceLikeItr/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*** SOF ./modules/51_internalizeDamages/DiceLikeItr/postsolve.gms

p51_sccLastItr(tall) = p51_scc(tall);
p51_scc(tall)$((tall.val ge 2020) and (tall.val le 2150)) = 1000 *
p51_scc(tall)$((tall.val ge 2025) and (tall.val le 2150)) = 1000 *
sum(regi2,
sum(tall2$( (tall2.val ge tall.val) and (tall2.val le (tall.val + cm_damages_SccHorizon)) ), !! add this for limiting horizon of damage consideration: and (tall2.val le 2150)
(1 + pm_prtp(regi2))**(-(tall2.val - tall.val))
Expand All @@ -22,7 +22,7 @@ p51_scc(tall)$((tall.val ge 2020) and (tall.val le 2150)) = 1000 *
*if(cm_iterative_target_adj eq 10 and cm_emiscen eq 9 and mod(iteration.val,2) eq 1, !! update only every uneven iteration to prevent zig-zagging

pm_taxCO2eqSCC(ttot,regi) = 0;
pm_taxCO2eqSCC(t,regi)$(t.val ge 2025) = p51_scc(t) * (44/12)/1000;
pm_taxCO2eqSCC(t,regi)$(t.val ge 2025) = p51_scc(t) * sm_c_2_co2/1000;

*);

Expand Down
7 changes: 4 additions & 3 deletions modules/51_internalizeDamages/KWTCintItr/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ $ifi not %cm_magicc_temperatureImpulseResponse% == 'on' abort "module internaliz


*inital guess carbon tax for 1st iter. Does not influence solution point.
p51_scc("2020") = 20;
p51_scc(tall)$(tall.val ge 2010 and tall.val le 2150) = p51_scc("2020")*(1+0.02*(tall.val-2020));
p51_scc(tall,regi) = 0;
p51_scc("2025",regi) = 20;
p51_scc(tall,regi)$(tall.val ge 2025 and tall.val le 2150) = p51_scc("2025",regi)*(1+0.025*(tall.val-2025));

pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot) * (44/12)/1000;
pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot) * sm_c_2_co2/1000;


*** EOF ./modules/51_internalizeDamages/KWTCintItr/datainput.gms
6 changes: 1 addition & 5 deletions modules/51_internalizeDamages/KWTCintItr/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ p51_sccParts(tall,tall2,regi2)$((tall.val ge 2010) and (tall.val le 2150) and (t
p51_sccLastItr(tall) = p51_scc(tall);

p51_scc(tall)$((tall.val ge 2020) and (tall.val le 2150)) = 1000 *
*p51_welf(tall)**(-1) *
sum(regi2,
sum(tall2$( (tall2.val ge tall.val) and (tall2.val le (tall.val + cm_damages_SccHorizon))), !! add this for limiting horizon of damage consideration: and (tall2.val le 2150)
p51_sccParts(tall,tall2,regi2)
Expand All @@ -52,14 +51,11 @@ p51_scc(tall)$((tall.val ge 2020) and (tall.val le 2150)) = 1000 *
display p51_scc;

*if(cm_iterative_target_adj eq 10 and cm_emiscen eq 9 and mod(iteration.val,2) eq 1, !! update only every uneven iteration to prevent zig-zagging

*display "proposed new scc tax:";
*display p51_scc;
*p51_scc(tall) = p51_sccLastItr(tall) * max(0, min(1.4,max(0.6, (p51_scc(tall)/max(p51_sccLastItr(tall),1e-8))**0.7 )));
p51_scc(tall) = p51_sccLastItr(tall) * min(max( (p51_scc(tall)/max(p51_sccLastItr(tall),1e-8)),1 - 0.5*0.95**iteration.val),1 + 0.95**iteration.val);

pm_taxCO2eqSCC(ttot,regi) = 0;
pm_taxCO2eqSCC(t,regi)$(t.val ge 2020) = max(0, p51_scc(t) * (44/12)/1000);
pm_taxCO2eqSCC(t,regi)$(t.val ge 2025) = max(0, p51_scc(t) * sm_c_2_co2/1000);

*);

Expand Down
7 changes: 4 additions & 3 deletions modules/51_internalizeDamages/KW_SEitr/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ $ifi not %cm_magicc_temperatureImpulseResponse% == 'on' abort "module internaliz


*inital guess carbon tax for 1st iter. Does not influence solution point.
p51_scc("2020") = 20;
p51_scc(tall)$(tall.val ge 2010 and tall.val le 2150) = p51_scc("2020")*(1+0.02*(tall.val-2020));
p51_scc(tall,regi) = 0;
p51_scc("2025",regi) = 20;
p51_scc(tall,regi)$(tall.val ge 2025 and tall.val le 2150) = p51_scc("2025",regi)*(1+0.025*(tall.val-2025));

pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot) * (44/12)/1000;
pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot) * sm_c_2_co2/1000;


*** EOF ./modules/51_internalizeDamages/KW_SEitr/datainput.gms
6 changes: 1 addition & 5 deletions modules/51_internalizeDamages/KW_SEitr/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ p51_sccParts(tall,tall2,regi2)$((tall.val ge 2010) and (tall.val le 2150) and (t

*convert unit from tr$/GtC to $/tCO2 as GDP is in tr$ and pulse is 1 GtC
p51_scc(tall)$((tall.val ge 2020) and (tall.val le 2150)) = 1000*12/44 *
*p51_welf(tall)**(-1) *
sum(regi2,
sum(tall2$( (tall2.val ge tall.val) and (tall2.val le (tall.val + cm_damages_SccHorizon))), !! add this for limiting horizon of damage consideration: and (tall2.val le 2150)
p51_sccParts(tall,tall2,regi2)
Expand All @@ -28,14 +27,11 @@ p51_scc(tall)$((tall.val ge 2020) and (tall.val le 2150)) = 1000*12/44 *
display p51_scc;

*if(cm_iterative_target_adj eq 10 and cm_emiscen eq 9 and mod(iteration.val,2) eq 1, !! update only every uneven iteration to prevent zig-zagging

*display "proposed new scc tax:";
*display p51_scc;
*p51_scc(tall) = p51_sccLastItr(tall) * max(0, min(1.4,max(0.6, (p51_scc(tall)/max(p51_sccLastItr(tall),1e-8))**0.7 )));
p51_scc(tall) = p51_sccLastItr(tall) * min(max( (p51_scc(tall)/max(p51_sccLastItr(tall),1e-8)),1 - 0.5*0.95**iteration.val),1 + 0.95**iteration.val);

pm_taxCO2eqSCC(ttot,regi) = 0;
pm_taxCO2eqSCC(t,regi)$(t.val ge 2020) = max(0, p51_scc(t) * (44/12)/1000);
pm_taxCO2eqSCC(t,regi)$(t.val ge 2025) = max(0, p51_scc(t) * sm_c_2_co2/1000);

*);

Expand Down
7 changes: 4 additions & 3 deletions modules/51_internalizeDamages/KWlikeItr/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ $ifi not %cm_magicc_temperatureImpulseResponse% == 'on' abort "module internaliz


*inital guess carbon tax for 1st iter. Does not influence solution point.
p51_scc("2020") = 20;
p51_scc(tall)$(tall.val ge 2010 and tall.val le 2150) = p51_scc("2020")*(1+0.02*(tall.val-2020));
p51_scc(tall,regi) = 0;
p51_scc("2025",regi) = 20;
p51_scc(tall,regi)$(tall.val ge 2025 and tall.val le 2150) = p51_scc("2025",regi)*(1+0.025*(tall.val-2025));

pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot) * (44/12)/1000;
pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot) * sm_c_2_co2/1000;


*** EOF ./modules/51_internalizeDamages/KWlikeItr/datainput.gms
6 changes: 1 addition & 5 deletions modules/51_internalizeDamages/KWlikeItr/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ p51_sccParts(tall,tall2,regi2)$((tall.val ge 2010) and (tall.val le 2150) and (t
;

p51_scc(tall)$((tall.val ge 2020) and (tall.val le 2150)) = 1000 *
*p51_welf(tall)**(-1) *
sum(regi2,
sum(tall2$( (tall2.val ge tall.val) and (tall2.val le (tall.val + cm_damages_SccHorizon))), !! add this for limiting horizon of damage consideration: and (tall2.val le 2150)
p51_sccParts(tall,tall2,regi2)
Expand All @@ -37,14 +36,11 @@ p51_scc(tall)$((tall.val ge 2020) and (tall.val le 2150)) = 1000 *
display p51_scc;

*if(cm_iterative_target_adj eq 10 and cm_emiscen eq 9 and mod(iteration.val,2) eq 1, !! update only every uneven iteration to prevent zig-zagging

*display "proposed new scc tax:";
*display p51_scc;
*p51_scc(tall) = p51_sccLastItr(tall) * max(0, min(1.4,max(0.6, (p51_scc(tall)/max(p51_sccLastItr(tall),1e-8))**0.7 )));
p51_scc(tall) = p51_sccLastItr(tall) * min(max( (p51_scc(tall)/max(p51_sccLastItr(tall),1e-8)),1 - 0.5*0.95**iteration.val),1 + 0.95**iteration.val);

pm_taxCO2eqSCC(ttot,regi) = 0;
pm_taxCO2eqSCC(t,regi)$(t.val ge 2020) = max(0, p51_scc(t) * (44/12)/1000);
pm_taxCO2eqSCC(t,regi)$(t.val ge 2025) = max(0, p51_scc(t) * sm_c_2_co2/1000);

*);

Expand Down
7 changes: 4 additions & 3 deletions modules/51_internalizeDamages/KWlikeItrCPnash/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ $ifi not %cm_magicc_temperatureImpulseResponse% == 'on' abort "module internaliz


*inital guess carbon tax for 1st iter. Does not influence solution point.
p51_scc("2020",regi) = 20;
p51_scc(tall,regi)$(tall.val ge 2010 and tall.val le 2150) = p51_scc("2020",regi)*(1+0.02*(tall.val-2020));
p51_scc(tall,regi) = 0;
p51_scc("2025",regi) = 20;
p51_scc(tall,regi)$(tall.val ge 2025 and tall.val le 2150) = p51_scc("2025",regi)*(1+0.025*(tall.val-2025));

pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot,regi) * (44/12)/1000;
pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot,regi) * sm_c_2_co2/1000;

*** EOF ./modules/51_internalizeDamages/KWlikeItrCPnash/datainput.gms
6 changes: 1 addition & 5 deletions modules/51_internalizeDamages/KWlikeItrCPnash/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,18 @@ p51_sccParts(tall,tall2,regi)$((tall.val ge 2010) and (tall.val le 2150) and (ta
;

p51_scc(tall,regi)$((tall.val ge 2020) and (tall.val le 2150)) = 1000 *
*p51_welf(tall)**(-1) *
sum(tall2$( (tall2.val ge tall.val) and (tall2.val le (tall.val + cm_damages_SccHorizon))), !! add this for limiting horizon of damage consideration: and (tall2.val le 2150)
p51_sccParts(tall,tall2,regi)
)
;
display p51_scc;

*if(cm_iterative_target_adj eq 10 and cm_emiscen eq 9 and mod(iteration.val,2) eq 1, !! update only every uneven iteration to prevent zig-zagging

*display "proposed new scc tax:";
*display p51_scc;
*p51_scc(tall) = p51_sccLastItr(tall) * max(0, min(1.4,max(0.6, (p51_scc(tall)/max(p51_sccLastItr(tall),1e-8))**0.7 )));
p51_scc(tall,regi) = p51_sccLastItr(tall,regi) * min(max( (p51_scc(tall,regi)/max(p51_sccLastItr(tall,regi),1e-8)),1 - 0.5*0.95**iteration.val),1 + 0.95**iteration.val);

pm_taxCO2eqSCC(ttot,regi) = 0;
pm_taxCO2eqSCC(t,regi)$(t.val ge 2020) = max(0, p51_scc(t,regi) * (44/12)/1000);
pm_taxCO2eqSCC(t,regi)$(t.val ge 2025) = max(0, p51_scc(t) * sm_c_2_co2/1000);

*);

Expand Down
7 changes: 4 additions & 3 deletions modules/51_internalizeDamages/KWlikeItrCPreg/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ $ifi not %cm_magicc_temperatureImpulseResponse% == 'on' abort "module internaliz


*inital guess carbon tax for 1st iter. Does not influence solution point.
p51_scc("2020",regi) = 20;
p51_scc(tall,regi)$(tall.val ge 2010 and tall.val le 2150) = p51_scc("2020",regi)*(1+0.02*(tall.val-2020));
p51_scc(tall,regi) = 0;
p51_scc("2025",regi) = 20;
p51_scc(tall,regi)$(tall.val ge 2025 and tall.val le 2150) = p51_scc("2025",regi)*(1+0.025*(tall.val-2025));

pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot,regi) * (44/12)/1000;
pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot,regi) * sm_c_2_co2/1000;


*** EOF ./modules/51_internalizeDamages/KWlikeItrCPreg/datainput.gms
6 changes: 1 addition & 5 deletions modules/51_internalizeDamages/KWlikeItrCPreg/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,18 @@ p51_sccParts(tall,tall2,regi)$((tall.val ge 2010) and (tall.val le 2150) and (ta
;

p51_scc(tall,regi)$((tall.val ge 2020) and (tall.val le 2150)) = 1000 *
*p51_welf(tall)**(-1) *
sum(tall2$( (tall2.val ge tall.val) and (tall2.val le (tall.val + cm_damages_SccHorizon))), !! add this for limiting horizon of damage consideration: and (tall2.val le 2150)
p51_sccParts(tall,tall2,regi)
)
;
display p51_scc;

*if(cm_iterative_target_adj eq 10 and cm_emiscen eq 9 and mod(iteration.val,2) eq 1, !! update only every uneven iteration to prevent zig-zagging

*display "proposed new scc tax:";
*display p51_scc;
*p51_scc(tall) = p51_sccLastItr(tall) * max(0, min(1.4,max(0.6, (p51_scc(tall)/max(p51_sccLastItr(tall),1e-8))**0.7 )));
p51_scc(tall,regi) = p51_sccLastItr(tall,regi) * min(max( (p51_scc(tall,regi)/max(p51_sccLastItr(tall,regi),1e-8)),1 - 0.5*0.95**iteration.val),1 + 0.95**iteration.val);

pm_taxCO2eqSCC(ttot,regi) = 0;
pm_taxCO2eqSCC(t,regi)$(t.val ge 2020) = max(0, p51_scc(t,regi) * (44/12)/1000);
pm_taxCO2eqSCC(t,regi)$(t.val ge 2025) = max(0, p51_scc(t) * sm_c_2_co2/1000);

*);

Expand Down
11 changes: 6 additions & 5 deletions modules/51_internalizeDamages/KotzWenzCPreg/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

* satisfy dependencies
$ifi not %damages% == 'KotzWenz' abort "module internalizeDamages=KotzWenzItr requires module damages=KotzWenz";
$ifi not %cm_magicc_temperatureImpulseResponse% == 'on' abort "module internalizeDamages=DiceLikeItr requires cm_magicc_temperatureImpulseResponse=on";
$ifi not %cm_magicc_temperatureImpulseResponse% == 'on' abort "module internalizeDamages=KotzWenzCPreg requires cm_magicc_temperatureImpulseResponse=on";

*init carbon tax for 1st iter
p51_scc("2020",regi) = 20;
p51_scc(tall,regi)$(tall.val ge 2010 and tall.val le 2150) = p51_scc("2020",regi)*(1+0.025*(tall.val-2020));
*init carbon tax for 1st iteration
p51_scc(tall,regi) = 0;
p51_scc("2025",regi) = 20;
p51_scc(tall,regi)$(tall.val ge 2025 and tall.val le 2150) = p51_scc("2025",regi)*(1+0.025*(tall.val-2025));

pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot,regi) * (44/12)/1000;
pm_taxCO2eqSCC(ttot,regi)$(ttot.val ge 2010) = p51_scc(ttot,regi) * sm_c_2_co2/1000;

*** EOF ./modules/51_internalizeDamages/KotzWenzItr/datainput.gms
Loading

0 comments on commit 8a6fcd6

Please sign in to comment.