Skip to content

Commit

Permalink
commodity index removed from storage bounds and losses
Browse files Browse the repository at this point in the history
  • Loading branch information
behnam-zakeri committed May 13, 2019
1 parent 581fbef commit 01fb55a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
12 changes: 5 additions & 7 deletions message_ix/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ def init_storage(scen, *args, **kwargs):
scen.init_par('time_seq', idx_sets=['time'])

# Initiating two parameters for specifying lower and upper bounds of
# storage reservoir as percentage of installed reservoir capacity
par_list_stor = ['bound_storage_lo', 'bound_storage_up']
for parname in par_list_stor:
scen.init_par(parname, idx_sets=['node', 'technology', 'commodity',
# storage reservoir, and storage losses all as % of installed capacity
# (values should be between 0 and 1)
par_stor = ['bound_storage_lo', 'bound_storage_up', 'storage_loss']
for parname in par_stor:
scen.init_par(parname, idx_sets=['node', 'technology',
'level', 'year', 'time'])
# Initiating a parameter for specifying storage losses (percentage)
scen.init_par('storage_loss', idx_sets=['node', 'technology', 'commodity',
'level', 'year', 'time'])


def _init_scenario(s, commit=False):
Expand Down
2 changes: 1 addition & 1 deletion message_ix/model/MESSAGE/data_load.gms
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ discharge_tec(tec)$(

* mapping of storage reservoir technologies to their levels and charge/discharge technologies
map_tec_storage_level(node,tec,storage_tec,level_storage,year_all,time)$(
SUM(commodity, storage_loss(node,storage_tec,commodity,level_storage,year_all,time) ) AND
storage_loss(node,storage_tec,level_storage,year_all,time) AND
map_tec_storage(tec,storage_tec) ) = yes;

*----------------------------------------------------------------------------------------------------------------------*
Expand Down
16 changes: 8 additions & 8 deletions message_ix/model/MESSAGE/model_core.gms
Original file line number Diff line number Diff line change
Expand Up @@ -1981,15 +1981,15 @@ STORAGE_CHANGE(node,storage_tec,level,year,time)$( SUM( (mode,tec,commodity), ma
* .. math::
* STORAGE_{n,t,l,y,h} \eq ... (math notation to be added)
***
STORAGE_BALANCE(node,storage_tec,level,year,time2)$ ( SUM(commodity, storage_loss(node,storage_tec,commodity,level,year,time2) ) )..
STORAGE_BALANCE(node,storage_tec,level,year,time2)$ ( storage_loss(node,storage_tec,level,year,time2) )..
* Showing the content level of storage at each timestep
STORAGE(node,storage_tec,level,year,time2) =E=
* change in the content of storage in the examined timestep
STORAGE_CHG(node,storage_tec,level,year,time2)
* storage content in the previous subannual timestep
+ SUM((time,year2)$map_time_period(year,year2,time,time2), STORAGE(node,storage_tec,level,year,time) *
* considering storage losses due to keeping the storage media between two subannual timesteps
(1 - SUM(commodity, storage_loss(node,storage_tec,commodity,level,year,time) ) ) ) ;
(1 - storage_loss(node,storage_tec,level,year,time) ) ) ;

***
* Equation STORAGE_EQUALITY
Expand All @@ -2008,19 +2008,19 @@ STORAGE_EQUALITY(node,storage_tec,level_storage,year,time)$(SUM(commodity, stora
* .. math::
* STORAGE_{n,t,l,y,h} \leq ... (math notation to be added)
***
STORAGE_BOUND_UP(node,storage_tec,level,year,time)$(sum(commodity, bound_storage_up(node,storage_tec,commodity,level,year,time) ) )..
STORAGE(node,storage_tec,level,year,time) =L= sum( commodity, bound_storage_up(node,storage_tec,commodity,level,year,time)*
SUM(vintage, capacity_factor(node,storage_tec,vintage,year,time) * CAP(node,storage_tec,vintage,year) ) ) ;
STORAGE_BOUND_UP(node,storage_tec,level,year,time)$(bound_storage_up(node,storage_tec,level,year,time) )..
STORAGE(node,storage_tec,level,year,time) =L= bound_storage_up(node,storage_tec,level,year,time)*
SUM(vintage, capacity_factor(node,storage_tec,vintage,year,time) * CAP(node,storage_tec,vintage,year) ) ;

***
* Equation STORAGE_BOUND_LO
* """""""""""""""""""""""""""""""
* .. math::
* STORAGE_{n,t,l,y,h} \geq ... (math notation to be added)
***
STORAGE_BOUND_LO(node,storage_tec,level,year,time)$(sum(commodity, bound_storage_lo(node,storage_tec,commodity,level,year,time) ) )..
STORAGE(node,storage_tec,level,year,time) =G= sum( commodity, bound_storage_lo(node,storage_tec,commodity,level,year,time)*
SUM(vintage, capacity_factor(node,storage_tec,vintage,year,time) * CAP(node,storage_tec,vintage,year) ) ) ;
STORAGE_BOUND_LO(node,storage_tec,level,year,time)$(bound_storage_lo(node,storage_tec,level,year,time) )..
STORAGE(node,storage_tec,level,year,time) =G= bound_storage_lo(node,storage_tec,level,year,time)*
SUM(vintage, capacity_factor(node,storage_tec,vintage,year,time) * CAP(node,storage_tec,vintage,year) ) ;

*----------------------------------------------------------------------------------------------------------------------*
* model statements *
Expand Down
6 changes: 3 additions & 3 deletions message_ix/model/MESSAGE/parameter_def.gms
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,8 @@ Parameters

* Added for storage
Parameters
bound_storage_lo(node,tec,commodity,level,year_all,time) lower bound of storage content (percentage of capacity)
bound_storage_up(node,tec,commodity,level,year_all,time) upper bound of storage content (percentage of capacity)
storage_loss(node,tec,commodity,level,year_all,time) storage loss per timestep (percentage of capacity)
bound_storage_lo(node,tec,level,year_all,time) lower bound of storage content (percentage of capacity)
bound_storage_up(node,tec,level,year_all,time) upper bound of storage content (percentage of capacity)
storage_loss(node,tec,level,year_all,time) storage loss per timestep (percentage of capacity)
time_seq(time) sequence of subannual timesteps
;
2 changes: 1 addition & 1 deletion tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def add_storage_data(scen, time_order):

# Adding minimum and maximum bound, and losses for storage (percentage)
for year, h in product(set(scen.set('year')), time_order.keys()):
storage_spec = ['node', 'dam', 'electr', 'storage', year, h]
storage_spec = ['node', 'dam', 'storage', year, h]
scen.add_par('bound_storage_lo', storage_spec, 0.0, '%')
scen.add_par('bound_storage_up', storage_spec, 1.0, '%')
scen.add_par('storage_loss', storage_spec, 0.05, '%')
Expand Down

0 comments on commit 01fb55a

Please sign in to comment.