Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/feedstocks review #6

Closed
wants to merge 56 commits into from

Conversation

0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q

Purpose of this PR

Type of change

(Make sure to delete from the Type-of-change list the items not relevant to your PR)

  • Bug fix
  • Refactoring
  • New feature
  • Minor change (default scenarios show only small differences)
  • Fundamental change
  • This change requires a documentation update

Checklist:

  • My code follows the coding etiquette
  • I performed a self-review of my own code
  • I explained my changes within the PR, particularly in hard-to-understand areas
  • I checked that the in-code documentation is up-to-date
  • I adjusted the reporting in remind2 where it was needed
  • I adjusted forbiddenColumnNames in readCheckScenarioConfig.R in case the PR leads to deprecated switches
  • All automated model tests pass (FAIL 0 in the output of make test)

Further information (optional):

  • Test runs are here:
  • Comparison of results (what changes by this PR?):

…tions to the relevant FE carriers, sectors, markets
…gy and chemical process emissions, only temporary purpose
fix subsetting sums of feedstocks implementation to only apply equation to relevant FE carriers, sectors, markets
remove feedstock carbon from capture potential and fix declaration of pm_emifacNonEnergy
…l carbon stored in feedstocks from energy emissions as this generates negative emissions
…that feedstocks in v_demFeNonEnergySector need to be supplied by the energy system, that is, need to be part of vm_demFeSector
…tion of feedstocks, can be deleted once everything checked
- constraint that all feedstocks should be fossil in baseline
- add penalty cost to avoid switching between biogenic and synthetic feedstocks between time steps (small fuel switching cost)
- subtracting non-fossil (biogenic and synthetic) feedstocks carbon from energy emissions (new form of CDR! -> please discuss with Jess and others!)
- correct FE2CES industry demand equation for feedstocks; this forces the model to actuallly supply the amount of biogenic, synthetic, fossil liquids etc. in vm_demFeSector that is used by vm_demFENonEnergySector. Before it was possible that there was, for instance, more bioliquids in vm_demFENonEnergySector than was in the total vm_demFeSector for indst. Eventually I think this should be refactored such that we define indst and indst_feed as two different sectors and only go with one variable, vm_demFeSector and have two different FE2CES balance equations one for indst and one for indst_feed. The current solution is cumbersome but functional.
- I added some further parameters in postsolve in industry to check whether the things I was subtracting/adding to various equations actually have the values I wanted them to have. This is just to check whether everything works and can be deleted later on
mellamoSimon and others added 26 commits August 2, 2022 11:45
@@ -1461,6 +1461,40 @@ pm_emifac(ttot,regi,"seliqfos","fehos","tdfoshos","co2") = p_ef_dem(regi,"fehos"
pm_emifac(ttot,regi,"seliqfos","fepet","tdfospet","co2") = p_ef_dem(regi,"fepet") / (sm_c_2_co2*1000*sm_EJ_2_TWa); !! GtC/TWa
pm_emifac(ttot,regi,"seliqfos","fedie","tdfosdie","co2") = p_ef_dem(regi,"fedie") / (sm_c_2_co2*1000*sm_EJ_2_TWa); !! GtC/TWa

***------ Read in emission factors for process emissions in chemicals sector---
*' calculated using IEA data on feedstocks flows and UNFCCC data on chem sector process emissions
***TO DO: remove the "*" by modif the input file (fegas instead of gases, etc.)

Choose a reason for hiding this comment

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

What exactly is going to be removed? What stays?

Choose a reason for hiding this comment

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

I wanted to remove the * here: parameter f_nechem_emissionFactors(ttot,all_regi,*) because I don't know if using that trick is proper coding for us. This means introducing some changes in data preparation in mrremind that I was postponing for the final cleaning before merging. Or can I just leave it like that?

Comment on lines +1476 to +1485
pm_emifacNonEnergy(ttot,regi,'segafos','fegas','indst','co2') = f_nechem_emissionFactors(ttot,regi,"gases") / s_zj_2_twa;
pm_emifacNonEnergy(ttot,regi,'seliqfos','fehos','indst','co2') = f_nechem_emissionFactors(ttot,regi,"liquids") / s_zj_2_twa;
pm_emifacNonEnergy(ttot,regi,'sesofos','fesos','indst','co2') = f_nechem_emissionFactors(ttot,regi,"solids") / s_zj_2_twa;

pm_emifacNonEnergy(ttot,regi,'segabio','fegas','indst','co2') = f_nechem_emissionFactors(ttot,regi,"gases") / s_zj_2_twa;
pm_emifacNonEnergy(ttot,regi,'seliqbio','fehos','indst','co2') = f_nechem_emissionFactors(ttot,regi,"liquids") / s_zj_2_twa;
pm_emifacNonEnergy(ttot,regi,'sesobio','fesos','indst','co2') = f_nechem_emissionFactors(ttot,regi,"solids") / s_zj_2_twa;

pm_emifacNonEnergy(ttot,regi,'segasyn','fegas','indst','co2') = f_nechem_emissionFactors(ttot,regi,"gases") / s_zj_2_twa;
pm_emifacNonEnergy(ttot,regi,'seliqsyn','fehos','indst','co2') = f_nechem_emissionFactors(ttot,regi,"liquids") / s_zj_2_twa;

Choose a reason for hiding this comment

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

Use double quotes, as per coding style.

pm_omeg (all_regi,opTimeYr,all_te) "technical depreciation parameter, gives the share of a capacity that is still usable after tlt. [none/share, value between 0 and 1]"
p_aux_lifetime(all_regi,all_te) "auxiliary parameter for calculating life times, calculated externally in excel sheet"
pm_pedem_res(ttot,all_regi,all_te) "Demand for pebiolc residues, needed for enhancement of residue potential [TWa]"
p_ef_dem(all_regi,all_enty) "Demand side emission factor of final energy carriers [MtCO2/EJ]"

*** share of plastic waste that is incinerated REDUNDANT; DELETE ME

Choose a reason for hiding this comment

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

Tip: use one marker comment (like FIXME or TODO) and describe what to change. You have at least DELETE ME and TO DO. Good luck remembering and finding all of them.

Choose a reason for hiding this comment

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

ouch, yeah

Comment on lines +430 to +434
vm_FeedstocksCarbon(ttot,all_regi,all_enty,all_enty,all_emiMkt) "carbon contained in chemical feedstocks [GtC]"
vm_plasticsCarbon(ttot,all_regi,all_enty,all_enty,all_emiMkt) "carbon contained in plastics [GtC]"
vm_feedstockEmiUnknownFate(ttot,all_regi,all_enty,all_enty,all_emiMkt) "carbon contained in plastics with unknown fate (assumed to go back into the atmosphere) [GtC]"
vm_incinerationEmi(ttot,all_regi,all_enty,all_enty,all_emiMkt) "Emissions from incineration of plastic waste [GtC]"
vm_nonIncineratedPlastics(ttot,all_regi,all_enty,all_enty,all_emiMkt) "carbon contained in plastics that are not incinerated [GtC]"

Choose a reason for hiding this comment

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

This could use a little more rigour in the naming and describing. Five variables, that are all defined over the same sets -- notably all_emiMkt, so they all look like emissions.

And it is not apparent what the different fates of plastics are. They can be incinerated, they can not be incinerated (that is landfilled?), and is there something else happening to them (unknown). or is there some part of plastics for which we do not know what happens to them?

Choose a reason for hiding this comment

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

ups yeah, one description is wrong. I'll extend them so it's more clear

vm_nonIncineratedPlastics(t,regi,entySe,entyFe,emiMkt)
)
)$( sameas(enty,"co2") )
!! add emissions from plastics incineration. CHECK FOR DOUBLE-COUNTING RISK

