Commit 9230f447 authored by Topi Rasku's avatar Topi Rasku
Browse files

Replacing *IntervalStepCounter* with *tt_aggregate* due to the poor...

Replacing *IntervalStepCounter* with *tt_aggregate* due to the poor performance of *intervalStepCounter*.
parent d18f743e
......@@ -94,6 +94,7 @@ Sets
tt_block(counter, t) "Temporary time step subset for storing the time interval blocks"
tt_interval(t) "Temporary time steps when forming the ft structure, current sample"
tt_forecast(t) "Temporary subset for time steps used for forecast updating during solve loop"
tt_aggregate(t, t) "Time steps included in each active time step for time series aggregation"
mf(mType, f) "Forecasts present in the models"
ms(mType, s) "Samples present in the models"
mst_start(mType, s, t) "Start point of samples"
......@@ -125,7 +126,6 @@ Sets
s_active(s) "Samples with non-zero probability in the current model solve"
ss(s, s) "Previous sample of sample"
s_prev(s) "Temporary set for previous sample"
intervalStepCounter(counter, t) "Interval step counter for time series averaging NOTE! t is used here as a general counter, not a time step! (counter set too limited in size)"
$if defined scenario
s_scenario(s, scenario) "Which samples belong to which scenarios"
gn_scenarios(*, node, *) "Which grid/flow, node and timeseries/param have data for long-term scenarios"
......
......@@ -167,11 +167,6 @@ count_sample = 1;
cc(counter)${ mInterval(mSolve, 'stepsPerInterval', counter) }
= yes;
// Determine the interval step counters for each interval
intervalStepCounter(cc(counter), t)
${ ord(t) <= mInterval(mSolve, 'stepsPerInterval', counter) }
= yes;
// Update tForecastNext
tForecastNext(mSolve)
${ tSolveFirst >= tForecastNext(mSolve) }
......@@ -266,8 +261,6 @@ loop(cc(counter),
and ord(t) <= tSolveFirst + currentForecastLength
} = yes;
// Set of locked combinations of forecasts and intervals for the reserves?
// Update tActive
t_active(tt_interval) = yes;
......@@ -500,6 +493,11 @@ ft_reservesFixed(node, restype, f_solve(f), t_active(t))
}
= yes;
// Group each full time step under each active time step for time series aggregation.
option clear = tt_aggregate;
tt_aggregate(t_current(t+dt_active(t)), t)
= yes;
* =============================================================================
* --- Defining unit aggregations and ramps ------------------------------------
* =============================================================================
......
......@@ -299,92 +299,84 @@ loop(cc(counter),
// Retrieve interval block time steps
option clear = tt_interval;
tt_interval(t) = tt_block(counter, t);
// Make a temporary clone of tt_interval(t)
option clear = tt_;
tt_(tt_interval) = yes;
// Select and average time series data matching the intervals
ts_unit_(unit_timeseries(unit), param_unit, ft(f, tt_interval(t)))
= sum(intervalStepCounter(counter, t_),
ts_unit(unit, param_unit, f, t+(ord(t_) - 1 + dt_circular(t + (ord(t_) - 1))))
= sum(tt_aggregate(t, t_),
ts_unit(unit, param_unit, 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)))
= sum(intervalStepCounter(counter, t_),
ts_effUnit(effSelector, unit, effSelector, param_eff, f_solve, t+(ord(t_) - 1 + dt_circular(t + ord(t_) - 1)))
= sum(tt_aggregate(t, t_),
ts_effUnit(effSelector, unit, effSelector, param_eff, f, t_+dt_circular(t_))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
ts_effGroupUnit_(effSelector, unit_timeseries(unit), param_eff, ft(f, tt_interval(t)))
= sum(intervalStepCounter(counter, t_),
ts_effGroupUnit(effSelector, unit, param_eff, f_solve, t+(ord(t_) - 1 + dt_circular(t + ord(t_) - 1)))
= sum(tt_aggregate(t, t_),
ts_effGroupUnit(effSelector, unit, param_eff, f, t_+dt_circular(t_))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
$offtext
ts_influx_(gn(grid, node), fts(f, tt_interval(t), s))
= sum(intervalStepCounter(counter, t_),
= sum(tt_aggregate(t, t_),
ts_influx(grid, node,
f + (df_scenario(f, t)$gn_scenarios(grid, node, 'ts_influx')),
t + ( ord(t_) - 1
+ dt_scenarioOffset(grid, node, 'ts_influx', s)
+ dt_circular(t + (ord(t_) - 1))$(not gn_scenarios(grid, node, 'ts_influx'))))
t_+ ( + dt_scenarioOffset(grid, node, 'ts_influx', s)
+ dt_circular(t_)$(not gn_scenarios(grid, node, 'ts_influx'))))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
ts_cf_(flowNode(flow, node), fts(f, tt_interval(t), s))
= sum(intervalStepCounter(counter, t_),
= sum(tt_aggregate(t, t_),
ts_cf(flow, node,
f + (df_scenario(f, t)$gn_scenarios(flow, node, 'ts_cf')),
t + ( ord(t_) - 1
+ dt_scenarioOffset(flow, node, 'ts_cf', s)
+ dt_circular(t + (ord(t_) - 1))$(not gn_scenarios(flow, node, 'ts_cf'))))
t_+ ( + dt_scenarioOffset(flow, node, 'ts_cf', s)
+ dt_circular(t_)$(not gn_scenarios(flow, node, 'ts_cf'))))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
// Reserves relevant only until reserve_length
ts_reserveDemand_(restypeDirectionNode(restype, up_down, node), ft(f, tt_interval(t)))
${ord(t) <= tSolveFirst + p_nReserves(node, restype, 'reserve_length') }
= sum(intervalStepCounter(counter, t_),
= sum(tt_aggregate(t, t_),
ts_reserveDemand(restype, up_down, node,
f + (df_scenario(f, t)$gn_scenarios(restype, node, 'ts_reserveDemand')),
t + ( ord(t_) - 1 + dt_circular(t + (ord(t_) - 1))))
t_+ dt_circular(t_))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
ts_node_(gn_state(grid, node), param_gnBoundaryTypes, fts(f, tt_interval(t), s))
$p_gnBoundaryPropertiesForStates(grid, node, param_gnBoundaryTypes, 'useTimeseries')
// Take average if not a limit type
= (sum(intervalStepCounter(counter, t_),
= (sum(tt_aggregate(t, t_),
ts_node(grid, node, param_gnBoundaryTypes,
f + (df_scenario(f, t)$gn_scenarios(grid, node, 'ts_node')),
t + ( ord(t_) - 1
+ dt_scenarioOffset(grid, node, param_gnBoundaryTypes, s)
+ dt_circular(t + (ord(t_) - 1))$(not gn_scenarios(grid, node, 'ts_node'))))
t_+ ( + dt_scenarioOffset(grid, node, param_gnBoundaryTypes, s)
+ dt_circular(t_)$(not gn_scenarios(grid, node, 'ts_node'))))
)
/ mInterval(mSolve, 'stepsPerInterval', counter))$( not (sameas(param_gnBoundaryTypes, 'upwardLimit')
or sameas(param_gnBoundaryTypes, 'downwardLimit')
or slack(param_gnBoundaryTypes)))
// Maximum lower limit
+ smax(intervalStepCounter(counter, t_),
+ smax(tt_aggregate(t, t_),
ts_node(grid, node, param_gnBoundaryTypes,
f + (df_scenario(f, t)$gn_scenarios(grid, node, 'ts_node')),
t + ( ord(t_) - 1
+ dt_scenarioOffset(grid, node, param_gnBoundaryTypes, s)
+ dt_circular(t + (ord(t_) - 1))$(not gn_scenarios(grid, node, 'ts_node'))))
t_+ ( + dt_scenarioOffset(grid, node, param_gnBoundaryTypes, s)
+ dt_circular(t_)$(not gn_scenarios(grid, node, 'ts_node'))))
)
$(sameas(param_gnBoundaryTypes, 'downwardLimit') or downwardSlack(param_gnBoundaryTypes))
// Minimum upper limit
+ smin(intervalStepCounter(counter, t_),
+ smin(tt_aggregate(t, t_),
ts_node(grid, node, param_gnBoundaryTypes,
f + (df_scenario(f, t)$gn_scenarios(grid, node, 'ts_node')),
t + ( ord(t_) - 1
+ dt_scenarioOffset(grid, node, param_gnBoundaryTypes, s)
+ dt_circular(t + (ord(t_) - 1))$(not gn_scenarios(grid, node, 'ts_node'))))
t_+ ( + dt_scenarioOffset(grid, node, param_gnBoundaryTypes, s)
+ dt_circular(t_)$(not gn_scenarios(grid, node, 'ts_node'))))
)
$(sameas(param_gnBoundaryTypes, 'upwardLimit') or upwardSlack(param_gnBoundaryTypes));
// Fuel price time series
ts_fuelPrice_(fuel, tt_interval(t))
${ p_fuelPrice(fuel, 'useTimeSeries') }
= sum(intervalStepCounter(counter, t_),
+ ts_fuelPrice(fuel, t+(ord(t_) - 1 + dt_circular(t + (ord(t_) - 1))))
= sum(tt_aggregate(t, t_),
+ ts_fuelPrice(fuel, t_+dt_circular(t_))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
......
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