Skip to content
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 DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Depends:
R (>= 4.0.0)
Imports:
callr,
climbed (>= 1.2.0),
colorspace,
crayon,
data.table,
Expand Down Expand Up @@ -54,6 +55,7 @@ Imports:
piamPlotComparison (>= 0.0.10),
piamutils,
plotly,
pracma,
purrr,
quitte (>= 0.3149.0),
R.utils,
Expand Down
1 change: 1 addition & 0 deletions core/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ p_prodAllReference(ttot,all_regi,all_te) "Sum of the above in the re
*** CES calibration tarjectories industry and buildings
pm_fedemandInd(tall,all_regi,all_in) "read-in parameter for final energy and production trajectories used for the CES parameter calibration in industry [EJ, ue_primary_steel, ue_secondary_steel: Gt, ue_otherInd: $tn]"
pm_fedemandBuild(tall,all_regi,all_in) "read-in parameter for final energy and production trajectories used for the CES parameter calibration in buildings [EJ]"
pm_climateCorrection(ttot,all_regi,all_in) "climate correction factors for building energy demand [unitless]"

*** parameters for setting final energy shares
pm_shfe_up(ttot,all_regi,all_enty,emi_sectors) "Final energy shares exogenous upper bounds per sector [share]"
Expand Down
2 changes: 1 addition & 1 deletion core/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ all_SSP_forcing_adjust "all possible forcing targets and budgets according to S
/

all_rcp_scen "all possible RCP scenarios"
/none,rcp20,rcp26,rcp37,rcp45,rcp60,rcp85/
/none,rcp19,rcp20,rcp26,rcp37,rcp45,rcp60,rcp70,rcp85/

all_delayPolicy "all possible SPA policy choices"
/
Expand Down
7 changes: 7 additions & 0 deletions main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,13 @@ $setGlobal cm_reducCostB none !! def = none
*** cfg$gms$cm_effHP <- 5 #def <- 5 , efficiency of heat pumps
$setGlobal cm_effHP 5 !! def = 5

*** cm_climateCorrection "enable or disable climate correction for buildings energy demand"
*** def = "off", climate correction is disabled and pm_climateCorrection is set to 1.0 for all iterations
*** (on): climate correction is enabled and correction factors are calculated iteratively using
*** external R scripts (climateAssessmentInterimRun.R and calculateClimateCorrection.R)
*** to adjust building energy demand based on climate conditions
$setGlobal cm_climateCorrection off !! def = off

*** Note on CES markup cost:
*** They represent the sector-specific demand-side transformation cost, can also
*** be used to influence efficiencies during calibration as higher markup-cost
Expand Down
3 changes: 2 additions & 1 deletion modules/36_buildings/simple/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ q36_demFeBuild(ttot,regi,entyFe,emiMkt)$(ttot.val ge cm_startyear
sum(in$(fe2ppfEn(entyFe,in)
AND ppfen_buildings_dyn36(in)),
vm_cesIO(ttot,regi,in)
+ pm_cesdata(ttot,regi,in,"offset_quantity")
+ (pm_climateCorrection(ttot,regi,in) - 1) * vm_cesIO.l(ttot,regi,in)
+ pm_cesdata(ttot,regi,in,"offset_quantity")
)$(sameas(emiMkt,"ES"))
;

Expand Down
22 changes: 21 additions & 1 deletion modules/36_buildings/simple/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,28 @@
*** SOF ./modules/36_buildings/simple/postsolve.gms

*** calculation of FE Buildings Prices (useful for internal use and reporting purposes)
pm_FEPrice(ttot,regi,entyFe,"build",emiMkt)$(abs(qm_budget.m(ttot,regi)) gt sm_eps) =
pm_FEPrice(ttot,regi,entyFe,"build",emiMkt)$(abs(qm_budget.m(ttot,regi)) gt sm_eps) =
q36_demFeBuild.m(ttot,regi,entyFe,emiMkt)
/ qm_budget.m(ttot,regi);

*** Climate correction handling
*** Only run climate assessment from iteration 2 onwards to ensure all postsolve calculations are complete
*** (reportEmiForClimateAssessment requires industry variables calculated in module 37)
$ifthen.climateCorr not "%cm_climateCorrection%" == "off"
if(iteration.val gt 1,

Execute_Unload 'fulldata_postsolve';

*** Execute climate assessment script
Execute "Rscript climateAssessmentInterimRun.R";

*** Call R script to calculate climate correction factors
Execute "Rscript calculateClimateCorrection.R";

*** Load climate correction factors
execute_load "pm_ClimateCorrection.gdx", pm_climateCorrection;

);
$endif.climateCorr

*** EOF ./modules/36_buildings/simple/postsolve.gms
6 changes: 6 additions & 0 deletions modules/36_buildings/simple/presolve.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*** Initialize climate correction factors to 1.0
*** - Always if climate correction is off
*** - In first iteration if climate correction is on
if(iteration.val eq 1 OR sameas("%cm_climateCorrection%","off"),
pm_climateCorrection(ttot,all_regi,ppfen_buildings_dyn36) = 1.0;
);
1 change: 1 addition & 0 deletions modules/36_buildings/simple/realization.gms
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ $Ifi "%phase%" == "declarations" $include "./modules/36_buildings/simple/declara
$Ifi "%phase%" == "datainput" $include "./modules/36_buildings/simple/datainput.gms"
$Ifi "%phase%" == "equations" $include "./modules/36_buildings/simple/equations.gms"
$Ifi "%phase%" == "bounds" $include "./modules/36_buildings/simple/bounds.gms"
$Ifi "%phase%" == "presolve" $include "./modules/36_buildings/simple/presolve.gms"
$Ifi "%phase%" == "postsolve" $include "./modules/36_buildings/simple/postsolve.gms"
*######################## R SECTION END (PHASES) ###############################
*** EOF ./modules/36_buildings/simple/realization.gms
12 changes: 12 additions & 0 deletions scripts/input/calculateClimateCorrection.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# | (C) 2006-2024 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: remind@pik-potsdam.de

# Load the local climbed package for development
devtools::load_all("/p/tmp/hagento/dev/climbed")

# Calculate climate correction factors
climbed::computeClimateCorrection()
3 changes: 2 additions & 1 deletion scripts/input/climateAssessmentInterimRun.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ runTimes <- c(runTimes, "write_gdx start" = Sys.time())
# Map climate assessment variables to REMIND/GAMS
varmap <- c(
'Surface Air Temperature Change' = 'pm_globalMeanTemperature',
'Effective Radiative Forcing|Anthropogenic' = 'p15_forc_magicc'
'Effective Radiative Forcing|Anthropogenic' = 'p15_forc_magicc',
'Atmospheric Concentrations|CO2' = 'p15_co2_conc'
)

# Postprocess by renaming IAMC-style `period` (year) column to REMIND compatible `tall` set & using this as sole index
Expand Down
Loading