Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for new switches to represent trade scenarios with limited cooperation between regions #1393

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### added
- **config** regex tests for many parameters
- **testthat** test and compile all config files
- **22_subsidizeLearning** option to define independent learning cumulative capacity for alternative region groups (`cm_altLearnRegiSet`).
- **24_trade** option to limit specific regions exports (`cm_XportRegiLim`).

### fixed
- fixed weights of energy carriers in `pm_IndstCO2Captured`
Expand Down
135 changes: 52 additions & 83 deletions config/21_regions_EU11/scenario_config_21_EU11_ECEMF.csv

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,18 @@ $setGlobal cm_gas_scen medGas !! def = medGas !! regexp = low|medium|h
*** (medCoal): medium
*** (highCoal): high
$setGlobal cm_coal_scen medCoal !! def = medCoal !! regexp = 0|lowCoal|medCoal|highCoal
*** cm_XportRegiLim
*** limit export levels on specific regions in relation to reference scenario levels
*** example: "(2025, 2030, 2035, 2040, 2045, 2050).REF_regi.peoil 0.5" limits total exports of oil in REF to 50% of the values observed in the reference gdx
$setGLobal cm_XportRegiLim off !! def off
*** cm_XportRegiLimRampUp
*** export limited levels defined at cm_XportRegiLim are gradually implemented with half of its level on the previous year
*** example: "cm_XportRegiLimRampUp = on" and "cm_XportRegiLim = (2030, 2035, 2040, 2045, 2050).REF_regi.peoil 0.5", exports will be limited to 75% of the reference scenario by 2025 (cm_XportRegiLimRampUp), and 50% onwards
$setGLobal cm_XportRegiLimRampUp off
*** cm_altLearnRegiSet
*** define an alternative group of regions that have independent learning cumulative capacity
*** example: "(REF, CHA).(wind, spv)", REF and CHA will have their cumulative capacity for wind and solar pv learning calculations accounted idenpendently of the rest of the World.
$setGLobal cm_altLearnRegiSet off !! def off
*** c_ccsinjecrateRegi "regional upper bound of the CCS injection rate, overwrites for specified regions the settings set with c_ccsinjecratescen"
*** ("off") no regional differentiation
*** ("GLO 0.005") reproduces c_ccsinjecratescen = 1
Expand Down
33 changes: 30 additions & 3 deletions modules/22_subsidizeLearning/globallyOptimal/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,39 @@

p22_deltacap0(ttot,regi,teLearn,rlf)$( (ttot.val ge 2005) and (pm_SolNonInfes(regi) eq 1)) = vm_deltaCap.l(ttot,regi,teLearn,rlf);

loop((ttot,regi,teLearn),
pm_capCumForeign(ttot,regi,teLearn)$(ttot.val ge 2005) = sum(regi2$(not sameas(regi2,regi)), pm_capCum0(ttot,regi2,teLearn) );
);
$ifthen.altLearnRegiSet not "%cm_altLearnRegiSet%" == "off"
loop((regi,teLearn),
if(altLearnRegi22(regi,teLearn),
pm_capCumForeign(ttot,regi,teLearn)$(ttot.val ge 2005) =
*** global cumulative capacity excluding region for years before 2025
sum(regi2$((not sameas(regi2,regi)) and (ttot.val ge 2005) and (ttot.val le 2020)),
pm_capCum0(ttot,regi2,teLearn)
)
+
*** 2020 cumulative capacity for other regions plus sub-region cumulative capacity for years after 2020
sum(regi2$((not sameas(regi2,regi)) and (NOT(altLearnRegi22(regi2,teLearn))) and (ttot.val ge 2025)),
pm_capCum0("2020",regi2,teLearn)
)
+
sum(regi2$((not sameas(regi2,regi)) and (altLearnRegi22(regi2,teLearn)) and (ttot.val ge 2025)),
pm_capCum0(ttot,regi2,teLearn)
)
;
else
pm_capCumForeign(ttot,regi,teLearn)$(ttot.val ge 2005) =
sum(regi2$((not sameas(regi2,regi)) and (not altLearnRegi22(regi2,teLearn))),
pm_capCum0(ttot,regi2,teLearn)
)
;
);
);
$else.altLearnRegiSet
pm_capCumForeign(ttot,regi,teLearn)$(ttot.val ge 2005) = sum(regi2$(not sameas(regi2,regi)), pm_capCum0(ttot,regi2,teLearn) );
$endif.altLearnRegiSet

display pm_capCumForeign;


