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

Add biomass demand for bioplastics in 62_material #427

Merged
merged 15 commits into from
Sep 29, 2022
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### changed
- **config** added `s62_max_dem_bioplastic` and `s62_midpoint_dem_bioplastic` to define bioplastic scenario
- **62_material** added biomass demand for bioplastic production
- **config** updated config to new module setup of MACCs
- **51_nitrogen** moved maccs into emission modules. change of interface from vm_btm_reg to vm_emissions_reg
- **58_peatland** moved maccs into emission modules. change of interface from vm_btm_reg to vm_emissions_reg
Expand Down
13 changes: 13 additions & 0 deletions config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1556,6 +1556,19 @@ cfg$gms$c60_bioenergy_subsidy <- 300 # def = 300
# * (exo_flexreg_apr16): default
cfg$gms$material <- "exo_flexreg_apr16"

# * Biomass demand for bioplastics is based on a logistic curve projecting
# * bioplastic demand, which matches the historic demand in 2020, and is
# * defined by the maximum demand for bioplastics s62_max_dem_bioplastics
# * (in mio. tonnes) and the midpoint s62_midpoint_dem_bioplastics (i.e.
# * where bioplastic demand is half of the maximum demand).
# * If maximum demand is 0, biomass demand for bioplastic production is not included.
# * Projected total plastic use in the "Global Ambiton" scneario of the OECD is
# * about 600 mio. tonnes in 2050 -> E.g. 200 mio. tonnes in 2050 could be a
# * reasonable (but ambitious) bioplastic scenario. With midpoint 2050 this
# * would mean s62_max_dem_bioplastic = 400.
cfg$gms$s62_max_dem_bioplastic <- 0 # def = 0
cfg$gms$s62_midpoint_dem_bioplastic <- 2050 # def = 2050

# ***--------------------- 70_livestock -----------------------------------
# * (fbask_jan16): default feed basket realization
cfg$gms$livestock <- "fbask_jan16" # def = fbask_jan16
Expand Down
11 changes: 8 additions & 3 deletions modules/62_material/exo_flexreg_apr16/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@

scalar
s62_historical Switch for turning off historical material demand (1) / 1 /
s62_growth_rate_bioplastic Logistic growth rate of bioplastic demand (1);
;

parameters
p62_dem_material_lh(i,kall) Material demand in last historical timestep (mio. tDM per yr)
p62_dem_food_lh(i) Food demand in last historical timestep (mio. tDM per yr)
p62_scaling_factor(i) Scaling factor for material demand (1)
p62_dem_material_lastcalibyear(i,kall) Material demand in last historical timestep (mio. tDM per yr)
p62_dem_food_lastcalibyearh(i) Food demand in last historical timestep (mio. tDM per yr)
Copy link
Member

Choose a reason for hiding this comment

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

perhaps use ref instead of lastcalibyear(h) as it is basically your point of reference for the following calculations, right?

p62_scaling_factor(i) Scaling factor for material demand (1)
p62_dem_bioplastic(t,i) Demand for bioplastic (mio. t per yr)
p62_bioplastic_substrate(t,i,kall) Regional biomass needed as substrate for bioplastic production (mio. tDM per yr)
p62_bioplastic_substrate_lastcalibyear(i,kall) Bioplastic substrate in last historical timestep (mio. tDM per yr)
p62_bioplastic_substrate_double_counted(t,i,kall) Bioplastic substrate counted both in general material demand and demand for bioplastic (mio. tDM per yr)
;

positive variables
Expand Down
13 changes: 9 additions & 4 deletions modules/62_material/exo_flexreg_apr16/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@
*' as the scaled version of material demand in last historical timestep
*' depending on a scaling factor. This scaling factor is calculated as the
*' ratio beween the food demand from last timestep and the food demand from
*' the last historical time step.
*' the last historical time step. If an exogenous target for bioplastic production
*' is set, material demand (substrate) for bioplastic production is included.
*' For historic years it is assumed that this demand is already part of the
*' general material demand, therefore the double-counted demand is subtracted.

