Commit 1d883e14 authored by DaKi404's avatar DaKi404
Browse files

Fix to issue #144

ts_unitConstraintNode can now be used with time aggregation (needs double-checking)
parent 0d549ace
......@@ -170,6 +170,7 @@ Sets
ts_influx
ts_cf
ts_reserveDemand
ts_unitConstraintNode
ts_node
ts_priceChange
ts_price
......
......@@ -173,7 +173,7 @@ Parameters
ts_influx_(grid, node, s, f, t) "Mean external power inflow/outflow during a time step (MWh/h)"
ts_cf_(flow, node, s, f, t) "Mean available capacity factor time series (p.u.)"
ts_reserveDemand_(restype, up_down, group, f, t) "Mean reserve demand in region in the time step (MW)"
ts_unitConstraintNode_(unit, constraint, node, f, t) "Mean time series coefficients for constraints (eq1-9, gt1-9) between inputs and outputs"
ts_unitConstraintNode_(unit, constraint, node, s, f, t) "Mean time series coefficients for constraints (eq1-9, gt1-9) between inputs and outputs"
ts_node_(grid, node, param_gnBoundaryTypes, s, f, t) "Mean value of ts_node"
ts_storageValue_(grid, node, s, f, t) "Mean value of ts_storageValue"
ts_vomCost_(grid, node, unit, t) "Calculated variable O&M cost that includes O&M cost, fuel cost and emission cost"
......@@ -186,6 +186,7 @@ Parameters
ts_influx_update(grid, node, f, t)
ts_cf_update(flow, node, f, t)
ts_reserveDemand_update(restype, up_down, group, f, t)
ts_unitConstraintNode_update(unit, constraint, node, f, t)
ts_node_update(grid, node, param_gnBoundaryTypes, f, t)
ts_priceChange_update(node, t)
ts_unavailability_update(unit, t)
......
......@@ -1975,7 +1975,7 @@ q_unitEqualityConstraint(s_active(s), eq_constraint, uft(unit, f, t))
)
+ sum(gnu(grid, node, unit)$p_unitConstraintNode(unit, eq_constraint, node, 'useTimeseries'),
+ v_gen(grid, node, unit, s, f, t) * ts_unitConstraintNode(unit, eq_constraint, node, f, t)
+ v_gen(grid, node, unit, s, f, t) * ts_unitConstraintNode_(unit, eq_constraint, node, s, f, t)
)
=E=
......@@ -2005,7 +2005,7 @@ q_unitGreaterThanConstraint(s_active(s), gt_constraint, uft(unit, f, t))
)
+ sum(gnu(grid, node, unit)$p_unitConstraintNode(unit, gt_constraint, node, 'useTimeseries'),
+ v_gen(grid, node, unit, s, f, t) * ts_unitConstraintNode(unit, gt_constraint, node, f, t)
+ v_gen(grid, node, unit, s, f, t) * ts_unitConstraintNode_(unit, gt_constraint, node, s, f, t)
)
=G=
......
......@@ -110,6 +110,18 @@ $offtext
= ts_reserveDemand_update(restype, up_down, group, f, t);
); // END if('ts_reserveDemand')
// Update ts_unitConstraintNode
if (mTimeseries_loop_read(mSolve, 'ts_unitConstraintNode'),
put_utility 'gdxin' / '%input_dir%/ts_unitConstraintNode/' tSolve.tl:0 '.gdx';
execute_load ts_unitConstraintNode_update=ts_unitConstraintNode;
ts_unitConstraintNode(unit, constraint, node, f_solve(f), tt_forecast(t))
${ not mf_realization(mSolve, f) // Realization not updated
and (mSettings(mSolve, 'onlyExistingForecasts')
-> ts_unitConstraintNode_update(unit, constraint, node, f ,t)) // Update only existing values (zeroes need to be EPS)
}
= ts_unitConstraintNode_update(unit, constraint, node, f ,t);
); // END if('ts_unitConstraintNode')
// Update ts_node
if (mTimeseries_loop_read(mSolve, 'ts_node'),
put_utility 'gdxin' / '%input_dir%/ts_node/' tSolve.tl:0 '.gdx';
......@@ -198,6 +210,9 @@ $offtext
// ts_reserveDemand
ts_reserveDemand(restypeDirectionGroup(restype, up_down, group), f, tt(t))
= ts_reserveDemand(restype, up_down, group, f, t) - ts_reserveDemand(restype, up_down, group, f+ddf(f), t);
// ts_unitConstraintNode
ts_unitConstraintNode(unit, constraint, node, f, tt(t))
= ts_unitConstraintNode(unit, constraint, node, f, t) - ts_unitConstraintNode(unit, constraint, node, f+ddf(f), t);
// ts_node
ts_node(gn(grid, node), param_gnBoundaryTypes, f, tt(t))
= ts_node(grid, node, param_gnBoundaryTypes, f, t) - ts_node(grid, node, param_gnBoundaryTypes, f+ddf(f), t);
......@@ -251,6 +266,13 @@ $offtext
+ (tSolveFirst - ord(t) + mSettings(mSolve, 't_improveForecast'))
* ts_reserveDemand(restype, up_down, group, f+ddf_(f), t)
] / mSettings(mSolve, 't_improveForecast');
// ts_unitConstraintNode
ts_unitConstraintNode(unit, constraint, node, f, tt(t))
= [ + (ord(t) - tSolveFirst)
* ts_unitConstraintNode(unit, constraint, node, f, t)
+ (tSolveFirst - ord(t) + mSettings(mSolve, 't_improveForecast'))
* ts_unitConstraintNode(unit, constraint, node, f+ddf_(f), t)
] / mSettings(mSolve, 't_improveForecast');
// ts_node
ts_node(gn(grid, node), param_gnBoundaryTypes, f, tt(t))
= [ + (ord(t) - tSolveFirst)
......@@ -284,7 +306,10 @@ $offtext
// ts_reserveDemand
ts_reserveDemand(restypeDirectionGroup(restype, up_down, group), f, tt(t))
= max(ts_reserveDemand(restype, up_down, group, f, t) + ts_reserveDemand(restype, up_down, group, f+ddf(f), t), 0); // Ensure that reserve demand forecasts remains positive
// ts_node
// ts_unitConstraintNode
ts_unitConstraintNode(unit, constraint, node, f, tt(t))
= ts_unitConstraintNode(unit, constraint, node, f, t) + ts_unitConstraintNode(unit, constraint, node, f+ddf(f), t);
// ts_node
ts_node(gn(grid, node), param_gnBoundaryTypes, f, tt(t))
= ts_node(grid, node, param_gnBoundaryTypes, f, t) + ts_node(grid, node, param_gnBoundaryTypes, f+ddf(f), t);
); // END loop(f_solve)
......@@ -308,6 +333,12 @@ loop(cc(counter),
ts_unit(unit, param_unit, f, t_+dt_circular(t_))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
ts_unitConstraintNode_(unit, constraint, node, sft(s, f, tt_interval(t)))
$p_unitConstraintNode(unit, constraint, node, 'useTimeseries')
= sum(tt_aggregate(t, t_),
ts_unitConstraintNode(unit, constraint, node, f, t_+dt_circular(t_))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
$ontext
* Should these be handled here at all? See above comment
ts_effUnit_(effGroupSelectorUnit(effSelector, unit_timeseries(unit), effSelector), param_eff, ft(f, tt_interval(t)))
......
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