* calculate marginal benefit of spillovers in each region. This expression for the subsidy can be derived analytically.
loop(regi$(pm_SolNonInfes(regi) eq 1),
p22_marginalCapcumBenefit(ttot,regi,teLearn) =
Expand Down
12 changes: 8 additions & 4 deletions modules/22_subsidizeLearning/globallyOptimal/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
*** | REMIND License Exception, version 1.0 (see LICENSE file).
*** | Contact: remind@pik-potsdam.de
*** SOF ./modules/22_subsidizeLearning/globallyOptimal/sets.gms
sets

m22_learnteUpdateSub(all_te) "learning technologies"


sets
m22_learnteUpdateSub(all_te) "learning technologies"
;

$IFTHEN.altLearnRegiSet not "%cm_altLearnRegiSet%" == "off"
Set
altLearnRegi22(all_regi,all_te) "Define regions to be accounted under an alternative learning cumulative capacity for each learning technology."
/ %cm_altLearnRegiSet% /
;
$ENDIF.altLearnRegiSet

*** EOF ./modules/22_subsidizeLearning/globallyOptimal/sets.gms
22 changes: 22 additions & 0 deletions modules/24_trade/standard/bounds.gms
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,26 @@ if (cm_phaseoutBiolc eq 1,
vm_Mport.fx(t,regi,entySe) = 0;
vm_Xport.fx(t,regi,entySe) = 0;

*** limit exports based on reference scenario results
$IFTHEN.XportRegiLim not "%cm_XportRegiLim%" == "off"
Execute_Loadpoint 'input_ref' p24_Xport_refgdx = vm_Xport.l;
loop((ttot,ext_regi,enty)$(p24_XportRegiLim(ttot,ext_regi,enty) and (ttot.val ge cm_startyear)),
loop(regi$regi_groupExt(ext_regi,regi),
vm_Xport.up(ttot,regi,enty) = min(vm_Xport.up(ttot,regi,enty),p24_XportRegiLim(ttot,ext_regi,enty)*p24_Xport_refgdx(ttot,regi,enty));
);
);
$IFTHEN.cm_XportRegiLimRampUp not "%cm_XportRegiLimRampUp%" == "off"
loop((ext_regi,enty),
loop(ttot$(p24_XportRegiLim(ttot,ext_regi,enty) and (ttot.val ge cm_startyear)),
loop(ttot2,
break$((ttot2.val ge ttot.val) and (ttot2.val ge cm_startyear) and (ttot2.val ge 2020));
s24_prevYear = ttot2.val;
);
vm_Xport.up(ttot3,regi,enty)$(ttot3.val eq s24_prevYear) = min(vm_Xport.up(ttot3,regi,enty),(1-((1-p24_XportRegiLim(ttot,ext_regi,enty))/2))*p24_Xport_refgdx(ttot3,regi,enty));
break;
);
);
$ENDIF.cm_XportRegiLimRampUp
$ENDIF.XportRegiLim

*** EOF ./modules/24_trade/standard/bounds.gms
9 changes: 9 additions & 0 deletions modules/24_trade/standard/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ p24_Mport2005correct(all_regi,all_enty) "Correction factor to match fossil s

pm_MPortsPrice(tall,all_regi,tradeSe) "Secondary energy import price for region. Calculated in the postsolve and assuming that trade is distributed uniformetly according existent capacities defined at p24_seTradeCapacity [T$/TWa]"
pm_XPortsPrice(tall,all_regi,tradeSe) "Secondary energy export price for region. Calculated in the postsolve and corresponding to the region secondary energy price [T$/TWa]"

$ifthen.XportRegiLim not "%cm_XportRegiLim%" == "off"
p24_Xport_refgdx(tall,all_regi,all_enty) "Export of traded commodity in the reference gdx"
p24_XportRegiLim(ttot,ext_regi,all_enty) "limit of total exports per region or region group in relation to the reference scenario [%]" / %cm_XportRegiLim% /
$IFTHEN.cm_XportRegiLimRampUp not "%cm_XportRegiLimRampUp%" == "off"
s24_prevYear "value of the previous year to the first exports limit"
$ENDIF.cm_XportRegiLimRampUp
$endIf.XportRegiLim
;

***-------------------------------------------------------------------------------
*** VARIABLES
***-------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions modules/80_optimization/nash/not_used.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ pm_taxCO2eq, parameter, ???
pm_ttot_val, parameter, ???
pm_welf, parameter, ???
vm_dummyBudget, input, questionnaire
pm_capCumForeign, parameter, defined at module 22
1 change: 0 additions & 1 deletion modules/80_optimization/nash/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*ML+LB 20140107* update of climate externality (carbon market)
*LB* 20140506 update of climate externality (link to the climate module)
*AJS* TODO: this is non-optimal: in summing over regi2, we'd like to keep the last known optimal value. To achieve that, param0 should not be overwritten in core/presolve.gms - we'd have to make p80_repynoninfes an interface.
pm_capCumForeign(ttot,regi,teLearn)$((ttot.val ge 2005) and (pm_SolNonInfes(regi) eq 1)) = sum(regi2$((NOT sameas(regi,regi2))), pm_capCum0(ttot,regi2,teLearn));

pm_cumEff(ttot,regi, in)$(ttot.val ge 2005 and pm_SolNonInfes(regi) eq 1) = sum( regi2$(pm_SolNonInfes(regi2) eq 1), (pm_cesdata("2005",regi2,in,"eff") * vm_effGr.l(ttot,regi2,in))) - (pm_cesdata("2005",regi,in,"eff") * vm_effGr.l(ttot,regi,in)); !! TODO: take care of the case of infeasible solution

Expand Down