q62_dem_material(i2,kall) ..
vm_dem_material(i2,kall)
=e=
sum(ct,f62_dem_material(ct,i2,kall))*s62_historical
+
(p62_dem_material_lh(i2,kall) * p62_scaling_factor(i2))
*(1-s62_historical)
(p62_dem_material_lastcalibyear(i2,kall) * p62_scaling_factor(i2))
*(1-s62_historical) + sum(ct, p62_bioplastic_substrate(ct, i2, kall)) -
sum(ct, p62_bioplastic_substrate_double_counted(ct,i2,kall))
;

*' Results are stored in the interface `vm_dem_material` and this interface
*' is then used in demand([16_demand]) module as a part of global supply-demand
*' is then used in demand ([16_demand]) module as a part of global supply-demand
*' balance for crop, livestock, secondary products and residues.
deleip marked this conversation as resolved.
Show resolved Hide resolved

19 changes: 19 additions & 0 deletions modules/62_material/exo_flexreg_apr16/input.gms
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,22 @@ table f62_dem_material(t_all,i,kall) Historical material demand (mio. tDM)
$ondelim
$include "./modules/62_material/input/f62_dem_material.cs3"
$offdelim;

parameter f62_biomass2bioplastic_conversion_ratio(kall) Biomass demand for one unit of bioplastics (tDM biomass per tDM bioplastic)
/
$ondelim
$include "./modules/62_material/input/f62_bioplastic2biomass.csv"
$offdelim
/
;

parameter f62_hist_dem_bioplastic(t_all) Historic demand for bioplastics (mio. tDM)
/
$ondelim
$include "./modules/62_material/input/f62_hist_dem_bioplastic.csv"
$offdelim
/
;

scalar s62_max_dem_bioplastic maximum demand for bioplastics (mio. tDM per yr) / 400 /;
scalar s62_midpoint_dem_bioplastic midpoint of logistic function for bioplastic demand (yr) / 2050 /;
8 changes: 4 additions & 4 deletions modules/62_material/exo_flexreg_apr16/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: magpie@pik-potsdam.de
*' @code
*' The parameters `p62_dem_material_lh` and `p62_dem_food_lh` are overwritten
*' based on each time step optimization, in order to be used in next step.
*' The parameters `p62_dem_material_lastcalibyear` and `p62_dem_food_lastcalibyearh`
*' are overwritten based on each time step optimization, in order to be used in next step.
*' This is only carried out when the model is still running in the time period
*' before (and including) y2010 with this model version.

if (sum(sameas(t_past,t),1) = 1,
p62_dem_material_lh(i,kall) = f62_dem_material(t,i,kall);
p62_dem_food_lh(i)= sum(kfo, vm_dem_food.l(i,kfo));
p62_dem_material_lastcalibyear(i,kall) = f62_dem_material(t,i,kall);
p62_dem_food_lastcalibyearh(i)= sum(kfo, vm_dem_food.l(i,kfo));
deleip marked this conversation as resolved.
Show resolved Hide resolved
);

*' @stop
Expand Down
16 changes: 14 additions & 2 deletions modules/62_material/exo_flexreg_apr16/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,17 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: magpie@pik-potsdam.de

p62_dem_material_lh(i,kall) =0;
p62_dem_food_lh(i)=1;
p62_dem_material_lastcalibyear(i,kall) =0;
deleip marked this conversation as resolved.
Show resolved Hide resolved
p62_dem_food_lastcalibyearh(i)=1;
deleip marked this conversation as resolved.
Show resolved Hide resolved


* Bioplastic demand is based on historic values up to 2020, and a logistic function with given
* midpoint and maximum for future years. Global bioplastic demand is distributed to regions
* proportional to population due to lack of better data.

p62_dem_bioplastic(t,i) = f62_hist_dem_bioplastic(t) * (im_pop(t,i) / sum(i2, im_pop(t,i2)));
bodirsky marked this conversation as resolved.
Show resolved Hide resolved

