Commit 40350697 authored by Topi Rasku's avatar Topi Rasku
Browse files

Removed the uftt sets as inefficient and replaced them with dt arrays instead.

parent ec13eb7b
......@@ -277,14 +277,45 @@ loop(m,
);
);
* --- Unit Startup and Shutdown Counters --------------------------------------
loop(m,
// Loop over units with online approximations in the model
loop(effLevelGroupUnit(effLevel, effOnline(effGroup), unit)${mSettingsEff(m, effLevel)},
// Loop over the constrained starttypes
loop(starttypeConstrained(starttype),
// Find the time step displacements needed to define the startup 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')
}
= yes;
dt_starttypeUnitCounter(starttype, unit, cc(counter)) = - ord(counter);
); // END loop(starttypeConstrained)
// Find the time step displacements needed to define the downtime requirements
Option clear = cc;
cc(counter)${ ord(counter) <= p_unit(unit, 'minShutDownTime') / mSettings(m, 'intervalInHours') }
= yes;
dt_downtimeUnitCounter(unit, cc(counter)) = - ord(counter);
// Find the time step displacements needed to define the uptime requirements
Option clear = cc;
cc(counter)${ ord(counter) <= p_unit(unit, 'minOperationTime') / mSettings(m, 'intervalInHours')}
= yes;
dt_uptimeUnitCounter(unit, cc(counter)) = - ord(counter);
); // END loop(effLevelGroupUnit)
); // END loop(m)
* =============================================================================
* --- Various Initial Values and Calculations ---------------------------------
* =============================================================================
// Calculating the order of time periods
* --- Calculating the order of time periods -----------------------------------
tOrd(t) = ord(t);
// Slack Direction
* --- Slack Direction ---------------------------------------------------------
// Upwards slack is positive, downward slack negative
p_slackDirection(upwardSlack) = 1;
......
......@@ -430,38 +430,6 @@ loop(effLevelGroupUnit(effLevel, effGroup, unit)${ mSettingsEff(mSolve, effLeve
= smin(effSelector$effGroupSelectorUnit(effGroup, unit, effSelector), ts_effUnit(effGroup, unit, effSelector, 'slope', f, t)); // Uses maximum efficiency for the group
); // END loop(effLevelGroupUnit)
* --- Define the time steps necessary for startup, downtime and uptime constraints
// Define the set of required historical timesteps
Option clear = tt;
tt(tFull(t))${ ord(t) <= tSolveFirst
and ord(t) > tSolveFirst - tMaxRequiredHistory
}
= yes;
// Required historical and currently active time steps
tt_(tFull(t)) = tt(t) + tActive(t);
// Time windows for startups
Option clear = uftt_startupType;
uftt_startupType(starttype, uft_online(unit, f, t), tt_(t_))${ ord(t_) > [ord(t)-p_uNonoperational(unit, starttype, 'max') / mSettings(mSolve, 'intervalInHours') / (p_stepLengthNoReset(mSolve, f, t_) + 1${not p_stepLengthNoReset(mSolve, f, t_)})]
and ord(t_)<=[ord(t)-p_uNonoperational(unit, starttype, 'min') / mSettings(mSolve, 'intervalInHours') / (p_stepLengthNoReset(mSolve, f, t_) + 1${not p_stepLengthNoReset(mSolve, f, t_)})]
}
= yes;
// Time windows for minimum uptime requirements
Option clear = uftt_minUptime;
uftt_minUptime(uft_online(unit, f, t), tt_(t_))${ ord(t_)>=[ord(t)-p_unit(unit, 'minOperationTime') / mSettings(mSolve, 'intervalInHours') / (p_stepLengthNoReset(mSolve,f,t_) + 1${not p_stepLengthNoReset(mSolve, f, t_)})]
and ord(t_)<ord(t)
}
= yes;
// Time windows for minimum downtime requirements
Option clear = uftt_minDowntime;
uftt_minDowntime(uft_online(unit, f, t), tt_(t_))${ ord(t_)>=[ord(t)-p_unit(unit, 'minShutDownTime') / mSettings(mSolve, 'intervalInHours') / (p_stepLengthNoReset(mSolve,f,t_) + 1${not p_stepLengthNoReset(mSolve, f, t_)})]
and ord(t_)<ord(t)
}
= yes;
* -----------------------------------------------------------------------------
* --- Probabilities -----------------------------------------------------------
* -----------------------------------------------------------------------------
......
......@@ -114,8 +114,9 @@ Sets
* --- General and Directional Sets --------------------------------------------
// General Counter
counter "general counter set"
counter "General counter set"
/c000*c999/
cc(counter) "Temporary subset of counter used for calculations"
// Directional Sets
up_down "Direction set used by some variables, e.g. reserve provisions and generation ramps"
......
......@@ -27,7 +27,6 @@ Sets
* --- Energy generation and consumption ---------------------------------------
unit "Set of generators, storages and loads"
* unit_elec(unit) "Units that generate and/or consume electricity"
unit_flow(unit) "Unit that depend directly on variable energy flows (RoR, solar PV, etc.)"
unit_fuel(unit) "Units using a commercial fuel"
unit_minLoad(unit) "Units that have unit commitment restrictions (e.g. minimum power level)"
......@@ -122,11 +121,6 @@ Sets
effGroupSelector(effSelector, effSelector) "Efficiency selectors included in efficiency groups, e.g. Lambda02 contains Lambda01 and Lambda02."
effLevelGroupUnit(effLevel, effSelector, unit) "What efficiency selectors are in use for each unit at each efficiency representation level"
effGroupSelectorUnit(effSelector, unit, effSelector) "Group name for efficiency selector set, e.g. Lambda02 contains Lambda01 and Lambda02"
// Auxiliary time step sets for startup and shutdown constraints
uftt_startupType(starttype, unit, f, t, t) "Set of time steps where special startup conditions apply for units"
uftt_minUptime(unit, f, t, t) "Set of time steps where minimum uptime constraints apply for units"
uftt_minDowntime(unit, f, t, t) "Set of time steps where minimum downtype constrains apply for units"
;
* Set initial values to avoid errors when checking if parameter contents have been loaded from input data
fRealization('f00') = yes;
......
......@@ -80,17 +80,19 @@ Scalar p_sWeightSum "Sum of sample weights";
* --- Model structure ---------------------------------------------------------
Parameters
// Time displacement arrays
dt(t) "Displacement needed to reach the previous time period (in time periods)"
dt_circular(t) "Circular t displacement if the time series data is not long enough to cover the model horizon"
dt_starttypeUnitCounter(starttype, unit, counter) "Displacement needed to account for starttype constraints"
dt_downtimeUnitCounter(unit, counter) "Displacement needed to account for downtime constraints"
dt_uptimeUnitCounter(unit, counter) "Displacement needed to account for uptime constraints"
// Forecast displacement arrays
df(f, t) "Displacement needed to reach the realized forecast on the current time step"
df_central(f, t) "Displacement needed to reach the central forecast - this is needed when the forecast tree gets reduced in dynamic equations"
df_nReserves(node, restype, f, t) "Forecast index displacement needed to reach the realized forecast when committing reserves."
* cf(f, t) "Displacement needed to reach the current forecast (in forecasts) - this is needed when the forecast tree gets reduced in dynamic equations"
* cf_nReserves(node, restype, f, t) "Forecast index displacement needed to reach the realization when committing reserves."
* t_bind(t) "Displacement to reach the binding time period in the parent sample (in time periods). Can skip with aggregated steps as well as when connecting samples."
* ft_bind(f, t) "Displacement to reach the binding forecast (in forecasts) in the current model"
* mt_bind(mType, t) "Displacement to reach the binding time period in the parent sample (in time periods) in the models"
* mft_bind(mType, f, t) "Displacement to reach the binding forecast (in forecasts) in the models"
// Other
p_slackDirection(slack) "+1 for upward slacks and -1 for downward slacks"
tForecastNext(mType) "When the next forecast will be availalbe (ord time)"
aaSolveInfo(mType, t, solveInfoAttributes) "stores information about the solve status"
......
......@@ -101,7 +101,7 @@ q_obj ..
// Sum over all the samples, forecasts, and time steps in the current model
+ sum(msft(m, s, f, t),
// Probability (weight coefficient) of (s,f,t)
+ p_sft_Probability(s,f,t)
+ p_sft_Probability(s, f, t)
* [
// Time step length dependent costs
+ p_stepLength(m, f, t)
......@@ -566,8 +566,8 @@ q_startuptype(m, starttypeConstrained(starttype), uft_online(unit, f, t)) ..
=L=
// Subunit shutdowns within special startup timeframe
+ sum(uftt_startupType(starttype, unit, f, t, t_),
+ v_shutdown(unit, f+df(f,t_), t_)
+ sum(counter${dt_starttypeUnitCounter(starttype, unit, counter)},
+ v_shutdown(unit, f+df(f,t+dt_starttypeUnitCounter(starttype, unit, counter)), t+dt_starttypeUnitCounter(starttype, unit, counter))
) // END sum(t_)
;
......@@ -587,8 +587,8 @@ q_onlineLimit(m, uft_online(unit, f, t))${ p_unit(unit, 'minShutDownTime')
+ p_unit(unit, 'unitCount')
// Number of units unable to start due to restrictions
- sum(uftt_minDowntime(unit, f, t, t_),
+ v_shutdown(unit, f+df(f,t_), t_)
- sum(counter${dt_downtimeUnitCounter(unit, counter)},
+ v_shutdown(unit, f+df(f,t+dt_downtimeUnitCounter(unit, counter)), t+dt_downtimeUnitCounter(unit, counter))
) // END sum(t_)
// Investments into units
......@@ -610,9 +610,9 @@ q_onlineMinUptime(m, uft_online(unit, f, t))${ p_unit(unit, 'minOperationTime')
=G=
// Units that have minimum operation time requirements active
+ sum(uftt_minUptime(unit, f, t, t_),
+ sum(counter${dt_uptimeUnitCounter(unit, counter)},
+ sum(starttype,
+ v_startup(unit, starttype, f+df(f,t_), t_)
+ v_startup(unit, starttype, f+df(f,t+dt_uptimeUnitCounter(unit, counter)), t+dt_uptimeUnitCounter(unit, counter))
) // END sum(starttype)
) // END sum(t_)
;
......@@ -815,7 +815,7 @@ q_outputRatioConstrained(gngnu_constrainedOutputRatio(grid, node, grid_, node_,
* --- Direct Input-Output Conversion ------------------------------------------
q_conversionDirectInputOutput(suft(effDirect, unit, f, t)) ..
q_conversionDirectInputOutput(suft(effDirect(effGroup), unit, f, t)) ..
// Sum over endogenous energy inputs
- sum(gnu_input(grid, node, unit),
......@@ -833,8 +833,8 @@ q_conversionDirectInputOutput(suft(effDirect, unit, f, t)) ..
+ sum(gnu_output(grid, node, unit),
+ v_gen(grid, node, unit, f, t)
* [ // Heat rate
+ p_effUnit(effDirect, unit, effDirect, 'slope')${not ts_effUnit(effDirect, unit, effDirect, 'slope', f, t)}
+ ts_effUnit(effDirect, unit, effDirect, 'slope', f, t)
+ p_effUnit(effGroup, unit, effGroup, 'slope')${not ts_effUnit(effGroup, unit, effGroup, 'slope', f, t)}
+ ts_effUnit(effGroup, unit, effGroup, 'slope', f, t)
] // END * v_gen
) // END sum(gnu_output)
......@@ -847,8 +847,8 @@ q_conversionDirectInputOutput(suft(effDirect, unit, f, t)) ..
+ v_online_MIP(unit, f, t)${uft_onlineMIP(unit, f, t)}
] // END * sum(gnu_output)
* [
+ p_effGroupUnit(effDirect, unit, 'section')${not ts_effUnit(effDirect, unit, effDirect, 'section', f, t)}
+ ts_effUnit(effDirect, unit, effDirect, 'section', f, t)
+ p_effGroupUnit(effGroup, unit, 'section')${not ts_effUnit(effGroup, unit, effDirect, 'section', f, t)}
+ ts_effUnit(effGroup, unit, effGroup, 'section', f, t)
] // END * sum(gnu_output)
;
......
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