Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1410f78
Comments and a new script.
dbantje Apr 9, 2025
14f34fe
eof lines
dbantje Apr 9, 2025
ebfa7dc
New switches and flags for LCA script
dbantje Apr 10, 2025
e150372
Added LCA scripts.
dbantje Apr 10, 2025
ea162aa
Fix bugs in LCA scripts.
dbantje Apr 10, 2025
192e30b
Added LCA coupling scenario config
dbantje Apr 10, 2025
aa8c239
Missing dimensions.
dbantje Apr 10, 2025
9f4c2f1
Fixed error with arguments passed to LCA script.
dbantje Apr 10, 2025
f305857
scenario config
dbantje May 7, 2025
c3a4619
Added FE component to EI tax in module 21.
dbantje May 7, 2025
976075d
Initialize FE EI costs to zero.
dbantje May 7, 2025
07bb4d6
clarifying LCA cost unit conversion
dbantje Jun 24, 2025
8e86075
Changes from make test
dbantje Jun 24, 2025
cf8b749
Reworked LCA python script
dbantje Jun 24, 2025
c23ce48
Recent developments of LCA coupling
dbantje Jul 28, 2025
69b98fb
Merge branch 'develop' into LCAscript
dbantje Jul 28, 2025
1f32e7e
Updated scenario configs and not_used docs.
dbantje Jul 28, 2025
419d784
Adapted LCa coupling scenario config to recent develop
dbantje Jul 29, 2025
d721eb6
Missing NPi2025 runs in config.
dbantje Jul 29, 2025
5d093ea
Added `path_gdx` for internalization scenarios in config.
dbantje Jul 31, 2025
18d985c
Refactoring to split LCA tasks, and run tax aggregation in each itera…
dbantje Aug 5, 2025
c83ae86
Removed depreceated switch `c_52_coupling_mode`. "Static" behaviour c…
dbantje Aug 5, 2025
8b7388c
Added switch `cm_freqIter_LCA` for setting the frequency of LCA updates.
dbantje Aug 5, 2025
a04d122
Improved LCA logging and fixed gams code so that the reporting runs i…
dbantje Aug 5, 2025
9a138b4
Fix bug in logging
dbantje Aug 5, 2025
3b7cca9
Logging errors from LCA python script also.
dbantje Aug 5, 2025
c406108
Little changes in logging.
dbantje Aug 6, 2025
86e28de
Bugfix: Wrong script called in postsolve of module 52
dbantje Aug 6, 2025
ea4c1d6
Calcuation setups + introducing FE costs
dbantje Aug 6, 2025
90ec804
Fix / redo GDX writing for LCA costs
dbantje Aug 7, 2025
99575a7
Avoid redundant extensions of .mif files
dbantje Aug 7, 2025
a7b33ef
Bugfix in reading of monetization factors (read a header where there …
dbantje Aug 12, 2025
424c217
Add logging of reporting in LCA workflow
dbantje Aug 20, 2025
ddf637a
Blueprint for LCA reporting script
dbantje Aug 20, 2025
c69ec13
Updated LCA coupling scenario config
dbantje Aug 20, 2025
cf551bf
Bugfix: Definition text for FE LCA costs variable changed
dbantje Sep 17, 2025
35c679b
Added premise and ecoinvent initialization script.
dbantje Oct 17, 2025
be2fa68
Added option for no double accounting removal
dbantje Oct 17, 2025
a5f0fde
Fix runtime calculation bug
dbantje Oct 17, 2025
719d962
Changes to scenario config
dbantje Oct 17, 2025
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
4 changes: 4 additions & 0 deletions config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ cfg$files2export$start <- c("config/conopt3.opt",
"scripts/input/climateAssessmentInterimRun.R",
"scripts/input/climateAssessmentImpulseResponse.R",
"scripts/input/run_KotzWenz_damages.R",
"scripts/input/climate_assessment_openscm_run.py",
"scripts/input/run_LCA_workflows.R",
"scripts/input/LCA_workflows.py",
"scripts/output/single/reporting.R",
".Rprofile",
"config/mappingEDGEtoREMINDsectors.csv", # To do: Is this still needed?
"modules/11_aerosols/exoGAINS/input/ef_gains.cs4r",
Expand Down
56 changes: 56 additions & 0 deletions config/scenario_config_LCAcoupling.csv

Large diffs are not rendered by default.

24 changes: 23 additions & 1 deletion main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ parameter
;
cm_tempConvergence = 0.05; !! def = 0.05
;

parameter
cm_carbonprice_temperatureLimit "not-to-exceed temperature target in degree above pre-industrial [45_carbonprice = temperatureNotToExceed]"
;
Expand All @@ -1055,7 +1056,6 @@ parameter
;
cm_frac_CCS = 10; !! def = 10
*'

parameter
cm_frac_NetNegEmi "tax on net negative emissions to reflect risk of overshooting, formulated as fraction of carbon price"
;
Expand Down Expand Up @@ -1201,6 +1201,17 @@ parameter
*' EDGE-T transport starting iteration of coupling
*' def 10, EDGE-T coupling starts at 10, if you want to test whether infeasibilities after EDGE-T -> set it to 1 to check after first iteration
*'
parameter
cm_startIter_LCA "starting iteration of LCA coupling"
;
cm_startIter_LCA = 15; !! def = 15 !! regexp = [0-9]+
*' starting iteration of coupling the LCA workflow in module 52
*' default is 15. As EDGE-T results are needed for the workflow, also cm_startIter_EDGET is also checked.
*'
parameter
cm_freqIter_LCA "Frequency of LCA updates"
;
cm_freqIter_LCA = 5; !! def = 5 !! regexp = ^[1-9]\d*$
parameter
cm_deuCDRmax "switch to limit maximum annual CDR amount in Germany in MtCO2 per y"
;
Expand Down Expand Up @@ -1955,6 +1966,17 @@ $setGlobal cm_chaCoalBounds off !! def = off
*' * (off): no, only infeasable regions are repeated, standard setting
*' * (on): also non-optimal regions are solved again, up to cm_solver_try_max
$setglobal cm_repeatNonOpt off !! def = off !! regexp = off|on
*' c_52_monetization_type "type of monetization, determines how c_52_LCA_monetizationFactor is interpreted"
*' (quantile): interpreted as quantile of MC sampled cost distributions
*' (perspective): interpreted as monetization perspective
*' (monetization_factors): interpreted as path to file with monetization factors
$setglobal c_52_monetization_type quantile !! def = quantile !! regexp = quantile|perspective|monetization_factors
*' c_52_LCA_monetizationFactor "quantile, cost perspective, or path of monetization factors"
$setglobal c_52_LCA_monetizationFactor 0.5 !! def = 0.5
*** Switch to use only a single midpoint for environmental cost internalization
$setglobal cm_52_single_midpoint none !! def = none
*** Switch to exclude a list of midpoints from environmental cost internalization
$setglobal cm_52_exclude_midpoints none !! def = none

*' @stop

Expand Down
1 change: 1 addition & 0 deletions modules/21_tax/off/not_used.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ sm_D2005_2_D2017,input,no conversion needed
pm_taxEI_PE,parameter,only needed if tax is on
pm_taxEI_SE,parameter,only needed if tax is on
pm_taxEI_cap,parameter,only needed if tax is on
pm_taxEI_FE,parameter,only needed if tax is on
vm_deltaCap,variable,only needed if tax is on
vm_emiCdrAll,input,added by codeCheck
cm_NetNegEmi_calculation,input,added by codeCheck
Expand Down
1 change: 1 addition & 0 deletions modules/21_tax/on/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ p21_CO2TaxSectorMarkup(ttot,all_regi,emi_sectors) "path for CO
pm_taxEI_PE(ttot,all_regi,all_enty) "tax path for environmental impacts tax on primary energy production"
pm_taxEI_SE(ttot,all_regi,all_te) "tax path for environmental impacts tax on secondary energy production"
pm_taxEI_cap(ttot,all_regi,all_te) "tax path for environmental impacts tax on capacity additions"
pm_taxEI_FE(ttot,all_regi,emi_sectors,all_enty) "tax path for environmental impacts tax on FE use"

p21_grossEmissions(iteration,ttot,all_regi) "Gross CO2 emissions"
p21_referenceGrossEmissions(ttot,all_regi) "Reference gross CO2 emissions used for computation of net-negative emissions"
Expand Down
11 changes: 10 additions & 1 deletion modules/21_tax/on/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ v21_taxrevResEx(t,regi) =e= sum(pe2rlf(peEx(enty),rlf), p21_tau_fuEx_sub(t,regi
;

***---------------------------------------------------------------------------
*' Calculation of Environmental impact tax: Sum of three components (PE, SE, deltaCap),
*' Calculation of Environmental impact tax: Sum of four components (PE, SE, deltaCap, FE),
*' each calculated as tax rate times production volume/capacity added.
***---------------------------------------------------------------------------
q21_taxrevEI(t,regi)$(t.val ge max(2010,cm_startyear))..
Expand All @@ -145,6 +145,15 @@ v21_taxrevEI(t,regi)
+ SUM(te2rlf(te,rlf),
pm_taxEI_cap(t,regi,te) * vm_deltaCap(t,regi,te,rlf)
)
+ SUM((entyFe,sector)$entyFe2Sector(entyFe,sector),
( pm_taxEI_FE(t,regi,sector,entyFe) )
*
SUM(emiMkt$sector2emiMkt(sector,emiMkt),
SUM(se2fe(entySe,entyFe,te),
vm_demFeSector(t,regi,entySe,entyFe,sector,emiMkt)
)
)
)
- p21_taxrevEI0(t,regi)
;

Expand Down
11 changes: 10 additions & 1 deletion modules/21_tax/on/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@ p21_taxrevSE0(t,regi) = sum(se2se(enty,enty2,te)$(teSeTax(te)),
p21_taxrevEI0(t,regi) = sum(entyPe, pm_taxEI_PE(t,regi,entyPe) * vm_prodPe.l(t,regi,entyPe))
+ sum(pe2se(enty,enty2,te), pm_taxEI_SE(t,regi,te) * vm_prodSe.l(t,regi,enty,enty2,te))
+ sum(se2se(enty,enty2,te), pm_taxEI_SE(t,regi,te) * vm_prodSe.l(t,regi,enty,enty2,te))
+ sum(te2rlf(te,rlf), pm_taxEI_cap(t,regi,te) * vm_deltaCap.l(t,regi,te,rlf));
+ sum(te2rlf(te,rlf), pm_taxEI_cap(t,regi,te) * vm_deltaCap.l(t,regi,te,rlf))
+ sum((entyFe,sector)$entyFe2Sector(entyFe,sector),
( pm_taxEI_FE(t,regi,sector,entyFe) )
*
sum(emiMkt$sector2emiMkt(sector,emiMkt),
sum(se2fe(entySe,entyFe,te),
vm_demFeSector.l(t,regi,entySe,entyFe,sector,emiMkt)
)
)
);


*** Save reference level of tax revenues for each iteration
Expand Down
11 changes: 10 additions & 1 deletion modules/21_tax/on/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,16 @@ p21_taxrevSE0(t,regi) = sum(se2se(enty,enty2,te)$(teSeTax(te)),
p21_taxrevEI0(t,regi) = sum(entyPe, pm_taxEI_PE(t,regi,entyPe) * vm_prodPe.l(t,regi,entyPe))
+ sum(pe2se(enty,enty2,te), pm_taxEI_SE(t,regi,te) * vm_prodSe.l(t,regi,enty,enty2,te))
+ sum(se2se(enty,enty2,te), pm_taxEI_SE(t,regi,te) * vm_prodSe.l(t,regi,enty,enty2,te))
+ sum(te2rlf(te,rlf), pm_taxEI_cap(t,regi,te) * vm_deltaCap.l(t,regi,te,rlf));
+ sum(te2rlf(te,rlf), pm_taxEI_cap(t,regi,te) * vm_deltaCap.l(t,regi,te,rlf))
+ sum((entyFe,sector)$entyFe2Sector(entyFe,sector),
( pm_taxEI_FE(t,regi,sector,entyFe) )
*
sum(emiMkt$sector2emiMkt(sector,emiMkt),
sum(se2fe(entySe,entyFe,te),
vm_demFeSector.l(t,regi,entySe,entyFe,sector,emiMkt)
)
)
);

*** If net-nagative emissions tax is calculated across iterations, activate net-negative emissions tax in iteration 2 after computation of tax revenue from iteration 1
if( (cm_NetNegEmi_calculation eq 1) AND (iteration.val ge 2),
Expand Down
8 changes: 8 additions & 0 deletions modules/52_internalizeLCAimpacts/coupled/declarations.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*** SOF ./modules/52_internalizeLCAimpacts/coupled/declarations.gms

Parameters
p52_LCAcosts_SE(ttot,all_regi,all_te) "Aggregated environmental costs per SE technology [US$/GJ]"
p52_LCAcosts_FE(ttot,all_regi,emi_sectors,all_enty) "Aggregated environmental costs per FE demand [US$/GJ]"
;

*** EOF ./modules/52_internalizeLCAimpacts/coupled/declarations.gms
32 changes: 32 additions & 0 deletions modules/52_internalizeLCAimpacts/coupled/postsolve.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
*** SOF ./modules/52_internalizeLCAimpacts/coupled/postsolve.gms

***---------------------------------------------------------------------------
*' TODO: adapt for LCA workflow
*' MAGICC is run and its output is read using different current R scripts in the external MAGICC folder
*' that are copied to each run's folder during the preparation phase. Different parametrizations of MAGICC can also be chosen with `cm_magicc_config`,
*' and are also handled during the preparation phase
*'
*' Below is the main code that handles the input prepration, running and output reading of MAGICC.
***---------------------------------------------------------------------------
*' @code

***

if( (ord(iteration) ge max(cm_startIter_EDGET, cm_startIter_LCA)),
Execute_unload 'fulldata_postsolve';
if ((mod(ord(iteration), cm_freqIter_LCA) eq 0),
Execute "Rscript run_LCA_workflows.R fulldata_postsolve.gdx update_plca";
else
Execute "Rscript run_LCA_workflows.R fulldata_postsolve.gdx recalculate_taxes";
);
);

!! Read in results
Execute_Loadpoint 'LCA_SE' p52_LCAcosts_SE=pm_LCAcosts_SE;
Execute_Loadpoint 'LCA_FE' p52_LCAcosts_FE=pm_LCAcosts_FE;

!! convert units
pm_taxEI_SE(ttot,all_regi,all_te) = p52_LCAcosts_SE(ttot,all_regi,all_te) * sm_DpGJ_2_TDpTWa;
pm_taxEI_FE(ttot,all_regi,emi_sectors,all_enty) = p52_LCAcosts_FE(ttot,all_regi,emi_sectors,all_enty) * sm_DpGJ_2_TDpTWa;

*** EOF ./modules/52_internalizeLCAimpacts/coupled/postsolve.gms
13 changes: 12 additions & 1 deletion modules/52_internalizeLCAimpacts/coupled/preloop.gms
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
*** SOF ./modules/52_internalizeLCAimpacts/coupled/preloop.gms

*** TODO: Run LCA workflow to initialize costs based on reference gdx
*** Set taxes to zero to begin with.
pm_taxEI_SE(ttot,all_regi,all_te) = 0;
pm_taxEI_PE(ttot,all_regi,all_enty) = 0;
pm_taxEI_cap(ttot,all_regi,all_te) = 0;
pm_taxEI_FE(ttot,all_regi,emi_sectors,all_enty) = 0;

Execute "Rscript run_LCA_workflows.R input.gdx preloop";

!! Read in results
Execute_Loadpoint 'LCA_SE' p52_LCAcosts_SE=pm_LCAcosts_SE;
Execute_Loadpoint 'LCA_FE' p52_LCAcosts_FE=pm_LCAcosts_FE;

!! convert units
pm_taxEI_SE(ttot,all_regi,all_te) = p52_LCAcosts_SE(ttot,all_regi,all_te) * sm_DpGJ_2_TDpTWa;
pm_taxEI_FE(ttot,all_regi,emi_sectors,all_enty) = p52_LCAcosts_FE(ttot,all_regi,emi_sectors,all_enty) * sm_DpGJ_2_TDpTWa;

*** EOF ./modules/52_internalizeLCAimpacts/coupled/preloop.gms
8 changes: 0 additions & 8 deletions modules/52_internalizeLCAimpacts/coupled/presolve.gms

This file was deleted.

3 changes: 2 additions & 1 deletion modules/52_internalizeLCAimpacts/coupled/realization.gms
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
*' @description The coupled-realization of the internalizeLCAimpacts module.

*####################### R SECTION START (PHASES) ##############################
$Ifi "%phase%" == "declarations" $include "./modules/52_internalizeLCAimpacts/coupled/declarations.gms"
$Ifi "%phase%" == "preloop" $include "./modules/52_internalizeLCAimpacts/coupled/preloop.gms"
$Ifi "%phase%" == "presolve" $include "./modules/52_internalizeLCAimpacts/coupled/presolve.gms"
$Ifi "%phase%" == "postsolve" $include "./modules/52_internalizeLCAimpacts/coupled/postsolve.gms"
*######################## R SECTION END (PHASES) ###############################
*** EOF ./modules/52_internalizeLCAimpacts/coupled/realization.gms
10 changes: 10 additions & 0 deletions modules/52_internalizeLCAimpacts/off/not_used.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# | (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
name,type,reason
sm_DpGJ_2_TDpTWa,scalar,conversion not needed
cm_startIter_EDGET,parameter,no iteration in off module
cm_startIter_LCA,parameter,no iteration in off module
2 changes: 1 addition & 1 deletion modules/52_internalizeLCAimpacts/off/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
pm_taxEI_SE(ttot,all_regi,all_te) = 0;
pm_taxEI_PE(ttot,all_regi,all_enty) = 0;
pm_taxEI_cap(ttot,all_regi,all_te) = 0;

pm_taxEI_FE(ttot,all_regi,emi_sectors,all_enty) = 0;
*** EOF ./modules/52_internalizeLCAimpacts/off/preloop.gms
Loading