Commit 56732716 authored by Niina Helistö's avatar Niina Helistö
Browse files

Merge branch 'master' into 'annual_energy_constraints'

# Conflicts:
#   defModels/building.gms
#   defModels/schedule.gms
parents 2b690a8f a8bb1b1d
......@@ -68,6 +68,8 @@ Model building /
* q_resTransferLimitLeftward
* q_reserveProvisionRightward
* q_reserveProvisionLeftward
q_transferTwoWayLimit1
* q_transferTwoWayLimit2
// State Variables
q_stateSlack
......
......@@ -68,6 +68,8 @@ Model invest /
q_resTransferLimitLeftward
q_reserveProvisionRightward
q_reserveProvisionLeftward
q_transferTwoWayLimit1
q_transferTwoWayLimit2
// State Variables
q_stateSlack
......
......@@ -68,6 +68,8 @@ Model schedule /
q_resTransferLimitLeftward
* q_reserveProvisionRightward
* q_reserveProvisionLeftward
q_transferTwoWayLimit1
* q_transferTwoWayLimit2
// State Variables
q_stateSlack
......
......@@ -142,6 +142,8 @@ v_help_inc
q_resTransferLimitLeftward
q_reserveProvisionRightward
q_reserveProvisionLeftward
q_transferTwoWayLimit1
q_transferTwoWayLimit2
// State Variables
q_stateSlack
......
......@@ -87,6 +87,7 @@ r_gnnTotalTransfer
r_gnTotalSpill
r_gnTotalSpillShare
r_gTotalSpill
r_gnnDiffusion
* --- Energy Generation/Consumption Result Symbols ----------------------------
......
......@@ -93,6 +93,7 @@ Parameters
r_gnTotalSpill(grid, node) "Total spilled energy from gn over the simulation (MWh)"
r_gnTotalSpillShare(grid, node) "Total spilled energy gn/g share"
r_gTotalSpill(grid) "Total spilled energy from gn over the simulation (MWh)"
r_gnnDiffusion(grid, node, node, f, t) "Diffusion between nodes"
* --- Energy Generation/Consumption Results -----------------------------------
......
......@@ -101,6 +101,8 @@ equations
q_resTransferLimitLeftward(grid, node, node, s, f, t) "Transfer of energy and capacity reservations are less than the transfer capacity to the leftward direction"
q_reserveProvisionRightward(restype, up_down, grid, node, node, s, f, t) "Rightward reserve provision limited - needed for links with investment possibility"
q_reserveProvisionLeftward(restype, up_down, grid, node, node, s, f, t) "Leftward reserve provision limited - needed for links with investment possibility"
q_transferTwoWayLimit1(grid, node, node, s, f, t) "Limiting transfer in both directions, option 1"
q_transferTwoWayLimit2(grid, node, node, s, f, t) "Limiting transfer in both directions, option 2"
// State Variables
q_stateSlack(grid, node, slack, s, f, t) "Slack variable greater than the difference between v_state and the slack boundary"
......
......@@ -2300,6 +2300,81 @@ q_reserveProvisionLeftward(restypeDirectionGridNodeNode(restype, up_down, grid,
]
;
* --- Additional transfer constraints to make the constraints tight -----------
* These two constraints are only needed for links that have availability to both
* directions.
* This first constraint is defined for links that do not have investment
* possibility but have existing transfer capacity to both directions. If there
* is no existing transfer capacity to both directions, a two-way constraint
* like this is not needed.
q_transferTwoWayLimit1(gn2n_directional(grid, node, node_), sft(s, f, t))
${not p_gnn(grid, node, node_, 'transferCapInvLimit')
and ((p_gnn(grid, node, node_, 'availability') and not gn2n_timeseries(grid, node, node_, 'availability'))
or (ts_gnn_(grid, node, node_, 'availability', f, t) and gn2n_timeseries(grid, node, node_, 'availability')))
and ((p_gnn(grid, node_, node, 'availability') and not gn2n_timeseries(grid, node_, node, 'availability'))
or (ts_gnn_(grid, node_, node, 'availability', f, t) and gn2n_timeseries(grid, node_, node, 'availability')))
and p_gnn(grid, node, node_, 'transferCap')
and p_gnn(grid, node_, node, 'transferCap')} ..
// Rightward / (availability * capacity)
+ v_transferRightward(grid, node, node_, s, f, t)
/ [
+ p_gnn(grid, node, node_, 'availability')${not gn2n_timeseries(grid, node, node_, 'availability')}
+ ts_gnn_(grid, node, node_, 'availability', f, t)${gn2n_timeseries(grid, node, node_, 'availability')}
]
/ p_gnn(grid, node, node_, 'transferCap')
// Leftward / (availability * capacity)
+ v_transferLeftward(grid, node, node_, s, f, t)
/ [
+ p_gnn(grid, node_, node, 'availability')${not gn2n_timeseries(grid, node_, node, 'availability')}
+ ts_gnn_(grid, node_, node, 'availability', f, t)${gn2n_timeseries(grid, node_, node, 'availability')}
]
/ p_gnn(grid, node_, node, 'transferCap')
=L=
+ 1
;
* This second constraint is defined for links that have investment possibility
* and where the exististing capacity is the same in both directions. If the
* exististing capacity is not the same in both directions, a tight and linear
* constraint cannot be defined.
q_transferTwoWayLimit2(gn2n_directional(grid, node, node_), sft(s, f, t))
${p_gnn(grid, node, node_, 'transferCapInvLimit')
and p_gnn(grid, node, node_, 'transferCap') = p_gnn(grid, node_, node, 'transferCap')
and ((p_gnn(grid, node, node_, 'availability') and not gn2n_timeseries(grid, node, node_, 'availability'))
or (ts_gnn_(grid, node, node_, 'availability', f, t) and gn2n_timeseries(grid, node, node_, 'availability')))
and ((p_gnn(grid, node_, node, 'availability') and not gn2n_timeseries(grid, node_, node, 'availability'))
or (ts_gnn_(grid, node_, node, 'availability', f, t) and gn2n_timeseries(grid, node_, node, 'availability')))} ..
// Rightward / availability
+ v_transferRightward(grid, node, node_, s, f, t)
/ [
+ p_gnn(grid, node, node_, 'availability')${not gn2n_timeseries(grid, node, node_, 'availability')}
+ ts_gnn_(grid, node, node_, 'availability', f, t)${gn2n_timeseries(grid, node, node_, 'availability')}
]
// Leftward / availability
+ v_transferLeftward(grid, node, node_, s, f, t)
/ [
+ p_gnn(grid, node_, node, 'availability')${not gn2n_timeseries(grid, node_, node, 'availability')}
+ ts_gnn_(grid, node_, node, 'availability', f, t)${gn2n_timeseries(grid, node_, node, 'availability')}
]
=L=
// Existing transfer capacity
+ p_gnn(grid, node, node_, 'transferCap')
// Investments into additional transfer capacity
+ sum(t_invest(t_)${ord(t_)<=ord(t)},
+ v_investTransfer_LP(grid, node, node_, t_)${gn2n_directional_investLP(grid, node, node_)}
+ v_investTransfer_MIP(grid, node, node_, t_)${gn2n_directional_investMIP(grid, node, node_)}
* p_gnn(grid, node, node_, 'unitSize')
) // END sum(t_invest)
;
* =============================================================================
* --- Node State Constraints -------------------------------------------------
* =============================================================================
......
......@@ -109,6 +109,8 @@ Option clear = q_resTransferLimitRightward;
Option clear = q_resTransferLimitLeftward;
Option clear = q_reserveProvisionRightward;
Option clear = q_reserveProvisionLeftward;
Option clear = q_transferTwoWayLimit1;
Option clear = q_transferTwoWayLimit2;
// State Variables
Option clear = q_stateSlack;
......
......@@ -120,6 +120,13 @@ loop(m,
) // END sum(ft_realizedNoReset)
]; // END * 1e-6
// Diffusion from node to node_
r_gnnDiffusion(gn_state(grid, node), node_, ft_realizedNoReset(f,startp(t)))
${gnn_state(grid, node, node_) or gnn_state(grid, node_, node)}
= p_gnn(grid, node, node_, 'diffCoeff') * r_state(grid, node, f, t)
- p_gnn(grid, node_, node, 'diffCoeff') * r_state(grid, node_, f, t)
;
* --- Total Cost Components (discounted) --------------------------------------
// Total VOM costs
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment