Skip to content

Commit

Permalink
Adjust calculation of PRICE_EMISSION
Browse files Browse the repository at this point in the history
  • Loading branch information
OFR-IIASA committed Jun 30, 2023
1 parent cec4092 commit 1383cbb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
20 changes: 11 additions & 9 deletions message_ix/model/MESSAGE/model_core.gms
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,23 @@ Variables
*
* Auxiliary variables
* ^^^^^^^^^^^^^^^^^^^
* =========================================================================== ======================================================================================================
* Variable Explanatory text
* =========================================================================== ======================================================================================================
* :math:`\text{DEMAND}_{n,c,l,y,h} \in \mathbb{R}` Demand level (in equilibrium with MACRO integration)
* :math:`\text{PRICE_COMMODITY}_{n,c,l,y,h} \in \mathbb{R}` Commodity price (undiscounted marginals of :ref:`commodity_balance_gt` and :ref:`commodity_balance_lt`)
* :math:`\text{PRICE_EMISSION}_{n,\widehat{e},\widehat{t},y} \in \mathbb{R}` Emission price (undiscounted marginals of :ref:`emission_constraint`)
* :math:`\text{COST_NODAL_NET}_{n,y} \in \mathbb{R}` System costs at the node level net of energy trade revenues/cost
* :math:`\text{GDP}_{n,y} \in \mathbb{R}` Gross domestic product (GDP) in market exchange rates for MACRO reporting
* =========================================================================== ======================================================================================================
* ======================================================================================= =======================================================================================================
* Variable Explanatory text
* ======================================================================================= =======================================================================================================
* :math:`\text{DEMAND}_{n,c,l,y,h} \in \mathbb{R}` Demand level (in equilibrium with MACRO integration)
* :math:`\text{EMISSION_CONSTRAINT_RESCALE}_{n,\widehat{e},\widehat{t},y} \in \mathbb{R}` Annual average marginal of :ref:`emission_constraint`
* :math:`\text{PRICE_COMMODITY}_{n,c,l,y,h} \in \mathbb{R}` Commodity price (undiscounted marginals of :ref:`commodity_balance_gt` and :ref:`commodity_balance_lt`)
* :math:`\text{PRICE_EMISSION}_{n,\widehat{e},\widehat{t},y} \in \mathbb{R}` Emission price (undiscounted marginals of :ref:`emission_constraint`)
* :math:`\text{COST_NODAL_NET}_{n,y} \in \mathbb{R}` System costs at the node level net of energy trade revenues/cost
* :math:`\text{GDP}_{n,y} \in \mathbb{R}` Gross domestic product (GDP) in market exchange rates for MACRO reporting
* ======================================================================================= =======================================================================================================
*
***

Variables
* auxiliary variables for demand, prices, costs and GDP (for reporting when MESSAGE is run with MACRO)
DEMAND(node,commodity,level,year_all,time) demand
EMISSION_CONSTRAINT_RESCALE(node,type_emission,type_tec,type_year) rescaled of marginals of EMISSION_CONSTRAINT constraint
PRICE_COMMODITY(node,commodity,level,year_all,time) commodity price (derived from marginals of COMMODITY_BALANCE constraint)
PRICE_EMISSION(node,type_emission,type_tec,year_all) emission price (derived from marginals of EMISSION_BOUND constraint)
COST_NODAL_NET(node,year_all) system costs at the node level over time including effects of energy trade
Expand Down
14 changes: 7 additions & 7 deletions message_ix/model/MESSAGE/model_solve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (%foresight% = 0,
* This is the standard option; the GAMS global variable ``%foresight%=0`` by default.
*
* .. math::
* \min_x \text{OBJ} = \sum_{y \in Y} \text{OBJ}_y(x_y)
* \min_x OBJ = \sum_{y \in Y} OBJ_y(x_y)
***

* reset year in case it was set by MACRO to include the base year before
Expand All @@ -40,11 +40,11 @@ if (%foresight% = 0,
) ;

* rescale the dual of the emission constraint to account that the constraint is defined on the average year, not total
EMISSION_CONSTRAINT.m(node,type_emission,type_tec,type_year)$(
EMISSION_CONSTRAINT_RESCALE.l(node,type_emission,type_tec,type_year)$(
EMISSION_CONSTRAINT.m(node,type_emission,type_tec,type_year) ) =
EMISSION_CONSTRAINT.m(node,type_emission,type_tec,type_year)
/ SUM(year$( cat_year(type_year,year) ), duration_period(year) )
* SUM(year$( map_first_period(type_year,year) ), duration_period(year) / df_period(year) * df_year(year) );
;


* assign auxiliary variables DEMAND, PRICE_COMMODITY and PRICE_EMISSION for integration with MACRO and reporting
Expand All @@ -54,8 +54,8 @@ EMISSION_CONSTRAINT.m(node,type_emission,type_tec,type_year)$(
/ df_period(year) ;
PRICE_EMISSION.l(node,type_emission,type_tec,year)$( SUM(type_year$( cat_year(type_year,year) ), 1 ) ) =
SMAX(type_year$( cat_year(type_year,year) ),
- EMISSION_CONSTRAINT.m(node,type_emission,type_tec,type_year) )
/ df_year(year) ;
- EMISSION_CONSTRAINT_RESCALE.l(node,type_emission,type_tec,type_year) )
/ df_period(year) * duration_period(year);
PRICE_EMISSION.l(node,type_emission,type_tec,year)$(
PRICE_EMISSION.l(node,type_emission,type_tec,year) = - inf ) = 0 ;

Expand All @@ -77,10 +77,10 @@ else
* Loop over :math:`\hat{y} \in Y`, solving
*
* .. math::
* \min_x \ \text{OBJ} = \sum_{y \in \hat{Y}(\hat{y})} \text{OBJ}_y(x_y) \\
* \min_x \ OBJ = \sum_{y \in \hat{Y}(\hat{y})} OBJ_y(x_y) \\
* \text{s.t. } x_{y'} = x_{y'}^* \quad \forall \ y' < y
*
* where :math:`\hat{Y}(\hat{y}) = \{y \in Y | \ |\hat{y}| - |y| < \text{optimization_horizon} \}` and
* where :math:`\hat{Y}(\hat{y}) = \{y \in Y | \ |\hat{y}| - |y| < optimization\_horizon \}` and
* :math:`x_{y'}^*` is the optimal value of :math:`x_{y'}` in iteration :math:`|y'|` of the iterative loop.
*
* The advantage of this implementation is that there is no need to 'store' the optimal values of all decision
Expand Down

0 comments on commit 1383cbb

Please sign in to comment.