Skip to content

Refactor buildings ces tree#2331

Open
hagento wants to merge 4 commits into
remindmodel:developfrom
hagento:buildingsCEStree
Open

Refactor buildings ces tree#2331
hagento wants to merge 4 commits into
remindmodel:developfrom
hagento:buildingsCEStree

Conversation

@hagento
Copy link
Copy Markdown

@hagento hagento commented Apr 14, 2026

Purpose of this PR

This PR refactors REMIND's buildings CES tree structure to provide more granular representation of electricity end-uses and removes unnecessary calibration bounds.

Type of change

Key changes:

  • Moved non-heating electricity uses (feelalb, feelictb, feelscb) to be direct children of enb rather than aggregated in feelcb.
  • Added 28 granular final energy carrier-enduse categories (e.g., space_heating_elecHP_fe, water_heating_natgas_fe) to support future post-processing.
  • Removed MEA region-specific calibration bound relaxations for buildings variables that are no longer needed with the improved CES structure since they lead to unreasonable results.

New Buildings CES Structure

graph TD
    en["en (total energy)"]
    enb["enb (buildings energy)"]
    enhb["enhb (buildings heating energy)"]
    enhgab["enhgab (gases)"]

    fesob["fesob (solids)"]
    fehob["fehob (liquids)"]
    feheb["feheb (district heat)"]
    feelhpb["feelhpb (electricity for heat pumps)"]
    feelrhcob["feelrhcob (electricity for resistive heating and cooking)\n[RENAMED from feelrhb]"]

    fegab["fegab (natural gas)"]
    feh2b["feh2b (hydrogen)"]

    feelalb["feelalb (electricity for appliances and lighting)\n[NEW - was part of feelcb]"]
    feelictb["feelictb (electricity for ICT)\n[NEW - was part of feelcb]"]
    feelscb["feelscb (electricity for space cooling)\n[NEW - was part of feelcb]"]

    en --> enb
    enb --> enhb
    enb --> feelalb
    enb --> feelictb
    enb --> feelscb

    enhb --> fesob
    enhb --> fehob
    enhb --> feheb
    enhb --> feelhpb
    enhb --> feelrhcob
    enhb --> enhgab

    enhgab --> fegab
    enhgab --> feh2b
Loading

Changes from previous structure:

  • feelcb (conventional electricity) → split into feelalb, feelictb, feelscb
  • feelrhb (resistive heating electricity) → renamed to feelrhcob since it also includes electric cooking

Parts concerned

  • ☑️ GAMS Code
  • ◻️ R-scripts
  • ◻️ Documentation (GAMS incode documentation, comments, tutorials)
  • ☑️ Input data / CES parameters
  • ◻️ Tests, CI/CD (continuous integration/deployment)
  • ◻️ Configuration (switches in main.gms, default.cfg, and scenario_config*.csv files)
  • ◻️ Other (please give a description)

Impact

  • ◻️ Bug fix
  • ☑️.\ Refactoring
  • ◻️ New feature
  • ☑️.\ Change of parameter values or input data (including CES parameters)
  • ◻️ Minor change (default scenarios show only small differences)
  • ◻️ Fundamental change of results of default scenarios

Checklist

Do not delete any line. Leave unfinished elements unchecked so others know how far along you are.
In the end all checkboxes must be ticked before you can merge
.

  • [x ] I executed the automated model tests (make test) after my final commit and all tests pass (FAIL 0)
  • [ x] I adjusted the reporting in remind2 if and where it was needed
  • [ x] I adjusted the madrat packages (mrremind and other packages involved) for input data generation if and where it was needed
  • [x ] My code follows the coding etiquette
  • [x ] I explained my changes within the PR, particularly in hard-to-understand areas
  • [ x] I checked that the in-code documentation is up-to-date
  • [x ] I adjusted forbiddenColumnNames in readCheckScenarioConfig.R in case the PR leads to deprecated switches
  • [ x] I updated the CHANGELOG.md correctly (added, changed, fixed, removed, input data/calibration)

