Commit ada3f515 authored by Erkka Rinne's avatar Erkka Rinne
Browse files

Allow perfect foresight beyond realization horizon

New model setting `t_perfectForesight` gives number of time steps after `t_jump` where realization foreast is used
parent da7a0e45
......@@ -107,6 +107,7 @@ if (mType('schedule'),
mSettings('schedule', 't_forecastStart') = 1; // At which time step the first forecast is available ( 1 = t000001 )
mSettings('schedule', 't_forecastLengthUnchanging') = 36; // Length of forecasts in time steps - this does not decrease when the solve moves forward (requires forecast data that is longer than the horizon at first)
mSettings('schedule', 't_forecastLengthDecreasesFrom') = 168; // Length of forecasts in time steps - this decreases when the solve moves forward until the new forecast data is read (then extends back to full length)
mSettings('schedule', 't_perfectForesight') = 0; // How many time steps after t_jump there is perfect foresight
mSettings('schedule', 't_forecastJump') = 24; // How many time steps before new forecast is available
mSettings('schedule', 't_improveForecast') = 0; // Number of time steps ahead of time that the forecast is improved on each solve.
......
......@@ -50,6 +50,7 @@ Sets
t_forecastStart, // Time step for first reading the forecasts (not necessarily t_start)
t_forecastJump, // Number of time steps between each update of the forecasts
t_improveForecast "Number of time steps ahead of time on which the forecast is improved on each solve"
t_perfectForesight "Number of time steps *after* t_jump for which realized data is used instead of forecasts"
onlyExistingForecasts "Use only existing forecast values when reading updated forecasts. Note: zero values need to be saved as Eps in the gdx file."
scenarios "Number of long-term scenarios used"
scenarioLength "Length of scenario in time steps for creating stocahstic scenarios from time series data"
......
......@@ -623,6 +623,15 @@ loop(msf(m, s, f)${ mf_realization(m, f) },
loop(m, // Not ideal, but multi-model functionality is not yet implemented
* --- Prefect foresight not longer than forecast length
if(mSettings(m, 't_jump') + mSettings(m, 't_perfectForesight')
> max(mSettings(m, 't_forecastLengthUnchanging'),
mSettings(m, 't_forecastLengthDecreasesFrom')),
put log "!!! Error in model ", m.tl:0 /;
put log "!!! Error: t_jump + t_perfectForesight > max(t_forecastLengthUnchanging, t_forecastLengthDecreasesFrom)"/;
abort "Period of perfect foresight cannot be longer than forecast horizon";
);
* --- Reserve structure checks ------------------------------------------------
loop(restypeDirectionNode(restype, up_down, node),
......
......@@ -232,12 +232,14 @@ loop(cc(counter),
// Include the t_jump for the realization
mft(mf(mSolve, f_solve), tt_interval(t))
${ord(t) <= tSolveFirst + mSettings(mSolve, 't_jump')
+ mSettings(mSolve, 't_perfectForesight')
and mf_realization(mSolve, f_solve)
} = yes;
// Include the full horizon for the central forecast
mft(mf(mSolve, f_solve), tt_interval(t))
${ord(t) > tSolveFirst + mSettings(mSolve, 't_jump')
+ mSettings(mSolve, 't_perfectForesight')
and (mf_central(mSolve, f_solve)
or mSettings(mSolve, 'forecasts') = 0)
} = yes;
......@@ -247,6 +249,7 @@ loop(cc(counter),
${not mf_central(mSolve, f_solve)
and not mf_realization(mSolve, f_solve)
and ord(t) > tSolveFirst + mSettings(mSolve, 't_jump')
+ mSettings(mSolve, 't_perfectForesight')
and ord(t) <= tSolveFirst + currentForecastLength
} = yes;
......@@ -414,7 +417,8 @@ dt(t)${sum(ms(mSolve, s)$(not ms_central(mSolve, s)), mst_start(mSolve, s, t))}
// Forecast index displacement between realized and forecasted intervals
// NOTE! This set cannot be reset without references to previously solved time steps in the stochastic tree becoming ill-defined!
df(f_solve(f), t_active(t))${ ord(t) <= tSolveFirst + mSettings(mSolve, 't_jump') }
df(f_solve(f), t_active(t))${ ord(t) <= tSolveFirst + mSettings(mSolve, 't_jump')
+ mSettings(mSolve, 't_perfectForesight')}
= sum(mf_realization(mSolve, f_), ord(f_) - ord(f));
// Central forecast for the long-term scenarios comes from a special forecast label
if(mSettings(mSolve, 'scenarios'),
......
......@@ -486,8 +486,9 @@ This avoids a discontinuity `jump' after the initial sample.
$offtext
// Do smoothing
loop((ms_initial(mSolve, s_), mf_central(mSolve, f_), t_)
$(ord(t_) = msEnd(mSolve, s_)),
loop((ms_initial(mSolve, s_), t_, ft(f_, t__))
$[ord(t_) = msEnd(mSolve, s_) and mst_end(mSolve, s_, t__)
and (mf_realization(mSolve, f_) xor mf_central(mSolve, f_))],
$$batinclude 'inc/smoothing.gms' ts_influx
$$batinclude 'inc/smoothing.gms' ts_cf
);
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