diff --git a/message_ix/model/MESSAGE/model_core.gms b/message_ix/model/MESSAGE/model_core.gms index 5880c6e76..d8d38d17d 100644 --- a/message_ix/model/MESSAGE/model_core.gms +++ b/message_ix/model/MESSAGE/model_core.gms @@ -126,6 +126,9 @@ Positive Variables ACT_LO(node,tec,year_all,time) relaxation variable for dynamic constraints on activity (downwards) * land-use model emulator LAND(node,land_scenario,year_all) relative share of land-use scenario +* content of storage + STORAGE(node,tec,level,year_all,time) content of storage at each sub-annual time step (positive) +; Variables * intertemporal stock variables (input or output quantity into the stock) @@ -142,7 +145,7 @@ Variables REL(relation,node,year_all) auxiliary variable for left-hand side of user-defined relations * auxiliary variable for left-hand side of commodity balance COMM(node,commodity,level,year_all,time) auxiliary variable for left-hand side of commodity balance -* BZ added for storage +* change in the content of storage device STORAGE_CHG(node,tec,level,year_all,time) change in the content of storage (positive or negative) ; @@ -241,9 +244,6 @@ Positive variables SLACK_LAND_TYPE_LO(node,year_all,land_type) slack variable for dynamic land type constraint relaxation (downwards) SLACK_RELATION_BOUND_UP(relation,node,year_all) slack variable for upper bound of generic relation SLACK_RELATION_BOUND_LO(relation,node,year_all) slack variable for lower bound of generic relation - -* Added for storage - STORAGE(node,tec,level,year_all,time) content of storage (positive) ; *----------------------------------------------------------------------------------------------------------------------* @@ -307,8 +307,6 @@ Equations RELATION_EQUIVALENCE auxiliary equation to simplify the implementation of relations RELATION_CONSTRAINT_UP upper bound of relations (linear constraints) RELATION_CONSTRAINT_LO lower bound of relations (linear constraints) - -* Added for storage STORAGE_CHANGE change in the content of storage STORAGE_BALANCE storage commodity (content) balance STORAGE_REL relation between the content of storage in two different time steps (time_first * value = time_last) @@ -559,7 +557,7 @@ RESOURCE_HORIZON(node,commodity,grade)$( SUM(year$map_resource(node,commodity,gr * Auxiliary COMMODITY_BALANCE * """"""""""""""""""""""""""" * For the commodity balance constraints below, we introduce an auxiliary `COMMODITY_BALANCE`. This is implemented -* as a GAMS `$macro` function. +* as a GAMS `$macro` function. * * .. math:: * \sum_{\substack{n^L,t,m,h^A \\ y^V \leq y}} output_{n^L,t,y^V,y,m,n,c,l,h^A,h} @@ -572,13 +570,14 @@ RESOURCE_HORIZON(node,commodity,grade)$( SUM(year$map_resource(node,commodity,gr * & = COMMODITY\_BALANCE{n,c,l,y,h} \quad \forall \ l \notin (L^{RES}, l^{REN} \subseteq L * * The commodity balance constraint at the resource level is included in the `Equation RESOURCE_CONSTRAINT`_, -* while at the renewable level, it is included in the `Equation RENEWABLES_EQUIVALENCE`_. +* while at the renewable level, it is included in the `Equation RENEWABLES_EQUIVALENCE`_, +* and at the storage level, it is included in the `Equation STORAGE_BALANCE`_. *** $macro COMMODITY_BALANCE(node,commodity,level,year,time) ( \ SUM( (location,tec,vintage,mode,time2)$( map_tec_act(location,tec,year,mode,time2) \ AND map_tec_lifetime(location,tec,vintage,year) ), \ * import into node and output by all technologies located at 'location' sending to 'node' and 'time2' sending to 'time' - output(location,tec,vintage,year,mode,node,commodity,level,time2,time) \ + output(location,tec,vintage,year,mode,node,commodity,level,time2,time) \ * duration_time_rel(time,time2) * ACT(location,tec,vintage,year,mode,time2) \ * 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) \ @@ -589,7 +588,7 @@ $macro COMMODITY_BALANCE(node,commodity,level,year,time) ( + SUM(land_scenario, \ ( land_output(node,land_scenario,year,commodity,level,time) \ - land_input(node,land_scenario,year,commodity,level,time) ) * LAND(node,land_scenario,year) ) \ -* final demand (exogenous parameter to be satisfied by the commodity system) +* final demand (exogenous parameter to be satisfied by the commodity system) - demand_fixed(node,commodity,level,year,time) \ )$( map_commodity(node,commodity,level,year,time) AND NOT level_resource(level) AND NOT level_renewable(level) ) @@ -603,7 +602,7 @@ $macro COMMODITY_BALANCE(node,commodity,level,year,time) ( * *** COMMODITY_BALANCE_GT(node,commodity,level,year,time)$( map_commodity(node,commodity,level,year,time) - AND NOT level_resource(level) AND NOT level_renewable(level) ).. + AND NOT level_resource(level) AND NOT level_renewable(level) AND NOT level_storage(level) ).. COMMODITY_BALANCE(node,commodity,level,year,time) * relaxation of constraints for debugging %SLACK_COMMODITY_EQUIVALENCE% + SLACK_COMMODITY_EQUIVALENCE_UP(node,commodity,level,year,time) @@ -620,7 +619,7 @@ COMMODITY_BALANCE_GT(node,commodity,level,year,time)$( map_commodity(node,commod * *** COMMODITY_BALANCE_LT(node,commodity,level,year,time)$( map_commodity(node,commodity,level,year,time) - AND NOT level_resource(level) AND NOT level_renewable(level) + AND NOT level_resource(level) AND NOT level_renewable(level) AND NOT level_storage(level) AND balance_equality(commodity,level) ).. COMMODITY_BALANCE(node,commodity,level,year,time) * relaxation of constraints for debugging diff --git a/message_ix/model/MESSAGE/parameter_def.gms b/message_ix/model/MESSAGE/parameter_def.gms index 31a5a538b..c4ed17bc8 100644 --- a/message_ix/model/MESSAGE/parameter_def.gms +++ b/message_ix/model/MESSAGE/parameter_def.gms @@ -705,9 +705,10 @@ Parameters status(*,*) model solution status parameter for log writing ; +*----------------------------------------------------------------------------------------------------------------------* +* Storage parameters *----------------------------------------------------------------------------------------------------------------------* -* Added for storage Parameters 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) diff --git a/message_ix/model/MESSAGE/sets_maps_def.gms b/message_ix/model/MESSAGE/sets_maps_def.gms index 8ffd8b20a..0c1ec3818 100644 --- a/message_ix/model/MESSAGE/sets_maps_def.gms +++ b/message_ix/model/MESSAGE/sets_maps_def.gms @@ -377,7 +377,10 @@ Sets is_fixed_land(node,land_scenario,year_all) flag whether land level is fixed ; -* Added for storage +*----------------------------------------------------------------------------------------------------------------------* +* Storage sets and mappings * +*----------------------------------------------------------------------------------------------------------------------* + Sets level_storage(level) levels of storage map_tec_charge(node,tec,mode,commodity,level,year_all,time) mapping of charging technologies (for storage) to their commodities