Skip to content

Commit

Permalink
Merge branch 'campaignersScens' of https://github.com/robinhasse/remind
Browse files Browse the repository at this point in the history
… into pr/1373
  • Loading branch information
jmuessel committed Nov 1, 2023
2 parents d136c73 + 8eaebb4 commit f63bcb5
Show file tree
Hide file tree
Showing 36 changed files with 285 additions and 133 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **config** regex tests for many parameters
- **testthat** test and compile all config files

### fixed
- fixed weights of energy carriers in `pm_IndstCO2Captured`
[[#1354](https://github.com/remindmodel/remind/pull/1354)]

## [3.2.1] - 2023-07-13 (incomplete)

### changed
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ test-full: ## Run all tests, including coupling tests and a default
## REMIND scenario. Takes significantly longer than 10 minutes to run.
$(info Full tests take more than an hour to run, please be patient)
@R_PROFILE_USER= TESTTHAT_RUN_SLOW=TRUE Rscript -e 'testthat::test_dir("tests/testthat")'
test-validation: ## Run validation tests, requires a full set of runs in the output folder
$(info Run validation tests, requires a full set of runs in the output folder)
@R_PROFILE_USER= TESTTHAT_RUN_SLOW=TRUE Rscript -e 'testthat::test_dir("tests/testthat/validation")'
2 changes: 1 addition & 1 deletion config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cfg$regionmapping <- "config/regionmappingH12.csv"
### Additional (optional) region mapping, so that those validation data can be loaded that contain the corresponding additional regions.
cfg$extramappings_historic <- ""
#### Current input data revision (<mainrevision>.<subrevision>) ####
cfg$inputRevision <- "6.543"
cfg$inputRevision <- "6.544"

#### Current CES parameter and GDX revision (commit hash) ####
cfg$CESandGDXversion <- "ce96f1f97389c0b49757726259a40754a3c930b3"
Expand Down
2 changes: 1 addition & 1 deletion core/input/generisdata_tech.prn
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ incolearn 19000 0.00 29000
ccap0 0.003 0.003
learn 0.10 0.10

+ rockgrind dac
+ weathering dac
tech_stat 4
inco0 0.01 18800
mix0 0 0
Expand Down
2 changes: 1 addition & 1 deletion core/input/generisdata_tech_SSP1.prn
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ incolearn 20000 0.00 29000
ccap0 0.003 0.003
learn 0.10 0.10

+ rockgrind dac
+ weathering dac
tech_stat 4
inco0 0.01 18800
mix0 0 0
Expand Down
2 changes: 1 addition & 1 deletion core/input/generisdata_tech_SSP5.prn
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ incolearn 18400 0.00 29000
ccap0 0.003 0.003
learn 0.10 0.10

+ rockgrind dac
+ weathering dac
tech_stat 4
inco0 0.01 18800
mix0 0 0
Expand Down
5 changes: 3 additions & 2 deletions core/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ $ENDIF.WindOff
apCarElT "Cars using final energy electricity (FEELT) to produce useful energy as electricity for transport (UEELT)"
apTrnElT "Trains using final energy electricity (FEELT) to produce useful energy as electricity for transport (UEELT)"
*** appCarGaT "Cars using FEGAT to produce ESGAT." ???
rockgrind "grinding rock for enhanced weathering"
rockgrind "grinding rock for enhanced weathering" !! deprecated, will be removed with CDR module refactoring
weathering "enhanced weathering"
dac "direct air capture"
x_gas2elec
d_bio2elec "d_* transmission and distribution losses"
Expand Down Expand Up @@ -2316,7 +2317,7 @@ alias(te,te2,te3);
alias(all_enty,all_enty2);
alias(enty,enty2,enty3,enty4,enty5,enty6,enty7);
alias(entyPE,entyPE2);
alias(entySe,entySe2);
alias(entySE,entySE2);
alias(entyFe,entyFe2);
alias(teEs,teEs2);
alias(esty,esty2);
Expand Down
1 change: 0 additions & 1 deletion main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,6 @@ $setglobal cm_CES_configuration indu_subsectors-buil_simple-tran_edge_esm-POP_p
$setglobal c_CES_calibration_iterations 10 !! def = 10
$setglobal c_CES_calibration_industry_FE_target 1
$setglobal c_testOneRegi_region EUR !! def = EUR !! regexp = [A-Z]{3}
$setglobal cm_fixCO2price off !! def = off

*' @stop

Expand Down
2 changes: 1 addition & 1 deletion modules/33_CDR/all/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ q33_demFeCDR(t,regi,entyFe)$(entyFe2Sector(entyFe,"cdr")) ..
q33_capconst_grindrock(t,regi)..
sum(rlf2,sum(rlf, v33_grindrock_onfield(t,regi,rlf,rlf2)))
=l=
sum(teNoTransform2rlf_dyn33("rockgrind",rlf2), vm_capFac(t,regi,"rockgrind") * vm_cap(t,regi,"rockgrind",rlf2))
sum(teNoTransform2rlf_dyn33("weathering",rlf2), vm_capFac(t,regi,"weathering") * vm_cap(t,regi,"weathering",rlf2))
;

***---------------------------------------------------------------------------
Expand Down
12 changes: 6 additions & 6 deletions modules/33_CDR/all/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ sets

te_dyn33(all_te) "all technologies"
/
rockgrind "grinding rock for enhanced weathering"
dac "direct air capture"
weathering "enhanced weathering"
dac "direct air capture"
/

teNoTransform_dyn33(all_te) "all technologies that do not transform energy but still have investment and O&M costs (like storage or grid)"
/
rockgrind "grinding rock for enhanced weathering"
dac "grinding rock for enhanced weathering"
weathering "enhanced weathering"
dac "direct air capture"
/

teNoTransform2rlf_dyn33(all_te,rlf) "mapping for final energy to grades"
/
(rockgrind) . 1
(dac) . 1
(weathering) . 1
(dac) . 1
/

adjte_dyn33(all_te) "technologies with linearly growing constraint on control variable"
Expand Down
2 changes: 1 addition & 1 deletion modules/33_CDR/off/bounds.gms
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*** | Contact: [email protected]
*** SOF ./modules/33_CDR/off/bounds.gms
vm_otherFEdemand.fx(t,regi,entyFe) = 0;
vm_cap.fx(t,regi,"rockgrind",rlf) = 0;
vm_cap.fx(t,regi,"weathering",rlf) = 0;
vm_emiCdr.fx(t,regi,enty) = 0;
vm_omcosts_cdr.fx(t,regi) = 0;
vm_ccs_cdr.fx(t,regi,enty,enty2,te,rlf)$ccs2te(enty,enty2,te) = 0;
Expand Down
2 changes: 1 addition & 1 deletion modules/33_CDR/weathering/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ q33_otherFEdemand(t,regi,entyFe)$(sameas(entyFe,"feels") OR sameas(entyFe,"fedie
q33_capconst_grindrock(t,regi)..
sum(rlf2,sum(rlf$(rlf.val le 2), v33_grindrock_onfield(t,regi,rlf,rlf2)))
=l=
sum(teNoTransform2rlf_dyn33(te,rlf2), vm_capFac(t,regi,"rockgrind") * vm_cap(t,regi,"rockgrind",rlf2))
sum(teNoTransform2rlf_dyn33(te,rlf2), vm_capFac(t,regi,"weathering") * vm_cap(t,regi,"weathering",rlf2))
;

***---------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions modules/33_CDR/weathering/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ sets

te_dyn33(all_te) "all technologies"
/
rockgrind "grinding rock for enhanced weathering"
weathering "grinding rock for enhanced weathering"
/

teNoTransform_dyn33(all_te) "all technologies that do not transform energy but still have investment and O&M costs (like storage or grid)"
/
rockgrind "grinding rock for enhanced weathering"
weathering "grinding rock for enhanced weathering"
/

teNoTransform2rlf_dyn33(all_te,rlf) "mapping for final energy to grades"
/
(rockgrind) . 1
(weathering) . 1
/
;

Expand Down
2 changes: 2 additions & 0 deletions modules/35_transport/edge_esm/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ NAV_tec
NAV_ele
NAV_lce
NAV_all
CAMP_lscWeak
CAMP_lscStrong
/

EDGE_scenario(EDGE_scenario_all) "Selected EDGE-T scenario"
Expand Down
17 changes: 17 additions & 0 deletions modules/37_industry/subsectors/bounds.gms
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,23 @@ $endif.CES_parameters
vm_cesIO.fx("2005",regi,ppfkap_industry_dyn37(in))
= pm_cesdata("2005",regi,in,"quantity");

*** Set lower bound for secondary steel electricity to 1 % of the lowest
*** existing lower bound (should be far above sm_eps) to avoid CONOPT getting
*** lost in the woods.
loop (in$( sameas(in,"feel_steel_secondary") ),
vm_cesIO.lo(t,regi,in)$( t.val ge cm_startyear
AND vm_cesIO.lo(t,regi,in) le sm_eps )
= max(
sm_eps,
( 0.01
* smax(ttot$( vm_cesIO.lo(ttot,regi,in) gt sm_eps),
vm_cesIO.lo(ttot,regi,in)
)
)
);
);

*** Default lower bounds on all industry pfs
vm_cesIO.lo(t,regi_dyn29(regi),in_industry_dyn37(in))$(
0 eq vm_cesIO.lo(t,regi,in) )
= sm_eps;
Expand Down
22 changes: 11 additions & 11 deletions modules/37_industry/subsectors/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ PARAMETERS
p37_specMatsDem(mats,teMats,opModes) "Specific materials demand of a production technology and operation mode [t_input/t_output]"
/
ironore.idr.(ng,h2) 1.5 !! Iron ore demand of iron direct-reduction (independent of fuel source)

dri.eaf.pri 1.0 !! DRI demand of EAF
scrap.eaf.sec 1.0 !! Scrap demand of EAF
dri.eaf.sec 0.0
scrap.eaf.pri 0.0

ironore.bfbof.pri 1.5 !! Iron ore demand of BF-BOF
scrap.bfbof.sec 1.0 !! Scrap demand of BF-BOF
scrap.bfbof.pri 0.0
Expand All @@ -33,10 +33,10 @@ PARAMETERS
feels.idr.(ng,h2) 0.33 !! Specific electric demand for both H2 and NG operation.
fegas.idr.ng 2.94 !! Specific natural gas demand when operating with NG.
feh2s.idr.h2 1.91 !! Specific hydrogen demand when operating with H2.

feels.eaf.pri 0.91 !! Specific electricy demand of EAF when operating with DRI.
feels.eaf.sec 0.67 !! Specific electricy demand of EAF when operating with scrap.

fesos.bfbof.pri 2.0 !! Specific coal demand of BF-BOF when operating with DRI -- this number is just a guess
fesos.bfbof.sec 0.5 !! Specific coal demand of BF-BOF when operating with scrap -- this number is just a guess
/
Expand Down Expand Up @@ -175,7 +175,7 @@ loop (industry_ue_calibration_target_dyn37(out)$( pm_energy_limit(out) ),

*** Specific energy demand limits for other industry and chemicals in TWa/trUSD
*** exponential decrease of minimum specific energy demand per value added up to 90% by 2100
sm_tmp2 = 0.9; !! maximum "efficiency gain" relative to 2015 baseline value
sm_tmp2 = 0.9; !! maximum "efficiency gain" relative to 2015 baseline value
sm_tmp = 2100; !! period in which closing could be achieved

loop (industry_ue_calibration_target_dyn37(out)$( sameas(out,"ue_chemicals") OR sameas(out,"ue_otherInd")),
Expand Down Expand Up @@ -415,17 +415,17 @@ pm_ue_eff_target("ue_otherInd") = 0.008;
*` CES mark-up cost industry

*` The Mark-up cost on primary production factors (final energy) of the CES tree have two functions.
*` (1) They represent sectoral end-use cost not captured by the energy system.
*` (2) As they alter prices to of the CES function inputs, they affect the CES efficiency parameters during calibration
*` (1) They represent sectoral end-use cost not captured by the energy system.
*` (2) As they alter prices to of the CES function inputs, they affect the CES efficiency parameters during calibration
*` and therefore influence the efficiency of different FE CES inputs. The resulting economic subsitution rates
*` are given by the marginal rate of subsitution (MRS) in the parameter o01_CESmrs.
*` Mark-up cost were tuned as to obtain similar or slightly higher marginal rate of substitution (MRS) to gas/liquids than technical subsitution rates and
*` obtain similar specific energy consumption per value added in chemicals and other industry across high and low electrification scenarios.
*` Mark-up cost were tuned as to obtain similar or slightly higher marginal rate of substitution (MRS) to gas/liquids than technical subsitution rates and
*` obtain similar specific energy consumption per value added in chemicals and other industry across high and low electrification scenarios.


*` There are two ways in which mark-up cost can be set:
*` (a) Mark-up cost on inputs in ppfen_MkupCost37: Those are counted as expenses in the budget and set by the parameter p37_CESMkup.
*` (b) Mark-up cost on other inputs: Those are budget-neutral and implemented as a tax. They are set by the parameter pm_tau_ces_tax.
*` (a) Mark-up cost on inputs in ppfen_MkupCost37: Those are counted as expenses in the budget and set by the parameter p37_CESMkup.
*` (b) Mark-up cost on other inputs: Those are budget-neutral and implemented as a tax. They are set by the parameter pm_tau_ces_tax.

*` Mark-up cost in industry are modeled without budget-effect (b).

Expand Down
21 changes: 10 additions & 11 deletions modules/37_industry/subsectors/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Parameters
pm_abatparam_Ind(ttot,all_regi,all_enty,steps) "industry CCS MAC curves [ratio @ US$2005]"
pm_energy_limit(all_in) "thermodynamic/technical limits of subsector energy use [GJ/t product]"
p37_energy_limit_slope(tall,all_regi,all_in) "limit for subsector specific energy demand that converges towards the thermodynamic/technical limit [GJ/t product]"
p37_clinker_cement_ratio(ttot,all_regi) "clinker content per unit cement used"
pm_ue_eff_target(all_in) "energy efficiency target trajectories [% p.a.]"
pm_IndstCO2Captured(ttot,all_regi,all_enty,all_enty,secInd37,all_emiMkt) "Captured CO2 in industry by energy carrier, subsector and emissions market"
p37_CESMkup(ttot,all_regi,all_in) "parameter for those CES markup cost accounted as investment cost in the budget [trUSD/CES input]"
p37_cesIO_up_steel_secondary(tall,all_regi,all_GDPscen) "upper limit to secondary steel production based on scrap availability"
p37_clinker_cement_ratio(ttot,all_regi) "clinker content per unit cement used"
pm_ue_eff_target(all_in) "energy efficiency target trajectories [% p.a.]"
pm_IndstCO2Captured(ttot,all_regi,all_enty,all_enty,secInd37,all_emiMkt) "Captured CO2 in industry by energy carrier, subsector and emissions market [GtC/a]"
p37_CESMkup(ttot,all_regi,all_in) "parameter for those CES markup cost accounted as investment cost in the budget [trUSD/CES input]"
p37_cesIO_up_steel_secondary(tall,all_regi,all_GDPscen) "upper limit to secondary steel production based on scrap availability"
p37_steel_secondary_max_share(tall,all_regi) "maximum share of secondary steel production"
p37_BAU_industry_ETS_solids(tall,all_regi) "industry solids demand in baseline scenario"
p37_cesIO_baseline(tall,all_regi,all_in) "vm_cesIO from the baseline scenario"
Expand All @@ -28,12 +28,12 @@ $ifthen.process_based_steel "%cm_process_based_steel%" == "on" !
$endif.process_based_steel

*** output parameters only for reporting
o37_emiInd(ttot,all_regi,all_enty,secInd37,all_enty) "industry CCS emissions [GtC/a]"
o37_cementProcessEmissions(ttot,all_regi,all_enty) "cement process emissions [GtC/a]"
o37_emiInd(ttot,all_regi,all_enty,secInd37,all_enty) "industry CCS emissions [GtC/a]"
o37_cementProcessEmissions(ttot,all_regi,all_enty) "cement process emissions [GtC/a]"
o37_demFeIndTotEn(ttot,all_regi,all_enty,all_emiMkt) "total FE per energy carrier and emissions market in industry (sum over subsectors)"
o37_shIndFE(ttot,all_regi,all_enty,secInd37,all_emiMkt) "share of subsector in FE industry energy carriers and emissions markets"
o37_demFeIndSub(ttot,all_regi,all_enty,all_enty,secInd37,all_emiMkt) "FE demand per industry subsector"
o37_demFeIndSub_SecCC(ttot,all_regi,secInd37) "FE per subsector whose emissions can be captured, helper parameter for calculation of industry captured CO2"
o37_shIndFE(ttot,all_regi,all_enty,secInd37,all_emiMkt) "share of subsector in FE industry energy carriers and emissions markets"
o37_demFeIndSub(ttot,all_regi,all_enty,all_enty,secInd37,all_emiMkt) "FE demand per industry subsector"
o37_demFeIndSub_SecCC(ttot,all_regi,secInd37) "FE per subsector whose emissions can be captured, helper parameter for calculation of industry captured CO2"

$ifThen.CESMkup not "%cm_CESMkup_ind%" == "standard"
p37_CESMkup_input(all_in) "markup cost parameter read in from config for CES levels in industry to influence demand-side cost and efficiencies in CES tree [trUSD/CES input]" / %cm_CESMkup_ind% /
Expand Down Expand Up @@ -81,4 +81,3 @@ $endif.process_based_steel
;

*** EOF ./modules/37_industry/subsectors/declarations.gms

8 changes: 4 additions & 4 deletions modules/37_industry/subsectors/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
***-------------------------------------------------------------------------------
*** MATERIAL-FLOW IMPLEMENTATION
***-------------------------------------------------------------------------------
* Balance equation: Demand of materials equals to production of those materials,
* accounting for trade. Demand of materials arises either due to external demand
* Balance equation: Demand of materials equals to production of those materials,
* accounting for trade. Demand of materials arises either due to external demand
* from the economy (i.e. steel) or due to internal demand of the processes modelled
* in the materials-flow model (i.e. directly reduced iron).
*
Expand Down Expand Up @@ -106,10 +106,10 @@ $ifthen.fixed_production "%cm_import_EU%" == "bal" !! cm_import_EU
!! do not limit steel production shares for fixed production
AND p37_industry_quantity_targets(ttot,regi,"ue_steel_secondary") eq 0
$endif.fixed_production
$ifthen.exogDem_scen NOT "%cm_exogDem_scen%" == "off"
$ifthen.exogDem_scen NOT "%cm_exogDem_scen%" == "off"
!! do not limit steel production shares for fixed production
AND pm_exogDemScen(ttot,regi,"%cm_exogDem_scen%","ue_steel_secondary") eq 0
$endif.exogDem_scen
$endif.exogDem_scen

) ..
vm_cesIO(ttot,regi,"ue_steel_secondary")
Expand Down
Loading

0 comments on commit f63bcb5

Please sign in to comment.