Skip to content

Commit

Permalink
Merge pull request #578 from weindl/f_past_mngmnt_calib
Browse files Browse the repository at this point in the history
Update pasture management factor
  • Loading branch information
weindl authored Jul 20, 2023
2 parents 6accc8f + e27a70f commit 31bcc2a
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 35 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]

### changed
-
-

### added
-
Expand All @@ -17,7 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
-

### fixed
-
- **70_livestock** consideration of milk demand in the calculation of the pasture management factor


## [4.6.8] - 2023-07-17
Expand Down
2 changes: 1 addition & 1 deletion config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cfg$input <- c(regional = "rev4.87_h12_magpie.tgz",
cellular = "rev4.87_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz",
validation = "rev4.87_h12_validation.tgz",
additional = "additional_data_rev4.43.tgz",
calibration = "calibration_H12_per_ton_fao_may22_glo_08Jul23.tgz")
calibration = "calibration_H12_per_ton_fao_may22_glo_14Jul23.tgz")

# NOTE: It is recommended to recalibrate the model when changing cellular input data
# as well as for any other setting that would affect initial values in the model,
Expand Down
3 changes: 1 addition & 2 deletions modules/15_food/anthro_iso_jun22/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ parameters

* before shock
o15_kcal_regr_initial(t,iso,kfo) Uncalibrated per capita demand before price shock (kcal per capita per day)
p15_kcal_pc_initial(t,i,kfo) Per capita consumption in food demand model before price shock on regional level (kcal per capita per day)
pm_kcal_pc_initial(t,i,kfo) Per capita consumption in food demand model before price shock (kcal per capita per day)
pm_kcal_pc_initial(t,i,kall) Per capita consumption in food demand model before price shock (kcal per capita per day)
p15_kcal_pc_initial_iso(t,iso,kfo) Per capita consumption in food demand model before price shock on country level (kcal per capita per day)

* after price shock
Expand Down
2 changes: 1 addition & 1 deletion modules/15_food/anthro_iso_jun22/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

q15_food_demand(i2,kfo) ..
(vm_dem_food(i2,kfo) + sum(ct, f15_household_balanceflow(ct,i2,kfo,"dm")))
* sum(ct,(f15_nutrition_attributes(ct,kfo,"kcal") * 10**6)) =g=
* sum(ct,(fm_nutrition_attributes(ct,kfo,"kcal") * 10**6)) =g=
sum(ct,im_pop(ct,i2) * p15_kcal_pc_calibrated(ct,i2,kfo)) * 365
;

Expand Down
5 changes: 2 additions & 3 deletions modules/15_food/anthro_iso_jun22/exodietmacro.gms
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ if (s15_run_diet_postprocessing = 1,
p15_bmi_shr_regr(t,iso,sex,age,bmi_group15) = v15_bmi_shr_regr.l(iso,sex,age,bmi_group15);

p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15) =
p15_bmi_shr_regr(t,iso,sex,age,bmi_group15)+
i15_bmi_shr_calib(t,iso,sex,age,bmi_group15);
p15_bmi_shr_regr(t,iso,sex,age,bmi_group15) + i15_bmi_shr_calib(t,iso,sex,age,bmi_group15) * s15_calibrate;

* The BMI shares are not allowed to exceed the bounds 0 and 1. Values are corrected to the bounds.
p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15)$(p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15)<0) = 0;
Expand Down Expand Up @@ -108,7 +107,7 @@ if (s15_run_diet_postprocessing = 1,
+ p15_kcal_pc_iso_rumdairy_orig(t,iso) * (1- i15_rumdairy_fadeout(t,iso)));

*** Substitution of ruminant meat and dairy products (kfo_rd) with single-cell protein (SCP) based on protein/cap/day
i15_protein_to_kcal_ratio(t,kfo) = f15_nutrition_attributes(t,kfo,"protein")/f15_nutrition_attributes(t,kfo,"kcal");
i15_protein_to_kcal_ratio(t,kfo) = fm_nutrition_attributes(t,kfo,"protein")/fm_nutrition_attributes(t,kfo,"kcal");
* Before the substitution, kfo_rd is converted from kcal/cap/day to g protein/cap/day
* using i15_protein_to_kcal_ratio(t,kfo_rd).
* After the substitution of kfo_rd with SCP (1-i15_rumdairy_scp_fadeout), SCP is converted
Expand Down
2 changes: 1 addition & 1 deletion modules/15_food/anthro_iso_jun22/input.gms
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ $ondelim
$include "./modules/15_food/input/f15_household_balanceflow.cs3"
$offdelim;

