Skip to content

Commit

Permalink
text cleanup in GAMS
Browse files Browse the repository at this point in the history
  • Loading branch information
behnam-zakeri committed Apr 28, 2019
1 parent ecceb37 commit 42581a0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,3 @@ tests/testdb/test.properties
tests/testdb/ixmptest.properties
tests/testdb/ixmptest.lck
.Rproj.user

message_ix/model/MESSAGE/workflow_modification\.gms

message_ix/model/cplex\.opt
Binary file not shown.
6 changes: 3 additions & 3 deletions message_ix/model/MESSAGE/data_load.gms
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ demand_fixed=demand
* fixing variables to pre-specified values
is_fixed_extraction, is_fixed_stock, is_fixed_new_capacity, is_fixed_capacity, is_fixed_activity, is_fixed_land
fixed_extraction, fixed_stock, fixed_new_capacity, fixed_capacity, fixed_activity, fixed_land
* BZ added for storage
bound_storage_lo,bound_storage_up,storage_loss,time_seq
* Added for storage
bound_storage_lo, bound_storage_up, storage_loss, time_seq
;

*----------------------------------------------------------------------------------------------------------------------*
Expand Down Expand Up @@ -170,7 +170,7 @@ map_tec_discharge(node,tec,mode,commodity,level_storage,year_all,time)$( Not sto
discharge_tec(tec)$(
SUM((node,mode,commodity,level_storage,year_all,time), map_tec_discharge(node,tec,mode,commodity,level_storage,year_all,time) ) ) = yes;

* mapping of storage reservoir technologies to their levels
* 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
map_tec_storage(tec,storage_tec) ) = yes;
Expand Down
2 changes: 1 addition & 1 deletion message_ix/model/MESSAGE/sets_maps_def.gms
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ Sets
map_tec_discharge(node,tec,mode,commodity,level,year_all,time) mapping of discharging technologies (for storage) to their commodities
map_tec_storage(tec,tec2) mapping of charge and discharging technologies (for storage) to their respective storage container
map_tec_storage_level(node,tec,tec2,level,year_all,time) mapping of storage container to its level and charge-discharge technologies
storage_tec(tec) set of storage container technologies
storage_tec(tec) storage container technologies
charge_tec(tec) charging technologies (for storage)
discharge_tec(tec) discharging technologies (for storage)

Expand Down
8 changes: 5 additions & 3 deletions message_ix/model/includes/period_parameter_assignment.gms
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ map_period(year_all,year_all2)$( ORD(year_all) <= ORD(year_all2) ) = yes ;

* Added for storage
* mapping of sequence of time in a period
map_time_period(year_all,year_all2,time,time2)$(time_seq(time) AND ORD(year_all) = ORD(year_all2) AND time_seq(time) AND (time_seq(time) + 1 = time_seq(time2) ) ) = yes;
map_time_period(year_all,year_all2,time,time2)$( ORD(year_all) = ORD(year_all2) AND time_seq(time) AND
(time_seq(time) + 1 = time_seq(time2) ) ) = yes;

* mapping of first and last time steps in a period
map_time_first_last(year_all,year_all2,time,time2)$((ORD(year_all) = ORD(year_all2)) AND (time_seq(time) = smin(time3$time_seq(time3),time_seq(time3))
AND time_seq(time2) = smax(time3$time_seq(time3),time_seq(time3) ) ) ) = yes;
map_time_first_last(year_all,year_all2,time,time2)$( ( ORD(year_all) = ORD(year_all2)) AND
(time_seq(time) = smin(time3$time_seq(time3),time_seq(time3) ) AND
time_seq(time2) = smax(time3$time_seq(time3),time_seq(time3) ) ) ) = yes;

* dynamic sets (singleton) with first and last periods in model horizon of MESSAGEix (for easier reference)
first_period(year_all) = no ;
Expand Down
2 changes: 1 addition & 1 deletion tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def test_storage(test_mp):
# I.2. Activity of discharger should be always =< activity of charger
act_pump = scen.var('ACT', {'technology': 'pump'})['lvl']
act_turb = scen.var('ACT', {'technology': 'turbine'})['lvl']
assert act_turb.sum() < act_pump.sum()
assert act_turb.sum() <= act_pump.sum()

# I.3. Max activity of charger is lower than storage capacity
max_pump = max(act_pump)
Expand Down

0 comments on commit 42581a0

Please sign in to comment.