Skip to content

Commit

Permalink
Merge pull request #1390 from fschreyer/QuickFixes
Browse files Browse the repository at this point in the history
Fix bug with switch cm_inco0Factor for scaling investment cost of technologies, investment cost in policy runs are not overwritten by reference gdx in 05_initialCap anymore
  • Loading branch information
fschreyer committed Sep 5, 2023
2 parents 658efef + c046470 commit bfed07c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **scripts** MAgPIE coupling interface: replace old MAgPIE cost variable
- **scripts** MAgPIE coupling interface: remove filtering of negative LU emissions
- **core** MAgPIE coupling: tolerate negative values for `n2ofertsom` and deactivate its MAC
- **05_initialCap** fix overwriting of investment cost changes from cm_inco0Factor switch

### added
- **45_carbonprice** added realization `NPi` (National Policies Implemented)
Expand Down
4 changes: 4 additions & 0 deletions main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,8 @@ $setglobal cm_CES_calibration_default_prices 0.01 !! def = 0.01
*** 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
*** (REG) regionalized technology costs
*** (GLO) globally homogenous technology costs
$setglobal cm_techcosts REG !! def = REG
*** cm_regNetNegCO2 - default "on" allows for regionally netNegative CO2 emissions, setting "off" activates bound in core/bounds.gms that disallows net negative CO2 emissions at the regional level
$setglobal cm_regNetNegCO2 on !! def = on
Expand Down Expand Up @@ -1479,10 +1481,12 @@ $setglobal cm_adj_coeff_multiplier off
*** cm_inco0Factor "change investment costs. [factor]."
*** def <- "off" = use default inco0 values.
*** or list of techs with respective factor to change inco0 value by a multiplication factor. (ex. "ccsinje=0.5,bioigccc=0.66,bioh2c=0.66,biogas=0.66,bioftrec=0.66,bioftcrec=0.66,igccc=0.66,coalh2c=0.66,coalgas=0.66,coalftrec=0.66,coalftcrec=0.66,ngccc=0.66,gash2c=0.66,gasftrec=0.66,gasftcrec=0.66,tnrs=0.66")
*** (note: if %cm_techcosts% == "GLO", switch will not work for policy runs, i.e. cm_startyear > 2005, for pc, ngt and ngcc as this gets overwritten in 05_initialCap module)
$setglobal cm_inco0Factor off !! def = off
*** cm_inco0RegiFactor "change investment costs regionalized technology values. [factor]."
*** def <- "off" = use default p_inco0 values.
*** or list of techs with respective factor to change p_inco0 value by a multiplication factor. (ex. "wind=0.33, spv=0.33" makes investment costs for wind and spv 3 times cheaper)
*** (note: if %cm_techcosts% == "GLO", switch will not work for policy runs, i.e. cm_startyear > 2005, for pc, ngt and ngcc as this gets overwritten in 05_initialCap module)
$setglobal cm_inco0RegiFactor off !! def = off
*** cm_CCS_markup "multiplicative factor for CSS cost markup"
*** def <- "off" = use default CCS pm_inco0_t values.
Expand Down
5 changes: 4 additions & 1 deletion modules/05_initialCap/on/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ Parameter
p05_aux_cap_distr(all_regi,all_te,rlf) "auxiliary calculation parameter for the calculation of initial capacities, distributed to grades"
p05_aux_cap(all_regi,all_te) "auxiliary calculation parameter for the calculation of initial capacities"
pm_aux_capLowerLimit(all_te,all_regi,tall) "auxiliary calculation parameter for the calculation of the lowest possible capacities in the first time steps"
p05_aux_calccapLowerLimitSwitch(tall) "auxiliary calculation parameter to allow the calculation of the lowest possible capacities in the first time steps"
p05_aux_calccapLowerLimitSwitch(tall) "auxiliary calculation parameter to allow the calculation of the lowest possible capacities in the first time steps"
$ifThen %cm_techcosts% == "GLO"
p05_inco0_t_ref(ttot,all_regi,all_te) "auxiliary parameter to load pm_inco0_t from reference run if cm_startyear > 2005 and initialCap is therefore not run"
$endIf
;

Variables
Expand Down
13 changes: 11 additions & 2 deletions modules/05_initialCap/on/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -512,14 +512,23 @@ if (cm_startyear gt 2005,
Execute_Loadpoint 'input_ref' pm_emifac = pm_emifac;
Execute_Loadpoint 'input_ref' pm_EN_demand_from_initialcap2 = pm_EN_demand_from_initialcap2;
Execute_Loadpoint 'input_ref' pm_pedem_res = pm_pedem_res;
Execute_Loadpoint 'input_ref' pm_inco0_t = pm_inco0_t;
Execute_Loadpoint 'input_ref' pm_dataeta = pm_dataeta;
Execute_Loadpoint 'input_ref' pm_data = pm_data;
Execute_Loadpoint 'input_ref' pm_aux_capLowerLimit = pm_aux_capLowerLimit;
Execute_Loadpoint 'input_ref' vm_deltaCap.l = vm_deltaCap.l;
Execute_Loadpoint 'input_ref' vm_deltaCap.lo = vm_deltaCap.lo;
Execute_Loadpoint 'input_ref' vm_deltaCap.up = vm_deltaCap.up;
);

*** if %cm_techcosts% == "GLO", load pm_inco0_t from input_ref.gdx and overwrite values
*** only for pc, ngt, ngcc since they have been adapted in initialCap routine above
*** This is to avoid overwriting changes to pm_inco0_t by scenario switches
$ifThen %cm_techcosts% == "GLO"
Execute_Loadpoint 'input_ref' p05_inco0_t_ref = pm_inco0_t;
pm_inco0_t(t,regi,te)$( teEtaIncr(te)
AND (sameas(te,"pc")
OR sameas(te,"ngt")
OR sameas(te,"ngcc") ) ) = p05_inco0_t_ref(t,regi,te);
$endIf
);

*** EOF ./modules/05_initialCap/on/preloop.gms

0 comments on commit bfed07c

Please sign in to comment.