From c283f4036a46116df50bf4b37a98c0d375202c0f Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Thu, 21 Aug 2025 15:39:46 +0200 Subject: [PATCH 1/8] remove deprecated internal emissions reporting --- core/declarations.gms | 32 ------ core/postsolve.gms | 222 ------------------------------------------ 2 files changed, 254 deletions(-) diff --git a/core/declarations.gms b/core/declarations.gms index 527a4fd1ea..5ba8178c9b 100644 --- a/core/declarations.gms +++ b/core/declarations.gms @@ -147,38 +147,6 @@ p_efFossilFuelExtrGlo(all_enty,all_enty) "CH4 and N2O emission facto *** share of stored carbon in captured carbon pm_share_CCS_CCO2(ttot,all_regi) "share of stored CO2 from total captured CO2 from previous iteration [share]" - -*** can be removed? - -*** output parameters of deprecated internal emissions reporting -o_emissions(ttot,all_regi,all_enty) "output parameter" -o_emissions_bunkers(ttot,all_regi,all_enty) "output parameter" -o_emissions_energy(ttot,all_regi,all_enty) "output parameter" -o_emissions_energy_demand(ttot,all_regi,all_enty) "output parameter" -o_emissions_energy_demand_sector(ttot,all_regi,all_enty,emi_sectors) "output parameter" -o_emissions_energy_supply_gross(ttot,all_regi,all_enty) "output parameter" -o_emissions_energy_supply_gross_carrier(ttot,all_regi,all_enty,all_enty) "output parameter" -o_emissions_energy_extraction(ttot,all_regi,all_enty,all_enty) "output parameter" -o_emissions_energy_negative(ttot,all_regi,all_enty) "output parameter" -o_emissions_industrial_processes(ttot,all_regi,all_enty) "output parameter" -o_emissions_AFOLU(ttot,all_regi,all_enty) "output parameter" -o_emissions_CDRmodule(ttot,all_regi,all_enty) "output parameter" -o_emissions_other(ttot,all_regi,all_enty) "output parameter" - -o_capture(ttot,all_regi,all_enty) "output parameter" -o_capture_energy(ttot,all_regi,all_enty) "output parameter" -o_capture_energy_elec(ttot,all_regi,all_enty) "output parameter" -o_capture_energy_other(ttot,all_regi,all_enty) "output parameter" -o_capture_cdr(ttot,all_regi,all_enty) "output parameter" -o_capture_industry(ttot,all_regi,all_enty) "output parameter" -o_capture_energy_bio(ttot,all_regi,all_enty) "output parameter" -o_capture_energy_fos(ttot,all_regi,all_enty) "output parameter" -o_carbon_CCU(ttot,all_regi,all_enty) "output parameter" -o_carbon_LandUse(ttot,all_regi,all_enty) "output parameter" -o_carbon_underground(ttot,all_regi,all_enty) "output parameter" -o_carbon_reemitted(ttot,all_regi,all_enty) "output parameter" - -o_emi_conv(all_enty) "output parameter" / co2 3666.6666666666666666666666666667, ch4 28, n2o 416.4286, so2 1, bc 1, oc 1 / ; *** ------------- Emissions Variables ---------------------------------------- diff --git a/core/postsolve.gms b/core/postsolve.gms index cac5381a97..18d75df334 100644 --- a/core/postsolve.gms +++ b/core/postsolve.gms @@ -126,228 +126,6 @@ pm_PEPrice(ttot,regi,entyPe)$(abs (qm_budget.m(ttot,regi)) gt sm_eps) = *** calculate share of stored CO2 from captured CO2 pm_share_CCS_CCO2(t,regi) = sum(teCCS2rlf(te,rlf), vm_co2CCS.l(t,regi,"cco2","ico2",te,rlf)) / (sum(teCCS2rlf(te,rlf), v_co2capture.l(t,regi,"cco2","ico2",te,rlf))+sm_eps); -*** emissions reporting helper parameters -o_emissions_bunkers(ttot,regi,emi)$(ttot.val ge 2005) = - sum(se2fe(enty,enty2,te), - pm_emifac(ttot,regi,enty,enty2,te,emi) - * vm_demFeSector.l(ttot,regi,enty,enty2,"trans","other") - )*o_emi_conv(emi); - -o_emissions(ttot,regi,emi)$(ttot.val ge 2005) = - sum(emiMkt, vm_emiAllMkt.l(ttot,regi,emi,emiMkt))*o_emi_conv(emi) - - o_emissions_bunkers(ttot,regi,emi); - -*** note! this still excludes industry CCS and CCU. To fix. -o_emissions_energy(ttot,regi,emi)$(ttot.val ge 2005) = - sum(emiMkt, vm_emiTeMkt.l(ttot,regi,emi,emiMkt))*o_emi_conv(emi) - - o_emissions_bunkers(ttot,regi,emi); - -*** note! this still excludes industry CCS. To fix. -o_emissions_energy_demand(ttot,regi,emi)$(ttot.val ge 2005) = - sum(sector2emiMkt(sector,emiMkt), - sum(se2fe(enty,enty2,te), - pm_emifac(ttot,regi,enty,enty2,te,emi) - * vm_demFeSector.l(ttot,regi,enty,enty2,sector,emiMkt) - ) - )*o_emi_conv(emi) - - o_emissions_bunkers(ttot,regi,emi) -; - -*** note! this still excludes industry CCS. To fix. -o_emissions_energy_demand_sector(ttot,regi,emi,sector)$(ttot.val ge 2005) = - sum(emiMkt$sector2emiMkt(sector,emiMkt), - sum(se2fe(enty,enty2,te), - pm_emifac(ttot,regi,enty,enty2,te,emi) * vm_demFeSector.l(ttot,regi,enty,enty2,sector,emiMkt) - ) - )*o_emi_conv(emi) - + - (sum(emiMacSector$(emiMac2sector(emiMacSector,"trans","process",emi)), - vm_emiMacSector.l(ttot,regi,emiMacSector) - )*o_emi_conv(emi) - - o_emissions_bunkers(ttot,regi,emi) - )$(sameas(sector,"trans")) - + - (sum(emiMacSector$(emiMac2sector(emiMacSector,"waste","process",emi)), - vm_emiMacSector.l(ttot,regi,emiMacSector) - )*o_emi_conv(emi) - )$(sameas(sector,"waste")) -; - -o_emissions_energy_extraction(ttot,regi,emi,entyPe)$(ttot.val ge 2005) = -*** emissions from non-conventional fuel extraction - ( - ( sum(emi2fuelMine(emi,entyPe,rlf), - p_cint(regi,emi,entyPe,rlf) - * vm_fuExtr.l(ttot,regi,entyPe,rlf) - )$( c_cint_scen eq 1 ) - ) -*** emissions from conventional fuel extraction - + ( sum(pe2rlf(entyPe,rlf2),sum(enty2, - (pm_cintraw(enty2) - * pm_fuExtrOwnCons(regi, enty2, entyPe) - * vm_fuExtr.l(ttot,regi,entyPe,rlf2) - )$(pm_fuExtrOwnCons(regi, entyPe, enty2) gt 0) - )) - ) - )*o_emi_conv(emi) - + - (sum(emiMacSector$(emiMac2sector("ch4coal","extraction","process",emi)), - vm_emiMacSector.l(ttot,regi,emiMacSector) - )*o_emi_conv(emi) - )$(sameas(entyPe,"pecoal")) - + - (sum(emiMacSector$(emiMac2sector("ch4gas","extraction","process",emi)), - vm_emiMacSector.l(ttot,regi,emiMacSector) - )*o_emi_conv(emi) - )$(sameas(entyPe,"pegas")) - + - (sum(emiMacSector$(emiMac2sector("ch4oil","extraction","process",emi)), - vm_emiMacSector.l(ttot,regi,emiMacSector) - )*o_emi_conv(emi) - )$(sameas(entyPe,"peoil")) -; - - -o_emissions_energy_supply_gross(ttot,regi,emi)$(ttot.val ge 2005) = - sum(pe2se(entyPe,entySe,te)$(pm_emifac(ttot,regi,entyPe,entySe,te,emi)>0), - pm_emifac(ttot,regi,entyPe,entySe,te,emi) - * vm_demPe.l(ttot,regi,entyPe,entySe,te) - )*o_emi_conv(emi) - + - sum(entyPe, o_emissions_energy_extraction(ttot,regi,emi,entyPe)) -; - -o_emissions_energy_supply_gross_carrier(ttot,regi,emi,entySe)$(ttot.val ge 2005) = - sum((entyPe,te)$(pe2se(entyPe,entySe,te) AND (pm_emifac(ttot,regi,entyPe,entySe,te,emi)>0)), - pm_emifac(ttot,regi,entyPe,entySe,te,emi) - * vm_demPe.l(ttot,regi,entyPe,entySe,te) - )*o_emi_conv(emi) - + - ( - o_emissions_energy_extraction(ttot,regi,emi,"pecoal") - )$(sameas(entySe,"sesofos")) - + - ( - o_emissions_energy_extraction(ttot,regi,emi,"pegas") - )$(sameas(entySe,"segafos")) - + - ( - o_emissions_energy_extraction(ttot,regi,emi,"peoil") - )$(sameas(entySe,"seliqfos")) -; - -o_emissions_energy_negative(ttot,regi,emi)$(ttot.val ge 2005) = - ( - sum(pe2se(entyPe,entySe,te)$(pm_emifac(ttot,regi,entyPe,entySe,te,emi)<0), - pm_emifac(ttot,regi,entyPe,entySe,te,emi) - * vm_demPe.l(ttot,regi,entyPe,entySe,te) - ) - + - sum((ccs2Leak(enty,enty2,te,emi),teCCS2rlf(te,rlf)), - pm_emifac(ttot,regi,enty,enty2,te,emi) - * vm_co2CCS.l(ttot,regi,enty,enty2,te,rlf) - ) -*** Industry CCS emissions - - sum(emiInd37_fuel, - vm_emiIndCCS.l(ttot,regi,emiInd37_fuel) - )$( sameas(emi,"co2") ) - )*o_emi_conv(emi) -; - -o_emissions_industrial_processes(ttot,regi,emi)$(ttot.val ge 2005) = - sum(emiMacSector$(emiMac2sector(emiMacSector,"indst","process",emi)), - vm_emiMacSector.l(ttot,regi,emiMacSector) - )*o_emi_conv(emi); - -o_emissions_AFOLU(ttot,regi,emi)$(ttot.val ge 2005) = - sum(emiMacSector$(emiMac2sector(emiMacSector,"agriculture","process",emi) OR emiMac2sector(emiMacSector,"lulucf","process",emi)), - vm_emiMacSector.l(ttot,regi,emiMacSector) - )*o_emi_conv(emi); - -o_emissions_CDRmodule(ttot,regi,emi)$(ttot.val ge 2005) = - vm_emiCdr.l(ttot,regi,emi)*o_emi_conv(emi) -; - -o_emissions_other(ttot,regi,emi)$(ttot.val ge 2005) = - pm_emiExog(ttot,regi,emi)*o_emi_conv(emi) -; - -***Carbon Management|Carbon Capture (Mt CO2/yr) -o_capture(ttot,regi,"co2")$(ttot.val ge 2005) = - sum(teCCS2rlf(te,rlf), - v_co2capture.l(ttot,regi,"cco2","ico2","ccsinje",rlf) - )*o_emi_conv("co2"); - -***Carbon Management|Carbon Capture|Process|Energy (Mt CO2/yr) -o_capture_energy(ttot,regi,"co2")$(ttot.val ge 2005) = - sum(emi2te(enty3,enty4,te2,"cco2"), - vm_emiTeDetail.l(ttot,regi,enty3,enty4,te2,"cco2") - )*o_emi_conv("co2"); - -***Carbon Management|Carbon Capture|Process|Energy|Electricity (Mt CO2/yr) -o_capture_energy_elec(ttot,regi,"co2")$(ttot.val ge 2005) = - sum(emi2te(enty3,enty4,te2,"cco2")$(sameas(enty4,"seel")), - vm_emiTeDetail.l(ttot,regi,enty3,enty4,te2,"cco2") - )*o_emi_conv("co2"); - -***Carbon Management|Carbon Capture|Process|Energy|Other (Mt CO2/yr) -o_capture_energy_other(ttot,regi,"co2")$(ttot.val ge 2005) = - sum(emi2te(enty3,enty4,te2,"cco2")$(NOT(sameas(enty4,"seel"))), - vm_emiTeDetail.l(ttot,regi,enty3,enty4,te2,"cco2") - )*o_emi_conv("co2"); - -***Carbon Management|Carbon Capture|Process|Direct Air Capture (Mt CO2/yr) -o_capture_cdr(ttot,regi,"co2")$(ttot.val ge 2005) = - sum(teCCS2rlf("ccsinje",rlf), - vm_co2capture_cdr.l(ttot,regi,"cco2","ico2","ccsinje",rlf) - )*o_emi_conv("co2"); - -***Carbon Management|Carbon Capture|Process|Industrial Processes (Mt CO2/yr) -o_capture_industry(ttot,regi,"co2")$(ttot.val ge 2005) = - sum(emiInd37, - vm_emiIndCCS.l(ttot,regi,emiInd37) - )*o_emi_conv("co2") -; - -***Carbon Management|Carbon Capture|Primary Energy|Biomass (Mt CO2/yr) -o_capture_energy_bio(ttot,regi,"co2")$(ttot.val ge 2005) = - sum(enty3$peBio(enty3), - sum(emi2te(enty3,enty4,te2,"cco2"), - vm_emiTeDetail.l(ttot,regi,enty3,enty4,te2,"cco2") - ) - )*o_emi_conv("co2"); - -***Carbon Management|Carbon Capture|Primary Energy|Fossil (Mt CO2/yr) -o_capture_energy_fos(ttot,regi,"co2")$(ttot.val ge 2005) = - sum(enty3$(NOT(peBio(enty3))), - sum(emi2te(enty3,enty4,te2,"cco2"), - vm_emiTeDetail.l(ttot,regi,enty3,enty4,te2,"cco2") - ) - )*o_emi_conv("co2"); - -***Carbon Management|CCU (Mt CO2/yr) -o_carbon_CCU(ttot,regi,"co2")$(ttot.val ge 2005) = - sum(teCCU2rlf(te2,rlf), - vm_co2CCUshort.l(ttot,regi,"cco2","ccuco2short",te2,rlf) - )*o_emi_conv("co2"); - -***Carbon Management|Land Use (Mt CO2/yr) -o_carbon_LandUse(ttot,regi,"co2")$(ttot.val ge 2005) = - vm_emiMacSector.l(ttot,regi,"co2luc") - *o_emi_conv("co2"); - -***Carbon Management|Underground Storage (Mt CO2/yr) -o_carbon_underground(ttot,regi,"co2")$(ttot.val ge 2005) = - sum(teCCS2rlf(te,rlf), - vm_co2CCS.l(ttot,regi,"cco2","ico2",te,rlf) - )*o_emi_conv("co2") -; - -***Carbon Management|Carbon Re-emitted (Mt CO2/yr) -o_carbon_reemitted(ttot,regi,"co2")$(ttot.val ge 2005) = - v_co2capturevalve.l(ttot,regi) - *o_emi_conv("co2") -; *CG**ML*: capital interest rate p_r(ttot,regi)$(ttot.val gt 2005 and ttot.val le 2130) From 17c8f625ff683bb3c7f29f14d02cd1dd389d9666 Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Thu, 21 Aug 2025 16:44:26 +0200 Subject: [PATCH 2/8] move pm_share_trans to module 11 --- core/datainput.gms | 22 ------------- core/declarations.gms | 2 -- core/presolve.gms | 3 -- modules/11_aerosols/exoGAINS/datainput.gms | 33 ++++++++++++++++--- modules/11_aerosols/exoGAINS/declarations.gms | 2 ++ modules/11_aerosols/exoGAINS/presolve.gms | 10 ++++-- 6 files changed, 37 insertions(+), 35 deletions(-) diff --git a/core/datainput.gms b/core/datainput.gms index ee91a9c746..0c1a2eb5dc 100644 --- a/core/datainput.gms +++ b/core/datainput.gms @@ -570,28 +570,6 @@ $include "./core/input/p_share_ind_fesos_bio.cs4r" $offdelim /; -*** initialize pm_share_trans with the global value, will be updated after each negishi/nash iteration -pm_share_trans("2005",regi) = 0.617; -pm_share_trans("2010",regi) = 0.625; -pm_share_trans("2015",regi) = 0.626; -pm_share_trans("2020",regi) = 0.642; -pm_share_trans("2025",regi) = 0.684; -pm_share_trans("2030",regi) = 0.710; -pm_share_trans("2035",regi) = 0.727; -pm_share_trans("2040",regi) = 0.735; -pm_share_trans("2045",regi) = 0.735; -pm_share_trans("2050",regi) = 0.742; -pm_share_trans("2055",regi) = 0.736; -pm_share_trans("2060",regi) = 0.751; -pm_share_trans("2070",regi) = 0.774; -pm_share_trans("2080",regi) = 0.829; -pm_share_trans("2090",regi) = 0.810; -pm_share_trans("2100",regi) = 0.829; -pm_share_trans("2110",regi) = 0.818; -pm_share_trans("2130",regi) = 0.865; -pm_share_trans("2150",regi) = 0.872; - - $ifthen.tech_CO2capturerate not "%c_tech_CO2capturerate%" == "off" p_PECarriers_CarbonContent(peFos)=pm_cintraw(peFos); *** From conversation: 25 GtC/ZJ is the assumed carbon content of PE biomass (makes default bioh2c capture rate 90%) diff --git a/core/declarations.gms b/core/declarations.gms index 5ba8178c9b..fd9af30000 100644 --- a/core/declarations.gms +++ b/core/declarations.gms @@ -29,8 +29,6 @@ p_pvpRef(ttot,all_enty) "Price on commodity markets p_pvpRegiBeforeStartYear(ttot,all_regi,all_enty) "prices of traded commodities before start year - regional. only used for permit trade [T$/GtC]" pm_ies(all_regi) "intertemporal elasticity of substitution", -*** only used in air pollutants module, move there? -pm_share_trans(tall,all_regi) "share of transport FE liquids (fedie and fepet) and all FE liquids [share]" *** macro variables from gdx or previous iteration pm_gdp_gdx(tall,all_regi) "GDP path from gdx, updated iteratively [T$]" diff --git a/core/presolve.gms b/core/presolve.gms index c7c3654b47..5d9898f645 100644 --- a/core/presolve.gms +++ b/core/presolve.gms @@ -9,9 +9,6 @@ * defining the CO2 price parameter that sums up the 3 CO2eq tax components pm_taxCO2eqSum(ttot,regi) = pm_taxCO2eq(ttot,regi) + pm_taxCO2eqRegi(ttot,regi) + pm_taxCO2eqSCC(ttot,regi); -*JeS* calculate share of transport fuels in liquids -pm_share_trans(ttot,regi)$(ttot.val ge 2005) = sum(se2fe(entySe,entyFe,te)$(seAgg2se("all_seliq",entySe) AND ( sameas(entyFe,"fepet") OR sameas(entyFe,"fedie"))), vm_prodFe.l(ttot,regi,entySe,entyFe,te)) / (sum(se2fe(entySe,entyFe,te)$seAgg2se("all_seliq",entySe), vm_prodFe.l(ttot,regi,entySe,entyFe,te)) + 0.0000001); - *AJS* we need those in nash pm_capCum0(ttot,regi,teLearn)$( (ttot.val ge 2005) and (pm_SolNonInfes(regi) eq 1)) = vm_capCum.l(ttot,regi,teLearn); pm_co2eq0(ttot,regi)$( (ttot.val ge 2005) and (pm_SolNonInfes(regi) eq 1)) = vm_co2eq.l(ttot,regi); diff --git a/modules/11_aerosols/exoGAINS/datainput.gms b/modules/11_aerosols/exoGAINS/datainput.gms index c9fdd9d8c1..f895f3843d 100644 --- a/modules/11_aerosols/exoGAINS/datainput.gms +++ b/modules/11_aerosols/exoGAINS/datainput.gms @@ -5,6 +5,29 @@ *** | REMIND License Exception, version 1.0 (see LICENSE file). *** | Contact: remind@pik-potsdam.de *** SOF ./modules/11_aerosols/exoGAINS/datainput.gms + + +*** initialize p11_share_trans with the global value, will be updated after each negishi/nash iteration +p11_share_trans("2005",regi) = 0.617; +p11_share_trans("2010",regi) = 0.625; +p11_share_trans("2015",regi) = 0.626; +p11_share_trans("2020",regi) = 0.642; +p11_share_trans("2025",regi) = 0.684; +p11_share_trans("2030",regi) = 0.710; +p11_share_trans("2035",regi) = 0.727; +p11_share_trans("2040",regi) = 0.735; +p11_share_trans("2045",regi) = 0.735; +p11_share_trans("2050",regi) = 0.742; +p11_share_trans("2055",regi) = 0.736; +p11_share_trans("2060",regi) = 0.751; +p11_share_trans("2070",regi) = 0.774; +p11_share_trans("2080",regi) = 0.829; +p11_share_trans("2090",regi) = 0.810; +p11_share_trans("2100",regi) = 0.829; +p11_share_trans("2110",regi) = 0.818; +p11_share_trans("2130",regi) = 0.865; +p11_share_trans("2150",regi) = 0.872; + ***---------------------------------- *** Using EDGE-downscaling procedure ***---------------------------------- @@ -153,14 +176,14 @@ loop ((t,regi)$( t.val ge 2005 ), = 1 - p11_share_sector(t,"seliqfos","fehos","tdfoshos","indst",regi); p11_share_sector(t,"peoil","seliqfos","refliq","trans",regi) - = pm_share_trans(t,regi); + = p11_share_trans(t,regi); p11_share_sector(t,"peoil","seliqfos","refliq","indst",regi) - = (1 - pm_share_trans(t,regi)) + = (1 - p11_share_trans(t,regi)) * p11_share_sector(t,"seliqfos","fehos","tdfoshos","indst",regi); p11_share_sector(t,"peoil","seliqfos","refliq","res",regi) - = (1 - pm_share_trans(t,regi)) + = (1 - p11_share_trans(t,regi)) * (1 - p11_share_sector(t,"seliqfos","fehos","tdfoshos","indst",regi)); !! share in gases @@ -194,8 +217,8 @@ loop(emiExog, ***-- SO2 specific ---- ***-- Oil/Other --- pm_emifac(ttot,regi,"peoil",enty2,"refliq","SO2") = - pm_share_trans(ttot,regi) * p11_emiFacAP(ttot,regi,"peoil",enty2,"refliq","trans","SO2") - + (1-pm_share_trans(ttot,regi)) + p11_share_trans(ttot,regi) * p11_emiFacAP(ttot,regi,"peoil",enty2,"refliq","trans","SO2") + + (1-p11_share_trans(ttot,regi)) * ( p11_share_ind_fehos(ttot,regi) * p11_emiFacAP(ttot,regi,"peoil",enty2,"refliq","indst","SO2") + (1-p11_share_ind_fehos(ttot,regi)) * p11_emiFacAP(ttot,regi,"peoil",enty2,"refliq","res", "SO2") diff --git a/modules/11_aerosols/exoGAINS/declarations.gms b/modules/11_aerosols/exoGAINS/declarations.gms index 6f850e92ca..8afb5a672d 100644 --- a/modules/11_aerosols/exoGAINS/declarations.gms +++ b/modules/11_aerosols/exoGAINS/declarations.gms @@ -20,6 +20,8 @@ p11_emiAPexoAgricult(ttot,all_regi,all_enty,all_exogEmi) "A p11_emiAPexo(ttot,all_regi,all_enty,all_exogEmi) "exogenous emissions from RCP scenarios" +p11_share_trans(tall,all_regi) "share of transport FE liquids (fedie and fepet) and all FE liquids [share]" + *** this parameter is not part of the optimization, but just used in remind2::reportEmiAirPol() to for emissions only accounted at the global level p11_emiAPexoGlob(ttot,all_enty,all_exogEmi) "exogenous emissions for aviation and international shipping from RCP scenarios" ; diff --git a/modules/11_aerosols/exoGAINS/presolve.gms b/modules/11_aerosols/exoGAINS/presolve.gms index 532939aafb..d245818469 100644 --- a/modules/11_aerosols/exoGAINS/presolve.gms +++ b/modules/11_aerosols/exoGAINS/presolve.gms @@ -5,6 +5,10 @@ *** | REMIND License Exception, version 1.0 (see LICENSE file). *** | Contact: remind@pik-potsdam.de *** SOF ./modules/11_aerosols/exoGAINS/presolve.gms + +*JeS* calculate share of transport fuels in liquids +p11_share_trans(ttot,regi)$(ttot.val ge 2005) = sum(se2fe(entySe,entyFe,te)$(seAgg2se("all_seliq",entySe) AND ( sameas(entyFe,"fepet") OR sameas(entyFe,"fedie"))), vm_prodFe.l(ttot,regi,entySe,entyFe,te)) / (sum(se2fe(entySe,entyFe,te)$seAgg2se("all_seliq",entySe), vm_prodFe.l(ttot,regi,entySe,entyFe,te)) + 0.0000001); + *** Update sector shares loop ((t,regi)$( t.val ge 2005 ), !! share in solids @@ -38,14 +42,14 @@ loop ((t,regi)$( t.val ge 2005 ), = 1 - p11_share_sector(t,"seliqfos","fehos","tdfoshos","indst",regi); p11_share_sector(t,"peoil","seliqfos","refliq","trans",regi) - = pm_share_trans(t,regi); + = p11_share_trans(t,regi); p11_share_sector(t,"peoil","seliqfos","refliq","indst",regi) - = (1 - pm_share_trans(t,regi)) + = (1 - p11_share_trans(t,regi)) * p11_share_sector(t,"seliqfos","fehos","tdfoshos","indst",regi); p11_share_sector(t,"peoil","seliqfos","refliq","res",regi) - = (1 - pm_share_trans(t,regi)) + = (1 - p11_share_trans(t,regi)) * (1 - p11_share_sector(t,"seliqfos","fehos","tdfoshos","indst",regi)); !! share in gases From be6ffa3d5189d021be67054ddbb0e0f572dcb1c1 Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Thu, 21 Aug 2025 16:49:04 +0200 Subject: [PATCH 3/8] remove no longer used gdx_rename.sh --- scripts/utils/gdx_rename.sh | 180 ------------------------------------ 1 file changed, 180 deletions(-) delete mode 100644 scripts/utils/gdx_rename.sh diff --git a/scripts/utils/gdx_rename.sh b/scripts/utils/gdx_rename.sh deleted file mode 100644 index d34804973e..0000000000 --- a/scripts/utils/gdx_rename.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/bash -#=========================================================== -# gdx_rename - Change item names -#=========================================================== -# description: gdx_rename calls an R script that -# renames a given list of items. -# author: Jerome Hilaire -# email: hilaire@pik-potsdam.de -# history: -# - 2015-10-08: Updating R script with latest name changes -# - 2015-03-04: Can process a directory containing several gdxs -# - 2015-02-16: Creation -#=========================================================== - -# Check number of arguments -if [ "$#" -lt 1 ]; then - echo 'Please provide a gdx path and optionally a revision number' - echo ' ' - echo 'Example:' - echo 'gdx_rename.sh gdx_path [revision_number]' - exit -1 -fi - -# Check case (single gdx file or directory of gdx?) -echo "Checking case..." -if [ -d $1 ]; then - echo " > directory of gdxs" - f_case="dir" -else - f_validgdx=$(basename $1 | cut -d'.' -f2) - if [ -f $1 ] && [ $f_validgdx == "gdx" ]; then - echo " > single gdx file" - else - echo "Error: please provide a valid gdx file." - exit -1 - fi -fi - -# Generate temporary R script -echo "Generating R script..." -echo " -library(gdx) - -args=(commandArgs(TRUE)) - -# path to the gdx you want to rename -gdx <- args[[1]] - -# renaming parameter and variables -if (length(args) == 1) { - gdx_rename(gdx, - ts = 'pm_ts', - s_earlyreti = 'sm_earlyreti', - s_tgn2pgc = 'sm_tgn2pgc', - regi2RCP_region = 'p_regi_2_MAGICC_regions', - s_tgch42pg = 'sm_tgch42pg', - s_tmp = 'sm_tmp', -# s_c_so2 = 'sm_c_so2', - s_tax_time = 's21_tax_time', - s_tax_value = 's21_tax_value', - conv_cap_2_MioLDV = 'pm_conv_cap_2_MioLDV', - s_before = 's80_before', - s_after = 's80_after', - p_limits_wp4_rcp = 'pm_emiAPexo', - p_ratio_ppp = 'pm_shPPPMER', - p_vintage_in = 'pm_vintage_in', - p_datafe = 'pm_dataFE', - p_ttot_val = 'pm_ttot_val', - p_t_interpolate = 'p80_t_interpolate', - c_iterative_target_adj = 'cm_iterative_target_adj', - c_co2_tax_2020 = 'cm_co2_tax_2020', - c_macscen = 'c_macscen', - c_bioenergy_tax = 'cm_bioenergy_SustTax', - cm_bioenergy_tax = 'cm_bioenergy_SustTax', - cm_bioenergymaxscen = 'cm_maxProdBiolc', - cm_tradecost_bio = 'cm_tradecostBio', - cm_biolc_tech_phaseout = 'cm_phaseoutBiolc', - c_startyear = 'cm_startyear', - c_export_tax_scen = 'c_export_tax_scen', - c_gdximport_target = 'cm_gdximport_target', - c_SSP_forcing_adjust = 'c_SSP_forcing_adjust', - p_share_ind_fesos = 'pm_share_ind_fesos', - p_share_ind_fesos_bio = 'pm_share_ind_fesos_bio', - p_share_trans = 'pm_share_trans', - p_petradecost_Mp_en = 'pm_costsPEtradeMp', - f_data_weathering_graderegi = 'f33_data_weathering_graderegi', - p_nw = 'p80_nw', - c_nucscen = 'cm_nucscen', - q_co2eq = 'q_co2eq', - pm_costsPEtradeMp = 'pm_costsPEtradeMp', - vm_welfare = 'v_welfare', - p21_tau_fe_sub = 'p21_tau_fe_sub', - pm_datapop = 'pm_pop', - p_datalab = 'pm_lab', - p80_pvp = 'pm_pvp', - p80_pvpRegi = 'pm_pvpRegi', -#-- 5152 ----- - p_w = 'pm_w', - v_emicap = 'vm_perm', - v_co2eqGlob = 'vm_co2eqGlob', - v_banking = 'vm_banking', - v_vari = 'vm_cesIO', - v_invest = 'vm_invMacro', - v_deltacap = 'vm_deltaCap', - v_pedem = 'vm_demPe', - v_seprod = 'vm_prodSe', - v_feprod = 'vm_prodFe', - v_fedem = 'v_demFe', - vm_peprod = 'vm_prodPe', - v_sedem = 'v_demSe', -#-- Power module creation - version 7452 ----- - q_limitCapTeChp = 'q32_limitCapTeChp', - q_shSeEl = 'q32_shSeEl', - q_shStor = 'q32_shStor', - q_storloss = 'q32_storloss', - q_operatingReserve = 'q32_operatingReserve', - q_usableSe = 'q32_usableSe', - q_usableSeTe = 'q32_usableSeTe', - q_limitCapTeStor = 'q32_limitCapTeStor', - q_limitCapTeGrid = 'q32_limitCapTeGrid', - v_demFe = 'v_demFe', - v_demSe = 'vm_demSe', - v_co2CCS = 'vm_co2CCS', - v_shStor = 'v32_shStor', - v_usableSe = 'vm_usableSe', - v_capDistr = 'vm_capDistr', - v_shSeEl = 'vm_shSeEl', - v32_shSeEl = 'vm_shSeEl', - v_usableSeTe = 'vm_usableSeTe', - v_storloss = 'v32_storloss', - p_shCHP = 'p32_shCHP', - p_dataren = 'pm_dataren', - p_storexp = 'p32_storexp', - p_gridexp = 'p32_gridexp', - p_grid_factor = 'p32_grid_factor', - p_factorStorage = 'p32_factorStorage', - p_correct = 'pm_correct' - ) -} else { - version <- args[[2]] - if (version == '5152') { - gdx_rename(gdx, - p_w = 'pm_w', - v_emicap = 'vm_perm', - v_co2eqGlob = 'vm_co2eqGlob', - v_banking = 'vm_banking', - v_vari = 'vm_cesIO', - v_invest = 'vm_invMacro', - v_deltacap = 'vm_deltaCap', - v_pedem = 'vm_demPe', - v_seprod = 'vm_prodSe', - v_feprod = 'vm_prodFe', - v_fedem = 'v_demFe', - vm_peprod = 'vm_prodPe', - v_sedem = 'v_demSe' - ) - } -}" > gdx_rename.R.tmp - -# Run R script -echo "Running R script..." -if [ -d $1 ]; then - for k_file in $1/*.gdx; do - f_validgdx=$(basename $k_file | cut -d'.' -f2) - if [ -f $k_file ] && [ $f_validgdx == "gdx" ]; then - fname=$(basename $k_file) - echo " > $fname" - Rscript gdx_rename.R.tmp $k_file $2 - echo " " - fi - done -else - fname=$(basename $1) - echo " > $fname" - Rscript gdx_rename.R.tmp $1 $2 -fi - -# Clean up -echo "Cleaning up..." -rm gdx_rename.R.tmp From c484263025c522957aa4f6994b644464d35320e5 Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Thu, 21 Aug 2025 17:01:38 +0200 Subject: [PATCH 4/8] remove p_pvpRegiBeforeStartYear --- core/declarations.gms | 1 - 1 file changed, 1 deletion(-) diff --git a/core/declarations.gms b/core/declarations.gms index fd9af30000..d17e84010b 100644 --- a/core/declarations.gms +++ b/core/declarations.gms @@ -26,7 +26,6 @@ parameters *** trade prices (move to trade module?) pm_pvp(ttot,all_enty) "Price on commodity markets, [T$/TWa] for energy commodities except uranium, uranium (peur) in [T$/Mt Uranium], emissions permits (perm) in [T$/GtC]" p_pvpRef(ttot,all_enty) "Price on commodity markets - imported from REF gdx, [T$/TWa] for energy commodities except uranium, uranium (peur) in [T$/Mt Uranium], emissions permits (perm) in [T$/GtC]" -p_pvpRegiBeforeStartYear(ttot,all_regi,all_enty) "prices of traded commodities before start year - regional. only used for permit trade [T$/GtC]" pm_ies(all_regi) "intertemporal elasticity of substitution", From c27248342b460f5f65585223cc2c396b659ad3bf Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Fri, 22 Aug 2025 09:53:37 +0200 Subject: [PATCH 5/8] remove commented out equation q_limitSo2 --- core/declarations.gms | 10 +--------- core/equations.gms | 12 ------------ 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/core/declarations.gms b/core/declarations.gms index d17e84010b..198277d7fd 100644 --- a/core/declarations.gms +++ b/core/declarations.gms @@ -91,6 +91,7 @@ q_esCapInv(ttot,all_regi,all_teEs) "investment equation for en *** ------------- Emissions Parameters ---------------------------------------- parameters +*** HERE *** air pollutant emissions parameters (move to module 11?) pm_emiExog(tall,all_regi,all_enty) "exogenous emissions from air pollutants [Mt SO2, Mt BC, Mt OC]" *** emissions permit parameters (move to module 41?) @@ -210,17 +211,8 @@ q_emiCdrAll(ttot,all_regi) "summing over all CDR emiss q_balcapture(ttot,all_regi,all_enty,all_enty,all_te) "balance equation for carbon capture" q_balCCUvsCCS(ttot,all_regi) "balance equation for captured carbon to CCU or CCS or valve" q_ccsShare(ttot,all_regi) "calculate the share of captured CO2 that is stored geologically" - -*** q_limitSo2 can be removed? -* RP: this equation is turned off as of 2025-03-11, because it has strong negative side -* effects on coal use - eg SSA strongly increases coal use until 2050 only because -* it wants coal solids in 2070 and needs to ramp it up until 2050 due to this limit -* this limit -* q_limitSo2(ttot,all_regi) "prevent SO2 from rising again after 2050" ; - - *** --------------------------------------------------------------------------- *** 3. Energy System *** --------------------------------------------------------------------------- diff --git a/core/equations.gms b/core/equations.gms index 2acb345bd8..4cc5149455 100644 --- a/core/equations.gms +++ b/core/equations.gms @@ -950,18 +950,6 @@ q_limitCCS(regi,ccs2te2(enty,"ico2",te),rlf)$teCCS2rlf(te,rlf).. =l= pm_dataccs(regi,"quan",rlf); -***--------------------------------------------------------------------------- -*' Emission constraint on SO2 after 2050: -***--------------------------------------------------------------------------- -* RP: this equation is turned off as of 2025-03-11, because it has strong negative side -* effects on coal use - eg SSA strongly increases coal use until 2050 only because -* it wants coal solids in 2070 and needs to ramp it up until 2050 due to this limit -* this limit -* q_limitSo2(ttot+1,regi) $((pm_ttot_val(ttot+1) ge max(cm_startyear,2055)) AND (cm_emiscen gt 1) AND (ord(ttot) lt card(ttot))) .. -* vm_emiTe(ttot+1,regi,"so2") -* =l= -* vm_emiTe(ttot,regi,"so2"); - ***--------------------------------------------------------------------------- *' Adjustment costs - calculation of the relative change to last time step From a4475a9964eb4c39d84192ea99255ad6e600eccc Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Fri, 22 Aug 2025 10:39:49 +0200 Subject: [PATCH 6/8] move output parameters to module 05 --- core/declarations.gms | 7 ------- modules/05_initialCap/on/declarations.gms | 8 +++++++- modules/05_initialCap/on/preloop.gms | 20 ++++++++++---------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/core/declarations.gms b/core/declarations.gms index 198277d7fd..c74c619fcc 100644 --- a/core/declarations.gms +++ b/core/declarations.gms @@ -91,7 +91,6 @@ q_esCapInv(ttot,all_regi,all_teEs) "investment equation for en *** ------------- Emissions Parameters ---------------------------------------- parameters -*** HERE *** air pollutant emissions parameters (move to module 11?) pm_emiExog(tall,all_regi,all_enty) "exogenous emissions from air pollutants [Mt SO2, Mt BC, Mt OC]" *** emissions permit parameters (move to module 41?) @@ -330,12 +329,6 @@ p_prodUeReference(ttot,all_regi,all_enty,all_enty,all_te) "Useful Energy output p_co2CCSReference(ttot,all_regi,all_enty,all_enty,all_te,rlf) "Captured CO2 put through the CCS chain in ccs2te (pipelines/injection) in the reference run [GtC]" p_prodAllReference(ttot,all_regi,all_te) "Sum of the above in the reference run. As each technology has only one type of output, the differing units should not be a problem" -*** output parameters for 2005 calibration (move to 05_initialCap module?) -o_INI_DirProdSeTe "directly produced SE by technology in 2005 (from initialcap2)" -o_INI_TotalDirProdSe "Total direct SE production in 2005 (from initialcap2)" -o_INI_TotalCap "Total electricity producing capacity in 2005 (from initialcap2)" -o_INI_AvCapFac "Average regional capacity factor of the power sector in 2005 (from initialcap2)" - *** CES calibration tarjectories industry and buildings pm_fedemand(tall,all_regi,all_in) "read-in parameter for final energy and production trajectories used for the CES parameter calibration in industry and buildings [TWa]" diff --git a/modules/05_initialCap/on/declarations.gms b/modules/05_initialCap/on/declarations.gms index f4ed7cb362..608383f66c 100644 --- a/modules/05_initialCap/on/declarations.gms +++ b/modules/05_initialCap/on/declarations.gms @@ -7,7 +7,7 @@ *** SOF ./modules/05_initialCap/on/declarations.gms Parameter - p05_cap0(all_regi,all_te) "standing capacity in 2005 as calculated by the initialization routine generisinical. Unit: TWa" + p05_cap0(all_regi,all_te) "standing capacity in 2005 as calculated by the initialization routine generisinical. Unit: TWa" p05_initial_capacity(all_regi,all_te) "capacitiy at t=2005, calculated from past deltacaps" p05_inital_input(all_regi,all_te) "input in 2005, calculated from past deltacaps and initial time-variable eta" p05_corrected_inital_input(all_regi,all_te) "corrected input in 2005, calculated from past deltacaps and corrected time-variable eta" @@ -28,6 +28,12 @@ $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 p05_pmdata_ref(all_regi,char,all_te) "auxiliary parameter to load pm_data from reference run if cm_startyear > 2005 and initialCap is therefore not run" + +*** output parameters for 2005 calibration +o05_INI_DirProdSeTe "directly produced SE by technology in 2005 (from initialcap2)" +o05_INI_TotalDirProdSe "Total direct SE production in 2005 (from initialcap2)" +o05_INI_TotalCap "Total electricity producing capacity in 2005 (from initialcap2)" +o05_INI_AvCapFac "Average regional capacity factor of the power sector in 2005 (from initialcap2)" ; Variables diff --git a/modules/05_initialCap/on/preloop.gms b/modules/05_initialCap/on/preloop.gms index 62d694c2ff..44693d3263 100644 --- a/modules/05_initialCap/on/preloop.gms +++ b/modules/05_initialCap/on/preloop.gms @@ -171,7 +171,7 @@ loop(regi, * pm_dataren(regi,"nur","1",te); loop (pe2se(entyPe,entySe,te), - o_INI_DirProdSeTe(regi,entySe,te) = s05_aux_tot_prod + o05_INI_DirProdSeTe(regi,entySe,te) = s05_aux_tot_prod ); s05_aux_prod_remaining = s05_aux_tot_prod; @@ -207,7 +207,7 @@ loop(regi, loop(opTimeYr2te(te,opTimeYr)$(NOT teReNoBio(te)), loop(tsu2opTime5(ttot,opTimeYr), loop(pe2se(entyPe,entySe,te), - o_INI_DirProdSeTe(regi,entySe,te) = p05_cap0(regi,te) * pm_cf("2005",regi,te) * pm_dataren(regi,"nur","1",te) + o05_INI_DirProdSeTe(regi,entySe,te) = p05_cap0(regi,te) * pm_cf("2005",regi,te) * pm_dataren(regi,"nur","1",te) ); sm_tmp = 1 / pm_ts(ttot) * p05_cap0(regi,te) * p05_vintage(regi,opTimeYr,te); @@ -254,16 +254,16 @@ display pm_aux_capLowerLimit; ***--------------------------------------------------------------------------- loop(regi, - o_INI_TotalCap(regi) = sum(pe2se(enty,"seel",te), p05_cap0(regi,te) ); - o_INI_TotalDirProdSe(regi,entySe) = sum(pe2se(enty,entySe,te), o_INI_DirProdSeTe(regi,entySe,te) ); - o_INI_AvCapFac(regi) = o_INI_TotalDirProdSe(regi,"seel") / o_INI_TotalCap(regi); + o05_INI_TotalCap(regi) = sum(pe2se(enty,"seel",te), p05_cap0(regi,te) ); + o05_INI_TotalDirProdSe(regi,entySe) = sum(pe2se(enty,entySe,te), o05_INI_DirProdSeTe(regi,entySe,te) ); + o05_INI_AvCapFac(regi) = o05_INI_TotalDirProdSe(regi,"seel") / o05_INI_TotalCap(regi); ); display -o_INI_DirProdSeTe -o_INI_TotalCap -o_INI_TotalDirProdSe -o_INI_AvCapFac +o05_INI_DirProdSeTe +o05_INI_TotalCap +o05_INI_TotalDirProdSe +o05_INI_AvCapFac p05_cap0 ; @@ -556,7 +556,7 @@ display pm_emifac; *** Please do not change any of the parameters (including pm_emifac and pm_eta_conv) after this section of the code! if (cm_startyear gt 2005, Execute_Loadpoint 'input_ref' pm_eta_conv = pm_eta_conv; - Execute_Loadpoint 'input_ref' o_INI_DirProdSeTe = o_INI_DirProdSeTe; + Execute_Loadpoint 'input_ref' o05_INI_DirProdSeTe = o05_INI_DirProdSeTe; 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_dataeta = pm_dataeta; From 4722c962bb7a2914e8f4428300fe1d478d16a33e Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Fri, 22 Aug 2025 11:03:18 +0200 Subject: [PATCH 7/8] move initialization of pm_cintraw to datainput.gms --- core/datainput.gms | 5 +++++ core/declarations.gms | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/datainput.gms b/core/datainput.gms index f80b834f85..8149fda20e 100644 --- a/core/datainput.gms +++ b/core/datainput.gms @@ -6,6 +6,11 @@ *** | Contact: remind@pik-potsdam.de *** SOF ./core/datainput.gms +*** carbon intensities of coal, oil, and gas +pm_cintraw("pecoal") = 26.1 / s_zj_2_twa; +pm_cintraw("peoil") = 20.0 / s_zj_2_twa; +pm_cintraw("pegas") = 15.0 / s_zj_2_twa; + *** technical. initialize parameters so that they are read from gdx vm_co2eq.l(ttot,regi) = 0; vm_emiAll.l(ttot,regi,enty) = 0; diff --git a/core/declarations.gms b/core/declarations.gms index c74c619fcc..2ddf91970b 100644 --- a/core/declarations.gms +++ b/core/declarations.gms @@ -792,9 +792,4 @@ $endif sm_tgn_2_pgc = (44/28) * s_gwpN2O * (12/44) * 0.001; sm_tgch4_2_pgc = s_gwpCH4 * (12/44) * 0.001; -*** carbon intensities of coal, oil, and gas (move to core datainput?) -pm_cintraw("pecoal") = 26.1 / s_zj_2_twa; -pm_cintraw("peoil") = 20.0 / s_zj_2_twa; -pm_cintraw("pegas") = 15.0 / s_zj_2_twa; - *** EOF ./core/declarations.gms From e281e6ed983a48db1a0e9a00245933d44d5b487b Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Mon, 25 Aug 2025 10:38:04 +0200 Subject: [PATCH 8/8] move pm_cintraw --- core/datainput.gms | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/datainput.gms b/core/datainput.gms index 8149fda20e..88ba35b83e 100644 --- a/core/datainput.gms +++ b/core/datainput.gms @@ -6,11 +6,6 @@ *** | Contact: remind@pik-potsdam.de *** SOF ./core/datainput.gms -*** carbon intensities of coal, oil, and gas -pm_cintraw("pecoal") = 26.1 / s_zj_2_twa; -pm_cintraw("peoil") = 20.0 / s_zj_2_twa; -pm_cintraw("pegas") = 15.0 / s_zj_2_twa; - *** technical. initialize parameters so that they are read from gdx vm_co2eq.l(ttot,regi) = 0; vm_emiAll.l(ttot,regi,enty) = 0; @@ -575,6 +570,13 @@ $include "./core/input/p_share_ind_fesos_bio.cs4r" $offdelim /; + +*** carbon intensities of coal, oil, and gas +*** emissions factor of primary energy fossil fuels +pm_cintraw("pecoal") = 26.1 / s_zj_2_twa; +pm_cintraw("peoil") = 20.0 / s_zj_2_twa; +pm_cintraw("pegas") = 15.0 / s_zj_2_twa; + $ifthen.tech_CO2capturerate not "%c_tech_CO2capturerate%" == "off" p_PECarriers_CarbonContent(peFos)=pm_cintraw(peFos); *** From conversation: 25 GtC/ZJ is the assumed carbon content of PE biomass (makes default bioh2c capture rate 90%)