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

WIP: sketch of 2 variants to add commodity flow of capacity variables #387

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a222872
sketch of 2 variants to add commodity flow of capacity variables
volker-krey Aug 19, 2020
079d117
introduced special treatment of commodity flows prior to and after en…
volker-krey Aug 25, 2020
70e383b
expanded variant 1 to include retirement, incl. treatment of prematur…
volker-krey Aug 25, 2020
d6fc881
merged variants 1 and 2 of capacity related commodity flows
volker-krey Aug 25, 2020
2f6ae96
added scaling factor to account for period length difference
volker-krey Aug 25, 2020
43a4ec8
added new parameters to data loading from GDX
volker-krey Aug 25, 2020
34a1e89
auto documentation for capacity related commodity flow added
volker-krey Aug 25, 2020
f1f7106
corrected commodity at end of life of capacities to be on annual basis
volker-krey Sep 23, 2020
6d7d600
sketch of 2 variants to add commodity flow of capacity variables
volker-krey Aug 19, 2020
e9f2448
introduced special treatment of commodity flows prior to and after en…
volker-krey Aug 25, 2020
3ae2e52
expanded variant 1 to include retirement, incl. treatment of prematur…
volker-krey Aug 25, 2020
4eccf76
merged variants 1 and 2 of capacity related commodity flows
volker-krey Aug 25, 2020
952428a
added scaling factor to account for period length difference
volker-krey Aug 25, 2020
4ec4881
added new parameters to data loading from GDX
volker-krey Aug 25, 2020
530fba8
auto documentation for capacity related commodity flow added
volker-krey Aug 25, 2020
dfc00ad
corrected commodity at end of life of capacities to be on annual basis
volker-krey Sep 23, 2020
a6576f5
Merge remote-tracking branch 'origin/material_stock' into material_stock
volker-krey Jan 10, 2021
0695a1c
corrected typos, wrong parenthesis and missing EOL symbols
volker-krey Jan 10, 2021
5a14a79
corrected syntax and inter-period notation
volker-krey Jan 11, 2021
ed0509d
sketch of 2 variants to add commodity flow of capacity variables
volker-krey Aug 19, 2020
b0af42d
introduced special treatment of commodity flows prior to and after en…
volker-krey Aug 25, 2020
5f3518a
expanded variant 1 to include retirement, incl. treatment of prematur…
volker-krey Aug 25, 2020
03356c2
merged variants 1 and 2 of capacity related commodity flows
volker-krey Aug 25, 2020
869d8ad
added scaling factor to account for period length difference
volker-krey Aug 25, 2020
8697db4
added new parameters to data loading from GDX
volker-krey Aug 25, 2020
76cfc10
auto documentation for capacity related commodity flow added
volker-krey Aug 25, 2020
a76df24
corrected commodity at end of life of capacities to be on annual basis
volker-krey Sep 23, 2020
b1a9c99
added scaling factor to account for period length difference
volker-krey Aug 25, 2020
7b53ff2
corrected commodity at end of life of capacities to be on annual basis
volker-krey Sep 23, 2020
b5cce35
corrected typos, wrong parenthesis and missing EOL symbols
volker-krey Jan 10, 2021
3cf0725
corrected syntax and inter-period notation
volker-krey Jan 11, 2021
d6cbda6
Merge branch 'material_stock' of https://github.com/volker-krey/messa…
Jihoon Mar 16, 2021
319daaf
added six new capacity-related in-/output parameters to models.py
volker-krey Mar 22, 2021
f8c006f
Merge branch 'master' into material_stock
Jihoon Mar 31, 2021
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
3 changes: 2 additions & 1 deletion message_ix/model/MESSAGE/data_load.gms
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ duration_period, duration_time, interestrate,
* resources parameters
resource_volume, resource_cost, is_bound_extraction_up, bound_extraction_up, resource_remaining,
* technology technical-engineering parameters and economic costs
input, output, construction_time, technical_lifetime
input, output, construction_time, technical_lifetime,
input_cap, output_cap, input_cap_new, output_cap_new, input_cap_ret, output_cap_ret,
capacity_factor, operation_factor, min_utilization_factor, inv_cost, fix_cost, var_cost,
* upper and lower bounds on new capacity investment, total installed capacity and activity (including mapping sets)
is_bound_new_capacity_up, is_bound_new_capacity_lo, bound_new_capacity_up, bound_new_capacity_lo,
Expand Down
53 changes: 53 additions & 0 deletions message_ix/model/MESSAGE/model_core.gms
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,18 @@ RESOURCE_HORIZON(node,commodity,grade)$( SUM(year$map_resource(node,commodity,gr
* \cdot duration\_time\_rel_{h,h^A} \cdot ACT_{n^L,t,y^V,y,m,h^A} & \\
* - \sum_{\substack{n^L,t,m,h^A \\ y^V \leq y}} input_{n^L,t,y^V,y,m,n,c,l,h^A,h}
* \cdot duration\_time\_rel_{h,h^A} \cdot ACT_{n^L,t,m,y,h^A} & \\
* + \sum_{\substack{n^L,t}} output\_cap\_new_{n^L,t,y,n,c,l,h}
* \cdot CAP\_NEW_{n^L,t,y} & \\
* - \sum_{\substack{n^L,t}} input\_cap\_new_{n^L,t,y,n,c,l,h}
* \cdot CAP\_NEW_{n^L,t,y} & \\
* + \sum_{\substack{n^L,t \\ y^V \leq y}} output\_cap\_ret_{n^L,t,y^V,n,c,l,h}
* \cdot ( CAP_{n^L,t,y^V,y-1} - CAP_{n^L,t,y^V,y} ) \cdot \frac{duration\_period_y}{duration\_period_CAP_y^V} & \\
* - \sum_{\substack{n^L,t \\ y^V \leq y}} input\_cap\_ret_{n^L,t,y^V,n,c,l,h}
* \cdot ( CAP_{n^L,t,y^V,y-1} - CAP_{n^L,t,y^V,y} ) \cdot \frac{duration\_period_y}{duration\_period_CAP_y^V} & \\
* + \sum_{\substack{n^L,t \\ y^V \leq y}} output\_cap_{n^L,t,y^V,y,n,c,l,h}
* \cdot CAP_{n^L,t,y^V,y} & \\
* - \sum_{\substack{n^L,t \\ y^V \leq y}} input\_cap_{n^L,t,y^V,y,n,c,l,h}
* \cdot CAP_{n^L,t,y^V,y} & \\
* + \ STOCK\_CHG_{n,c,l,y,h} + \ \sum_s \Big( land\_output_{n,s,y,c,l,h} - land\_input_{n,s,y,c,l,h} \Big) \cdot & LAND_{n,s,y} \\[4pt]
* - \ demand\_fixed_{n,c,l,y,h}
* = COMMODITY\_BALANCE_{n,c,l,y,h} \quad \forall \ l \notin (L^{RES}, & L^{REN}, L^{STOR} \subseteq L)
Expand All @@ -572,6 +584,47 @@ $macro COMMODITY_BALANCE(node,commodity,level,year,time) (
* export from node and input into technologies located at 'location' taking from 'node' and 'time2' taking from 'time'
- input(location,tec,vintage,year,mode,node,commodity,level,time2,time) \
* duration_time_rel(time,time2) * ACT(location,tec,vintage,year,mode,time2) ) \
* +++++
* commodity input and output associated with construction of new technology capacity (during vintage period)
+ SUM( (location,tec)$( inv_tec(tec) AND map_tec(location,tec,year) ), \
* output by all new capacity of technologies located at 'location' sending to 'node' and 'time'
output_cap_new(location,tec,year,node,commodity,level,time) \
* CAP_NEW(location,tec,year) \
* input by all new capacity of technologies located at 'location' taking from 'node' and 'time'
- input_cap_new(location,tec,year,node,commodity,level,time) \
* CAP_NEW(location,tec,year) ) \
* commodity input and output associated with retirement of technology capacity (via differentials of capacity of successive periods)
* for first model period (differential with historical remaining capacity)
+ SUM( (location,tec,vintage,year2)$( inv_tec(tec) AND map_tec_lifetime(location,tec,vintage,year2) \
AND first_period(year) AND seq_period(year2,year) ), \
* output by all new capacity of technologies located at 'location' sending to 'node' and 'time' distributed over years of periods
output_cap_ret(location,tec,vintage,node,commodity,level,time) \
* ( remaining_capacity(node,tec,vintage,year2) - CAP(location,tec,vintage,year) ) \
/ duration_period(year) \
* input by all new capacity of technologies located at 'location' taking from 'node' and 'time' distributed over years of periods
- input_cap_ret(location,tec,vintage,node,commodity,level,time) \
* ( remaining_capacity(node,tec,vintage,year2) - CAP(location,tec,vintage,year) ) \
/ duration_period(year) ) \
* for other model periods (differential with installed capacity of preceding period)
+ SUM( (location,tec,vintage,year2)$( inv_tec(tec) AND map_tec_lifetime(location,tec,vintage,year2) \
AND NOT first_period(year) AND seq_period(year2,year) ), \
* output by all new capacity of technologies located at 'location' sending to 'node' and 'time' distributed over years of periods
output_cap_ret(location,tec,vintage,node,commodity,level,time) \
* ( CAP(location,tec,vintage,year2) - CAP(location,tec,vintage,year) ) \
/ duration_period(year) \
* input by all new capacity of technologies located at 'location' taking from 'node' and 'time' distributed over years of periods
- input_cap_ret(location,tec,vintage,node,commodity,level,time) \
* ( CAP(location,tec,vintage,year2) - CAP(location,tec,vintage,year) ) \
/ duration_period(year) ) \
* commodity input and output associated with operation of capacity at any period
+ SUM( (location,tec,vintage)$( inv_tec(tec) AND map_tec_lifetime(location,tec,vintage,year) ), \
* output by all new capacity of technologies located at 'location' sending to 'node', 'year' and 'time'
output_cap(location,tec,vintage,year,node,commodity,level,time) \
* CAP(location,tec,vintage,year) \
* input by all new capacity of technologies located at 'location' taking from 'node', 'year' and 'time'
- input_cap(location,tec,vintage,year,node,commodity,level,time) \
* CAP(location,tec,vintage,year) ) \
* +++++
* quantity taken out from ( >0 ) or put into ( <0 ) inter-period stock (storage)
+ STOCK_CHG(node,commodity,level,year,time)$( map_stocks(node,commodity,level,year) ) \
* yield from land-use model emulator
Expand Down
29 changes: 29 additions & 0 deletions message_ix/model/MESSAGE/parameter_def.gms
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,24 @@ Parameter
* * - output [#tecvintage]_
* - ``node_loc`` | ``tec`` | ``year_vtg`` | ``year_act`` | ``mode`` |
* ``node_dest`` | ``commodity`` | ``level`` | ``time`` | ``time_dest``
* * - input_cap [#tecvintage]_
* - ``node_loc`` | ``tec`` | ``year_vtg`` | ``year_act`` |
* ``node_origin`` | ``commodity`` | ``level`` | ``time_origin``
* * - output_cap [#tecvintage]_
* - ``node_loc`` | ``tec`` | ``year_vtg`` | ``year_act`` |
* ``node_dest`` | ``commodity`` | ``level`` | ``time_dest``
* * - input_cap_new [#tecvintage]_
* - ``node_loc`` | ``tec`` | ``year_vtg`` |
* ``node_origin`` | ``commodity`` | ``level`` | ``time_origin``
* * - output_cap_new [#tecvintage]_
* - ``node_loc`` | ``tec`` | ``year_vtg`` |
* ``node_dest`` | ``commodity`` | ``level`` | ``time_dest``
* * - input_cap_ret [#tecvintage]_
* - ``node_loc`` | ``tec`` | ``year_vtg`` |
* ``node_origin`` | ``commodity`` | ``level`` | ``time_origin``
* * - output_cap_ret [#tecvintage]_
* - ``node_loc`` | ``tec`` | ``year_vtg`` |
* ``node_dest`` | ``commodity`` | ``level`` | ``time_dest``
* * - inv_cost [#tecvintage]_
* - ``node_loc`` | ``tec`` | ``year_vtg``
* * - fix_cost [#tecvintage]_
Expand Down Expand Up @@ -235,6 +253,17 @@ Parameters
* technology input-output mapping and costs parameters
input(node,tec,vintage,year_all,mode,node,commodity,level,time,time) relative share of input per unit of activity
output(node,tec,vintage,year_all,mode,node,commodity,level,time,time) relative share of output per unit of activity
* +++++
* commodity input and output associated with construction of capacity
input_cap_new(node,tec,vintage,node,commodity,level,time) relative share of input per unit of new capacity built
output_cap_new(node,tec,vintage,node,commodity,level,time) relative share of output per unit of new capacity built
Jihoon marked this conversation as resolved.
Show resolved Hide resolved
* commodity input and output associated with retirement of capacity
input_cap_ret(node,tec,vintage,node,commodity,level,time) relative share of input per unit of capacity retired
output_cap_ret(node,tec,vintage,node,commodity,level,time) relative share of output per unit of capacity retired
* commodity input and output associated with operation of capacity at any period
input_cap(node,tec,vintage,year_all,node,commodity,level,time) relative share of input per unit of capacity
output_cap(node,tec,vintage,year_all,node,commodity,level,time) relative share of output per unit of capacity
* +++++
inv_cost(node,tec,year_all) investment costs (per unit of new capacity)
fix_cost(node,tec,vintage,year_all) fixed costs per year (per unit of capacity maintained)
var_cost(node,tec,vintage,year_all,mode,time) variable costs of operation (per unit of capacity maintained)
Expand Down
6 changes: 6 additions & 0 deletions message_ix/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ def item(ix_type, expr):
"initial_new_capacity_lo": item("par", "nl t yv"),
"initial_new_capacity_up": item("par", "nl t yv"),
"input": item("par", "nl t yv ya m no c l h ho"),
"input_cap": item("par", "nl t yv ya no c l ho"),
"input_cap_new": item("par", "nl t yv no c l ho"),
"input_cap_ret": item("par", "nl t yv no c l ho"),
"interestrate": dict(ix_type="par", idx_sets=["year"]),
"inv_cost": item("par", "nl t yv"),
"land_cost": item("par", "n land_scenario y"),
Expand All @@ -213,6 +216,9 @@ def item(ix_type, expr):
"min_utilization_factor": item("par", "nl t yv ya"),
"operation_factor": item("par", "nl t yv ya"),
"output": item("par", "nl t yv ya m nd c l h hd"),
"output_cap": item("par", "nl t yv ya nd c l hd"),
"output_cap_new": item("par", "nl t yv nd c l hd"),
"output_cap_ret": item("par", "nl t yv nd c l hd"),
"peak_load_factor": item("par", "n c l y h"),
"rating_bin": item("par", "n t ya c l h r"),
"ref_activity": item("par", "nl t ya m h"),
Expand Down