Commit 810e486f authored by Topi Rasku's avatar Topi Rasku
Browse files

Adding a new model parameter called "intervalInHours", that defines the length...

Adding a new model parameter called "intervalInHours", that defines the length of a single time step (index) in hours.
parent 18dc108c
......@@ -21,22 +21,22 @@ $offOrder
ts_nodeState_(gn_state(grid, node), param_gnBoundaryTypes, fSolve, t)$tInterval(t) = ts_nodeState(grid, node, param_gnBoundaryTypes, fSolve, t+ct(t));
ts_unit_(unit, param_unit, fSolve, t)$tInterval(t) = ts_unit(unit, param_unit, fSolve, t+ct(t));
tCounter = mInterval(mSolve, 'intervalEnd', counter); // move tCounter to the next interval setting
p_stepLength(mf(mSolve, fSolve), t)$tInterval(t) = 1; // p_stepLength will hold the length of the interval in model equations
p_stepLengthNoReset(mSolve, fSolve, t)$tInterval(t) = 1;
p_stepLength(mf(mSolve, fSolve), t)$tInterval(t) = mSettings(mSolve, 'intervalInHours'); // p_stepLength will hold the length of the interval in hours in model equations
p_stepLengthNoReset(mSolve, fSolve, t)$tInterval(t) = mSettings(mSolve, 'intervalInHours');
pt(t + 1)$tInterval(t) = -1;
mftLastSteps(mf(mSolve,fSolve),t)$[ord(t)-1 = mInterval(mSolve,'intervalEnd',counter)] = yes;
elseif mInterval(mSolve, 'intervalLength', counter) > 1, // intervalLength > 1 (not defined if intervalLength < 1)
loop(t$[ord(t) >= tSolveFirst + tCounter and ord(t) < min(tSolveFirst + mInterval(mSolve, 'intervalEnd', counter), tSolveLast)], // Loop t relevant for each interval (interval borders defined by intervalEnd) - but do not go beyond tSolveLast
if (not mod(tCounter - mInterval(mSolve, 'intervalEnd', counter), mInterval(mSolve, 'intervalLength', counter)), // Skip those t's that are not at the start of any interval
intervalLength = min(mInterval(mSolve, 'intervalLength', counter), max(mSettings(mSolve, 't_forecastLength'), mSettings(mSolve, 't_horizon')) - tCounter);
p_stepLength(mf(mSolve, fSolve), t) = intervalLength; // p_stepLength will hold the length of the interval in model equations
if (p_stepLengthNoReset(mSolve, 'f00', t) <> mInterval(mSolve, 'intervalLength', counter), // and skip those t's that have been calculated for the right interval previously
p_stepLength(mf(mSolve, fSolve), t) = intervalLength * mSettings(mSolve, 'IntervalInHours'); // p_stepLength will hold the length of the interval in model equations
if (p_stepLengthNoReset(mSolve, 'f00', t) <> mInterval(mSolve, 'intervalLength', counter) * mSettings(mSolve, 'IntervalInHours'), // and skip those t's that have been calculated for the right interval previously
tInterval(t_) = no;
tInterval(t_)$( ord(t_) >= ord(t)
and ord(t_) < ord(t) + intervalLength
) = yes; // Set of t's within the interval (right border defined by intervalEnd) - but do not go beyond tSolveLast
ft_new(f,t_)$(mf(mSolve, f) and tInterval(t_)) = yes;
p_stepLengthNoReset(mf(mSolve, fSolve), t) = intervalLength;
p_stepLengthNoReset(mf(mSolve, fSolve), t) = intervalLength * mSettings(mSolve, 'IntervalInHours');
// Aggregates the interval time series data by averaging the power data
ts_influx_(grid, node, fSolve, t) = sum{t_$tInterval(t_), ts_influx(grid, node, fSolve, t_+ct(t_))} / p_stepLength(mSolve, fSolve, t); // Averages the absolute power terms over the interval
ts_cf_(flow, node, fSolve, t) = sum{t_$tInterval(t_), ts_cf(flow, node, fSolve, t_+ct(t_))} / p_stepLength(mSolve, fSolve, t); // Averages the capacity factor over the inverval
......@@ -60,7 +60,7 @@ $offOrder
) // end loop for set intervals
else
// ...otherwise use all time periods with equal weight
p_stepLength(mSolve, f, t)$(ord(t) >= tSolveFirst and ord(t) < tSolveLast and fRealization(f)) = 1;
p_stepLength(mSolve, f, t)$(ord(t) >= tSolveFirst and ord(t) < tSolveLast and fRealization(f)) = mSettings(mSolve, 'IntervalInHours');
);
// Determine the time-series values for the last time step of the simulation, necessary for the state variables due to different indexing... NOTE! Doesn't aggregate in any way, uses raw data
ts_nodeState_(gn_state(grid, node), param_gnBoundaryTypes, fSolve, t)${ord(t) = tSolveLast} = ts_nodeState(grid, node, param_gnBoundaryTypes, fSolve, t+ct(t));
......
if (mType('schedule'),
m('schedule') = yes;
mSettings('schedule', 't_start') = 1; // Ord of first solve (i.e. >0)
mSettings('schedule', 't_horizon') = 8760;
mSettings('schedule', 't_jump') = 48;
mSettings('schedule', 't_forecastLength') = 8760;
mSettings('schedule', 't_end') = 80;
mSettings('schedule', 'samples') = 1;
mSettings('schedule', 'forecasts') = 0;
mSettings('schedule', 't_aggregate') = 72;
mSettingsEff('schedule', 'level1') = 1;
mSettingsEff('schedule', 'level2') = 24;
mSettingsEff('schedule', 'level3') = 48;
mSettingsEff('schedule', 'level4') = 168;
mf('schedule', f)$[ord(f)-1 <= mSettings('schedule', 'forecasts')] = yes;
m('schedule') = yes; // Definition, that the model exists by its name
// Define the temporal structure of the model in time indeces
mSettings('schedule', 'intervalInHours') = 1; // Define the duration of a single time-step in hours
mInterval('schedule', 'intervalLength', 'c000') = 1;
mInterval('schedule', 'intervalEnd', 'c000') = 168;
mInterval('schedule', 'intervalLength', 'c001') = 3;
......@@ -23,8 +13,28 @@ if (mType('schedule'),
mInterval('schedule', 'intervalEnd', 'c003') = 4392;
mInterval('schedule', 'intervalLength', 'c004') = 168;
mInterval('schedule', 'intervalEnd', 'c004') = 8760;
// Define the model execution parameters in time indeces
mSettings('schedule', 't_start') = 1; // Ord of first solve (i.e. >0)
mSettings('schedule', 't_horizon') = 8760;
mSettings('schedule', 't_jump') = 48;
mSettings('schedule', 't_forecastLength') = 8760;
mSettings('schedule', 't_end') = 80;
//
mSettings('schedule', 't_aggregate') = 72;
mSettingsEff('schedule', 'level1') = 1;
mSettingsEff('schedule', 'level2') = 24;
mSettingsEff('schedule', 'level3') = 48;
mSettingsEff('schedule', 'level4') = 168;
// Define active model features
active('storageValue') = yes;
// Define model stochastic parameters
mSettings('schedule', 'samples') = 1;
mSettings('schedule', 'forecasts') = 0;
mf('schedule', f)$[ord(f)-1 <= mSettings('schedule', 'forecasts')] = yes;
fRealization(f) = no;
fRealization('f00') = yes;
fCentral(f) = no;
......
* --- Model parameters, features and switches ---------------------------------
Sets // Model related selections
mType "model types in the Backbone" /invest, storage, schedule, realtime, building/
mSetting "setting categories for models" /t_start, t_jump, t_horizon, t_forecastLength, t_end, samples, forecasts, intervalEnd, intervalLength, t_aggregate/
counter "general counter set" /c000*c999/
rb "Right borders of efficiency curves"
mType "model types in the Backbone"
/invest, storage, schedule, realtime, building/
mSetting "setting categories for models"
/t_start, t_jump, t_horizon, t_forecastLength, t_end, samples, forecasts, intervalEnd, intervalLength, IntervalInHours, t_aggregate/
counter "general counter set"
/c000*c999/
// Efficiency approximation related sets
rb "Right borders of efficiency curves, also functions as index for data points"
/rb00*rb12/ // IMPORTANT! Has to equal the same param_unit!
eff "Effiency data indeces"
eff "Effiency data for corresponding sections ('rb') of the efficiency curves, also used for data indexing"
/eff00*eff12/ // IMPORTANT! Has to equal the same param_unit!
lambda "Lambda approximation indeces"
/lambda01*lambda12/ // IMPORTANT! Has to equal effLambda!
......@@ -24,6 +28,12 @@ Sets // Model related selections
/ directOn, lambda01*lambda12 / // IMPORTANT! Online variables are generated based on this, so keep it up to date!
effLevel "Pre-defined levels for efficiency representation that can start from t_solve + x"
/ level1*level9 /
// Variable direction related sets
up_down "Direction set used by some variables, e.g. reserve provisions and generation ramps"
/ up, down /
inc_dec "Increase or decrease in dummy, or slack variables"
/ increase, decrease /
;
......@@ -105,8 +115,6 @@ upwardSlack(slack) "Set of upward slacks"
/ upwardSlack01*upwardSlack20 /
downwardSlack(slack) "Set of downward slacks"
/ downwardSlack01*downwardSlack20 /
inc_dec "Increase or decrease in dummy or slack variables"
/ increase, decrease /
stateLimits(param_gnBoundaryTypes) "set of upward and downward state limits"
/ upwardLimit, downwardLimit /
spillLimits(param_gnBoundaryTypes) "set of upward and downward state limits"
......@@ -139,9 +147,9 @@ param_unit "Set of possible data parameters for units" /
coldStart "Start-up time from cold to warm (h)"
warmStart "Start-up time from warm to hot (h)"
hotStart "Start-up time from hot to minLoad (h)"
minOperation "Minimum operation time (h)"
minShutDown "Minimum shut down time (h)"
rampUp "Speed to ramp up (p.u. / min)"
minOperationTime "Minimum operation time (h), prevents shutdown after startup until the defined amount of time has passed"
minShutDownTime "Minimum shut down time (h), prevents starting up again after the defined amount of time has passed"
SO2 "SO2 emissions (tonne per MWh_fuel)"
NOx "NOx emissions (tonne per MWh_fuel)"
CH4 "CH4 emissions (tonne per MWh_fuel)"
......
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