Further information (optional)

I ran a full scenario_config without any convergence issues (see runs below). I aggregated the runs with the new ces tree to the resolution of the old tree and could only spot slight differences due to different baselines from non-heating electricity and resistive heating electricity which are expected due to the shift of electricity from cooking from one quantity to the other in the new ces structure.

  • Runs with these changes are here in /p/tmp/hagento/dev/REMIND/develop/remind/output:
    • SSP1-EU21-NPi2025-ces_2026-05-29_10.56.30
    • SSP1-EU21-PkBudg750-ces_2026-05-29_10.56.40
    • SSP1-NDC-ces_2026-05-29_10.43.38
    • SSP1-NPi2025-ces_2026-05-29_10.43.47
    • SSP1-PkBudg1000-ces_2026-05-29_10.44.06
    • SSP1-PkBudg750-ces_2026-05-29_10.43.57
    • SSP2-EU21-NPi2025-ces_2026-05-29_08.59.42
    • SSP2-EU21-PkBudg1000-ces_2026-05-29_10.56.21
    • SSP2-EU21-PkBudg650-ces_2026-05-29_10.56.02
    • SSP2-EU21-PkBudg750-ces_2026-05-29_10.56.11
    • SSP2-EcBudg500-ces_2026-05-29_10.42.40
    • SSP2-NDC-LTS-ces_2026-05-29_10.41.43
    • SSP2-NDC-ces_2026-05-29_10.41.53
    • SSP2-NPi-ces_2026-05-29_08.58.55
    • SSP2-NPi2025-ces_2026-05-29_08.59.19
    • SSP2-PkBudg1000-ces_2026-05-29_10.42.30
    • SSP2-PkBudg650-ces_2026-05-29_10.42.02
    • SSP2-PkBudg750-ces_2026-05-29_10.42.11
    • SSP2-PkBudg750_wo100EJBiobound-ces_2026-05-29_10.42.21
    • SSP2-rollBack-ces_2026-05-29_10.42.49
    • SSP3-NDC-ces_2026-05-29_10.42.59
    • SSP3-NPi2025-ces_2026-05-29_10.43.09
    • SSP3-PkBudg1000-ces_2026-05-29_10.43.18
    • SSP3-rollBack-ces_2026-05-29_10.43.28
  • Comparison of results (what changes by this PR?):
    • /p/tmp/hagento/dev/REMIND/develop/remind/compScen-cesSSP1New-2026-06-01_10.25.09-H12.pdf
    • /p/tmp/hagento/dev/REMIND/develop/remind/compScen-cesSSP2New-2026-06-01_10.25.56-H12.pdf
    • /p/tmp/hagento/dev/REMIND/develop/remind/compScen-cesSSP3New-2026-06-01_10.24.14-H12.pdf

@hagento hagento added the enhancement New feature or request label Apr 14, 2026
Copy link
Copy Markdown
Contributor

@ricardarosemann ricardarosemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good - I only think that we can probably delete/skip some of the things that you have added or modified. I'm happy to help if you have questions on this.

