Commit a91b4d5a authored by Juha Kiviluoma's avatar Juha Kiviluoma
Browse files

Updated some terminology and changed the effLevel determination from start...

Updated some terminology and changed the effLevel determination from start time step to end time step. Addresses issue #19.
parent 1ed5384a
......@@ -25,12 +25,12 @@ if (mType('building'),
* --- Define Key Execution Parameters in Time Indeces -------------------------
// Define simulation start and end time indeces
mSettings('building', 't_start') = 1; // Ord of first solve (i.e. >0)
mSettings('building', 't_end') = 8760;
mSettings('building', 't_start') = 1; // First time step to be solved, 1 corresponds to t000001 (t000000 will then be used for initial status of dynamic variables)
mSettings('building', 't_end') = 8760; // Last time step to be included in the solve (may solve and output more time steps in case t_jump does not match)
// Define simulation horizon and moving horizon optimization "speed"
mSettings('building', 't_horizon') = 336;
mSettings('building', 't_jump') = 168;
mSettings('building', 't_horizon') = 336; // How many active time steps the solve contains (aggregation of time steps does not impact this, unless the aggregation does not match)
mSettings('building', 't_jump') = 168; // How many time steps the model rolls forward between each solve
* =============================================================================
* --- Model Time Structure ----------------------------------------------------
......@@ -58,11 +58,11 @@ if (mType('building'),
* --- Define Time Step Intervals ----------------------------------------------
// Define the duration of a single time-step in hours
mSettings('building', 'intervalInHours') = 1;
mSettings('building', 'stepLengthInHours') = 1;
// Define the time step intervals in time-steps
mInterval('building', 'intervalLength', 'c000') = 1;
mInterval('building', 'intervalEnd', 'c000') = 336;
mInterval('building', 'stepsPerInterval', 'c000') = 1;
mInterval('building', 'lastStepInIntervalBlock', 'c000') = 336;
* =============================================================================
* --- Model Forecast Structure ------------------------------------------------
......@@ -72,10 +72,10 @@ if (mType('building'),
mSettings('building', 'forecasts') = 0;
// Define forecast properties and features
mSettings('building', 't_forecastStart') = 0;
mSettings('building', 't_forecastLengthUnchanging') = 0; // 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('building', 't_forecastStart') = 0; // At which time step the first forecast is available ( 1 = t000001 )
mSettings('building', 't_forecastLengthUnchanging') = 0; // 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('building', 't_forecastLengthDecreasesFrom') = 0; // 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('building', 't_forecastJump') = 0;
mSettings('building', 't_forecastJump') = 0; // How many time steps before new forecast is available
// Define Realized and Central forecasts
* mf_realization('building', f) = no;
......@@ -104,8 +104,8 @@ if (mType('building'),
// Define unit aggregation threshold
mSettings('building', 't_aggregate') = 0;
// Define unit aggregation and efficiency levels starting indeces
mSettingsEff('building', 'level1') = 1;
// Define the last time step for each unit aggregation and efficiency level (3a_periodicInit.gms ensures that there is a effLevel until t_horizon)
mSettingsEff('building', 'level1') = inf;
// Define threshold for omitting start-up and shutdown trajectories
mSettings('building', 't_omitTrajectories') = 8761;
......
......@@ -25,12 +25,12 @@ if (mType('invest'),
* --- Define Key Execution Parameters in Time Indeces -------------------------
// Define simulation start and end time indeces
mSettings('invest', 't_start') = 1; // Ord of first solve (i.e. >0)
mSettings('invest', 't_end') = 8760;
mSettings('invest', 't_start') = 1; // First time step to be solved, 1 corresponds to t000001 (t000000 will then be used for initial status of dynamic variables)
mSettings('invest', 't_end') = 8760; // Last time step to be included in the solve (may solve and output more time steps in case t_jump does not match)
// Define simulation horizon and moving horizon optimization "speed"
mSettings('invest', 't_horizon') = 8760;
mSettings('invest', 't_jump') = 8760;
mSettings('invest', 't_horizon') = 8760; // How many active time steps the solve contains (aggregation of time steps does not impact this, unless the aggregation does not match)
mSettings('invest', 't_jump') = 8760; // How many time steps the model rolls forward between each solve
* =============================================================================
* --- Model Time Structure ----------------------------------------------------
......@@ -64,11 +64,11 @@ if (mType('invest'),
* --- Define Time Step Intervals ----------------------------------------------
// Define the duration of a single time-step in hours
mSettings('invest', 'intervalInHours') = 1;
mSettings('invest', 'stepLengthInHours') = 1;
// Define the time step intervals in time-steps
mInterval('invest', 'intervalLength', 'c000') = 1;
mInterval('invest', 'intervalEnd', 'c000') = 8760;
mInterval('invest', 'stepsPerInterval', 'c000') = 1;
mInterval('invest', 'lastStepInIntervalBlock', 'c000') = 8760;
* =============================================================================
* --- Model Forecast Structure ------------------------------------------------
......@@ -78,10 +78,10 @@ if (mType('invest'),
mSettings('invest', 'forecasts') = 0;
// Define forecast properties and features
mSettings('invest', 't_forecastStart') = 0;
mSettings('invest', 't_forecastLengthUnchanging') = 0; // 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('invest', 't_forecastStart') = 0; // At which time step the first forecast is available ( 1 = t000001 )
mSettings('invest', 't_forecastLengthUnchanging') = 0; // 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('invest', 't_forecastLengthDecreasesFrom') = 0; // 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('invest', 't_forecastJump') = 0;
mSettings('invest', 't_forecastJump') = 0; // How many time steps before new forecast is available
// Define Realized and Central forecasts
mf_realization('invest', f) = no;
......@@ -110,8 +110,8 @@ if (mType('invest'),
// Define unit aggregation threshold
mSettings('invest', 't_aggregate') = 8761;
// Define unit aggregation and efficiency levels starting indeces
mSettingsEff('invest', 'level1') = 1;
// Define the last time step for each unit aggregation and efficiency level (3a_periodicInit.gms ensures that there is a effLevel until t_horizon)
mSettingsEff('invest', 'level1') = inf;
// Define threshold for omitting start-up and shutdown trajectories
mSettings('invest', 't_omitTrajectories') = 8761;
......
......@@ -25,12 +25,12 @@ if (mType('schedule'),
* --- Define Key Execution Parameters in Time Indeces -------------------------
// Define simulation start and end time indeces
mSettings('schedule', 't_start') = 1; // Ord of first solve (i.e. >0)
mSettings('schedule', 't_end') = 8760;
mSettings('schedule', 't_start') = 1; // First time step to be solved, 1 corresponds to t000001 (t000000 will then be used for initial status of dynamic variables)
mSettings('schedule', 't_end') = 8760; // Last time step to be included in the solve (may solve and output more time steps in case t_jump does not match)
// Define simulation horizon and moving horizon optimization "speed"
mSettings('schedule', 't_horizon') = 8760;
mSettings('schedule', 't_jump') = 3;
mSettings('schedule', 't_horizon') = 8760; // How many active time steps the solve contains (aggregation of time steps does not impact this, unless the aggregation does not match)
mSettings('schedule', 't_jump') = 3; // How many time steps the model rolls forward between each solve
* =============================================================================
* --- Model Time Structure ----------------------------------------------------
......@@ -58,19 +58,19 @@ if (mType('schedule'),
* --- Define Time Step Intervals ----------------------------------------------
// Define the duration of a single time-step in hours
mSettings('schedule', 'intervalInHours') = 1;
mSettings('schedule', 'stepLengthInHours') = 1;
// Define the time step intervals in time-steps
mInterval('schedule', 'intervalLength', 'c000') = 1;
mInterval('schedule', 'intervalEnd', 'c000') = 48;
mInterval('schedule', 'intervalLength', 'c001') = 24;
mInterval('schedule', 'intervalEnd', 'c001') = 168;
mInterval('schedule', 'intervalLength', 'c002') = 168;
mInterval('schedule', 'intervalEnd', 'c002') = 840;
mInterval('schedule', 'intervalLength', 'c003') = 720;
mInterval('schedule', 'intervalEnd', 'c003') = 8760;
mInterval('schedule', 'intervalLength', 'c004') = 168;
mInterval('schedule', 'intervalEnd', 'c004') = 8760;
mInterval('schedule', 'stepsPerInterval', 'c000') = 1;
mInterval('schedule', 'lastStepInIntervalBlock', 'c000') = 48;
mInterval('schedule', 'stepsPerInterval', 'c001') = 24;
mInterval('schedule', 'lastStepInIntervalBlock', 'c001') = 168;
mInterval('schedule', 'stepsPerInterval', 'c002') = 168;
mInterval('schedule', 'lastStepInIntervalBlock', 'c002') = 840;
mInterval('schedule', 'stepsPerInterval', 'c003') = 720;
mInterval('schedule', 'lastStepInIntervalBlock', 'c003') = 8760;
mInterval('schedule', 'stepsPerInterval', 'c004') = 168;
mInterval('schedule', 'lastStepInIntervalBlock', 'c004') = 8760;
* =============================================================================
* --- Model Forecast Structure ------------------------------------------------
......@@ -80,10 +80,11 @@ if (mType('schedule'),
mSettings('schedule', 'forecasts') = 3;
// Define forecast properties and features
mSettings('schedule', 't_forecastStart') = 1;
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_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_forecastJump') = 24;
mSettings('schedule', 't_forecastJump') = 24; // How many time steps before new forecast is available
mTimeseries_loop_read('schedule', 'ts_reserveDemand') = no;
mTimeseries_loop_read('schedule', 'ts_unit') = no;
mTimeseries_loop_read('schedule', 'ts_effUnit') = no;
......@@ -125,9 +126,9 @@ if (mType('schedule'),
// Define unit aggregation threshold
mSettings('schedule', 't_aggregate') = 168;
// Define unit aggregation and efficiency levels starting indeces
mSettingsEff('schedule', 'level1') = 1;
mSettingsEff('schedule', 'level2') = 12;
// Define the last time step for each unit aggregation and efficiency level (3a_periodicInit.gms ensures that there is a effLevel until t_horizon)
mSettingsEff('schedule', 'level1') = 12;
mSettingsEff('schedule', 'level2') = 36;
// Define threshold for omitting start-up and shutdown trajectories
mSettings('schedule', 't_omitTrajectories') = 8761;
......
......@@ -38,9 +38,9 @@ Sets
t_end, // Last time step of the simulation
loadPoint, // Load advanced basis; 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
savePoint, // Save advanced basis; 0 = no basis, 1 = latest solve, 2 = all solves, 3 = first solve
intervalEnd, // Last time step in the block of intervals with the same length
intervalLength, // Number of time steps aggregated within interval
IntervalInHours, // Length of one time step in hours
lastStepInIntervalBlock, // Last time step in the block of intervals with the same length
stepsPerInterval, // Number of time steps aggregated within interval
stepLengthInHours, // Length of one time step in hours
// Samples and Forecasts
samples, // Number of active samples
......
......@@ -25,7 +25,7 @@ Scalars
lastCounter "last member in use of the general counter"
ts_length "Length of time series (t)"
continueLoop "Helper to stop the looping early"
* intervalLength "Length of the interval to be calculated, considering end of modelling period" // redundant
* stepsPerInterval "Length of the interval to be calculated, considering end of modelling period" // redundant
currentForecastLength "Length of the forecast in the curren solve, minimum of unchanging and decreasing forecast lengths"
count "General counter"
count_lambda, count_lambda2 "Counter for lambdas"
......
......@@ -91,10 +91,10 @@ $offtext
// Check whether the defined intervals are feasible
continueLoop = 1;
loop(counter${ continueLoop },
if(not mInterval(m, 'intervalEnd', counter),
if(not mInterval(m, 'lastStepInIntervalBlock', counter),
continueLoop = 0;
else
abort$(mod(mInterval(m, 'intervalEnd', counter) - mInterval(m, 'intervalEnd', counter-1) -1${ not mInterval(m, 'intervalEnd', counter-1) }, mInterval(m, 'intervalLength', counter))) "IntervalLength is not evenly divisible within the interval", m, continueLoop;
abort$(mod(mInterval(m, 'lastStepInIntervalBlock', counter) - mInterval(m, 'lastStepInIntervalBlock', counter-1) -1${ not mInterval(m, 'lastStepInIntervalBlock', counter-1) }, mInterval(m, 'stepsPerInterval', counter))) "stepsPerInterval is not evenly divisible within the interval", m, continueLoop;
continueLoop = continueLoop + 1;
);
);
......@@ -121,6 +121,31 @@ dt_circular(t_full(t))${ ord(t) > ts_length }
* --- Initialize Unit Efficiency Approximations -------------------------------
* =============================================================================
* --- Ensure that efficiency levels extend to the end of the model horizon and do not go beyond ----
loop(m,
continueLoop = 0;
// First check how many efficiency levels there are and cut levels going beyond the t_horizon
loop(effLevel$mSettingsEff(m, effLevel),
continueLoop = continueLoop + 1;
if (mSettingsEff(m, effLevel) > mSettings(m, 't_horizon'),
mSettingsEff(m, effLevel) = mSettings(m, 't_horizon');
);
);
// Set last effLevel to equal to the t_horizon
loop(effLevel$(ord(effLevel) = continueLoop),
if (mSettingsEff(m, effLevel) < mSettings(m, 't_horizon'),
mSettingsEff(m, effLevel + 1) = mSettings(m, 't_horizon');
);
);
// Remove effLevels with same end time step
loop(effLevel$mSettingsEff(m, effLevel),
if (mSettingsEff(m, effLevel + 1) = mSettingsEff(m, effLevel),
mSettingsEff(m, effLevel + 1) = no;
);
);
);
* --- Parse through effLevelGroupUnit and convert selected effSelectors into sets representing those selections
// Loop over effLevelGroupUnit
......@@ -275,19 +300,6 @@ loop(effLevelGroupUnit(effLevel, effGroup, unit)${sum(m, mSettingsEff(m, effLeve
p_effGroupUnit(effGroup, unit, 'slope') = smin(effGroupSelectorUnit(effGroup, unit, effSelector), p_effUnit(effGroup, unit, effSelector, 'slope')); // NOTE! Uses maximum efficiency for the group.
); // END loop(effLevelGroupUnit)
* --- Ensure that efficiency levels extend to the end of the model horizon ----
loop(m,
continueLoop = 0;
loop(effLevel$mSettingsEff(m, effLevel),
continueLoop = continueLoop + 1;
);
loop(effLevel$(ord(effLevel) = continueLoop),
if (mSettingsEff(m, effLevel) <> mSettings(m, 't_horizon'),
mSettingsEff(m, effLevel + 1) = mSettings(m, 't_horizon');
);
);
);
* =============================================================================
* --- Initialize Unit Startup and Shutdown Counters ---------------------------
......@@ -299,7 +311,7 @@ loop(m,
loop(unit$(p_unit(unit, 'rampSpeedToMinLoad') and p_unit(unit,'op00')),
p_unit(unit, 'rampSpeedToMinLoad') = p_unit(unit, 'rampSpeedToMinLoad'); // Is something happening here?
// Calculate time intervals needed for the run-up phase
tmp = [ p_unit(unit,'op00') / (p_unit(unit, 'rampSpeedToMinLoad') * 60) ] / mSettings(m, 'intervalInHours');
tmp = [ p_unit(unit,'op00') / (p_unit(unit, 'rampSpeedToMinLoad') * 60) ] / mSettings(m, 'stepLengthInHours');
p_u_runUpTimeIntervals(unit) = tmp;
p_u_runUpTimeIntervalsCeil(unit) = ceil(p_u_runUpTimeIntervals(unit))
......@@ -308,15 +320,15 @@ loop(m,
p_ut_runUp(unit, t) =
+ p_unit(unit, 'rampSpeedToMinLoad') * (ceil(p_u_runUpTimeIntervals(unit) - ord(t) + 1))
* 60 // Unit conversion from [p.u./min] to [p.u./h]
* mSettings(m, 'intervalInHours')
* mSettings(m, 'stepLengthInHours')
);
// Combine output in the second last interval and the weighted average of rampSpeedToMinLoad and the smallest non-zero maxRampUp
p_u_maxOutputInLastRunUpInterval(unit) =
(
+ p_unit(unit, 'rampSpeedToMinLoad') * (tmp-floor(tmp)) * mSettings(m, 'intervalInHours')
+ smin(gnu(grid, node, unit)${p_gnu(grid, node, unit, 'maxRampUp')}, p_gnu(grid, node, unit, 'maxRampUp')) * (ceil(tmp)-tmp) * mSettings(m, 'intervalInHours')
+ p_unit(unit, 'rampSpeedToMinLoad')${not sum(gnu(grid, node, unit), p_gnu(grid, node, unit, 'maxRampUp'))} * (ceil(tmp)-tmp) * mSettings(m, 'intervalInHours')
+ p_unit(unit, 'rampSpeedToMinLoad') * (tmp-floor(tmp)) * mSettings(m, 'stepLengthInHours')
+ smin(gnu(grid, node, unit)${p_gnu(grid, node, unit, 'maxRampUp')}, p_gnu(grid, node, unit, 'maxRampUp')) * (ceil(tmp)-tmp) * mSettings(m, 'stepLengthInHours')
+ p_unit(unit, 'rampSpeedToMinLoad')${not sum(gnu(grid, node, unit), p_gnu(grid, node, unit, 'maxRampUp'))} * (ceil(tmp)-tmp) * mSettings(m, 'stepLengthInHours')
)
* 60 // Unit conversion from [p.u./min] to [p.u./h]
+ sum(t${ord(t) = 2}, p_ut_runUp(unit, t));
......@@ -344,7 +356,7 @@ loop(m,
loop(m,
loop(unit$(p_unit(unit, 'rampSpeedFromMinLoad') and p_unit(unit,'op00')),
// Calculate time intervals needed for the shutdown phase
tmp = [ p_unit(unit,'op00') / (p_unit(unit, 'rampSpeedFromMinLoad') * 60) ] / mSettings(m, 'intervalInHours');
tmp = [ p_unit(unit,'op00') / (p_unit(unit, 'rampSpeedFromMinLoad') * 60) ] / mSettings(m, 'stepLengthInHours');
p_u_shutdownTimeIntervals(unit) = tmp;
p_u_shutdownTimeIntervalsCeil(unit) = ceil(p_u_shutdownTimeIntervals(unit))
......@@ -353,15 +365,15 @@ loop(m,
p_ut_shutdown(unit, t) =
+ p_unit(unit, 'rampSpeedFromMinLoad') * (ceil(p_u_shutdownTimeIntervals(unit) - ord(t) + 1))
* 60 // Unit conversion from [p.u./min] to [p.u./h]
* mSettings(m, 'intervalInHours')
* mSettings(m, 'stepLengthInHours')
);
// Combine output in the second interval and the weighted average of rampSpeedFromMinLoad and the smallest non-zero maxRampDown
p_u_maxOutputInFirstShutdownInterval(unit) =
(
+ p_unit(unit, 'rampSpeedFromMinLoad') * (tmp-floor(tmp)) * mSettings(m, 'intervalInHours')
+ smin(gnu(grid, node, unit)${p_gnu(grid, node, unit, 'maxRampDown')}, p_gnu(grid, node, unit, 'maxRampDown')) * (ceil(tmp)-tmp) * mSettings(m, 'intervalInHours')
+ p_unit(unit, 'rampSpeedFromMinLoad')${not sum(gnu(grid, node, unit), p_gnu(grid, node, unit, 'maxRampDown'))} * (ceil(tmp)-tmp) * mSettings(m, 'intervalInHours')
+ p_unit(unit, 'rampSpeedFromMinLoad') * (tmp-floor(tmp)) * mSettings(m, 'stepLengthInHours')
+ smin(gnu(grid, node, unit)${p_gnu(grid, node, unit, 'maxRampDown')}, p_gnu(grid, node, unit, 'maxRampDown')) * (ceil(tmp)-tmp) * mSettings(m, 'stepLengthInHours')
+ p_unit(unit, 'rampSpeedFromMinLoad')${not sum(gnu(grid, node, unit), p_gnu(grid, node, unit, 'maxRampDown'))} * (ceil(tmp)-tmp) * mSettings(m, 'stepLengthInHours')
)
* 60 // Unit conversion from [p.u./min] to [p.u./h]
+ sum(t${ord(t) = 2}, p_ut_shutdown(unit, t));
......@@ -384,8 +396,8 @@ loop(m,
loop(starttypeConstrained(starttype),
// Find the time step displacements needed to define the start-up time frame
Option clear = cc;
cc(counter)${ ord(counter) <= p_uNonoperational(unit, starttype, 'max') / mSettings(m, 'intervalInHours')
and ord(counter) > p_uNonoperational(unit, starttype, 'min') / mSettings(m, 'intervalInHours')
cc(counter)${ ord(counter) <= p_uNonoperational(unit, starttype, 'max') / mSettings(m, 'stepLengthInHours')
and ord(counter) > p_uNonoperational(unit, starttype, 'min') / mSettings(m, 'stepLengthInHours')
}
= yes;
dt_starttypeUnitCounter(starttype, unit, cc(counter)) = - ord(counter);
......@@ -393,7 +405,7 @@ loop(m,
// Find the time step displacements needed to define the downtime requirements (include run-up phase and shutdown phase)
Option clear = cc;
cc(counter)${ ord(counter) <= ceil(p_unit(unit, 'minShutdownHours') / mSettings(m, 'intervalInHours'))
cc(counter)${ ord(counter) <= ceil(p_unit(unit, 'minShutdownHours') / mSettings(m, 'stepLengthInHours'))
+ ceil(p_u_runUpTimeIntervals(unit)) // NOTE! Check this
+ ceil(p_u_shutdownTimeIntervals(unit)) // NOTE! Check this
}
......@@ -402,7 +414,7 @@ loop(m,
// Find the time step displacements needed to define the uptime requirements
Option clear = cc;
cc(counter)${ ord(counter) <= ceil(p_unit(unit, 'minOperationHours') / mSettings(m, 'intervalInHours'))}
cc(counter)${ ord(counter) <= ceil(p_unit(unit, 'minOperationHours') / mSettings(m, 'stepLengthInHours'))}
= yes;
dt_uptimeUnitCounter(unit, cc(counter)) = - ord(counter);
); // END loop(effLevelGroupUnit)
......
......@@ -152,7 +152,7 @@ Option clear = cc;
tCounter = 1;
// Determine the set of active interval counters (or blocks of intervals)
cc(counter)${ mInterval(mSolve, 'intervalLength', counter) }
cc(counter)${ mInterval(mSolve, 'stepsPerInterval', counter) }
= yes;
currentForecastLength = min( mSettings(mSolve, 't_forecastLengthUnchanging'), // Unchanging forecast length would remain the same
......@@ -167,18 +167,18 @@ loop(cc(counter),
// Initialize tInterval
Option clear = tt_interval;
// If intervalLength equals one, simply use all the steps within the block
if(mInterval(mSolve, 'intervalLength', counter) = 1,
// If stepsPerInterval equals one, simply use all the steps within the block
if(mInterval(mSolve, 'stepsPerInterval', counter) = 1,
tt_interval(t_current(t))${ ord(t) >= tSolveFirst + tCounter
and ord(t) < min(tSolveFirst + mInterval(mSolve, 'intervalEnd', counter), tSolveLast)
and ord(t) < min(tSolveFirst + mInterval(mSolve, 'lastStepInIntervalBlock', counter), tSolveLast)
and ord(t) > msStart(mSolve, s) + tSolveFirst - 1 // Move the samples along with the dispatch
and ord(t) < msEnd(mSolve, s) + tSolveFirst // Move the samples along with the dispatch
}
= yes; // Include all time steps within the block
// Calculate the interval length in hours
p_stepLength(mf(mSolve, f_solve), tt_interval(t)) = mSettings(mSolve, 'intervalInHours');
p_stepLengthNoReset(mf(mSolve, f_solve), tt_interval(t)) = mSettings(mSolve, 'intervalInHours');
p_stepLength(mf(mSolve, f_solve), tt_interval(t)) = mSettings(mSolve, 'stepLengthInHours');
p_stepLengthNoReset(mf(mSolve, f_solve), tt_interval(t)) = mSettings(mSolve, 'stepLengthInHours');
// Determine the combinations of forecasts and intervals
// Include the t_jump for the realization
......@@ -213,7 +213,7 @@ loop(cc(counter),
// Reduce the model dimension
ft(f_solve, tt_interval(t)) = mft(mSolve, f_solve, t);
// Select time series data matching the intervals, for intervalLength = 1, this is trivial.
// Select time series data matching the intervals, for stepsPerInterval = 1, this is trivial.
ts_influx_(gn(grid, node), ft(f_solve, tt_interval(t))) = ts_influx(grid, node, f_solve, t+dt_circular(t));
ts_cf_(flowNode(flow, node), ft(f_solve, tt_interval(t))) = ts_cf(flow, node, f_solve, t+dt_circular(t));
ts_unit_(unit, param_unit, ft(f_solve, tt_interval(t)))${ p_unit(unit, 'useTimeseries') } // Only include units that have timeseries attributed to them
......@@ -227,19 +227,19 @@ loop(cc(counter),
ts_fuelPrice_(fuel, tt_interval(t))
= ts_fuelPrice(fuel, t+dt_circular(t));
// If intervalLength exceeds 1 (intervalLength < 1 not defined)
elseif mInterval(mSolve, 'intervalLength', counter) > 1,
// If stepsPerInterval exceeds 1 (stepsPerInterval < 1 not defined)
elseif mInterval(mSolve, 'stepsPerInterval', counter) > 1,
tt_interval(t_current(t))${ ord(t) >= tSolveFirst + tCounter
and ord(t) < min(tSolveFirst + mInterval(mSolve, 'intervalEnd', counter), tSolveLast)
and mod(ord(t) - tSolveFirst - tCounter, mInterval(mSolve, 'intervalLength', counter)) = 0
and ord(t) < min(tSolveFirst + mInterval(mSolve, 'lastStepInIntervalBlock', counter), tSolveLast)
and mod(ord(t) - tSolveFirst - tCounter, mInterval(mSolve, 'stepsPerInterval', counter)) = 0
and ord(t) > msStart(mSolve, s) + tSolveFirst - 1 // Move the samples along with the dispatch
and ord(t) < msEnd(mSolve, s) + tSolveFirst // Move the samples along with the dispatch
}
= yes;
// Calculate the interval length in hours
p_stepLength(mf(mSolve, f_solve), tt_interval(t)) = mInterval(mSolve, 'intervalLength', counter) * mSettings(mSolve, 'intervalInHours');
p_stepLengthNoReset(mf(mSolve, f_solve), tt_interval(t)) = mInterval(mSolve, 'intervalLength', counter) * mSettings(mSolve, 'intervalInHours');
p_stepLength(mf(mSolve, f_solve), tt_interval(t)) = mInterval(mSolve, 'stepsPerInterval', counter) * mSettings(mSolve, 'stepLengthInHours');
p_stepLengthNoReset(mf(mSolve, f_solve), tt_interval(t)) = mInterval(mSolve, 'stepsPerInterval', counter) * mSettings(mSolve, 'stepLengthInHours');
// Determine the combinations of forecasts and intervals
// Include the t_jump for the realization
......@@ -268,13 +268,13 @@ loop(cc(counter),
// Reduce the model dimension
ft(f_solve, tt_interval(t)) = mft(mSolve, f_solve, t)
// Select and average time series data matching the intervals, for intervalLength > 1
// Select and average time series data matching the intervals, for stepsPerInterval > 1
// Loop over the t:s of the interval
loop(ft(f_solve, tt_interval(t)),
// Select t:s within the interval
Option clear = tt;
tt(t_current(t_))${ ord(t_) >= ord(t)
and ord(t_) < ord(t) + mInterval(mSolve, 'intervalLength', counter)
and ord(t_) < ord(t) + mInterval(mSolve, 'stepsPerInterval', counter)
}
= yes;
ts_influx_(gn(grid, node), f_solve, t)
......@@ -299,8 +299,8 @@ loop(cc(counter),
/ p_stepLength(mSolve, f_solve, t);
); // END loop(ft)
// Abort if intervalLength is less than one
elseif mInterval(mSolve, 'intervalLength', counter) < 1, abort "intervalLength < 1 is not defined!"
// Abort if stepsPerInterval is less than one
elseif mInterval(mSolve, 'stepsPerInterval', counter) < 1, abort "stepsPerInterval < 1 is not defined!"
); // END IF intervalLenght
......@@ -310,7 +310,7 @@ loop(cc(counter),
); // END loop(ms)
// Update tCounter for the next block of intervals
tCounter = mInterval(mSolve, 'intervalEnd', counter);
tCounter = mInterval(mSolve, 'lastStepInIntervalBlock', counter);
); // END loop(counter)
......@@ -335,7 +335,7 @@ loop(t_active(t),
dt_next(t)
= sum(f_solve$mf(mSolve, f_solve), p_stepLength(mSolve, f_solve, t))
/ sum(f_solve${mf(mSolve, f_solve) and p_stepLength(mSolve, f_solve, t)}, 1)
/ mSettings(mSolve, 'intervalInHours');
/ mSettings(mSolve, 'stepLengthInHours');
); // END loop(t_active)
// Initial model ft
......@@ -345,7 +345,7 @@ mft_start(mf_realization(mSolve, f), tSolve)
;
// Last steps of model fts
Option clear = mft_lastSteps;
mft_lastSteps(mSolve, ft(f,t))${ ord(t) + p_stepLength(mSolve, f, t) / mSettings(mSolve, 'intervalInHours') >= tSolveLast }
mft_lastSteps(mSolve, ft(f,t))${ ord(t) + p_stepLength(mSolve, f, t) / mSettings(mSolve, 'stepLengthInHours') >= tSolveLast }
= yes
;
......@@ -390,7 +390,7 @@ df(f_solve(f), t_active(t))${ ord(t) <= tSolveFirst + mSettings(mSolve, 't_jump'
// Forecast displacement between central and forecasted intervals at the end of forecast horizon
Option clear = df_central; // This can be reset.
df_central(ft(f,t))${ ord(t) = tSolveFirst + mSettings(mSolve, 't_forecastLengthUnchanging') - p_stepLength(mSolve, f, t) / mSettings(mSolve, 'intervalInHours')
df_central(ft(f,t))${ ord(t) = tSolveFirst + mSettings(mSolve, 't_forecastLengthUnchanging') - p_stepLength(mSolve, f, t) / mSettings(mSolve, 'stepLengthInHours')
and not mf_realization(mSolve, f)
}
= sum(mf_central(mSolve, f_), ord(f_) - ord(f));
......@@ -410,11 +410,11 @@ df_nReserves(node, restype, ft(f, t))${ p_nReserves(node, restype, 'update_frequ
// Units active on each ft
Option clear = uft;
uft(unit, ft(f, t))${ [
ord(t) <= tSolveFirst + mSettings(mSolve, 't_aggregate') - 1
ord(t) <= tSolveFirst + mSettings(mSolve, 't_aggregate')
and not unit_aggregate(unit) // Non-aggregate units
]
or [
ord(t) > tSolveFirst + mSettings(mSolve, 't_aggregate') - 1
ord(t) > tSolveFirst + mSettings(mSolve, 't_aggregate')
and (unit_aggregate(unit) or unit_noAggregate(unit)) // Aggregate units
]
}
......@@ -454,8 +454,8 @@ Option clear = sufts;
// Loop over the defined efficiency groups for units
loop(effLevelGroupUnit(effLevel, effGroup, unit)${ mSettingsEff(mSolve, effLevel) },
// Determine the used effGroup for each uft
suft(effGroup, uft(unit, f, t))${ ord(t) >= tSolveFirst + mSettingsEff(mSolve, effLevel)
and ord(t) < tSolveFirst + mSettingsEff(mSolve, effLevel + 1) }
suft(effGroup, uft(unit, f, t))${ ord(t) >= tSolveFirst + mSettingsEff(mSolve, effLevel - 1) + 1
and ord(t) <= tSolveFirst + mSettingsEff(mSolve, effLevel) }
= yes;
); // END loop(effLevelGroupUnit)
......
......@@ -236,7 +236,7 @@ loop(m,
/ [
+ (p_gnu(grid, node, unit, 'maxGen') + r_invest(unit)*p_gnu(grid, node, unit, 'unitSizeGen'))
* (mSettings(m, 't_end') - mSettings(m, 'results_t_start') + 1)
* mSettings(m, 'intervalInHours')
* mSettings(m, 'stepLengthInHours')
]; // END division
* --- Total Reserve Provision -------------------------------------------------
......
......@@ -54,7 +54,7 @@ loop(m,
put "Model horizon: ", mSettings(m, 't_horizon')/;
put "Model jumps after solve: ", mSettings(m, 't_jump')/;
put "Last time period to solve: ", mSettings(m, 't_end')/;
* put "Length of each time period: ", mSettings(m, 'intervalLength')/;
* put "Length of each time period: ", mSettings(m, 'stepsPerInterval')/;
put "Number of samples: ", mSettings(m, 'samples')/;
);
......
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