Skip to content

Commit

Permalink
Merge pull request magpiemodel#622 from flohump/f_forestryBugfix
Browse files Browse the repository at this point in the history
bugfix forestry
  • Loading branch information
flohump authored Jan 4, 2024
2 parents d3400df + 4b782fe commit e29a8af
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **scenario_config.csv** removed erroneous setting `cc` from column `input`

### added
- **32_forestry** new interfaces `vm_forestry`, `pcm_land_forestry` `vm_landexpansion_forestry` and `vm_landreduction_forestry`
- **32_forestry** new interfaces `vm_land_forestry`, `pcm_land_forestry` `vm_landexpansion_forestry` and `vm_landreduction_forestry`
- **scripts** added peatland to output/extra/disaggregation.R

### removed
Expand Down
8 changes: 4 additions & 4 deletions modules/32_forestry/dynamic_feb21/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ positive variables
v32_land_missing(j) Forestry land which can be used at extrmemly high costs in case not enough area is available for new establishment (mio. ha)
vm_landdiff_forestry Aggregated difference in forestry land compared to previous timestep (mio. ha)
v32_cost_recur(i) Recurring forest management costs (USD per ha)
v32_land_expansion(j,type32,ac) Forestry land expansion (mio. ha)
v32_land_expansion(j,type32) Forestry land expansion (mio. ha)
v32_land_reduction(j,type32,ac) Forestry land reduction (mio. ha)
v32_cost_establishment(i) Cost of establishment calculated at the current time step (mio. USD)
v32_hvarea_forestry(j,ac) Harvested area from timber plantations (mio. ha)
Expand Down Expand Up @@ -99,7 +99,7 @@ equations
q32_establishment_dynamic(i) Establishment in current time step for future demand (mio. ha)
q32_establishment_dynamic_yield(i) Regional timber yield (tDM per ha)
q32_establishment_fixed(j) Establishment in current time step for future demand (mio. ha)
q32_land_expansion(j,type32,ac) Land expansion (mio. ha)
q32_land_expansion(j,type32) Land expansion (mio. ha)
q32_land_reduction(j,type32,ac) Land contraction (mio. ha)
q32_cost_establishment(i) Present value of cost of establishment (mio. USD)
q32_bgp_aff(j,ac) Biophysical afforestation calculation (mio. tCeq)
Expand All @@ -122,7 +122,7 @@ parameters
ov32_land_missing(t,j,type) Forestry land which can be used at extrmemly high costs in case not enough area is available for new establishment (mio. ha)
ov_landdiff_forestry(t,type) Aggregated difference in forestry land compared to previous timestep (mio. ha)
ov32_cost_recur(t,i,type) Recurring forest management costs (USD per ha)
ov32_land_expansion(t,j,type32,ac,type) Forestry land expansion (mio. ha)
ov32_land_expansion(t,j,type32,type) Forestry land expansion (mio. ha)
ov32_land_reduction(t,j,type32,ac,type) Forestry land reduction (mio. ha)
ov32_cost_establishment(t,i,type) Cost of establishment calculated at the current time step (mio. USD)
ov32_hvarea_forestry(t,j,ac,type) Harvested area from timber plantations (mio. ha)
Expand All @@ -146,7 +146,7 @@ parameters
oq32_establishment_dynamic(t,i,type) Establishment in current time step for future demand (mio. ha)
oq32_establishment_dynamic_yield(t,i,type) Regional timber yield (tDM per ha)
oq32_establishment_fixed(t,j,type) Establishment in current time step for future demand (mio. ha)
oq32_land_expansion(t,j,type32,ac,type) Land expansion (mio. ha)
oq32_land_expansion(t,j,type32,type) Land expansion (mio. ha)
oq32_land_reduction(t,j,type32,ac,type) Land contraction (mio. ha)
oq32_cost_establishment(t,i,type) Present value of cost of establishment (mio. USD)
oq32_bgp_aff(t,j,ac,type) Biophysical afforestation calculation (mio. tCeq)
Expand Down
13 changes: 7 additions & 6 deletions modules/32_forestry/dynamic_feb21/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum(
vm_land_forestry(j2,type32) =e= sum(ac, v32_land(j2,type32,ac));

q32_land_expansion_forestry(j2,type32) ..
vm_landexpansion_forestry(j2,type32) =e= sum(ac_est, v32_land_expansion(j2,type32,ac_est));
vm_landexpansion_forestry(j2,type32) =e= v32_land_expansion(j2,type32);

q32_land_reduction_forestry(j2,type32) ..
vm_landreduction_forestry(j2,type32) =e= sum(ac_sub, v32_land_reduction(j2,type32,ac_sub));
Expand Down Expand Up @@ -95,12 +95,13 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum(

*' Forestry land expansion and reduction is calculated as follows:

q32_land_diff .. vm_landdiff_forestry =e= sum((j2,type32,ac),
v32_land_expansion(j2,type32,ac)
+ v32_land_reduction(j2,type32,ac));
q32_land_diff .. vm_landdiff_forestry =e= sum((j2,type32),
v32_land_expansion(j2,type32)
+ sum(ac_sub, v32_land_reduction(j2,type32,ac_sub)));

q32_land_expansion(j2,type32,ac_est) ..
v32_land_expansion(j2,type32,ac_est) =e= v32_land(j2,type32,ac_est) - pc32_land(j2,type32,ac_est);
q32_land_expansion(j2,type32) ..
v32_land_expansion(j2,type32) =e=
sum(ac_est, v32_land(j2,type32,ac_est)) - sum(ac_est, pc32_land(j2,type32,ac_est));

q32_land_reduction(j2,type32,ac_sub) ..
v32_land_reduction(j2,type32,ac_sub) =e= pc32_land(j2,type32,ac_sub) - v32_land(j2,type32,ac_sub);
Expand Down
16 changes: 8 additions & 8 deletions modules/32_forestry/dynamic_feb21/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac);
ov32_land_missing(t,j,"marginal") = v32_land_missing.m(j);
ov_landdiff_forestry(t,"marginal") = vm_landdiff_forestry.m;
ov32_cost_recur(t,i,"marginal") = v32_cost_recur.m(i);
ov32_land_expansion(t,j,type32,ac,"marginal") = v32_land_expansion.m(j,type32,ac);
ov32_land_expansion(t,j,type32,"marginal") = v32_land_expansion.m(j,type32);
ov32_land_reduction(t,j,type32,ac,"marginal") = v32_land_reduction.m(j,type32,ac);
ov32_cost_establishment(t,i,"marginal") = v32_cost_establishment.m(i);
ov32_hvarea_forestry(t,j,ac,"marginal") = v32_hvarea_forestry.m(j,ac);
Expand All @@ -40,7 +40,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac);
oq32_establishment_dynamic(t,i,"marginal") = q32_establishment_dynamic.m(i);
oq32_establishment_dynamic_yield(t,i,"marginal") = q32_establishment_dynamic_yield.m(i);
oq32_establishment_fixed(t,j,"marginal") = q32_establishment_fixed.m(j);
oq32_land_expansion(t,j,type32,ac,"marginal") = q32_land_expansion.m(j,type32,ac);
oq32_land_expansion(t,j,type32,"marginal") = q32_land_expansion.m(j,type32);
oq32_land_reduction(t,j,type32,ac,"marginal") = q32_land_reduction.m(j,type32,ac);
oq32_cost_establishment(t,i,"marginal") = q32_cost_establishment.m(i);
oq32_bgp_aff(t,j,ac,"marginal") = q32_bgp_aff.m(j,ac);
Expand All @@ -58,7 +58,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac);
ov32_land_missing(t,j,"level") = v32_land_missing.l(j);
ov_landdiff_forestry(t,"level") = vm_landdiff_forestry.l;
ov32_cost_recur(t,i,"level") = v32_cost_recur.l(i);
ov32_land_expansion(t,j,type32,ac,"level") = v32_land_expansion.l(j,type32,ac);
ov32_land_expansion(t,j,type32,"level") = v32_land_expansion.l(j,type32);
ov32_land_reduction(t,j,type32,ac,"level") = v32_land_reduction.l(j,type32,ac);
ov32_cost_establishment(t,i,"level") = v32_cost_establishment.l(i);
ov32_hvarea_forestry(t,j,ac,"level") = v32_hvarea_forestry.l(j,ac);
Expand All @@ -82,7 +82,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac);
oq32_establishment_dynamic(t,i,"level") = q32_establishment_dynamic.l(i);
oq32_establishment_dynamic_yield(t,i,"level") = q32_establishment_dynamic_yield.l(i);
oq32_establishment_fixed(t,j,"level") = q32_establishment_fixed.l(j);
oq32_land_expansion(t,j,type32,ac,"level") = q32_land_expansion.l(j,type32,ac);
oq32_land_expansion(t,j,type32,"level") = q32_land_expansion.l(j,type32);
oq32_land_reduction(t,j,type32,ac,"level") = q32_land_reduction.l(j,type32,ac);
oq32_cost_establishment(t,i,"level") = q32_cost_establishment.l(i);
oq32_bgp_aff(t,j,ac,"level") = q32_bgp_aff.l(j,ac);
Expand All @@ -100,7 +100,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac);
ov32_land_missing(t,j,"upper") = v32_land_missing.up(j);
ov_landdiff_forestry(t,"upper") = vm_landdiff_forestry.up;
ov32_cost_recur(t,i,"upper") = v32_cost_recur.up(i);
ov32_land_expansion(t,j,type32,ac,"upper") = v32_land_expansion.up(j,type32,ac);
ov32_land_expansion(t,j,type32,"upper") = v32_land_expansion.up(j,type32);
ov32_land_reduction(t,j,type32,ac,"upper") = v32_land_reduction.up(j,type32,ac);
ov32_cost_establishment(t,i,"upper") = v32_cost_establishment.up(i);
ov32_hvarea_forestry(t,j,ac,"upper") = v32_hvarea_forestry.up(j,ac);
Expand All @@ -124,7 +124,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac);
oq32_establishment_dynamic(t,i,"upper") = q32_establishment_dynamic.up(i);
oq32_establishment_dynamic_yield(t,i,"upper") = q32_establishment_dynamic_yield.up(i);
oq32_establishment_fixed(t,j,"upper") = q32_establishment_fixed.up(j);
oq32_land_expansion(t,j,type32,ac,"upper") = q32_land_expansion.up(j,type32,ac);
oq32_land_expansion(t,j,type32,"upper") = q32_land_expansion.up(j,type32);
oq32_land_reduction(t,j,type32,ac,"upper") = q32_land_reduction.up(j,type32,ac);
oq32_cost_establishment(t,i,"upper") = q32_cost_establishment.up(i);
oq32_bgp_aff(t,j,ac,"upper") = q32_bgp_aff.up(j,ac);
Expand All @@ -142,7 +142,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac);
ov32_land_missing(t,j,"lower") = v32_land_missing.lo(j);
ov_landdiff_forestry(t,"lower") = vm_landdiff_forestry.lo;
ov32_cost_recur(t,i,"lower") = v32_cost_recur.lo(i);
ov32_land_expansion(t,j,type32,ac,"lower") = v32_land_expansion.lo(j,type32,ac);
ov32_land_expansion(t,j,type32,"lower") = v32_land_expansion.lo(j,type32);
ov32_land_reduction(t,j,type32,ac,"lower") = v32_land_reduction.lo(j,type32,ac);
ov32_cost_establishment(t,i,"lower") = v32_cost_establishment.lo(i);
ov32_hvarea_forestry(t,j,ac,"lower") = v32_hvarea_forestry.lo(j,ac);
Expand All @@ -166,7 +166,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac);
oq32_establishment_dynamic(t,i,"lower") = q32_establishment_dynamic.lo(i);
oq32_establishment_dynamic_yield(t,i,"lower") = q32_establishment_dynamic_yield.lo(i);
oq32_establishment_fixed(t,j,"lower") = q32_establishment_fixed.lo(j);
oq32_land_expansion(t,j,type32,ac,"lower") = q32_land_expansion.lo(j,type32,ac);
oq32_land_expansion(t,j,type32,"lower") = q32_land_expansion.lo(j,type32);
oq32_land_reduction(t,j,type32,ac,"lower") = q32_land_reduction.lo(j,type32,ac);
oq32_cost_establishment(t,i,"lower") = q32_cost_establishment.lo(i);
oq32_bgp_aff(t,j,ac,"lower") = q32_bgp_aff.lo(j,ac);
Expand Down
1 change: 0 additions & 1 deletion modules/32_forestry/dynamic_feb21/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ ac_sub(ac) = yes$(ord(ac) > (m_yeardiff_forestry(t)/5));
*Reduction of ac_est is not possible.
v32_hvarea_forestry.fx(j,ac_est) = 0;
v32_land_reduction.fx(j,type32,ac_est) = 0;
v32_land_expansion.fx(j,type32,ac_sub) = 0;

** START ndc **
* calc NPI/NDC afforestation per time step based on forest stock change
Expand Down

0 comments on commit e29a8af

Please sign in to comment.