From dd15c06ca8b42244bb2b1080d26702a40c3eee93 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Mon, 18 Jul 2022 16:38:04 +0200 Subject: [PATCH 01/12] added demand for bioplastics in f62_materials --- config/default.cfg | 5 +++++ modules/62_material/exo_flexreg_apr16/equations.gms | 2 +- modules/62_material/exo_flexreg_apr16/input.gms | 7 +++++++ modules/62_material/input/files | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/config/default.cfg b/config/default.cfg index 7a9d834657..c89e477010 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1510,6 +1510,11 @@ cfg$gms$c60_bioenergy_subsidy <- 300 # def = 300 # * (exo_flexreg_apr16): default cfg$gms$material <- "exo_flexreg_apr16" +# * scalar whether demand for bioplastics should be considered +# * (0) off +# * (1) on +cfg$gms$s62_bioplastics <- 0 # def = 0 + # ***--------------------- 70_livestock ----------------------------------- # * (fbask_jan16): default feed basket realization cfg$gms$livestock <- "fbask_jan16" # def = fbask_jan16 diff --git a/modules/62_material/exo_flexreg_apr16/equations.gms b/modules/62_material/exo_flexreg_apr16/equations.gms index 7db6e00930..3a56959aff 100644 --- a/modules/62_material/exo_flexreg_apr16/equations.gms +++ b/modules/62_material/exo_flexreg_apr16/equations.gms @@ -22,7 +22,7 @@ sum(ct,f62_dem_material(ct,i2,kall))*s62_historical + (p62_dem_material_lh(i2,kall) * p62_scaling_factor(i2)) - *(1-s62_historical) + *(1-s62_historical) + sum(ct,f62_dem_bioplastics(ct,i2,kall)) * s62_bioplastics ; *' Results are stored in the interface `vm_dem_material` and this interface diff --git a/modules/62_material/exo_flexreg_apr16/input.gms b/modules/62_material/exo_flexreg_apr16/input.gms index 4783aca37b..7134649154 100644 --- a/modules/62_material/exo_flexreg_apr16/input.gms +++ b/modules/62_material/exo_flexreg_apr16/input.gms @@ -10,3 +10,10 @@ table f62_dem_material(t_all,i,kall) Historical material demand (mio. tDM) $ondelim $include "./modules/62_material/input/f62_dem_material.cs3" $offdelim; + +table f62_dem_bioplastics(t_all,i,kall) Material demand for bioplastic production (mio. tDM) +$ondelim +$include "./modules/62_material/input/f62_dem_bioplastics.cs3" +$offdelim; + +scalar s62_bioplastics switch to include material demand for bioplastics (binary) / 0 /; \ No newline at end of file diff --git a/modules/62_material/input/files b/modules/62_material/input/files index 7da2fb95c9..757829de06 100644 --- a/modules/62_material/input/files +++ b/modules/62_material/input/files @@ -1,2 +1,3 @@ * list of files that are required here f62_dem_material.cs3 +f62_dem_bioplastics.cs3 \ No newline at end of file From c4e18ce9e04fbcbd0a81ca14b969b7d85a45899c Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Tue, 26 Jul 2022 16:40:51 +0200 Subject: [PATCH 02/12] implemented scalar to change bioplastic demand --- config/default.cfg | 8 ++++---- .../exo_flexreg_apr16/declarations.gms | 9 ++++++--- .../exo_flexreg_apr16/equations.gms | 3 ++- .../62_material/exo_flexreg_apr16/input.gms | 11 ++++++++--- .../62_material/exo_flexreg_apr16/preloop.gms | 3 +++ .../exo_flexreg_apr16/presolve.gms | 19 +++++++++++++++++++ 6 files changed, 42 insertions(+), 11 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index c89e477010..f119275d04 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1510,10 +1510,10 @@ cfg$gms$c60_bioenergy_subsidy <- 300 # def = 300 # * (exo_flexreg_apr16): default cfg$gms$material <- "exo_flexreg_apr16" -# * scalar whether demand for bioplastics should be considered -# * (0) off -# * (1) on -cfg$gms$s62_bioplastics <- 0 # def = 0 +# * maximum demand of bioplastic, defines logistic curve matching historic demand +# * in 2020 and with midpoint (i.e. half of max. bioplastic demand) in 2050. If 0 +# * biomass demand for bioplastic production is not included. +cfg$gms$s62_max_demand_bioplastics <- 400 # def = 0 # ***--------------------- 70_livestock ----------------------------------- # * (fbask_jan16): default feed basket realization diff --git a/modules/62_material/exo_flexreg_apr16/declarations.gms b/modules/62_material/exo_flexreg_apr16/declarations.gms index 5b3475a4c7..e1302ea91c 100644 --- a/modules/62_material/exo_flexreg_apr16/declarations.gms +++ b/modules/62_material/exo_flexreg_apr16/declarations.gms @@ -8,12 +8,15 @@ scalar s62_historical Switch for turning off historical material demand (1) / 1 / + s62_growth_rate_bioplastic Growth rate of bioplastic demand (1) /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_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_bioplastic_demand(t_all) Demand for bioplastic (mio. t) + p62_biomass4bioplastic(t_all, i, kall) Regional biomass demand for bioplastic production (mio. tDM) ; positive variables diff --git a/modules/62_material/exo_flexreg_apr16/equations.gms b/modules/62_material/exo_flexreg_apr16/equations.gms index 3a56959aff..0e65c32fbd 100644 --- a/modules/62_material/exo_flexreg_apr16/equations.gms +++ b/modules/62_material/exo_flexreg_apr16/equations.gms @@ -22,9 +22,10 @@ sum(ct,f62_dem_material(ct,i2,kall))*s62_historical + (p62_dem_material_lh(i2,kall) * p62_scaling_factor(i2)) - *(1-s62_historical) + sum(ct,f62_dem_bioplastics(ct,i2,kall)) * s62_bioplastics + *(1-s62_historical) + sum(ct, p62_biomass4bioplastic(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 *' balance for crop, livestock, secondary products and residues. + diff --git a/modules/62_material/exo_flexreg_apr16/input.gms b/modules/62_material/exo_flexreg_apr16/input.gms index 7134649154..eaef9e4cb4 100644 --- a/modules/62_material/exo_flexreg_apr16/input.gms +++ b/modules/62_material/exo_flexreg_apr16/input.gms @@ -11,9 +11,14 @@ $ondelim $include "./modules/62_material/input/f62_dem_material.cs3" $offdelim; -table f62_dem_bioplastics(t_all,i,kall) Material demand for bioplastic production (mio. tDM) +table f62_bioplastic2biomass(kall) Biomass demand for one unit of bioplastics (mio. tDM) $ondelim -$include "./modules/62_material/input/f62_dem_bioplastics.cs3" +$include "./modules/62_material/input/f62_bioplastic2biomass.cs3" $offdelim; -scalar s62_bioplastics switch to include material demand for bioplastics (binary) / 0 /; \ No newline at end of file +table f62_hist_bioplastic_demand(t_all) Historic demand for bioplastics (mio. t) +$ondelim +$include "./modules/62_material/input/f62_hist_bioplastic_demand.cs3" +$offdelim; + +scalar s62_max_demand_bioplastics maximum demand for bioplastics / 0 /; \ No newline at end of file diff --git a/modules/62_material/exo_flexreg_apr16/preloop.gms b/modules/62_material/exo_flexreg_apr16/preloop.gms index 487203c5e0..e2095dc135 100644 --- a/modules/62_material/exo_flexreg_apr16/preloop.gms +++ b/modules/62_material/exo_flexreg_apr16/preloop.gms @@ -7,3 +7,6 @@ p62_dem_material_lh(i,kall) =0; p62_dem_food_lh(i)=1; + +s62_growth_rate_bioplastic = log(s62_max_demand_bioplastics/f62_hist_bioplastic_demand(2020) - 1)/(2050-2020); +p62_bioplastic_demand(t_all) = f62_hist_bioplastic_demand(t_all); \ No newline at end of file diff --git a/modules/62_material/exo_flexreg_apr16/presolve.gms b/modules/62_material/exo_flexreg_apr16/presolve.gms index 20d0aac3dd..2c30c5ac16 100644 --- a/modules/62_material/exo_flexreg_apr16/presolve.gms +++ b/modules/62_material/exo_flexreg_apr16/presolve.gms @@ -22,3 +22,22 @@ 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); *' @stop + +# calculate bioplastic demand according to logistic curve for future years +if (m_year(t)>2020, + p62_bioplastic_demand(t) = s62_max_demand_bioplastics / (1 + exp(-s62_growth_rate_bioplastic*(m_year(t)-2050))) +); + +* subtract bioplastic demand in 2010 from all years, as this is already included in biomass demand +if (m_year(t)>=2010, + p62_bioplastic_demand(t) = p62_bioplastic_demand(t) - p62_bioplastic_demand("y2010") +); + +* if max. bioplastic demand is set to zero, overwrite calculations with zero +if (s62_max_demand_bioplastics == 0, + p62_bioplastic_demand(t) = 0 +); + +* translate bioplastic demand to biomass demand using conversion factors between bioplastic and the different biomass sources +* and population for spatial disaggregation +p62_biomass4bioplastic(t, i, kall) = p62_bioplastic_demand(t) * f62_bioplastic2biomass(kall) * (im_pop(t, i) / sum(i2, im_pop(t, i2))); \ No newline at end of file From 56ce9687cda107a60bba4f8818f188271f0fb0f6 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Mon, 1 Aug 2022 19:45:04 +0200 Subject: [PATCH 03/12] update of bioplastic implementation --- config/default.cfg | 12 ++++++---- .../exo_flexreg_apr16/declarations.gms | 11 +++++----- .../exo_flexreg_apr16/equations.gms | 2 +- .../62_material/exo_flexreg_apr16/input.gms | 21 ++++++++++++------ .../62_material/exo_flexreg_apr16/preloop.gms | 6 +++-- .../exo_flexreg_apr16/presolve.gms | 22 +++++++++---------- 6 files changed, 43 insertions(+), 31 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index f119275d04..11273e8bd0 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1510,10 +1510,14 @@ cfg$gms$c60_bioenergy_subsidy <- 300 # def = 300 # * (exo_flexreg_apr16): default cfg$gms$material <- "exo_flexreg_apr16" -# * maximum demand of bioplastic, defines logistic curve matching historic demand -# * in 2020 and with midpoint (i.e. half of max. bioplastic demand) in 2050. If 0 -# * biomass demand for bioplastic production is not included. -cfg$gms$s62_max_demand_bioplastics <- 400 # def = 0 +# * 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 +# * 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. +cfg$gms$s62_max_dem_bioplastics <- 400 # def = 0 +cfg$gms$s62_midpoint_dem_bioplastics <- 2050 # def = 2050 # ***--------------------- 70_livestock ----------------------------------- # * (fbask_jan16): default feed basket realization diff --git a/modules/62_material/exo_flexreg_apr16/declarations.gms b/modules/62_material/exo_flexreg_apr16/declarations.gms index e1302ea91c..c3c9ac0135 100644 --- a/modules/62_material/exo_flexreg_apr16/declarations.gms +++ b/modules/62_material/exo_flexreg_apr16/declarations.gms @@ -12,11 +12,12 @@ scalar ; 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_bioplastic_demand(t_all) Demand for bioplastic (mio. t) - p62_biomass4bioplastic(t_all, i, kall) Regional biomass demand for bioplastic production (mio. tDM) + 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_dem_bioplastic_lh(i) Demand for bioplastics in last historical timestep (mio. t) + p62_scaling_factor(i) Scaling factor for material demand (1) + p62_dem_bioplastic(t,i) Demand for bioplastic (mio. t) + p62_biomass4bioplastic(t, i, kall) Regional biomass demand for bioplastic production (mio. tDM) ; positive variables diff --git a/modules/62_material/exo_flexreg_apr16/equations.gms b/modules/62_material/exo_flexreg_apr16/equations.gms index 0e65c32fbd..eda72d1ffe 100644 --- a/modules/62_material/exo_flexreg_apr16/equations.gms +++ b/modules/62_material/exo_flexreg_apr16/equations.gms @@ -22,7 +22,7 @@ sum(ct,f62_dem_material(ct,i2,kall))*s62_historical + (p62_dem_material_lh(i2,kall) * p62_scaling_factor(i2)) - *(1-s62_historical) + sum(ct, p62_biomass4bioplastic(ct, i2, kall)) + *(1-s62_historical) + sum(ct, p62_biomass4bioplastic(ct, i2, kall)) ; *' Results are stored in the interface `vm_dem_material` and this interface diff --git a/modules/62_material/exo_flexreg_apr16/input.gms b/modules/62_material/exo_flexreg_apr16/input.gms index eaef9e4cb4..e08ea3bb85 100644 --- a/modules/62_material/exo_flexreg_apr16/input.gms +++ b/modules/62_material/exo_flexreg_apr16/input.gms @@ -11,14 +11,21 @@ $ondelim $include "./modules/62_material/input/f62_dem_material.cs3" $offdelim; -table f62_bioplastic2biomass(kall) Biomass demand for one unit of bioplastics (mio. tDM) +parameter f62_bioplastic2biomass(kall) Biomass demand for one unit of bioplastics (mio. tDM) +/ $ondelim -$include "./modules/62_material/input/f62_bioplastic2biomass.cs3" -$offdelim; +$include "./modules/62_material/input/f62_bioplastic2biomass.csv" +$offdelim +/ +; -table f62_hist_bioplastic_demand(t_all) Historic demand for bioplastics (mio. t) +parameter f62_hist_dem_bioplastic(t_all) Historic demand for bioplastics (mio. t) +/ $ondelim -$include "./modules/62_material/input/f62_hist_bioplastic_demand.cs3" -$offdelim; +$include "./modules/62_material/input/f62_hist_dem_bioplastic.csv" +$offdelim +/ +; -scalar s62_max_demand_bioplastics maximum demand for bioplastics / 0 /; \ No newline at end of file +scalar s62_max_dem_bioplastic maximum demand for bioplastics / 0 /; +scalar s62_midpoint_dem_bioplastic midpoint of logistic function for bioplastic demand / 2050 /; \ No newline at end of file diff --git a/modules/62_material/exo_flexreg_apr16/preloop.gms b/modules/62_material/exo_flexreg_apr16/preloop.gms index e2095dc135..2acd065797 100644 --- a/modules/62_material/exo_flexreg_apr16/preloop.gms +++ b/modules/62_material/exo_flexreg_apr16/preloop.gms @@ -8,5 +8,7 @@ p62_dem_material_lh(i,kall) =0; p62_dem_food_lh(i)=1; -s62_growth_rate_bioplastic = log(s62_max_demand_bioplastics/f62_hist_bioplastic_demand(2020) - 1)/(2050-2020); -p62_bioplastic_demand(t_all) = f62_hist_bioplastic_demand(t_all); \ No newline at end of file +s62_growth_rate_bioplastic = log(s62_max_demand_bioplastics/f62_hist_bioplastic_demand("y2020") - 1)/(s62_midpoint_bioplastics_dem-2020); +p62_bioplastic_demand(t,i) = f62_hist_bioplastic_demand(t) * (im_pop(t,i) / sum(i2, im_pop(t,i2))); +p62_bioplastic_demand(t,i)$(myear(t)>2020) = s62_max_demand_bioplastics / (1 + exp(-s62_growth_rate_bioplastic*(m_year(t)-s62_midpoint_bioplastics_dem))) * (im_pop(t,i) / sum(i2, im_pop(t,i2))); +p62_dem_bioplastic_lh(i) = sum(t_past$(ord(t_past) eq card(t_past)), p62_bioplastic_demand(t_past, i); \ No newline at end of file diff --git a/modules/62_material/exo_flexreg_apr16/presolve.gms b/modules/62_material/exo_flexreg_apr16/presolve.gms index 2c30c5ac16..fa83f73779 100644 --- a/modules/62_material/exo_flexreg_apr16/presolve.gms +++ b/modules/62_material/exo_flexreg_apr16/presolve.gms @@ -23,21 +23,19 @@ p62_scaling_factor(i)$(p62_dem_food_lh(i) > 0) = sum(kfo, vm_dem_food.l(i,kfo)) *' @stop -# calculate bioplastic demand according to logistic curve for future years -if (m_year(t)>2020, - p62_bioplastic_demand(t) = s62_max_demand_bioplastics / (1 + exp(-s62_growth_rate_bioplastic*(m_year(t)-2050))) -); - -* subtract bioplastic demand in 2010 from all years, as this is already included in biomass demand -if (m_year(t)>=2010, - p62_bioplastic_demand(t) = p62_bioplastic_demand(t) - p62_bioplastic_demand("y2010") +* in t_past, biomass demand for bioplastic is already included in the general material demand, which is +* scaled for future years. Therefore we set bioplastic demand for t_past to zero, and subtract scaled +* bioplastic demand from the last year of t_past from all future bioplastic demand +if (sum(sameas(t_past,t),1) = 1, + p62_dem_bioplastic(t,i) = 0; +else + p62_dem_bioplastic(t,i) = p62_dem_bioplastic(t,i) - p62_dem_bioplastic_lh(i) * p62_scaling_factor(i)); ); * if max. bioplastic demand is set to zero, overwrite calculations with zero -if (s62_max_demand_bioplastics == 0, - p62_bioplastic_demand(t) = 0 +if (s62_max_dem_bioplastic = 0, + p62_dem_bioplastic(t,i) = 0 ); * translate bioplastic demand to biomass demand using conversion factors between bioplastic and the different biomass sources -* and population for spatial disaggregation -p62_biomass4bioplastic(t, i, kall) = p62_bioplastic_demand(t) * f62_bioplastic2biomass(kall) * (im_pop(t, i) / sum(i2, im_pop(t, i2))); \ No newline at end of file +p62_biomass4bioplastic(t,i,kall) = p62_dem_bioplastic(t,i) * f62_bioplastic2biomass(kall); \ No newline at end of file From d669be7ae7a3149737525b4997c6026c190825f9 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Mon, 1 Aug 2022 20:46:48 +0200 Subject: [PATCH 04/12] fixed names, added comments, merged develop --- .../62_material/exo_flexreg_apr16/equations.gms | 5 ++++- modules/62_material/exo_flexreg_apr16/preloop.gms | 14 ++++++++++---- modules/62_material/exo_flexreg_apr16/presolve.gms | 3 ++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/modules/62_material/exo_flexreg_apr16/equations.gms b/modules/62_material/exo_flexreg_apr16/equations.gms index eda72d1ffe..475b4a631d 100644 --- a/modules/62_material/exo_flexreg_apr16/equations.gms +++ b/modules/62_material/exo_flexreg_apr16/equations.gms @@ -14,7 +14,10 @@ *' 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. For future years, additional biomass demand for +*' the production of bioplastics is included according to the scenario choice +*' (for historic years it is assumed that this demand is already part of the +*' general material demand). q62_dem_material(i2,kall) .. vm_dem_material(i2,kall) diff --git a/modules/62_material/exo_flexreg_apr16/preloop.gms b/modules/62_material/exo_flexreg_apr16/preloop.gms index 2acd065797..ff0f252581 100644 --- a/modules/62_material/exo_flexreg_apr16/preloop.gms +++ b/modules/62_material/exo_flexreg_apr16/preloop.gms @@ -8,7 +8,13 @@ p62_dem_material_lh(i,kall) =0; p62_dem_food_lh(i)=1; -s62_growth_rate_bioplastic = log(s62_max_demand_bioplastics/f62_hist_bioplastic_demand("y2020") - 1)/(s62_midpoint_bioplastics_dem-2020); -p62_bioplastic_demand(t,i) = f62_hist_bioplastic_demand(t) * (im_pop(t,i) / sum(i2, im_pop(t,i2))); -p62_bioplastic_demand(t,i)$(myear(t)>2020) = s62_max_demand_bioplastics / (1 + exp(-s62_growth_rate_bioplastic*(m_year(t)-s62_midpoint_bioplastics_dem))) * (im_pop(t,i) / sum(i2, im_pop(t,i2))); -p62_dem_bioplastic_lh(i) = sum(t_past$(ord(t_past) eq card(t_past)), p62_bioplastic_demand(t_past, i); \ No newline at end of file + +*' @code +*' Bioplastic demand is based on historic values up to 2020, and based on a logistic function with given +*' midpoint and limit for future years. + +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) = f62_hist_dem_bioplastic(t) * (im_pop(t,i) / sum(i2, im_pop(t,i2))); +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))); + +*' @stop \ No newline at end of file diff --git a/modules/62_material/exo_flexreg_apr16/presolve.gms b/modules/62_material/exo_flexreg_apr16/presolve.gms index fa83f73779..d2374dfdaf 100644 --- a/modules/62_material/exo_flexreg_apr16/presolve.gms +++ b/modules/62_material/exo_flexreg_apr16/presolve.gms @@ -23,10 +23,11 @@ p62_scaling_factor(i)$(p62_dem_food_lh(i) > 0) = sum(kfo, vm_dem_food.l(i,kfo)) *' @stop -* in t_past, biomass demand for bioplastic is already included in the general material demand, which is +* In t_past, biomass demand for bioplastic is already included in the general material demand, which is * scaled for future years. Therefore we set bioplastic demand for t_past to zero, and subtract scaled * bioplastic demand from the last year of t_past from all future bioplastic demand if (sum(sameas(t_past,t),1) = 1, + p62_dem_bioplastic_lh(i) = p62_dem_bioplastic(t,i); p62_dem_bioplastic(t,i) = 0; else p62_dem_bioplastic(t,i) = p62_dem_bioplastic(t,i) - p62_dem_bioplastic_lh(i) * p62_scaling_factor(i)); From 13865e390fc80158455435c05de3916478ed38e9 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Mon, 1 Aug 2022 22:20:18 +0200 Subject: [PATCH 05/12] small fixes --- CHANGELOG.md | 4 +++- config/default.cfg | 4 ++-- .../62_material/exo_flexreg_apr16/declarations.gms | 2 +- modules/62_material/exo_flexreg_apr16/preloop.gms | 11 +++++++---- modules/62_material/exo_flexreg_apr16/presolve.gms | 2 +- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03ac120b4e..31fc272db0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 - **scripts** output/extra/disaggregation_BII.R adjusted BII output for primary and secondary other land - **59_som** Now calculates soil C for fallow - **inputs** updated non-food initial prices, MACCs curves, and removed suitability threshold of 0.1 in all_marginal setting @@ -16,7 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### added -- **scripts* added output scripts for FSEC FSDP runs +- **scripts** added output scripts for FSEC FSDP runs - **15_food** added new realization with country level exogenous diets, product-specific intake estimates, new scenarios for exogenous BMI and decomposition switches for EAT Lancet diets. Simplified code and improved iteration procedure. ### removed diff --git a/config/default.cfg b/config/default.cfg index 5d3dc65be7..991b83eba3 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1516,8 +1516,8 @@ cfg$gms$material <- "exo_flexreg_apr16" # * 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. -cfg$gms$s62_max_dem_bioplastics <- 400 # def = 0 -cfg$gms$s62_midpoint_dem_bioplastics <- 2050 # def = 2050 +cfg$gms$s62_max_dem_bioplastic <- 400 # def = 0 +cfg$gms$s62_midpoint_dem_bioplastic <- 2050 # def = 2050 # ***--------------------- 70_livestock ----------------------------------- # * (fbask_jan16): default feed basket realization diff --git a/modules/62_material/exo_flexreg_apr16/declarations.gms b/modules/62_material/exo_flexreg_apr16/declarations.gms index c3c9ac0135..b475f7a243 100644 --- a/modules/62_material/exo_flexreg_apr16/declarations.gms +++ b/modules/62_material/exo_flexreg_apr16/declarations.gms @@ -17,7 +17,7 @@ parameters p62_dem_bioplastic_lh(i) Demand for bioplastics in last historical timestep (mio. t) p62_scaling_factor(i) Scaling factor for material demand (1) p62_dem_bioplastic(t,i) Demand for bioplastic (mio. t) - p62_biomass4bioplastic(t, i, kall) Regional biomass demand for bioplastic production (mio. tDM) + p62_biomass4bioplastic(t,i,kall) Regional biomass demand for bioplastic production (mio. tDM) ; positive variables diff --git a/modules/62_material/exo_flexreg_apr16/preloop.gms b/modules/62_material/exo_flexreg_apr16/preloop.gms index ff0f252581..15856e3253 100644 --- a/modules/62_material/exo_flexreg_apr16/preloop.gms +++ b/modules/62_material/exo_flexreg_apr16/preloop.gms @@ -10,11 +10,14 @@ *' @code -*' Bioplastic demand is based on historic values up to 2020, and based on a logistic function with given -*' midpoint and limit for future years. +*' Bioplastic demand is based on historic values up to 2020, and a logistic function with given +*' midpoint and maximum for future years. -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) = f62_hist_dem_bioplastic(t) * (im_pop(t,i) / sum(i2, im_pop(t,i2))); -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))); + +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))); +); *' @stop \ No newline at end of file diff --git a/modules/62_material/exo_flexreg_apr16/presolve.gms b/modules/62_material/exo_flexreg_apr16/presolve.gms index d2374dfdaf..59bfc30bb2 100644 --- a/modules/62_material/exo_flexreg_apr16/presolve.gms +++ b/modules/62_material/exo_flexreg_apr16/presolve.gms @@ -30,7 +30,7 @@ if (sum(sameas(t_past,t),1) = 1, p62_dem_bioplastic_lh(i) = p62_dem_bioplastic(t,i); p62_dem_bioplastic(t,i) = 0; else - p62_dem_bioplastic(t,i) = p62_dem_bioplastic(t,i) - p62_dem_bioplastic_lh(i) * p62_scaling_factor(i)); + p62_dem_bioplastic(t,i) = p62_dem_bioplastic(t,i) - p62_dem_bioplastic_lh(i) * p62_scaling_factor(i); ); * if max. bioplastic demand is set to zero, overwrite calculations with zero From bb04caac9242040356554abfd4211b840760843a Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Mon, 1 Aug 2022 23:04:19 +0200 Subject: [PATCH 06/12] updated comments --- modules/62_material/exo_flexreg_apr16/equations.gms | 7 +++---- modules/62_material/exo_flexreg_apr16/preloop.gms | 7 ++----- modules/62_material/exo_flexreg_apr16/realization.gms | 3 +++ modules/62_material/module.gms | 2 ++ 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/62_material/exo_flexreg_apr16/equations.gms b/modules/62_material/exo_flexreg_apr16/equations.gms index 475b4a631d..0cea950312 100644 --- a/modules/62_material/exo_flexreg_apr16/equations.gms +++ b/modules/62_material/exo_flexreg_apr16/equations.gms @@ -15,9 +15,8 @@ *' 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. For future years, additional biomass demand for -*' the production of bioplastics is included according to the scenario choice -*' (for historic years it is assumed that this demand is already part of the -*' general material demand). +*' the production of bioplastics is included (for historic years it is assumed +*' that this demand is already part of the general material demand). q62_dem_material(i2,kall) .. vm_dem_material(i2,kall) @@ -29,6 +28,6 @@ ; *' 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. diff --git a/modules/62_material/exo_flexreg_apr16/preloop.gms b/modules/62_material/exo_flexreg_apr16/preloop.gms index 15856e3253..f90677a464 100644 --- a/modules/62_material/exo_flexreg_apr16/preloop.gms +++ b/modules/62_material/exo_flexreg_apr16/preloop.gms @@ -9,9 +9,8 @@ p62_dem_food_lh(i)=1; -*' @code -*' Bioplastic demand is based on historic values up to 2020, and a logistic function with given -*' midpoint and maximum for future years. +* Bioplastic demand is based on historic values up to 2020, and a logistic function with given +* midpoint and maximum for future years. p62_dem_bioplastic(t,i) = f62_hist_dem_bioplastic(t) * (im_pop(t,i) / sum(i2, im_pop(t,i2))); @@ -19,5 +18,3 @@ 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))); ); - -*' @stop \ No newline at end of file diff --git a/modules/62_material/exo_flexreg_apr16/realization.gms b/modules/62_material/exo_flexreg_apr16/realization.gms index fdb5ed523f..58c8840e03 100644 --- a/modules/62_material/exo_flexreg_apr16/realization.gms +++ b/modules/62_material/exo_flexreg_apr16/realization.gms @@ -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" diff --git a/modules/62_material/module.gms b/modules/62_material/module.gms index a488e29d2e..df7d0d7022 100644 --- a/modules/62_material/module.gms +++ b/modules/62_material/module.gms @@ -15,6 +15,8 @@ *' 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 From 9ece2be7b7af61494c6aa7dd8592dc85c501733e Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Thu, 4 Aug 2022 08:52:17 +0200 Subject: [PATCH 07/12] added new inputs to files --- modules/62_material/input/files | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/62_material/input/files b/modules/62_material/input/files index 757829de06..066a7ebcfd 100644 --- a/modules/62_material/input/files +++ b/modules/62_material/input/files @@ -1,3 +1,4 @@ * list of files that are required here f62_dem_material.cs3 -f62_dem_bioplastics.cs3 \ No newline at end of file +f62_bioplastic2biomass.csv +f62_hist_dem_bioplastic.csv \ No newline at end of file From fbf88b0d4cac692b4da5145958d1141547421f2f Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Thu, 4 Aug 2022 10:43:12 +0200 Subject: [PATCH 08/12] upated default setting --- config/default.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.cfg b/config/default.cfg index 991b83eba3..fbb39b9912 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1516,7 +1516,7 @@ cfg$gms$material <- "exo_flexreg_apr16" # * 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. -cfg$gms$s62_max_dem_bioplastic <- 400 # def = 0 +cfg$gms$s62_max_dem_bioplastic <- 0 # def = 0 cfg$gms$s62_midpoint_dem_bioplastic <- 2050 # def = 2050 # ***--------------------- 70_livestock ----------------------------------- From d2eb97979ea6e62296361c487a951bfc7cd8f62e Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Mon, 26 Sep 2022 20:12:35 +0200 Subject: [PATCH 09/12] addressed comments --- .../exo_flexreg_apr16/declarations.gms | 15 ++++++----- .../exo_flexreg_apr16/equations.gms | 5 ++-- .../62_material/exo_flexreg_apr16/input.gms | 8 +++--- .../exo_flexreg_apr16/postsolve.gms | 8 +++--- .../62_material/exo_flexreg_apr16/preloop.gms | 7 ++--- .../exo_flexreg_apr16/presolve.gms | 26 +++++++++---------- modules/62_material/module.gms | 2 +- 7 files changed, 37 insertions(+), 34 deletions(-) diff --git a/modules/62_material/exo_flexreg_apr16/declarations.gms b/modules/62_material/exo_flexreg_apr16/declarations.gms index b475f7a243..1b80c8c240 100644 --- a/modules/62_material/exo_flexreg_apr16/declarations.gms +++ b/modules/62_material/exo_flexreg_apr16/declarations.gms @@ -8,16 +8,17 @@ scalar s62_historical Switch for turning off historical material demand (1) / 1 / - s62_growth_rate_bioplastic Growth rate of bioplastic 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_dem_bioplastic_lh(i) Demand for bioplastics in last historical timestep (mio. t) - p62_scaling_factor(i) Scaling factor for material demand (1) - p62_dem_bioplastic(t,i) Demand for bioplastic (mio. t) - p62_biomass4bioplastic(t,i,kall) Regional biomass demand for bioplastic production (mio. tDM) + 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) + p62_scaling_factor(i) Scaling factor for material demand (1) + p62_dem_bioplastic(t,i) Demand for bioplastic (mio. tDM 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 diff --git a/modules/62_material/exo_flexreg_apr16/equations.gms b/modules/62_material/exo_flexreg_apr16/equations.gms index 0cea950312..aa8b58afa6 100644 --- a/modules/62_material/exo_flexreg_apr16/equations.gms +++ b/modules/62_material/exo_flexreg_apr16/equations.gms @@ -23,8 +23,9 @@ =e= sum(ct,f62_dem_material(ct,i2,kall))*s62_historical + - (p62_dem_material_lh(i2,kall) * p62_scaling_factor(i2)) - *(1-s62_historical) + sum(ct, p62_biomass4bioplastic(ct, i2, kall)) + (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 diff --git a/modules/62_material/exo_flexreg_apr16/input.gms b/modules/62_material/exo_flexreg_apr16/input.gms index e08ea3bb85..6c4e9abb62 100644 --- a/modules/62_material/exo_flexreg_apr16/input.gms +++ b/modules/62_material/exo_flexreg_apr16/input.gms @@ -11,7 +11,7 @@ $ondelim $include "./modules/62_material/input/f62_dem_material.cs3" $offdelim; -parameter f62_bioplastic2biomass(kall) Biomass demand for one unit of bioplastics (mio. tDM) +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" @@ -19,7 +19,7 @@ $offdelim / ; -parameter f62_hist_dem_bioplastic(t_all) Historic demand for bioplastics (mio. t) +parameter f62_hist_dem_bioplastic(t_all) Historic demand for bioplastics (mio. tDM) / $ondelim $include "./modules/62_material/input/f62_hist_dem_bioplastic.csv" @@ -27,5 +27,5 @@ $offdelim / ; -scalar s62_max_dem_bioplastic maximum demand for bioplastics / 0 /; -scalar s62_midpoint_dem_bioplastic midpoint of logistic function for bioplastic demand / 2050 /; \ No newline at end of file +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 /; diff --git a/modules/62_material/exo_flexreg_apr16/postsolve.gms b/modules/62_material/exo_flexreg_apr16/postsolve.gms index 4ce1b563b2..de2732f019 100644 --- a/modules/62_material/exo_flexreg_apr16/postsolve.gms +++ b/modules/62_material/exo_flexreg_apr16/postsolve.gms @@ -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)); ); *' @stop diff --git a/modules/62_material/exo_flexreg_apr16/preloop.gms b/modules/62_material/exo_flexreg_apr16/preloop.gms index f90677a464..39ef0e47fb 100644 --- a/modules/62_material/exo_flexreg_apr16/preloop.gms +++ b/modules/62_material/exo_flexreg_apr16/preloop.gms @@ -5,12 +5,13 @@ *** | 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; + p62_dem_food_lastcalibyearh(i)=1; * Bioplastic demand is based on historic values up to 2020, and a logistic function with given -* midpoint and maximum for future years. +* 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))); diff --git a/modules/62_material/exo_flexreg_apr16/presolve.gms b/modules/62_material/exo_flexreg_apr16/presolve.gms index 59bfc30bb2..6092b177e4 100644 --- a/modules/62_material/exo_flexreg_apr16/presolve.gms +++ b/modules/62_material/exo_flexreg_apr16/presolve.gms @@ -19,24 +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 -* In t_past, biomass demand for bioplastic is already included in the general material demand, which is -* scaled for future years. Therefore we set bioplastic demand for t_past to zero, and subtract scaled -* bioplastic demand from the last year of t_past from all future bioplastic demand -if (sum(sameas(t_past,t),1) = 1, - p62_dem_bioplastic_lh(i) = p62_dem_bioplastic(t,i); - p62_dem_bioplastic(t,i) = 0; -else - p62_dem_bioplastic(t,i) = p62_dem_bioplastic(t,i) - p62_dem_bioplastic_lh(i) * p62_scaling_factor(i); -); - -* if max. bioplastic demand is set to zero, overwrite calculations with zero +* if max. bioplastic demand is set to zero, overwrite bioplastic demand with zero if (s62_max_dem_bioplastic = 0, p62_dem_bioplastic(t,i) = 0 ); * translate bioplastic demand to biomass demand using conversion factors between bioplastic and the different biomass sources -p62_biomass4bioplastic(t,i,kall) = p62_dem_bioplastic(t,i) * f62_bioplastic2biomass(kall); \ No newline at end of file +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); +); diff --git a/modules/62_material/module.gms b/modules/62_material/module.gms index df7d0d7022..c155dd722e 100644 --- a/modules/62_material/module.gms +++ b/modules/62_material/module.gms @@ -18,7 +18,7 @@ *' 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" From 4ef4d188ec2c1e9caa836b8e8fd21f8e19d27345 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Tue, 27 Sep 2022 09:55:40 +0200 Subject: [PATCH 10/12] updated documentation --- modules/62_material/exo_flexreg_apr16/equations.gms | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/62_material/exo_flexreg_apr16/equations.gms b/modules/62_material/exo_flexreg_apr16/equations.gms index aa8b58afa6..70b24ed40f 100644 --- a/modules/62_material/exo_flexreg_apr16/equations.gms +++ b/modules/62_material/exo_flexreg_apr16/equations.gms @@ -14,9 +14,10 @@ *' 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. For future years, additional biomass demand for -*' the production of bioplastics is included (for historic years it is assumed -*' that this demand is already part of the general material demand). +*' 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) From 0a559f476b16be2905a6b101bef7d0ad1605bb82 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Wed, 28 Sep 2022 14:47:28 +0200 Subject: [PATCH 11/12] updated documentation --- config/default.cfg | 8 ++++++-- modules/62_material/exo_flexreg_apr16/declarations.gms | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index b2374e653a..f427ce2bbf 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1559,9 +1559,13 @@ 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 -# * and the midpoint s62_midpoint_dem_bioplastics (i.e. where bioplastic -# * demand is half of the maximum demand). +# * (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 diff --git a/modules/62_material/exo_flexreg_apr16/declarations.gms b/modules/62_material/exo_flexreg_apr16/declarations.gms index 1b80c8c240..ef5ad1b5f5 100644 --- a/modules/62_material/exo_flexreg_apr16/declarations.gms +++ b/modules/62_material/exo_flexreg_apr16/declarations.gms @@ -15,7 +15,7 @@ parameters 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) p62_scaling_factor(i) Scaling factor for material demand (1) - p62_dem_bioplastic(t,i) Demand for bioplastic (mio. tDM per yr) + 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) From 7ac17c2689bb33876ba7a9c9d77455eb90cea1a1 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Thu, 29 Sep 2022 11:53:45 +0200 Subject: [PATCH 12/12] addressed comments --- .../62_material/exo_flexreg_apr16/declarations.gms | 2 +- modules/62_material/exo_flexreg_apr16/equations.gms | 3 --- modules/62_material/exo_flexreg_apr16/postsolve.gms | 4 ++-- modules/62_material/exo_flexreg_apr16/preloop.gms | 12 +++++++----- modules/62_material/exo_flexreg_apr16/presolve.gms | 10 +--------- 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/modules/62_material/exo_flexreg_apr16/declarations.gms b/modules/62_material/exo_flexreg_apr16/declarations.gms index ef5ad1b5f5..d0f50eea5c 100644 --- a/modules/62_material/exo_flexreg_apr16/declarations.gms +++ b/modules/62_material/exo_flexreg_apr16/declarations.gms @@ -13,7 +13,7 @@ scalar parameters 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) + p62_dem_food_lastcalibyear(i) Food demand in last historical timestep (mio. tDM per yr) 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) diff --git a/modules/62_material/exo_flexreg_apr16/equations.gms b/modules/62_material/exo_flexreg_apr16/equations.gms index 70b24ed40f..53c18a1139 100644 --- a/modules/62_material/exo_flexreg_apr16/equations.gms +++ b/modules/62_material/exo_flexreg_apr16/equations.gms @@ -29,7 +29,4 @@ 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 -*' balance for crop, livestock, secondary products and residues. diff --git a/modules/62_material/exo_flexreg_apr16/postsolve.gms b/modules/62_material/exo_flexreg_apr16/postsolve.gms index de2732f019..68be8d8259 100644 --- a/modules/62_material/exo_flexreg_apr16/postsolve.gms +++ b/modules/62_material/exo_flexreg_apr16/postsolve.gms @@ -5,14 +5,14 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de *' @code -*' The parameters `p62_dem_material_lastcalibyear` and `p62_dem_food_lastcalibyearh` +*' The parameters `p62_dem_material_lastcalibyear` and `p62_dem_food_lastcalibyear` *' 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_lastcalibyear(i,kall) = f62_dem_material(t,i,kall); - p62_dem_food_lastcalibyearh(i)= sum(kfo, vm_dem_food.l(i,kfo)); + p62_dem_food_lastcalibyear(i) = sum(kfo, vm_dem_food.l(i,kfo)); ); *' @stop diff --git a/modules/62_material/exo_flexreg_apr16/preloop.gms b/modules/62_material/exo_flexreg_apr16/preloop.gms index 39ef0e47fb..8e0f53e746 100644 --- a/modules/62_material/exo_flexreg_apr16/preloop.gms +++ b/modules/62_material/exo_flexreg_apr16/preloop.gms @@ -5,17 +5,19 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de - p62_dem_material_lastcalibyear(i,kall) =0; - p62_dem_food_lastcalibyearh(i)=1; - + p62_dem_material_lastcalibyear(i,kall) = 0; + p62_dem_food_lastcalibyear(i) = 1; + p62_dem_bioplastic(t,i) = 0; * 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))); - if (s62_max_dem_bioplastic <> 0, + p62_dem_bioplastic(t,i) = f62_hist_dem_bioplastic(t) * (im_pop(t,i) / sum(i2, im_pop(t,i2))); 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))); ); + +* 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); \ No newline at end of file diff --git a/modules/62_material/exo_flexreg_apr16/presolve.gms b/modules/62_material/exo_flexreg_apr16/presolve.gms index 6092b177e4..f7553f0844 100644 --- a/modules/62_material/exo_flexreg_apr16/presolve.gms +++ b/modules/62_material/exo_flexreg_apr16/presolve.gms @@ -19,18 +19,10 @@ else ); p62_scaling_factor(i) = 1; -p62_scaling_factor(i)$(p62_dem_food_lastcalibyearh(i) > 0) = sum(kfo, vm_dem_food.l(i,kfo)) / p62_dem_food_lastcalibyearh(i); +p62_scaling_factor(i)$(p62_dem_food_lastcalibyear(i) > 0) = sum(kfo, vm_dem_food.l(i,kfo)) / p62_dem_food_lastcalibyear(i); *' @stop -* if max. bioplastic demand is set to zero, overwrite bioplastic demand with zero -if (s62_max_dem_bioplastic = 0, - 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.