Commit 1044b030 authored by Topi Rasku's avatar Topi Rasku
Browse files

Further improving 'dt_active' performance.

parent 6c2d6a1d
......@@ -110,7 +110,7 @@ Parameters
dt(t) "Displacement needed to reach the previous time interval (in time steps)"
dt_circular(t) "Circular t displacement if the time series data is not long enough to cover the model horizon"
dt_next(t) "Displacement needed to reach the next time interval (in time steps)"
dt_active(t) "Displacement needed to reach the previous active time interval (in time steps)"
dt_active(t) "Displacement needed to reach the corresponding active time interval from any time interval (in time steps)"
dt_toStartup(unit, t) "Displacement from the current time interval to the time interval where the unit was started up in case online variable changes from 0 to 1 (in time steps)"
dt_toShutdown(unit, t) "Displacement from the current time interval to the time interval where the shutdown phase began in case generation becomes 0 (in time steps)"
dt_starttypeUnitCounter(starttype, unit, counter) "Displacement needed to account for starttype constraints (in time steps)"
......
......@@ -188,6 +188,9 @@ t_current(t_full(t))
}
= yes;
// Initialize dt_active
Option clear = dt_active;
// Loop over the defined blocks of intervals
loop(cc(counter),
......@@ -213,14 +216,17 @@ loop(cc(counter),
// If stepsPerInterval equals one, simply use all the steps within the block
if(mInterval(mSolve, 'stepsPerInterval', counter) = 1,
tt_interval(tt(t)) = yes; // Include all time steps within the block
// Include all time steps within the block
tt_interval(tt(t)) = yes;
// If stepsPerInterval exceeds 1 (stepsPerInterval < 1 not defined)
elseif mInterval(mSolve, 'stepsPerInterval', counter) > 1,
tt_interval(tt(t)) // Select the active time steps within the block
${mod(ord(t) - tSolveFirst - tCounter,
mInterval(mSolve, 'stepsPerInterval', counter)) = 0
} = yes;
// Calculate the displacement required to reach the corresponding active time step from any time step
dt_active(tt(t)) = - (mod(ord(t) - tSolveFirst - tCounter, mInterval(mSolve, 'stepsPerInterval', counter)));
// Select the active time steps within the block
tt_interval(tt(t))${ not dt_active(t) } = yes;
); // END ELSEIF intervalLenght
......@@ -601,9 +607,6 @@ loop(uft_online(unit, f, t)${ p_u_shutdownTimeIntervals(unit) },
* --- Displacements for start-up and shutdown decisions -----------------------
* -----------------------------------------------------------------------------
// Calculate the time displacement to reach the preceding active time step from any current time step
dt_active(t_current(t)) = smax(t_active(t_)${ord(t_) <= ord(t)}, ord(t_)) - ord(t);
* --- Start-up decisions ------------------------------------------------------
// Calculate dt_toStartup: in case the unit becomes online in the current time interval,
......
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