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

bugfix trade exo over kall instead of k #153

Merged
merged 2 commits into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions modules/21_trade/exo/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@

positive variables
vm_cost_trade(i) Regional trade costs (mio. USD05MER per yr)
v21_manna_from_heaven(i,k) Last resort resource for otherwise infeasble trade balance constraints (mio. tDM per yr)
v21_manna_from_heaven(i,kall) Last resort resource for otherwise infeasble trade balance constraints (mio. tDM per yr)
;

equations
q21_notrade(i,k) Regional production constraint of non-tradable commodities (mio. tDM per yr)
q21_notrade(i,kall) Regional production constraint of non-tradable commodities (mio. tDM per yr)
q21_cost_trade(i) Regional trade costs (mio. USD05MER per yr)
;

*#################### R SECTION START (OUTPUT DECLARATIONS) ####################
parameters
ov_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr)
ov21_manna_from_heaven(t,i,k,type) Last resort resource for otherwise infeasble trade balance constraints (mio. tDM per yr)
oq21_notrade(t,i,k,type) Regional production constraint of non-tradable commodities (mio. tDM per yr)
oq21_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr)
ov_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr)
ov21_manna_from_heaven(t,i,kall,type) Last resort resource for otherwise infeasble trade balance constraints (mio. tDM per yr)
oq21_notrade(t,i,kall,type) Regional production constraint of non-tradable commodities (mio. tDM per yr)
oq21_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr)
;
*##################### R SECTION END (OUTPUT DECLARATIONS) #####################
4 changes: 2 additions & 2 deletions modules/21_trade/exo/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: magpie@pik-potsdam.de

q21_notrade(i2,k).. vm_prod_reg(i2,k) =g= vm_supply(i2,k) + sum(ct,f21_trade_balance(ct,i2,k)) - v21_manna_from_heaven(i2,k);
q21_notrade(i2,kall).. vm_prod_reg(i2,kall) =g= vm_supply(i2,kall) + sum(ct,f21_trade_balance(ct,i2,kall)) - v21_manna_from_heaven(i2,kall);

*' The regional production must be bigger than the regional demand plus exports
*' from that region (or minus imports in case of a negative trade balance). As
Expand All @@ -15,7 +15,7 @@
*' unlimited, but heavily expensive resource which can be used as last resort,
*' if in any other case the model would become infeasible.

q21_cost_trade(i2).. vm_cost_trade(i2) =e= 10**6 * sum(k,v21_manna_from_heaven(i2,k));
q21_cost_trade(i2).. vm_cost_trade(i2) =e= 10**6 * sum(kall,v21_manna_from_heaven(i2,kall));

*' After each run trade costs `vm_cost_trade` as well as `v21_manna_from_heaven`
*' should be checked for non-zero values as these will indicate inconsistencies
Expand Down
32 changes: 16 additions & 16 deletions modules/21_trade/exo/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@


*#################### R SECTION START (OUTPUT DEFINITIONS) #####################
ov_cost_trade(t,i,"marginal") = vm_cost_trade.m(i);
ov21_manna_from_heaven(t,i,k,"marginal") = v21_manna_from_heaven.m(i,k);
oq21_notrade(t,i,k,"marginal") = q21_notrade.m(i,k);
oq21_cost_trade(t,i,"marginal") = q21_cost_trade.m(i);
ov_cost_trade(t,i,"level") = vm_cost_trade.l(i);
ov21_manna_from_heaven(t,i,k,"level") = v21_manna_from_heaven.l(i,k);
oq21_notrade(t,i,k,"level") = q21_notrade.l(i,k);
oq21_cost_trade(t,i,"level") = q21_cost_trade.l(i);
ov_cost_trade(t,i,"upper") = vm_cost_trade.up(i);
ov21_manna_from_heaven(t,i,k,"upper") = v21_manna_from_heaven.up(i,k);
oq21_notrade(t,i,k,"upper") = q21_notrade.up(i,k);
oq21_cost_trade(t,i,"upper") = q21_cost_trade.up(i);
ov_cost_trade(t,i,"lower") = vm_cost_trade.lo(i);
ov21_manna_from_heaven(t,i,k,"lower") = v21_manna_from_heaven.lo(i,k);
oq21_notrade(t,i,k,"lower") = q21_notrade.lo(i,k);
oq21_cost_trade(t,i,"lower") = q21_cost_trade.lo(i);
ov_cost_trade(t,i,"marginal") = vm_cost_trade.m(i);
ov21_manna_from_heaven(t,i,kall,"marginal") = v21_manna_from_heaven.m(i,kall);
oq21_notrade(t,i,kall,"marginal") = q21_notrade.m(i,kall);
oq21_cost_trade(t,i,"marginal") = q21_cost_trade.m(i);
ov_cost_trade(t,i,"level") = vm_cost_trade.l(i);
ov21_manna_from_heaven(t,i,kall,"level") = v21_manna_from_heaven.l(i,kall);
oq21_notrade(t,i,kall,"level") = q21_notrade.l(i,kall);
oq21_cost_trade(t,i,"level") = q21_cost_trade.l(i);
ov_cost_trade(t,i,"upper") = vm_cost_trade.up(i);
ov21_manna_from_heaven(t,i,kall,"upper") = v21_manna_from_heaven.up(i,kall);
oq21_notrade(t,i,kall,"upper") = q21_notrade.up(i,kall);
oq21_cost_trade(t,i,"upper") = q21_cost_trade.up(i);
ov_cost_trade(t,i,"lower") = vm_cost_trade.lo(i);
ov21_manna_from_heaven(t,i,kall,"lower") = v21_manna_from_heaven.lo(i,kall);
oq21_notrade(t,i,kall,"lower") = q21_notrade.lo(i,kall);
oq21_cost_trade(t,i,"lower") = q21_cost_trade.lo(i);
*##################### R SECTION END (OUTPUT DEFINITIONS) ######################