Commit 1f51eb63 authored by jussi ikäheimo's avatar jussi ikäheimo
Browse files

Added sets and equations for superpositioned state variables.

parent 13471bd4
......@@ -76,6 +76,14 @@ Model invest /
q_boundStateMaxDiff
q_boundCyclic
// superpositioned state variables
q_superposBegin
q_superposInter
q_superposStateMax
q_superposStateMin
q_superposStateUpwardLimit
q_superposStateDownwardLimit
// Policy
q_inertiaMin
q_instantaneousShareMax
......
......@@ -56,6 +56,7 @@ Sets
* --- Nodes -------------------------------------------------------------------
node_spill(node) "Nodes that can spill; used to remove v_spill variables where not relevant"
flowNode(flow, node) "Nodes with flows"
node_superpos(node) "Nodes whose state is monitored in the z dimension using superpositioning of state"
* --- Sets bounding geography and units ---------------------------------------
group "A group of units, transfer links, nodes, etc."
......@@ -138,6 +139,9 @@ $if defined scenario
gn_forecasts(*, node, timeseries) "Which grid/flow, node and timeseries use short-term forecasts"
gn_scenarios(*, node, timeseries) "Which grid/flow, node and timeseries have data for long-term scenarios"
mz(mType, z) "z periods in the models"
zs(z, s) "relationship between the z-periods and samples"
* --- Sets used for the changing unit aggregation and efficiency approximations as well as unit lifetimes
uft(unit, f, t) "Active units on intervals, enables aggregation of units for later intervals"
uft_online(unit, f, t) "Units with any online and startup variables on intervals"
......
......@@ -61,7 +61,7 @@ $ifthen exist '%input_dir%/inputData.gdx'
$$loaddc ts_priceChange
$$loaddc ts_influx
$$loaddc ts_node
$$loaddc p_s_discountFactor
* $$loaddc p_s_discountFactor
$$loaddc t_invest
$$loaddc utAvailabilityLimits
$$loaddc p_storageValue
......
......@@ -22,6 +22,9 @@ Free variables
v_genRamp(grid, node, unit, s, f, t) "Change in energy generation or consumption over an interval (MW/h)"
v_transfer(grid, node, node, s, f, t) "Average electricity transmission level from node to node during an interval (MW)"
v_ICramp(grid, node, node, s, f, t) "Change in energy transfer over an interval (MW/h)"
v_statemax(grid, node, s) "State variable maximum in sample s"
v_statemin(grid, node, s) "State variable minimum in sample s"
v_state_z(grid, node, z) "State in the beginning of the time period z"
;
Integer variables
v_startup_MIP(unit, starttype, s, f, t) "Sub-units started up after/during an interval (p.u.), (MIP variant)"
......
......@@ -109,6 +109,14 @@ equations
q_boundStateMaxDiff(grid, node, node, mType, s, f, t) "Node state variables bounded by other nodes (maximum state difference)"
q_boundCyclic(grid, node, s, s, mType) "Cyclic node state bound for the first and the last states of samples"
// superpositioned state variables
q_superposBegin(grid, node, mType, s)
q_superposInter(grid, node, mType,z)
q_superposStateMax(grid, node, mType, s, f, t)
q_superposStateMin(grid, node, mType, s, f, t)
q_superposStateUpwardLimit(grid, node, mType, z)
q_superposStateDownwardLimit(grid, node, mType, z)
// Policy
q_inertiaMin(restype, up_down, group, s, f, t) "Minimum inertia in a group of nodes"
q_instantaneousShareMax(group, s, f, t) "Maximum instantaneous share of generation and controlled import from a group of units and links"
......
......@@ -2010,7 +2010,7 @@ q_unitGreaterThanConstraint(s_active(s), gt_constraint, uft(unit, f, t))
${uft_onlineLP(unit, f, t)}
+ v_online_MIP(unit, s, f+df_central(f,t), t)
${uft_onlineMIP(unit, f, t)}
]
]
;
* --- Total Transfer Limits ---------------------------------------------------
......@@ -2543,6 +2543,138 @@ q_boundCyclic(gnss_bound(gn_state(grid, node), s_, s), m)
] // END * p_msWeight(m, s_)
;
*--- Intra-period state for superpositioned states ----------------------------
q_superposBegin(gn_state(grid, node_superpos(node)), m, s)
${ ms(m, s)
}..
// Initial value of the state of the node at the start of the sample s
+ sum(mst_start(m, s, t),
+ sum(sft(s, f, t),
+ v_state(grid, node, s, f+df(f,t+dt(t)), t+dt(t))
) // END sum(ft)
) // END sum(mst_start)
=E= 0
;
*--- Inter-period state dynamic equation for superpositioned states -----------
q_superposInter(gn_state(grid, node_superpos(node)), mz(m,z))
${ ord(z) > 1
}..
// State of the node at the beginning of period z
v_state_z(grid, node, z)
=E=
v_state_z(grid, node, z-1)
+
sum(zs(z-1, s_),
// State of the node at the end of the sample s_
+ sum(mst_end(m, s_, t),
+ sum(sft(s_, f, t),
+ v_state(grid, node, s_, f, t)
) // END sum(ft)
) // END sum(mst_end)
// State of the node at the start of the sample s_
- sum(mst_start(m, s_, t),
sum(sft(s_, f, t),
+ v_state(grid, node, s_, f+df(f,t+dt(t)), t+dt(t))
) // END sum(ft)
) // END sum(mst_start)
) // end sum(zs)
;
*--- Max state value during sample for superpositioned states -----------------
q_superposStateMax(gn_state(grid, node_superpos(node)), msft(m, s, f, t))..
v_statemax(grid, node, s)
=G=
v_state(grid, node, s, f+df(f,t+dt(t)), t+dt(t))
;
*--- Min state value during sample for superpositioned states -----------------
q_superposStateMin(gn_state(grid, node_superpos(node)), msft(m, s, f, t))..
v_statemin(grid, node, s)
=L=
v_state(grid, node, s, f+df(f,t+dt(t)), t+dt(t))
;
*--- Upward limit for superpositioned states -----------------
q_superposStateUpwardLimit(gn_state(grid, node_superpos(node)), mz(m,z))..
// Utilizable headroom in the state variable
+ [
// Upper boundary of the variable
+ p_gnBoundaryPropertiesForStates(grid, node, 'upwardLimit', 'constant')${p_gnBoundaryPropertiesForStates(grid, node, 'upwardLimit', 'useConstant')}
// Investments
+ sum(gnu(grid, node, unit),
+ p_gnu(grid, node, unit, 'upperLimitCapacityRatio')
* p_gnu(grid, node, unit, 'unitSize')
* [
+ v_invest_LP(unit)${unit_investLP(unit)}
+ v_invest_MIP(unit)${unit_investMIP(unit)}
]
) // END sum(gnu)
// State of the node at the beginning of period z
- v_state_z(grid, node, z)
// Maximum state reached during the related sample
- sum(zs(z,s_),
v_statemax(grid, node, s_)
)
] // END Headroom
*
// Conversion to energy
p_gn(grid, node, 'energyStoredPerUnitOfState')
=G= 0
;
*--- Upward limit for superpositioned states -----------------
q_superposStateDownwardLimit(gn_state(grid, node_superpos(node)), mz(m,z))..
// Utilizable headroom in the state variable
+ [
// State of the node at the beginning of period z
+ v_state_z(grid, node, z)
// Maximum state reached during the related sample
+ sum(zs(z,s_),
v_statemin(grid, node, s_)
)
// Lower boundary of the variable
- p_gnBoundaryPropertiesForStates(grid, node, 'downwardLimit', 'constant')${p_gnBoundaryPropertiesForStates(grid, node, 'downwardLimit', 'useConstant')}
] // END Headroom
*
// Conversion to energy
p_gn(grid, node, 'energyStoredPerUnitOfState')
=G= 0
;
*--- Minimum Inertia ----------------------------------------------------------
q_inertiaMin(restypeDirectionGroup(restype_inertia, up_down, group), sft(s, f, t))
......
......@@ -25,6 +25,7 @@ $offtext
// Upper bound
v_state.up(gn_state(grid, node), sft(s, f, t))${ p_gnBoundaryPropertiesForStates(grid, node, 'upwardLimit', 'useConstant')
and not df_central(f,t)
and not node_superpos(node)
}
= p_gnBoundaryPropertiesForStates(grid, node, 'upwardLimit', 'constant')
* p_gnBoundaryPropertiesForStates(grid, node, 'upwardLimit', 'multiplier')
......@@ -32,6 +33,7 @@ v_state.up(gn_state(grid, node), sft(s, f, t))${ p_gnBoundaryPropertiesForSta
// Lower bound
v_state.lo(gn_state(grid, node), sft(s, f, t))${ p_gnBoundaryPropertiesForStates(grid, node, 'downwardLimit', 'useConstant')
and not df_central(f,t)
and not node_superpos(node)
}
= p_gnBoundaryPropertiesForStates(grid, node, 'downwardLimit', 'constant')
* p_gnBoundaryPropertiesForStates(grid, node, 'downwardLimit', 'multiplier')
......@@ -40,6 +42,7 @@ v_state.lo(gn_state(grid, node), sft(s, f, t))${ p_gnBoundaryPropertiesForSta
v_state.fx(gn_state(grid, node), sft(s, f, t))${ p_gn(grid, node, 'boundAll')
and p_gnBoundaryPropertiesForStates(grid, node, 'reference', 'useConstant')
and not df_central(f,t)
and not node_superpos(node)
}
= p_gnBoundaryPropertiesForStates(grid, node, 'reference', 'constant')
* p_gnBoundaryPropertiesForStates(grid, node, 'reference', 'multiplier')
......@@ -48,6 +51,7 @@ v_state.fx(gn_state(grid, node), sft(s, f, t))${ p_gn(grid, node, 'boundAll')
v_state.fx(gn_state(grid, node), sft(s, f,t))${ mft_lastSteps(mSolve, f, t)
and p_gn(grid, node, 'boundEnd')
and p_gnBoundaryPropertiesForStates(grid, node, 'reference', 'useConstant')
and not node_superpos(node)
}
= p_gnBoundaryPropertiesForStates(grid, node, 'reference', 'constant')
* p_gnBoundaryPropertiesForStates(grid, node, 'reference', 'multiplier');
......@@ -56,6 +60,7 @@ v_state.fx(gn_state(grid, node), sft(s, f,t))${ mft_lastSteps(mSolve, f, t)
// Upper Bound
v_state.up(gn_state(grid, node), sft(s, f, t))${ p_gnBoundaryPropertiesForStates(grid, node, 'upwardLimit', 'useTimeSeries')
and not df_central(f,t)
and not node_superpos(node)
}
= ts_node_(grid, node, 'upwardLimit', s, f, t)
* p_gnBoundaryPropertiesForStates(grid, node, 'upwardLimit', 'multiplier')
......@@ -63,6 +68,7 @@ v_state.up(gn_state(grid, node), sft(s, f, t))${ p_gnBoundaryPropertiesForSta
// Lower bound
v_state.lo(gn_state(grid, node), sft(s, f, t))${ p_gnBoundaryPropertiesForStates(grid, node, 'downwardLimit', 'useTimeSeries')
and not df_central(f,t)
and not node_superpos(node)
}
= ts_node_(grid, node, 'downwardLimit', s, f, t)
* p_gnBoundaryPropertiesForStates(grid, node, 'downwardLimit', 'multiplier')
......@@ -71,7 +77,8 @@ v_state.lo(gn_state(grid, node), sft(s, f, t))${ p_gnBoundaryPropertiesForSta
v_state.fx(gn_state(grid, node), sft(s, f, t))${ p_gn(grid, node, 'boundAll')
and p_gnBoundaryPropertiesForStates(grid, node, 'reference', 'useTimeSeries')
and not df_central(f,t)
}
and not node_superpos(node)
}
= ts_node_(grid, node, 'reference', s, f, t)
* p_gnBoundaryPropertiesForStates(grid, node, 'reference', 'multiplier')
;
......@@ -79,14 +86,16 @@ v_state.fx(gn_state(grid, node), sft(s, f, t))${ p_gn(grid, node, 'boundAll')
v_state.fx(gn_state(grid, node), sft(s, f,t))${ mft_lastSteps(mSolve, f, t)
and p_gn(grid, node, 'boundEnd')
and p_gnBoundaryPropertiesForStates(grid, node, 'reference', 'useTimeSeries')
}
and not node_superpos(node)
}
= ts_node_(grid, node, 'reference', s, f, t)
* p_gnBoundaryPropertiesForStates(grid, node, 'reference', 'multiplier');
// BoundStartToEnd: bound the last interval in the horizon to the value just before the horizon
v_state.fx(gn_state(grid, node), sft(s, f, t))${ mft_lastSteps(mSolve, f, t)
and p_gn(grid, node, 'boundStartToEnd')
}
and not node_superpos(node)
}
= sum(mf_realization(mSolve, f_),
+ r_state(grid, node, f_, tSolve)
); // END sum(mf_realization)
......@@ -96,6 +105,7 @@ loop(mst_start(mSolve, s, t)$(tSolveFirst = mSettings(mSolve, 't_start')),
// Upper bound
v_state.up(gn_state(grid, node), s, f_solve, t+dt(t))${ p_gnBoundaryPropertiesForStates(grid, node, 'upwardLimit', 'useConstant')
and not df_central(f_solve,t)
and not node_superpos(node)
}
= p_gnBoundaryPropertiesForStates(grid, node, 'upwardLimit', 'constant')
* p_gnBoundaryPropertiesForStates(grid, node, 'upwardLimit', 'multiplier');
......@@ -103,6 +113,7 @@ loop(mst_start(mSolve, s, t)$(tSolveFirst = mSettings(mSolve, 't_start')),
// Lower bound
v_state.lo(gn_state(grid, node), s, f_solve, t+dt(t))${ p_gnBoundaryPropertiesForStates(grid, node, 'downwardLimit', 'useConstant')
and not df_central(f_solve,t)
and not node_superpos(node)
}
= p_gnBoundaryPropertiesForStates(grid, node, 'downwardLimit', 'constant')
* p_gnBoundaryPropertiesForStates(grid, node, 'downwardLimit', 'multiplier');
......@@ -554,6 +565,9 @@ if( tSolveFirst <> mSettings(mSolve, 't_start'), // Avoid rewriting the fixes on
= r_online(unit, f, t);
); // END if
*v_invest_LP.fx("U75FI_02Es_wind") = 50;
* =============================================================================
* --- Fix previously realized investment results ------------------------------
* =============================================================================
......
Markdown is supported
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