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

*intervalStepCounter* now uses (counter, t) instead of (counter, counter_) due...

*intervalStepCounter* now uses (counter, t) instead of (counter, counter_) due to the counter set being too limited in size.
parent be578674
......@@ -117,16 +117,13 @@ Sets
effOnline(effSelector) "Efficiency selectors that use online variables"
/ directOnLP, directOnMIP, lambda01*lambda12 ,incHR / // IMPORTANT! Online variables are generated based on this, so keep it up to date!
* --- General, Interval and Directional Sets ----------------------------------
* --- General and Directional Sets --------------------------------------------
// General Counter
counter "General counter set"
/c000*c999/
cc(counter) "Temporary subset of counter used for calculations"
// Interval Step Counter
intervalStepCounter(counter, counter) "Interval step counter for time series averaging"
// Directional Sets
up_down "Direction set used by some variables, e.g. reserve provisions and generation ramps"
/ up, down /
......@@ -175,9 +172,6 @@ Sets
; // END Sets
// Alias the counter set
alias(counter, counter_);
* =============================================================================
* --- Model Parameter Definitions ---------------------------------------------
* =============================================================================
......
......@@ -125,6 +125,7 @@ Sets
s_active(s) "Samples with non-zero probability in the current model solve"
ss(s, s) "Previous sample of sample"
s_prev(s) "Temporary set for previous sample"
intervalStepCounter(counter, t) "Interval step counter for time series averaging NOTE! t is used here as a general counter, not a time step! (counter set too limited in size)"
$if defined scenario
s_scenario(s, scenario) "Which samples belong to which scenarios"
gn_scenarios(*, node, *) "Which grid/flow, node and timeseries/param have data for long-term scenarios"
......
......@@ -168,8 +168,8 @@ cc(counter)${ mInterval(mSolve, 'stepsPerInterval', counter) }
= yes;
// Determine the interval step counters for each interval
intervalStepCounter(cc(counter), counter_)
${ ord(counter_) <= mInterval(mSolve, 'stepsPerInterval', counter) }
intervalStepCounter(cc(counter), t)
${ ord(t) <= mInterval(mSolve, 'stepsPerInterval', counter) }
= yes;
// Update tForecastNext
......
......@@ -305,86 +305,86 @@ loop(cc(counter),
// Select and average time series data matching the intervals
ts_unit_(unit_timeseries(unit), param_unit, ft(f, tt_interval(t)))
= sum(intervalStepCounter(counter, counter_),
ts_unit(unit, param_unit, f, t+(ord(counter_) - 1 + dt_circular(t + (ord(counter_) - 1))))
= sum(intervalStepCounter(counter, t_),
ts_unit(unit, param_unit, f, t+(ord(t_) - 1 + dt_circular(t + (ord(t_) - 1))))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
$ontext
* Should these be handled here at all? See above comment
ts_effUnit_(effGroupSelectorUnit(effSelector, unit_timeseries(unit), effSelector), param_eff, ft(f, tt_interval(t)))
= sum(intervalStepCounter(counter, counter_),
ts_effUnit(effSelector, unit, effSelector, param_eff, f_solve, t+(ord(counter_) - 1 + dt_circular(t + ord(counter_) - 1)))
= sum(intervalStepCounter(counter, t_),
ts_effUnit(effSelector, unit, effSelector, param_eff, f_solve, t+(ord(t_) - 1 + dt_circular(t + ord(t_) - 1)))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
ts_effGroupUnit_(effSelector, unit_timeseries(unit), param_eff, ft(f, tt_interval(t)))
= sum(intervalStepCounter(counter, counter_),
ts_effGroupUnit(effSelector, unit, param_eff, f_solve, t+(ord(counter_) - 1 + dt_circular(t + ord(counter_) - 1)))
= sum(intervalStepCounter(counter, t_),
ts_effGroupUnit(effSelector, unit, param_eff, f_solve, t+(ord(t_) - 1 + dt_circular(t + ord(t_) - 1)))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
$offtext
ts_influx_(gn(grid, node), fts(f, tt_interval(t), s))
= sum(intervalStepCounter(counter, counter_),
= sum(intervalStepCounter(counter, t_),
ts_influx(grid, node,
f + (df_scenario(f, t)$gn_scenarios(grid, node, 'ts_influx')),
t + ( ord(counter_) - 1
t + ( ord(t_) - 1
+ dt_scenarioOffset(grid, node, 'ts_influx', s)
+ dt_circular(t + (ord(counter_) - 1))$(not gn_scenarios(grid, node, 'ts_influx'))))
+ dt_circular(t + (ord(t_) - 1))$(not gn_scenarios(grid, node, 'ts_influx'))))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
ts_cf_(flowNode(flow, node), fts(f, tt_interval(t), s))
= sum(intervalStepCounter(counter, counter_),
= sum(intervalStepCounter(counter, t_),
ts_cf(flow, node,
f + (df_scenario(f, t)$gn_scenarios(flow, node, 'ts_cf')),
t + ( ord(counter_) - 1
t + ( ord(t_) - 1
+ dt_scenarioOffset(flow, node, 'ts_cf', s)
+ dt_circular(t + (ord(counter_) - 1))$(not gn_scenarios(flow, node, 'ts_cf'))))
+ dt_circular(t + (ord(t_) - 1))$(not gn_scenarios(flow, node, 'ts_cf'))))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
// Reserves relevant only until reserve_length
ts_reserveDemand_(restypeDirectionNode(restype, up_down, node), ft(f, tt_interval(t)))
${ord(t) <= tSolveFirst + p_nReserves(node, restype, 'reserve_length') }
= sum(intervalStepCounter(counter, counter_),
= sum(intervalStepCounter(counter, t_),
ts_reserveDemand(restype, up_down, node,
f + (df_scenario(f, t)$gn_scenarios(restype, node, 'ts_reserveDemand')),
t + ( ord(counter_) - 1 + dt_circular(t + (ord(counter_) - 1))))
t + ( ord(t_) - 1 + dt_circular(t + (ord(t_) - 1))))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
ts_node_(gn_state(grid, node), param_gnBoundaryTypes, fts(f, tt_interval(t), s))
$p_gnBoundaryPropertiesForStates(grid, node, param_gnBoundaryTypes, 'useTimeseries')
// Take average if not a limit type
= (sum(intervalStepCounter(counter, counter_),
= (sum(intervalStepCounter(counter, t_),
ts_node(grid, node, param_gnBoundaryTypes,
f + (df_scenario(f, t)$gn_scenarios(grid, node, 'ts_node')),
t + ( ord(counter_) - 1
t + ( ord(t_) - 1
+ dt_scenarioOffset(grid, node, param_gnBoundaryTypes, s)
+ dt_circular(t + (ord(counter_) - 1))$(not gn_scenarios(grid, node, 'ts_node'))))
+ dt_circular(t + (ord(t_) - 1))$(not gn_scenarios(grid, node, 'ts_node'))))
)
/ mInterval(mSolve, 'stepsPerInterval', counter))$( not (sameas(param_gnBoundaryTypes, 'upwardLimit')
or sameas(param_gnBoundaryTypes, 'downwardLimit')
or slack(param_gnBoundaryTypes)))
// Maximum lower limit
+ smax(intervalStepCounter(counter, counter_),
+ smax(intervalStepCounter(counter, t_),
ts_node(grid, node, param_gnBoundaryTypes,
f + (df_scenario(f, t)$gn_scenarios(grid, node, 'ts_node')),
t + ( ord(counter_) - 1
t + ( ord(t_) - 1
+ dt_scenarioOffset(grid, node, param_gnBoundaryTypes, s)
+ dt_circular(t + (ord(counter_) - 1))$(not gn_scenarios(grid, node, 'ts_node'))))
+ dt_circular(t + (ord(t_) - 1))$(not gn_scenarios(grid, node, 'ts_node'))))
)
$(sameas(param_gnBoundaryTypes, 'downwardLimit') or downwardSlack(param_gnBoundaryTypes))
// Minimum upper limit
+ smin(intervalStepCounter(counter, counter_),
+ smin(intervalStepCounter(counter, t_),
ts_node(grid, node, param_gnBoundaryTypes,
f + (df_scenario(f, t)$gn_scenarios(grid, node, 'ts_node')),
t + ( ord(counter_) - 1
t + ( ord(t_) - 1
+ dt_scenarioOffset(grid, node, param_gnBoundaryTypes, s)
+ dt_circular(t + (ord(counter_) - 1))$(not gn_scenarios(grid, node, 'ts_node'))))
+ dt_circular(t + (ord(t_) - 1))$(not gn_scenarios(grid, node, 'ts_node'))))
)
$(sameas(param_gnBoundaryTypes, 'upwardLimit') or upwardSlack(param_gnBoundaryTypes));
// Fuel price time series
ts_fuelPrice_(fuel, tt_interval(t))
${ p_fuelPrice(fuel, 'useTimeSeries') }
= sum(intervalStepCounter(counter, counter_),
+ ts_fuelPrice(fuel, t+(ord(counter_) - 1 + dt_circular(t + (ord(counter_) - 1))))
= sum(intervalStepCounter(counter, t_),
+ ts_fuelPrice(fuel, t+(ord(t_) - 1 + dt_circular(t + (ord(t_) - 1))))
)
/ mInterval(mSolve, 'stepsPerInterval', counter);
......
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