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

Elastic Food Demand and Tax recycling #767

Merged
merged 18 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### changed
- **scripts** peatland rewetting now automatically considered in `extra/runSEALSallocation.R`
- **15_food** tax recycling for income effect in elastic food demand

flohump marked this conversation as resolved.
Show resolved Hide resolved
### added
- **scripts** added start script for land-based mitigation and biodiversity conservation paper
- **start_scripts** added `lock_timeout` as option to `start_run` function

### removed
-
- **modules/15_food/anthropometrics_jan18** removed as outdated

### fixed
- **44_biodiversity** bugfix i44_biome_share, code cleanup, added scaling of `q44_bii`
- **15_food** elastic demand did not receive prices from the right iteration

## [4.9.0] - 2024-12-05

Expand Down
5 changes: 5 additions & 0 deletions config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ cfg$gms$food <- "anthro_iso_jun22" # def = anthro_iso_jun22
# * options: 0 (exogenous food demand) and 1 (endogenous food demand)
cfg$gms$s15_elastic_demand <- 0 # def =0
bodirsky marked this conversation as resolved.
Show resolved Hide resolved

# * Per capita redistribution of GHG tax revenues
# * options: 1 (distribution_neutral recycling), 0 (burning of money),
#`* <1 (incomplete recycling, regressive), >1 progressive recycling
bodirsky marked this conversation as resolved.
Show resolved Hide resolved
cfg$gms$s15_tax_recycling <- 1 # def = 1

# * maximal number of iterations between food and magpie model before
# * simulation proceeds to next time step
cfg$gms$s15_maxiter <- 5 # def = 5
Expand Down
13 changes: 9 additions & 4 deletions main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ $title magpie
* md5sum: NA
* Repository: https://rse.pik-potsdam.de/data/magpie/public
*
* Used data set: additional_data_rev4.59.tgz
* Used data set: additional_data_rev4.60.tgz
* md5sum: NA
* Repository: https://rse.pik-potsdam.de/data/magpie/public
*
Expand All @@ -179,11 +179,11 @@ $title magpie
*
* Regionscode: 62eff8f7
*
* Regions data revision: 4.114
* Regions data revision: 4.116
*
* lpj2magpie settings:
* * LPJmL data: MRI-ESM2-0:ssp370
* * Revision: 4.114
* * Revision: 4.116
*
* aggregation settings:
* * Input resolution: 0.5
Expand All @@ -194,8 +194,13 @@ $title magpie
* 14 23 10 7 4 26 21 9 16 23 32 15
* * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler)
*
* Warning messages:
bodirsky marked this conversation as resolved.
Show resolved Hide resolved
* 1: In override(url = url, destfile = destfile, quiet = quiet, ... :
* downloaded length 14647821 != reported length 28623062
* 2: In override(url = url, destfile = destfile, quiet = quiet, ... :
* URL 'https://rse.pik-potsdam.de/r/packages/src/contrib/mrdownscale_0.29.0.tar.gz': Timeout of 60 seconds was reached
*
* Last modification (input data): Sun Oct 27 00:37:36 2024
* Last modification (input data): Fri Jan 17 13:44:42 2025
*
*###################### R SECTION END (VERSION INFO) ###########################

Expand Down
8 changes: 5 additions & 3 deletions modules/15_food/anthro_iso_jun22/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ parameters
p15_livestock_threshold_subst_fader(t_all) Fader for livestock threshold target (1)
p15_exo_food_scenario_fader(t_all) Exogenous diet scenario fader (1)

* prices
p15_prices_kcal(t,iso,kfo,iter15) Prices from MAgPIE after optimization (USD17PPP per kcal)
i15_prices_initial_kcal(iso,kfo) Initial prices that capture the approximate level of prices in 1961-2010 (USD17PPP per kcal)

* anthropometrics
p15_bodyheight(t,iso,sex,age,estimates15) Body height (cm per cap)
Expand Down Expand Up @@ -178,6 +175,11 @@ parameters
* country-specific scenario switch
p15_country_switch(iso) Switch indicating whether country is affected by diet scenarios (1)

* elastic demand
p15_tax_recycling(t,iso) Tax revenue recycling to households (USD17PPP per capita)
Copy link
Contributor

Choose a reason for hiding this comment

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

The name of the switch 's15_tax_recycling' that determines how GHG tax revenues are recycled is very similar to the name of the parameter 'p15_tax_recycling(t,iso)'.
Would it be an idea to rename one of them to make the code easier to read?

p15_prices_kcal(t,iso,kfo,iter15) Prices from MAgPIE after optimization (USD17PPP per kcal)
i15_prices_initial_kcal(iso,kfo) Initial prices that capture the approximate level of prices in 1961-2010 (USD17PPP per kcal)

* calculate diet iteration breakpoint
p15_income_pc_real_ppp(t,i) Regional per capita income after price shock on regional level (USD17PPP per capita)
p15_delta_income(t,i,iter15) Regional change in per capita income due to price shock on regional level (1)
Expand Down
6 changes: 3 additions & 3 deletions modules/15_food/anthro_iso_jun22/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ q15_aim ..

q15_budget(iso) ..
v15_income_pc_real_ppp_iso(iso) =e=
sum(kfo, v15_kcal_regr(iso,kfo)*365
*(i15_prices_initial_kcal(iso,kfo)-sum((ct,curr_iter15), p15_prices_kcal(ct,iso,kfo,curr_iter15))))
+ sum(ct,im_gdp_pc_ppp_iso(ct,iso)) + v15_income_balance(iso);
sum(kfo, v15_kcal_regr(iso,kfo) * 365
*(i15_prices_initial_kcal(iso,kfo) - sum((ct,prev_iter15), p15_prices_kcal(ct,iso,kfo,prev_iter15))))
+ sum(ct, im_gdp_pc_ppp_iso(ct,iso) + p15_tax_recycling(ct,iso)) + v15_income_balance(iso);

*' The budget constraint calculates the real income after a possible price
*' shock. The basic assumption is that increasing prices reduce real income,
Expand Down
1 change: 1 addition & 0 deletions modules/15_food/anthro_iso_jun22/input.gms
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ $offMulti

scalars
s15_elastic_demand Elastic demand switch (1=elastic 0=exogenous) (1) / 0 /
s15_tax_recycling Tax recycling multiplier (1=distribution neutral) / 1 /
bodirsky marked this conversation as resolved.
Show resolved Hide resolved
s15_calibrate Calibration switch (1=calibrated 0=pure regression outcomes) (1) / 1 /
* only for per-capita calories, not for e.g. calibration of transformation parameters between per-capita calories in dm
s15_maxiter Scalar defining maximum number of iterations (1) / 5 /
Expand Down
11 changes: 8 additions & 3 deletions modules/15_food/anthro_iso_jun22/intersolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
*' module is executed once again.
display "Coupling: Reading out marginal costs from MAgPIE";
p15_prices_kcal(t,iso,kfo,curr_iter15)=sum(i_to_iso(i,iso), q15_food_demand.m(i,kfo));
*' the quantity of tax money from emission pricing for redistribution is calculated
p15_tax_recycling(t,iso) = sum(i_to_iso(i,iso), (vm_emission_costs.l(i)
/ im_pop(t,i)) * s15_tax_recycling
* (im_gdp_pc_ppp_iso(t,iso) / im_gdp_pc_mer_iso(t,iso)));
*' @stop
);

Expand All @@ -32,12 +36,13 @@ if (s15_elastic_demand = 1 AND m_year(t) > sm_fix_SSP2,
* A new iteration is started
p15_iteration_counter(t) = p15_iteration_counter(t) + 1;
* The set current iter includes only one element with the set element
* of the current iteration, e.g. "iter2"
* of the current iteration, e.g. "iter2". As iter0 also exists,
* "iter2" is the third entry of the set iter15, so we add 1.
curr_iter15(iter15) = no;
curr_iter15(iter15)$(ord(iter15)=p15_iteration_counter(t)) = yes;
curr_iter15(iter15)$(ord(iter15)=p15_iteration_counter(t)+1) = yes;
* Now we also define a set for the previous iteration
prev_iter15(iter15) = no;
prev_iter15(iter15)$(ord(iter15)=p15_iteration_counter(t)-1) = yes;
prev_iter15(iter15)$(ord(iter15)=p15_iteration_counter(t)) = yes;

*' @code
display "starting m15_food_demand in iteration number ", p15_iteration_counter;
Expand Down
3 changes: 2 additions & 1 deletion modules/15_food/anthro_iso_jun22/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,6 @@ else
* initial prices in $US per Kcal
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_tax_recycling(t,iso) = 0;
p15_convergence_measure(t,iter15) = NA;
11 changes: 9 additions & 2 deletions modules/15_food/anthro_iso_jun22/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,20 @@ vm_dem_food.fx(i,knf)=0;

*** Food demand model is calculated the first time for the current time step, using standard prices

* Food prices are intitialized
bodirsky marked this conversation as resolved.
Show resolved Hide resolved
p15_prices_kcal(t,iso,kfo,"iter0") = i15_prices_initial_kcal(iso,kfo);

* activating the first iteration
p15_iteration_counter(t) = 1;

* The set curr_iter15 includes only one element with the set element
* of the current iteration, e.g. "iter2"
* of the current iteration, here "iter1". As iter0 also exists,
* its the second entry of the set.
curr_iter15(iter15) = no;
curr_iter15(iter15)$(ord(iter15)=p15_iteration_counter(t)) = yes;
curr_iter15(iter15)$(ord(iter15)=p15_iteration_counter(t)+1) = yes;
* Now we also define a set for the previous iteration
prev_iter15(iter15) = no;
prev_iter15(iter15)$(ord(iter15)=p15_iteration_counter(t)) = yes;

p15_delta_income(t,i,curr_iter15) = 1;

Expand Down
2 changes: 1 addition & 1 deletion modules/15_food/anthro_iso_jun22/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sets

iter15 iterations between food demand model and magpie
/iter1*iter10/
/iter0*iter10/
curr_iter15(iter15) currently active iteration
prev_iter15(iter15) last active iteration

Expand Down
Loading