if (s62_max_dem_bioplastic <> 0,
s62_growth_rate_bioplastic = log((s62_max_dem_bioplastic/f62_hist_dem_bioplastic("y2020")) - 1)/(s62_midpoint_dem_bioplastic-2020);
p62_dem_bioplastic(t,i)$(m_year(t)>2020) = s62_max_dem_bioplastic / (1 + exp(-s62_growth_rate_bioplastic*(m_year(t)-s62_midpoint_dem_bioplastic))) * (im_pop(t,i) / sum(i2, im_pop(t,i2)));
);
20 changes: 19 additions & 1 deletion modules/62_material/exo_flexreg_apr16/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ else
);

p62_scaling_factor(i) = 1;
p62_scaling_factor(i)$(p62_dem_food_lh(i) > 0) = sum(kfo, vm_dem_food.l(i,kfo)) / p62_dem_food_lh(i);
p62_scaling_factor(i)$(p62_dem_food_lastcalibyearh(i) > 0) = sum(kfo, vm_dem_food.l(i,kfo)) / p62_dem_food_lastcalibyearh(i);

*' @stop

* if max. bioplastic demand is set to zero, overwrite bioplastic demand with zero
if (s62_max_dem_bioplastic = 0,
Copy link
Member

Choose a reason for hiding this comment

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

why is this case treated separately and why in presolve and not in preloop where it is done for all other cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was left over from an earlier version of handling the double counted bioplastic substrate. I moved it to preloop

p62_dem_bioplastic(t,i) = 0
);

* translate bioplastic demand to biomass demand using conversion factors between bioplastic and the different biomass sources
p62_bioplastic_substrate(t,i,kall) = p62_dem_bioplastic(t,i) * f62_biomass2bioplastic_conversion_ratio(kall);

* In t_past, biomass demand for bioplastic is already included in the general material demand, which is
* scaled for future years. Therefore we calculate the amount of biomass that is counted twice, and subtract
* it in the final biomass demand equation.
if (sum(sameas(t_past,t),1) = 1,
p62_bioplastic_substrate_double_counted(t,i,kall) = p62_bioplastic_substrate(t,i,kall);
p62_bioplastic_substrate_lastcalibyear(i,kall) = p62_bioplastic_substrate(t,i,kall);
else
p62_bioplastic_substrate_double_counted(t,i,kall) = p62_bioplastic_substrate_lastcalibyear(i,kall) * p62_scaling_factor(i);
);
3 changes: 3 additions & 0 deletions modules/62_material/exo_flexreg_apr16/realization.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
*' material module based on historical data. The assumption that material demand
*' grows proportional to food demand is a simplification that can be justified
*' by the minor importance of non-bioenergy material usage of agricultural products.
*' In addition, biomass demand for bioplastic production can be included, with
*' future bioplastic production following a logistic curve with exogenously defined
*' target production.

*####################### R SECTION START (PHASES) ##############################
$Ifi "%phase%" == "sets" $include "./modules/62_material/exo_flexreg_apr16/sets.gms"
Expand Down
2 changes: 2 additions & 0 deletions modules/62_material/input/files
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
* list of files that are required here
f62_dem_material.cs3
f62_bioplastic2biomass.csv
f62_hist_dem_bioplastic.csv
4 changes: 3 additions & 1 deletion modules/62_material/module.gms
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
*' category, the use for bioenergy (oils and ethanol) has been excluded
*' and is accounted for in the demand for bioenergy. Material demand in this
*' context can be considered as a subset of "other utils" category of FAO.
*' In addition, future material demand for bioplastic production can be included
*' by setting a target bioplastic demand.

*' @authors Benjamin Bodirsky
*' @authors Benjamin Bodirsky, Debbora Leip

*###################### R SECTION START (MODULETYPES) ##########################
$Ifi "%material%" == "exo_flexreg_apr16" $include "./modules/62_material/exo_flexreg_apr16/realization.gms"
Expand Down