Choose a reason for hiding this comment

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

Another instance where FIXME would have been safer.

Comment on lines +27 to +28
v02_NegInconvPenNonEnSwitch.l(t,regi,entySe,entyFe,sector,emiMkt)
+ v02_NegInconvPenNonEnSwitch.l(t,regi,entySe,entyFe,sector,emiMkt)

Choose a reason for hiding this comment

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

As above: why is this two times the negative variable, not positive and negative?

Choose a reason for hiding this comment

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

I'm running tests now to investigate the effect of fixing this mistake

v02_NegInconvPenNonEnSwitch.l(t,regi,entySe,entyFe,sector,emiMkt)
+ v02_NegInconvPenNonEnSwitch.l(t,regi,entySe,entyFe,sector,emiMkt)
)
/ 1e3

Choose a reason for hiding this comment

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

Again, where does the magic number come from?

@@ -198,6 +198,13 @@ $endif.process_based_steel
feh2_otherInd, fehe_otherInd, feelhth_otherInd)
/

in_chemicals_37(all_in) "chemicals FE that can provide feedstocks"

Choose a reason for hiding this comment

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

A more descriptive name would be welcome. Somebody sometime will mistake this for all the production factors in the chemicals subsector.

/
fesos
fehos
fegas
/

entySE_emiFac_feedstocks(all_enty,all_enty) "SE type of emissions factor that should be used to calculate carbon contained in feedstocks"

Choose a reason for hiding this comment

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

Appears to be unused.

*** carriers, no biofuels or synfuels
q37_FossilFeedstock_Base(t,regi,entyFE,emiMkt)$(
entyFE2sector2emiMkt_NonEn(entyFE,"indst",emiMkt)
AND cm_emiscen eq 1 ) ..

Choose a reason for hiding this comment

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

Not sure if that is (still) sufficient, ince we more or less replaced baseline by NPi.
Should this be the case for NPi runs, too?
See remindmodel#1342.

@0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q 0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q deleted the dev/feedstocks-review branch December 19, 2023 16:11
0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q pushed a commit that referenced this pull request Sep 5, 2024
Reworked `checkClimatePercentiles.R`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants