Skip to content

Commit

Permalink
renamed _country_dummy to _country_switch in all modules
Browse files Browse the repository at this point in the history
  • Loading branch information
flohump committed Dec 2, 2024
1 parent 41624b5 commit f5e1215
Show file tree
Hide file tree
Showing 38 changed files with 103 additions and 103 deletions.
2 changes: 1 addition & 1 deletion modules/12_interest_rate/select_apr20/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
parameters
pm_interest(t_all,i) Interest rate in each region and timestep (% per yr)
* country-specific region scenario switch
p12_country_dummy(iso) Dummy parameter indicating whether country is affected by interest rate scenario (1)
p12_country_switch(iso) Switch indicating whether country is affected by interest rate scenario (1)
p12_reg_shr(t_all,i) Weighted share of region with regards to interest rate scenario of countries (1)
;
6 changes: 3 additions & 3 deletions modules/12_interest_rate/select_apr20/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
* shall be applied.
* In the default case, the interest rate scenario affects all countries when
* activated.
p12_country_dummy(iso) = 0;
p12_country_dummy(select_countries12) = 1;
p12_country_switch(iso) = 0;
p12_country_switch(select_countries12) = 1;
* Because MAgPIE is not run at country-level, but at region level, a region
* share is calculated that translates the countries' influence to regional level.
* Countries are weighted by their population size.
p12_reg_shr(t_all,i) = sum(i_to_iso(i,iso), p12_country_dummy(iso) * im_pop_iso(t_all,iso)) / sum(i_to_iso(i,iso), im_pop_iso(t_all,iso));
p12_reg_shr(t_all,i) = sum(i_to_iso(i,iso), p12_country_switch(iso) * im_pop_iso(t_all,iso)) / sum(i_to_iso(i,iso), im_pop_iso(t_all,iso));

* Interest rate in countries selected in select_countries12
$ifthen "%c12_interest_rate%" == "coupling"
Expand Down
2 changes: 1 addition & 1 deletion modules/15_food/anthro_iso_jun22/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ parameters
i15_exo_foodscen_fader(t,iso) Fader that converges per capita food consumption to an exogenous diet scenario (1)

* country-specific scenario switch
p15_country_dummy(iso) Dummy parameter indicating whether country is affected by diet scenarios (1)
p15_country_switch(iso) Switch indicating whether country is affected by diet scenarios (1)

* calculate diet iteration breakpoint
p15_income_pc_real_ppp(t,i) Regional per capita income after price shock on regional level (USD17PPP per capita)
Expand Down
20 changes: 10 additions & 10 deletions modules/15_food/anthro_iso_jun22/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Elseif s15_milk_share_fadeout_india = 1,
* Switch to determine countries for which exogenous food scenarios (EAT Lancet diet and
* food waste scenarios), and food substitution scenarios shall be applied.
* In the default case, the exogenous food scenarios affect all countries.
p15_country_dummy(iso) = 0;
p15_country_dummy(scen_countries15) = 1;
p15_country_switch(iso) = 0;
p15_country_switch(scen_countries15) = 1;

** The following lines define scenario faders for substituting different food groups
* If s15_exo_foodscen_functional_form = 1, the exogenous food scenario is faded in linearly.
Expand Down Expand Up @@ -96,13 +96,13 @@ elseif s15_food_subst_functional_form = 2,


* Food substitution scenarios including functional forms, targets and transition periods
i15_ruminant_fadeout(t,iso) = 1 - p15_country_dummy(iso)*p15_ruminant_subst_fader(t);
i15_fish_fadeout(t,iso) = 1 - p15_country_dummy(iso)*p15_fish_subst_fader(t);
i15_alcohol_fadeout(t,iso) = 1 - p15_country_dummy(iso)*p15_alcohol_subst_fader(t);
i15_livestock_fadeout(t,iso) = 1 - p15_country_dummy(iso)*p15_livestock_subst_fader(t);
i15_rumdairy_fadeout(t,iso) = 1 - p15_country_dummy(iso)*p15_rumdairy_subst_fader(t);
i15_rumdairy_scp_fadeout(t,iso) = 1 - p15_country_dummy(iso)*p15_rumdairy_scp_subst_fader(t);
i15_livestock_fadeout_threshold(t,iso) = 1 - p15_country_dummy(iso)*p15_livestock_threshold_subst_fader(t);
i15_ruminant_fadeout(t,iso) = 1 - p15_country_switch(iso)*p15_ruminant_subst_fader(t);
i15_fish_fadeout(t,iso) = 1 - p15_country_switch(iso)*p15_fish_subst_fader(t);
i15_alcohol_fadeout(t,iso) = 1 - p15_country_switch(iso)*p15_alcohol_subst_fader(t);
i15_livestock_fadeout(t,iso) = 1 - p15_country_switch(iso)*p15_livestock_subst_fader(t);
i15_rumdairy_fadeout(t,iso) = 1 - p15_country_switch(iso)*p15_rumdairy_subst_fader(t);
i15_rumdairy_scp_fadeout(t,iso) = 1 - p15_country_switch(iso)*p15_rumdairy_scp_subst_fader(t);
i15_livestock_fadeout_threshold(t,iso) = 1 - p15_country_switch(iso)*p15_livestock_threshold_subst_fader(t);


** The following lines define the scenario fader for the exogeneous food scenario
Expand All @@ -117,7 +117,7 @@ elseif s15_exo_foodscen_functional_form = 2,
);

* Fade in scenarios at country level
i15_exo_foodscen_fader(t,iso) = p15_exo_food_scenario_fader(t) * p15_country_dummy(iso);
i15_exo_foodscen_fader(t,iso) = p15_exo_food_scenario_fader(t) * p15_country_switch(iso);

* Select from the data set of EAT Lancet scenarios the target years that are
* consistent with the target year of the fader:
Expand Down
16 changes: 8 additions & 8 deletions modules/15_food/anthro_iso_jun22/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ if(m_year(t) <= sm_fix_SSP2,
i15_dem_halfsat(iso,regr15) = f15_demand_paras(regr15,"SSP2","halfsaturation");
i15_dem_nonsat(iso,regr15) = f15_demand_paras(regr15,"SSP2","non_saturation");
else
i15_dem_intercept(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","intercept")*p15_country_dummy(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","intercept")*(1-p15_country_dummy(iso));
i15_dem_saturation(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","saturation")*p15_country_dummy(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","saturation")*(1-p15_country_dummy(iso));
i15_dem_halfsat(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","halfsaturation")*p15_country_dummy(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","halfsaturation")*(1-p15_country_dummy(iso));
i15_dem_nonsat(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","non_saturation")*p15_country_dummy(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","non_saturation")*(1-p15_country_dummy(iso));
i15_dem_intercept(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","intercept")*p15_country_switch(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","intercept")*(1-p15_country_switch(iso));
i15_dem_saturation(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","saturation")*p15_country_switch(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","saturation")*(1-p15_country_switch(iso));
i15_dem_halfsat(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","halfsaturation")*p15_country_switch(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","halfsaturation")*(1-p15_country_switch(iso));
i15_dem_nonsat(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","non_saturation")*p15_country_switch(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","non_saturation")*(1-p15_country_switch(iso));
);

option nlp = conopt4;
Expand Down
2 changes: 1 addition & 1 deletion modules/15_food/anthropometrics_jan18/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ parameters
i15_exo_foodscen_fader(t,i) Fader that converges per capita food consumption to an exogenous diet scenario (1)

* country-specific scenario switch
p15_country_dummy(iso) Dummy parameter indicating whether country is affected by diet scenarios (1)
p15_country_switch(iso) Switch indicating whether country is affected by diet scenarios (1)
p15_foodscen_region_shr(t_all,i) Weighted share of region with regards to diet scenario of countries (1)

* calculate diet iteration breakpoint
Expand Down
6 changes: 3 additions & 3 deletions modules/15_food/anthropometrics_jan18/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ p15_demand2intake_ratio_ref(i) = 0;
* Switch to determine countries for which exogenous food scenarios (EAT Lancet diet and
* food waste scenarios), and food substitution scenarios shall be applied.
* In the default case, the food scenario affects all countries when activated.
p15_country_dummy(iso) = 0;
p15_country_dummy(scen_countries15) = 1;
p15_country_switch(iso) = 0;
p15_country_switch(scen_countries15) = 1;

* Because MAgPIE is not run at country-level, but at region level, a region
* share is calculated that translates the countries' influence to regional level.
* Countries are weighted by their population size.
p15_foodscen_region_shr(t_all,i) = sum(i_to_iso(i,iso), p15_country_dummy(iso) * im_pop_iso(t_all,iso)) / sum(i_to_iso(i,iso), im_pop_iso(t_all,iso));
p15_foodscen_region_shr(t_all,i) = sum(i_to_iso(i,iso), p15_country_switch(iso) * im_pop_iso(t_all,iso)) / sum(i_to_iso(i,iso), im_pop_iso(t_all,iso));


** The following lines define scenario faders for substituting different food groups
Expand Down
16 changes: 8 additions & 8 deletions modules/15_food/anthropometrics_jan18/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ if(m_year(t) <= sm_fix_SSP2,
i15_dem_halfsat(iso,regr15) = f15_demand_paras(regr15,"SSP2","halfsaturation");
i15_dem_nonsat(iso,regr15) = f15_demand_paras(regr15,"SSP2","non_saturation");
else
i15_dem_intercept(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","intercept")*p15_country_dummy(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","intercept")*(1-p15_country_dummy(iso));
i15_dem_saturation(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","saturation")*p15_country_dummy(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","saturation")*(1-p15_country_dummy(iso));
i15_dem_halfsat(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","halfsaturation")*p15_country_dummy(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","halfsaturation")*(1-p15_country_dummy(iso));
i15_dem_nonsat(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","non_saturation")*p15_country_dummy(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","non_saturation")*(1-p15_country_dummy(iso));
i15_dem_intercept(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","intercept")*p15_country_switch(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","intercept")*(1-p15_country_switch(iso));
i15_dem_saturation(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","saturation")*p15_country_switch(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","saturation")*(1-p15_country_switch(iso));
i15_dem_halfsat(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","halfsaturation")*p15_country_switch(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","halfsaturation")*(1-p15_country_switch(iso));
i15_dem_nonsat(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","non_saturation")*p15_country_switch(iso)
+ f15_demand_paras(regr15,"%c15_food_scenario_noselect%","non_saturation")*(1-p15_country_switch(iso));
);

option nlp = conopt4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ parameters
p22_past_restore_pot(t,j) Potential pasture restoration area (mio. ha)
p22_other_restore_pot(t,j) Potential other land restoration area (mio. ha)
p22_country_weight(i) Land conservation country weight per region (1)
p22_country_dummy(iso) Dummy parameter indicating whether country is affected by selected land conservation policy (1)
p22_country_switch(iso) Switch indicating whether country is affected by selected land conservation policy (1)
i22_land_iso(iso) Total land area at ISO level (mio. ha)
;

6 changes: 3 additions & 3 deletions modules/22_land_conservation/area_based_apr22/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
* Regional share of land conservation policies in selective countries:
* Country switch to determine countries for which land conservation shall be applied.
* In the default case, the land conservation affects all countries when activated.
p22_country_dummy(iso) = 0;
p22_country_dummy(policy_countries22) = 1;
p22_country_switch(iso) = 0;
p22_country_switch(policy_countries22) = 1;
* Because MAgPIE is not run at country-level, but at region level, a region
* share is calculated that translates the countries' influence to regional level.
* Countries are weighted by total land area.
i22_land_iso(iso) = sum(land, fm_land_iso("y1995",iso,land));
p22_country_weight(i) = sum(i_to_iso(i,iso), p22_country_dummy(iso) * i22_land_iso(iso)) / sum(i_to_iso(i,iso), i22_land_iso(iso));
p22_country_weight(i) = sum(i_to_iso(i,iso), p22_country_switch(iso) * i22_land_iso(iso)) / sum(i_to_iso(i,iso), i22_land_iso(iso));

* ---------------------------------------------------------------------
* Initialise baseline protection and conservation priority areas
Expand Down
2 changes: 1 addition & 1 deletion modules/29_cropland/detail_apr24/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ parameters
i29_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha)
p29_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha)
p29_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha)
p29_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1)
p29_country_switch(iso) Switch indicating whether country is affected by selected cropland policy (1)
pm_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha)
i29_snv_scenario_fader(t_all) SNV scenario fader (1)

Expand Down
6 changes: 3 additions & 3 deletions modules/29_cropland/detail_apr24/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ elseif s29_treecover_bii_coeff = 1,

* Country switch to determine countries for which certain policies shall be applied.
* In the default case, the policy affects all countries when activated.
p29_country_dummy(iso) = 0;
p29_country_dummy(policy_countries29) = 1;
p29_country_switch(iso) = 0;
p29_country_switch(policy_countries29) = 1;
* Because MAgPIE is not run at country-level, but at region level, a region
* share is calculated that translates the countries' influence to regional level.
* Countries are weighted by available cropland area.
pm_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%");
p29_country_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso));
p29_country_weight(i) = sum(i_to_iso(i,iso), p29_country_switch(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso));

* Initialize biodiversity value
vm_fallow.l(j) = 0;
Expand Down
2 changes: 1 addition & 1 deletion modules/29_cropland/simple_apr24/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ parameters
i29_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha)
p29_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha)
p29_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha)
p29_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1)
p29_country_switch(iso) Switch indicating whether country is affected by selected cropland policy (1)
pm_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha)
i29_snv_scenario_fader(t_all) SNV scenario fader (1)
;
Expand Down
6 changes: 3 additions & 3 deletions modules/29_cropland/simple_apr24/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ elseif s29_snv_shr > s29_snv_relocation_data_x1,

* Country switch to determine countries for which certain policies shall be applied.
* In the default case, the policy affects all countries when activated.
p29_country_dummy(iso) = 0;
p29_country_dummy(policy_countries29) = 1;
p29_country_switch(iso) = 0;
p29_country_switch(policy_countries29) = 1;
* Because MAgPIE is not run at country-level, but at region level, a region
* share is calculated that translates the countries' influence to regional level.
* Countries are weighted by available cropland area.
pm_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%");
p29_country_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso));
p29_country_weight(i) = sum(i_to_iso(i,iso), p29_country_switch(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso));
2 changes: 1 addition & 1 deletion modules/30_croparea/detail_apr24/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ parameters
i30_betr_target(t,j) Target share for bioenergy land on total cropland (1)
i30_betr_penalty(t) Penalty for violation of betr target (USD17MER per ha)
p30_country_weight(i) Policy country weight per region (1)
p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected policy (1)
p30_country_switch(iso) Switch indicating whether country is affected by selected policy (1)
;

positive variables
Expand Down
6 changes: 3 additions & 3 deletions modules/30_croparea/detail_apr24/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ if(s30_implementation = 1,

* Country switch to determine countries for which certain policies shall be applied.
* In the default case, the policy affects all countries when activated.
p30_country_dummy(iso) = 0;
p30_country_dummy(policy_countries30) = 1;
p30_country_switch(iso) = 0;
p30_country_switch(policy_countries30) = 1;
* Because MAgPIE is not run at country-level, but at region level, a region
* share is calculated that translates the countries' influence to regional level.
* Countries are weighted by available cropland area.
p30_country_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso));
p30_country_weight(i) = sum(i_to_iso(i,iso), p30_country_switch(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso));

* Initialize biodiversity value
vm_bv.l(j,"crop_ann",potnatveg) =
Expand Down
2 changes: 1 addition & 1 deletion modules/30_croparea/simple_apr24/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parameters
i30_betr_target(t,j) Target share for bioenergy land on total cropland (1)
i30_betr_penalty(t) Penalty for violation of betr target (USD17MER per ha)
p30_country_weight(i) Policy country weight per region (1)
p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected policy (1)
p30_country_switch(iso) Switch indicating whether country is affected by selected policy (1)
;

positive variables
Expand Down
6 changes: 3 additions & 3 deletions modules/30_croparea/simple_apr24/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ fm_croparea(t_past,j,w,kcr)$(fm_croparea(t_past,j,w,kcr)<0) = 0;

* Country switch to determine countries for which certain policies shall be applied.
* In the default case, the policy affects all countries when activated.
p30_country_dummy(iso) = 0;
p30_country_dummy(policy_countries30) = 1;
p30_country_switch(iso) = 0;
p30_country_switch(policy_countries30) = 1;
* Because MAgPIE is not run at country-level, but at region level, a region
* share is calculated that translates the countries' influence to regional level.
* Countries are weighted by available cropland area.
p30_country_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso));
p30_country_weight(i) = sum(i_to_iso(i,iso), p30_country_switch(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso));

* Initialize biodiversity value
vm_bv.l(j,"crop_ann",potnatveg) =
Expand Down
2 changes: 1 addition & 1 deletion modules/42_water_demand/agr_sector_aug13/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ parameters
i42_env_flow_policy(t,i) Determines whether environmental flow protection is enforced (1)
p42_efp(t_all,scen42) Determines whether environmental flow protection is enforced and its fading in of environmental flow policy (1)
p42_efp_fader(t_all) Determines the fading in of environmental flow policy (1)
p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1)
p42_country_switch(iso) Switch indicating whether country is affected by EFP (1)
p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1)
ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD17MER per m^3)
i42_watdem_total(t,j,watdem_ineldo,wtype) Non-agricultural water demand for entire year used in post-processing (mio. m^3 per yr)
Expand Down
Loading

0 comments on commit f5e1215

Please sign in to comment.