Commit 35bbe007 authored by ran li's avatar ran li Committed by ran li
Browse files

construct N-1 constraint. should now create a work sheet in the input, unitFail

parent 7a6350de
......@@ -23,7 +23,7 @@ Model schedule /
q_obj
q_balance
q_resDemand
q_resDemand_Infeed
// Unit Operation
q_maxDownward
q_maxUpward
......
......@@ -29,6 +29,8 @@ Sets
unit "Set of generators, storages and loads"
unit_flow(unit) "Unit that depend directly on variable energy flows (RoR, solar PV, etc.)"
unit_fuel(unit) "Units using a commercial fuel"
unit_fail(unit) "Units that might fail"
unitFail(unit) "Units that might fail"
unit_minLoad(unit) "Units that have unit commitment restrictions (e.g. minimum power level)"
unit_online(unit) "Units that have an online variable in the first active effLevel"
unit_online_LP(unit) "Units that have an LP online variable in the first active effLevel"
......
......@@ -26,6 +26,7 @@ $loaddc flow
$loaddc unittype
$loaddc unit
$loaddc unitUnittype
$loaddc unitFail
$loaddc fuel
$loaddc unitUnitEffLevel
$loaddc uFuel
......@@ -144,6 +145,8 @@ unit_flow(unit)${ sum(flow, flowUnit(flow, unit)) }
= yes;
unit_fuel(unit)${ sum(fuel, uFuel(unit, 'main', fuel)) }
= yes;
// Unit trips
unit_fail(unit)$(unitFail(unit))=yes;
// Units with investment variables
unit_investLP(unit)${ not p_unit(unit, 'investMIP')
......@@ -367,6 +370,7 @@ restypeDirectionNodeNode(restypeDirection(restype, up_down), node, node_)
restypeDirectionNode(restypeDirection(restype, up_down), node)
$ { p_nReserves(node, restype, up_down)
or p_nReserves(node, restype, 'use_time_series')
or p_nReserves(node, restype, 'N-1')
or sum(nu(node, unit), nuRescapable(restype, up_down, node, unit))
or sum(gn2n(grid, node, to_node), restypeDirectionNodeNode(restype, up_down, node, to_node))
}
......
......@@ -50,7 +50,7 @@ equations
q_obj "Objective function"
q_balance(grid, node, mType, f, t) "Energy demand must be satisfied at each node"
q_resDemand(restype, up_down, node, f, t) "Procurement for each reserve type is greater than demand"
q_resDemand_Infeed(grid, restype, up_down,node, f, t ,unit) "N-1 Reserve"
// Unit Operation
q_maxDownward(mType, grid, node, unit, f, t) "Downward commitments will not undercut power plant minimum load constraints or maximum elec. consumption"
q_maxUpward(mType, grid, node, unit, f, t) "Upward commitments will not exceed maximum available capacity or consumed power"
......
......@@ -141,6 +141,61 @@ q_resDemand(restypeDirectionNode(restype, up_down, node), ft(f, t))
- vq_resMissing(restype, up_down, node, f+df_reserves(node, restype, f, t), t)${ft_reservesFixed(node, restype, f+df_reserves(node, restype, f, t), t)}
;
* --- N-1 Reserve Demand ----------------------------------------------------------
// NOTE! Currently, there are multiple identical instances of the reserve balance equation being generated for each forecast branch even when the reserves are committed and identical between the forecasts.
// NOTE! This could be solved by formulating a new "ft_reserves" set to cover only the relevant forecast-time steps, but it would possibly make the reserves even more confusing.
q_resDemand_Infeed(grid, restypeDirectionNode(restype, 'up', node), ft(f, t), unit_)
${ ord(t) < tSolveFirst + p_nReserves(node, restype, 'reserve_length')
and not [ restypeReleasedForRealization(restype)
and ft_realized(f, t)
]
and unit_fail(unit_)
} ..
// Reserve provision by capable units on this node excluding the failing one
+ sum(nuft(node, unit, f, t)${nuRescapable(restype, 'up', node, unit) and (ord(unit_) ne ord(unit))},
+ v_reserve(restype, 'up', node, unit, f+df_reserves(node, restype, f, t), t)
) // END sum(nuft)
// Reserve provision from other reserve categories when they can be shared
+ sum((nuft(node, unit, f, t), restype_)${p_nuRes2Res(node, unit, restype, 'up', restype_)},
+ v_reserve(restype_, 'up', node, unit, f+df_reserves(node, restype_, f, t), t)
* p_nuRes2Res(node, unit, restype, 'up', restype_)
) // END sum(nuft)
// Reserve provision to this node via transfer links
+ sum(gn2n_directional(grid, node_, node)${restypeDirectionNodeNode(restype, 'up', node_, node)},
+ (1 - p_gnn(grid, node_, node, 'transferLoss') )
* v_resTransferRightward(restype, 'up', node_, node, f+df_reserves(node_, restype, f, t), t) // Reserves from another node - reduces the need for reserves in the node
) // END sum(gn2n_directional)
+ sum(gn2n_directional(grid, node, node_)${restypeDirectionNodeNode(restype, 'up', node_, node)},
+ (1 - p_gnn(grid, node, node_, 'transferLoss') )
* v_resTransferLeftward(restype, 'up', node, node_, f+df_reserves(node_, restype, f, t), t) // Reserves from another node - reduces the need for reserves in the node
) // END sum(gn2n_directional)
=G=
// Demand for reserves of the failing one
v_gen(grid,node,unit_,f,t)*p_nReserves(node, restype, 'Infeed2Cover')
// Reserve demand increase because of units
+ sum(nuft(node, unit, f, t)${p_nuReserves(node, unit, restype, 'reserve_increase_ratio')}, // Could be better to have 'reserve_increase_ratio' separately for up and down directions
+ sum(gnu(grid, node, unit), v_gen(grid, node, unit, f, t)) // Reserve sets and variables are currently lacking the grid dimension...
* p_nuReserves(node, unit, restype, 'reserve_increase_ratio')
) // END sum(nuft)
// Reserve provisions to another nodes via transfer links
+ sum(gn2n_directional(grid, node, node_)${restypeDirectionNodeNode(restype, 'up', node_, node)}, // If trasferring reserves to another node, increase your own reserves by same amount
+ v_resTransferRightward(restype, 'up', node, node_, f+df_reserves(node, restype, f, t), t)
) // END sum(gn2n_directional)
+ sum(gn2n_directional(grid, node_, node)${restypeDirectionNodeNode(restype, 'up', node_, node)}, // If trasferring reserves to another node, increase your own reserves by same amount
+ v_resTransferLeftward(restype, 'up', node_, node, f+df_reserves(node, restype, f, t), t)
) // END sum(gn2n_directional)
// Reserve demand feasibility dummy variables
- vq_resDemand(restype, 'up', node, f+df_reserves(node, restype, f, t), t)
- vq_resMissing(restype, 'up', node, f+df_reserves(node, restype, f, t), t)${ft_reservesFixed(node, restype, f+df_reserves(node, restype, f, t), t)}
;
* --- Maximum Downward Capacity -----------------------------------------------
q_maxDownward(m, gnuft(grid, node, unit, f, t))${ [ ord(t) < tSolveFirst + smax(restype, p_nReserves(node, restype, 'reserve_length')) // Unit is either providing
......
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