Commit 274c2285 authored by Topi Rasku's avatar Topi Rasku
Browse files

Slight performance improvement in 'inputsLoop' by avoiding looping over entire...

Slight performance improvement in 'inputsLoop' by avoiding looping over entire 't_' when averaging time series data.
parent 70d19148
......@@ -89,6 +89,7 @@ Sets
t_active(t) "Set of active t:s within the current solve horizon, including necessary history"
t_invest(t) "Time steps when investments can be made"
tt(t) "Temporary subset for time steps used for calculations"
tt_(t) "Another temporary subset for time steps used for calculations"
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"
......
......@@ -294,6 +294,9 @@ 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;
// If stepsPerInterval equals one, simply use all the steps within the block
if(mInterval(mSolve, 'stepsPerInterval', counter) = 1,
......@@ -336,10 +339,9 @@ $offtext
loop(ft(f_solve, tt_interval(t)),
// Select t:s within the interval
Option clear = tt;
tt(t_)
${tt_interval(t_)
and ord(t_) >= ord(t)
and ord(t_) < ord(t) + mInterval(mSolve, 'stepsPerInterval', counter)
tt(tt_(t_))
${ ord(t_) >= ord(t)
and ord(t_) < ord(t) + mInterval(mSolve, 'stepsPerInterval', counter)
}
= yes;
ts_unit_(unit_timeseries(unit), param_unit, f_solve, 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