table f15_nutrition_attributes(t_all,kall,nutrition) Nutrition attributes of food items dedicated for fooduse (mio. kcal per tDM | t Protein per tDM)
table fm_nutrition_attributes(t_all,kall,nutrition) Nutrition attributes of food items dedicated for fooduse (mio. kcal per tDM | t Protein per tDM)
$ondelim
$include "./modules/15_food/input/f15_nutrition_attributes.cs3"
$offdelim;
Expand Down
4 changes: 2 additions & 2 deletions modules/15_food/anthro_iso_jun22/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ $else
$endif

* initial prices in $US per Kcal
i15_prices_initial_kcal(iso,kfo)$(f15_nutrition_attributes("y1995",kfo,"kcal")>0) = f15_prices_initial(kfo)
/ (f15_nutrition_attributes("y1995",kfo,"kcal")*10**6);
i15_prices_initial_kcal(iso,kfo)$(fm_nutrition_attributes("y1995",kfo,"kcal")>0) = f15_prices_initial(kfo)
/ (fm_nutrition_attributes("y1995",kfo,"kcal")*10**6);
p15_prices_kcal(t,iso,kfo,"iter1")=i15_prices_initial_kcal(iso,kfo);
p15_convergence_measure(t,iter15)=NA;
7 changes: 4 additions & 3 deletions modules/15_food/anthro_iso_jun22/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ sets
kfo_lp(kfo) Livestock food products
/ livst_rum,livst_pig,livst_chick, livst_egg, livst_milk /

kfo_rd(kfo) Ruminant meat and dairy food products
/ livst_rum,livst_milk /

kfo_st(kfo) Staple products
/ tece,maiz,trce,rice_pro,soybean,rapeseed,groundnut,sunflower,puls_pro,
potato,cassav_sp,sugr_cane,sugr_beet,molasses,brans,scp /
Expand Down Expand Up @@ -148,6 +145,10 @@ sets
livst_fadeoutscen15 Scenarios for changed composition of livestock products
/ halving2050, constant /

* The set kfo_rd can be defined in default.cfg and is used in the food substitution scenarios c15_rumdairy_scp_scen and c15_rumdairyscen
kfo_rd(kfo) Ruminant meat and dairy food products
/ livst_rum,livst_milk /

fadeoutscen15 Food substitution scenarios including functional forms with targets and transition periods
/ constant,
lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_zero_20_70, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80,
Expand Down
3 changes: 1 addition & 2 deletions modules/15_food/anthropometrics_jan18/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ parameters

* before shock
o15_kcal_regr_initial(t,iso,kfo) Uncalibrated per capita demand before price shock (kcal per capita per day)
p15_kcal_pc_initial(t,i,kfo) Per capita consumption in food demand model before price shock on regional level (kcal per capita per day)
pm_kcal_pc_initial(t,i,kfo) Per capita consumption in food demand model before price shock (kcal per capita per day)
pm_kcal_pc_initial(t,i,kall) Per capita consumption in food demand model before price shock (kcal per capita per day)
p15_kcal_pc_initial_iso(t,iso,kfo) Per capita consumption in food demand model before price shock on country level (kcal per capita per day)

* after price shock
Expand Down
2 changes: 1 addition & 1 deletion modules/15_food/anthropometrics_jan18/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

q15_food_demand(i2,kfo) ..
(vm_dem_food(i2,kfo) + sum(ct, f15_household_balanceflow(ct,i2,kfo,"dm")))
* sum(ct,(f15_nutrition_attributes(ct,kfo,"kcal") * 10**6)) =g=
* sum(ct,(fm_nutrition_attributes(ct,kfo,"kcal") * 10**6)) =g=
sum(ct,im_pop(ct,i2) * p15_kcal_pc_calibrated(ct,i2,kfo)) * 365
;

Expand Down
2 changes: 1 addition & 1 deletion modules/15_food/anthropometrics_jan18/input.gms
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ $ondelim
$include "./modules/15_food/input/f15_household_balanceflow.cs3"
$offdelim;

table f15_nutrition_attributes(t_all,kall,nutrition) Nutrition attributes of food items dedicated for fooduse (mio. kcal per tDM | t Protein per tDM)
table fm_nutrition_attributes(t_all,kall,nutrition) Nutrition attributes of food items dedicated for fooduse (mio. kcal per tDM | t Protein per tDM)
$ondelim
$include "./modules/15_food/input/f15_nutrition_attributes.cs3"
$offdelim;
Expand Down
2 changes: 1 addition & 1 deletion modules/15_food/anthropometrics_jan18/intersolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ p15_kcal_pc_calibrated(t,i,kfo_pp) = p15_plant_kcal_structure_orig(t,i,kfo_pp)
+ p15_kcal_pc_calibrated_rumdairy_orig(t,i) * (1-i15_rumdairy_fadeout(t,i)));

*** Substitution of ruminant meat and dairy products (kfo_rd) with single-cell protein (SCP) based on protein/cap/day
i15_protein_to_kcal_ratio(t,kfo) = f15_nutrition_attributes(t,kfo,"protein")/f15_nutrition_attributes(t,kfo,"kcal");
i15_protein_to_kcal_ratio(t,kfo) = fm_nutrition_attributes(t,kfo,"protein")/fm_nutrition_attributes(t,kfo,"kcal");
* Before the substitution, kfo_rd is converted from kcal/cap/day to g protein/cap/day
* using i15_protein_to_kcal_ratio(t,kfo_rd).
* After the substitution of kfo_rd with SCP (1-i15_rumdairy_scp_fadeout), SCP is converted
Expand Down
4 changes: 2 additions & 2 deletions modules/15_food/anthropometrics_jan18/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ i15_exo_foodscen_fader(t,i) = (1-f15_food_substitution_fader(t,"%c15_exo_foodsce


* initial prices in $US per Kcal
i15_prices_initial_kcal(iso,kfo)$(f15_nutrition_attributes("y1995",kfo,"kcal")>0) = f15_prices_initial(kfo)
/ (f15_nutrition_attributes("y1995",kfo,"kcal")*10**6);
i15_prices_initial_kcal(iso,kfo)$(fm_nutrition_attributes("y1995",kfo,"kcal")>0) = f15_prices_initial(kfo)
/ (fm_nutrition_attributes("y1995",kfo,"kcal")*10**6);
p15_prices_kcal(t,iso,kfo,"iter1")=i15_prices_initial_kcal(iso,kfo);
p15_convergence_measure(t,iter15)=NA;
2 changes: 1 addition & 1 deletion modules/15_food/anthropometrics_jan18/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ p15_kcal_pc_calibrated(t,i,kfo_pp) = p15_plant_kcal_structure_orig(t,i,kfo_pp)
+ p15_kcal_pc_calibrated_rumdairy_orig(t,i) * (1-i15_rumdairy_fadeout(t,i)));

*** Substitution of ruminant meat and dairy products (kfo_rd) with single-cell protein (SCP) based on protein/cap/day
i15_protein_to_kcal_ratio(t,kfo) = f15_nutrition_attributes(t,kfo,"protein")/f15_nutrition_attributes(t,kfo,"kcal");
i15_protein_to_kcal_ratio(t,kfo) = fm_nutrition_attributes(t,kfo,"protein")/fm_nutrition_attributes(t,kfo,"kcal");
* Before the substitution, kfo_rd is converted from kcal/cap/day to g protein/cap/day
* using i15_protein_to_kcal_ratio(t,kfo_rd).
* After the substitution of kfo_rd with SCP (1-i15_rumdairy_scp_fadeout), SCP is converted
Expand Down
7 changes: 4 additions & 3 deletions modules/15_food/anthropometrics_jan18/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ sets
kfo_lp(kfo) Livestock food products
/ livst_rum,livst_pig,livst_chick, livst_egg, livst_milk /

kfo_rd(kfo) Ruminant meat and dairy food products
/ livst_rum,livst_milk /

kfo_st(kfo) Staple products
/ tece,maiz,trce,rice_pro,soybean,rapeseed,groundnut,sunflower,puls_pro,
potato,cassav_sp,sugr_cane,sugr_beet,molasses,brans,scp /
Expand Down Expand Up @@ -148,6 +145,10 @@ sets
livst_fadeoutscen15 Scenarios for changed composition of livestock products
/ halving2050, constant /

* The set kfo_rd can be defined in default.cfg and is used in the food substitution scenarios c15_rumdairy_scp_scen and c15_rumdairyscen
kfo_rd(kfo) Ruminant meat and dairy food products
/ livst_rum,livst_milk /

fadeoutscen15 Food substitution scenarios including functional forms with targets and transition periods
/ constant,
lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_zero_20_70, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80,
Expand Down
4 changes: 3 additions & 1 deletion modules/15_food/module.gms
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*' agricultural commodities q15_food_demand.m to change food demand and iterates
*' with MAgPIE until a common solution is found. Outputs include next to food
*' demand also projections of anthropometric parameters such as body height and
*' weight distribution, as well as phyiscal activity levels.
*' weight distribution, as well as phyiscal activity levels. In addition, this
*' module also provides information about nutrition attributes of foods that can
*' be used in other modules via the interface fm_nutrition_attributes.
*' @authors Benjamin Leon Bodirsky, Isabelle Weindl, Jan Philipp Dietrich

*###################### R SECTION START (MODULETYPES) ##########################
Expand Down
3 changes: 3 additions & 0 deletions modules/16_demand/sector_may15/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ sets
kli(kap) Livestock products
/ livst_rum, livst_pig, livst_chick, livst_egg, livst_milk /

kli_rd(kap) Ruminant meat and dairy products
/ livst_rum,livst_milk /

kforestry(k) forestry products
/ wood, woodfuel /

Expand Down
4 changes: 3 additions & 1 deletion modules/70_livestock/fbask_jan16/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ parameters
im_slaughter_feed_share(t_all,i,kap,attributes) Share of feed that is incorporated in animal biomass (1)
i70_livestock_productivity(t_all,i,sys) Productivity indicator for livestock production (t FM per animal per yr)
im_feed_baskets(t_all,i,kap,kall) Feed baskets in tDM per tDM livestock product (1)
p70_cattle_stock_proxy(t,i) Proxy for cattle stocks needed to fullfil domestic food demand (mio. animals per yr)
p70_cattle_stock_proxy(t,i) Proxy for cattle stocks needed to fullfil food demand for ruminant meat (mio. animals per yr)
p70_milk_cow_proxy(t,i) Proxy for milk cows needed to fullfil food demand for milk (mio. animals per yr)
p70_cattle_feed_pc_proxy(t,i,kli_rd) Proxy for daily per capita feed demand for pasture biomass driven by demand for beef and dairy products (tDM per capita per day)
p70_incr_cattle(t,i) Change in estimated cattle stocks attributed to food demand projections (1)
pm_past_mngmnt_factor(t,i) Regional pasture management intensification factor (1)
i70_cereal_scp_fadeout(t_all,i) Cereal feed fadeout (share 0-1) to be replaced by SCP (1)
Expand Down
28 changes: 21 additions & 7 deletions modules/70_livestock/fbask_jan16/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,39 @@
*' biophysical pasture yields in the module [14_yields].

*' The exogenous calculation of pasture management requires information on
*' the number of cattle reared to fulfil the domestic demand for ruminant
*' changes in the number of cattle reared to fulfil the food demand for ruminant
*' livestock products:

p70_cattle_stock_proxy(t,i) = im_pop(t,i)*pm_kcal_pc_initial(t,i,"livst_rum")
/i70_livestock_productivity(t,i,"sys_beef");
/i70_livestock_productivity(t,i,"sys_beef");

*' The lower bound for `p70_cattle_stock_proxy` is set to 20% of initial cattle
*' stocks in 1995:
p70_milk_cow_proxy(t,i) = im_pop(t,i)*pm_kcal_pc_initial(t,i,"livst_milk")
/i70_livestock_productivity(t,i,"sys_dairy");

*' The lower bound for `p70_cattle_stock_proxy` and `p70_milk_cow_proxy` is
*' set to 20% of initial values in 1995:

p70_cattle_stock_proxy(t,i)$(p70_cattle_stock_proxy(t,i) < 0.2*p70_cattle_stock_proxy("y1995",i)) = 0.2*p70_cattle_stock_proxy("y1995",i);
p70_milk_cow_proxy(t,i)$(p70_milk_cow_proxy(t,i) < 0.2*p70_milk_cow_proxy("y1995",i)) = 0.2*p70_milk_cow_proxy("y1995",i);

*' The parameter `p70_cattle_feed_pc_proxy` is a proxy for regional daily per capita
*' feed demand for pasture biomass driven by demand for beef and dairy products,
*' which is later used for weighted aggregation.
p70_cattle_feed_pc_proxy(t,i,kli_rd) = pm_kcal_pc_initial(t,i,kli_rd)*im_feed_baskets(t,i,kli_rd,"pasture")/(fm_nutrition_attributes(t,kli_rd,"kcal") * 10**6);

*' The parameter `p70_incr_cattle` describes the changes in cattle stocks
*' The parameter `p70_incr_cattle` describes the changes in the number of cattle
*' relative to the previous time step:

p70_incr_cattle(t,i) = 1$(ord(t)=1)
+ (p70_cattle_stock_proxy(t,i)/p70_cattle_stock_proxy(t-1,i))$(ord(t)>1);
+ (
( p70_cattle_feed_pc_proxy(t,i,"livst_rum") * (p70_cattle_stock_proxy(t,i)/p70_cattle_stock_proxy(t-1,i))
+
p70_cattle_feed_pc_proxy(t,i,"livst_milk") * (p70_milk_cow_proxy(t,i)/p70_milk_cow_proxy(t-1,i)) )
/ sum(kli_rd, p70_cattle_feed_pc_proxy(t,i,kli_rd) )
)$(ord(t)>1);

*' The pasture management factor is calculated by applying a linear relationship
*' that links changes in pasture management with changes in cattle stocks:
*' that links changes in pasture management with changes in the number of cattle:

if (m_year(t) <= s70_past_mngmnt_factor_fix,
pm_past_mngmnt_factor(t,i) = 1;
Expand Down

0 comments on commit 31bcc2a

Please sign in to comment.