Commit 30b95b77 authored by Erkka Rinne's avatar Erkka Rinne
Browse files

Speedup for calculation of time series data

Uses new set `fts(f, t, s)` which is the same as `sft` but different order of domains.
parent 582afbf3
......@@ -106,6 +106,7 @@ Sets
msf(mType, s, f) "Combination of samples and forecasts in the models"
msft(mType, s, f, t) "Combination of models, samples, forecasts and t's"
sft(s, f, t) "Combination of samples, forecasts and t's in the current model solve"
fts(f, t, s) "Like `sft` but different order"
sft_realized(s, f, t) "Realized sft"
sft_realizedNoReset(s, f, t) "Full set of realized sft, facilitates calculation of results"
msft_realizedNoReset(mType, s, f, t) "Combination of realized samples, forecasts and t:s in the current model solve and previously realized t:s"
......
......@@ -291,6 +291,7 @@ loop(cc(counter),
// Reduce the sample dimension
sft(s, f, t)$msft(mSolve, s, f, t) = ft(f, t);
fts(f, t, s)$sft(s, f, t) = ft(f, t);
// Update tCounter for the next block of intervals
tCounter = mInterval(mSolve, 'lastStepInIntervalBlock', counter) + 1;
......
......@@ -318,11 +318,11 @@ $ontext
ts_effGroupUnit_(effSelector, unit_timeseries(unit), param_eff, f_solve, t)
= ts_effGroupUnit(effSelector, unit, param_eff, f_solve, t+dt_circular(t));
$offtext
ts_cf_(flowNode(flow, node), f, t, s)$sft(s, f, t)
ts_cf_(flowNode(flow, node), fts(f, t, s))
= ts_cf(flow, node, f + (df_scenario(f, t)$gn_scenarios(flow, node, 'ts_cf')),
t + (dt_scenarioOffset(flow, node, 'ts_cf', s)
+ dt_circular(t)$(not gn_scenarios(flow, node, 'ts_cf'))));
ts_influx_(gn(grid, node), f, t, s)$sft(s, f, t)
ts_influx_(gn(grid, node), fts(f, t, s))
= ts_influx(grid, node, f + (df_scenario(f, t)$gn_scenarios(grid, node, 'ts_node')),
t + (dt_scenarioOffset(grid, node, 'ts_influx', s)
+ dt_circular(t)$(not gn_scenarios(grid, node, 'ts_influx'))));
......@@ -332,9 +332,8 @@ $offtext
= ts_reserveDemand(restype, up_down, node,
f + (df_scenario(f,t)$gn_scenarios(restype, node, 'ts_reserveDemand')),
t+dt_circular(t));
ts_node_(gn_state(grid, node), param_gnBoundaryTypes, f, t, s)
$(p_gnBoundaryPropertiesForStates(grid, node, param_gnBoundaryTypes, 'useTimeseries')
and sft(s, f, t))
ts_node_(gn_state(grid, node), param_gnBoundaryTypes, fts(f, t, s))
$p_gnBoundaryPropertiesForStates(grid, node, param_gnBoundaryTypes, 'useTimeseries')
= ts_node(grid, node, param_gnBoundaryTypes,
f + (df_scenario(f, t)$gn_scenarios(grid, node, 'ts_node')),
t + (dt_scenarioOffset(grid, node, param_gnBoundaryTypes, s)
......@@ -372,13 +371,13 @@ $ontext
= sum(tt(t_), ts_effGroupUnit(effSelector, unit, param_eff, f_solve, t_+dt_circular(t_))))
/ mInterval(mSolve, 'stepsPerInterval', counter);
$offtext
ts_influx_(gn(grid, node), f, t, s)$sft(s, f, t)
ts_influx_(gn(grid, node), fts(f, t, s))
= sum(tt(t_), ts_influx(grid, node,
f + (df_scenario(f, t)$gn_scenarios(grid, node, 'ts_influx')),
t_ + (dt_scenarioOffset(grid, node, 'ts_influx', s)
+ dt_circular(t_)$(not gn_scenarios(grid, node, 'ts_influx')))))
/ mInterval(mSolve, 'stepsPerInterval', counter);
ts_cf_(flowNode(flow, node), f, t, s)$sft(s, f, t)
ts_cf_(flowNode(flow, node), fts(f, t, s))
= sum(tt(t_), ts_cf(flow, node,
f + (df_scenario(f, t)$gn_scenarios(flow, node, 'ts_cf')),
t_ + (dt_scenarioOffset(flow, node, 'ts_cf', s)
......@@ -391,9 +390,8 @@ $offtext
f + (df_scenario(f, t)$gn_scenarios(restype, node, 'ts_reserveDemand')),
t_+ dt_circular(t_)))
/ mInterval(mSolve, 'stepsPerInterval', counter);
ts_node_(gn_state(grid, node), param_gnBoundaryTypes, f, t, s)
${p_gnBoundaryPropertiesForStates(grid, node, param_gnBoundaryTypes, 'useTimeseries')
and sft(s, f, t)}
ts_node_(gn_state(grid, node), param_gnBoundaryTypes, fts(f, t, s))
$p_gnBoundaryPropertiesForStates(grid, node, param_gnBoundaryTypes, 'useTimeseries')
// Take average if not a limit type
= (sum(tt(t_), ts_node(grid, node, param_gnBoundaryTypes,
f + (df_scenario(f, t)$gn_scenarios(grid, node, 'ts_node')),
......
......@@ -48,6 +48,7 @@ else
msf(mSolve, s, f)$msf(mSolve, s, f) = ms(mSolve, s);
msft(mSolve, s, f, t)$msft(mSolve, s, f, t) = msf(mSolve, s, f);
sft(s, f, t)$sft(s, f, t) = yes$p_msProbability(mSolve, s);
fts(f, t, s)$fts(f, t, s) = sft(s, f, t);
// Update scenarios
Option clear = s_scenario;
......
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