Comment thread core/sets.gms Outdated
Comment thread core/sets.gms Outdated
Comment on lines +374 to +401
appliances_light_elec_fe "buildings appliances and lighting electricity"
appliances_light_natgas_fe "buildings appliances and lighting natural gas"
appliances_light_petrol_fe "buildings appliances and lighting petrol"
cooking_biomod_fe "buildings cooking modern biomass"
cooking_biotrad_fe "buildings cooking traditional biomass"
cooking_coal_fe "buildings cooking coal"
cooking_elec_fe "buildings cooking electricity"
cooking_natgas_fe "buildings cooking natural gas"
cooking_petrol_fe "buildings cooking petrol"
ict_elec_fe "buildings information communication technology electricity"
space_cooling_elec_fe "buildings space cooling electricity"
space_cooling_heat_fe "buildings space cooling district heat"
space_heating_biomod_fe "buildings space heating modern biomass"
space_heating_biotrad_fe "buildings space heating traditional biomass"
space_heating_coal_fe "buildings space heating coal"
space_heating_elecHP_fe "buildings space heating electricity heat pump"
space_heating_elecRH_fe "buildings space heating electricity resistive heating"
space_heating_heat_fe "buildings space heating district heat"
space_heating_natgas_fe "buildings space heating natural gas"
space_heating_petrol_fe "buildings space heating petrol"
water_heating_biomod_fe "buildings water heating modern biomass"
water_heating_biotrad_fe "buildings water heating traditional biomass"
water_heating_coal_fe "buildings water heating coal"
water_heating_elecHP_fe "buildings water heating electricity heat pump"
water_heating_elecRH_fe "buildings water heating electricity resistive heating"
water_heating_heat_fe "buildings water heating district heat"
water_heating_natgas_fe "buildings water heating natural gas"
water_heating_petrol_fe "buildings water heating petrol"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty certain we don't need this here. The dimension of the object that the buildings input data is read into is all_in not all_enty. So if we only need these entries for reporting, they should only exist in all_in.

Copy link
Copy Markdown
Author

@hagento hagento May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried running the model without these entries in all_enty and it turns out that they're used as indices in vm_emiFgas(ttot,all_regi,all_enty) and GAMS throws domain violation errors during compilation when removing them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's very weird - vm_emiFgas should only contain entries of all_enty related to F-gases. Maybe you can check the file core/input/f_emiFgas.cs4r in your runs (which is where vm_emiFgas gets its data from), this should not contain any of our variables.
If it turns out we need the detailed edgebuildings variables in all_enty for some reasons related to buildings or at least FE demand, fair enough, but this makes no sense, so I think we should take the time to investigate.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also a bit puzzled by that. I tried to reproduce the error but can't and core/input/f_emiFgas.cs4r does not contain any buildings-related variables as expected so should be all good.

Comment thread modules/36_buildings/simple/sets.gms Outdated
@hagento hagento force-pushed the buildingsCEStree branch 2 times, most recently from 2087f25 to 4c2d12e Compare May 27, 2026 08:38
@hagento hagento force-pushed the buildingsCEStree branch from 4c2d12e to 8813912 Compare June 1, 2026 14:08
@hagento hagento marked this pull request as ready for review June 1, 2026 14:08
Copy link
Copy Markdown
Contributor

@ricardarosemann ricardarosemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, it looks all good, thanks! I also checked the compScens and they look fine to me, too. I only noticed one thing: In SSP2 there is a notable difference in liquids demand for transport in the NPi-scenario. I don't quite see how this could be related to your changes, so it might make sense to briefly verify whether this deviation can come from somewhere else - maybe input data differs between the "ces"-scenario and the default one?

Apart from that you definitely need to put a new input revision and possibly a new CES commit hash. My take is that you also need to generate new input data and recalibrate, but please check on this with Lavinia if you're unsure.

Comment thread config/default.cfg
Comment on lines -31 to -34
cfg$inputRevision <- "7.95"
cfg$inputRevision <- "7.91ces"

#### Current CES parameter and GDX revision (commit hash) ####
cfg$CESandGDXversion <- "dec24b712ce59db95bb4385ba71ec9a4cd921041"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the final merge you still need to put an up to date revision without a development suffix and make sure that the CES commit hash lies in the group-wide calibration repo and not in a local one (which I haven't checked). This means in my view you'd need to regenerate input data and recalibrate - if you want to skip this, please check with Lavinia first.

@hagento
Copy link
Copy Markdown
Author

hagento commented Jun 2, 2026

Thanks for your comments @ricardarosemann. I wanted to update the inputRevision as soon as you checked the changes - I will let you know when the fresh calibrations ran through. As far as the deviations are concerned, I saw that there is a different rent package version for the input data for the new CES tree as compared to the develop branch - this is most-likely the reason for the deviations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants