Commit 631d1ecc authored by Topi Rasku's avatar Topi Rasku
Browse files

#82: All hard-coded *elec* grids have been removed and replaced by...

#82: All hard-coded *elec* grids have been removed and replaced by looping/summing over *gn* instead. This fix should work as long as no *node* belongs to multiple *grids*, which I think is already ill-advised (or even forbidden?).
parent 559b6821
......@@ -10,6 +10,9 @@ All notable changes to this project will be documented in this file.
### Changed
- Updated tool defintions for Sceleton Titan and Spine Toolbox
### Fixed
- Removed hard-coded `elec grids` from *setVariableLimits* and *rampSched files*
## [1.1] - 2019-04-17
### Added
- New model setting 't_perfectForesight' tells the number of time steps (from
......
......@@ -316,7 +316,8 @@ v_transferLeftward.up(gn2n_directional(grid, node, node_), sft(s, f, t))${ not
* --- Reserve Provision Boundaries --------------------------------------------
// Loop over the forecasts to minimize confusion regarding the df_reserves forecast displacement
loop((restypeDirectionNode(restype, up_down, node), sft(s, f, t))${ ord(t) <= tSolveFirst + p_nReserves(node, restype, 'reserve_length') },
// NOTE! The loop over gn is not ideal, but the reserve variables are currently lacking the grid dimension.
loop((restypeDirectionNode(restype, up_down, node), gn(grid, node), sft(s, f, t))${ ord(t) <= tSolveFirst + p_nReserves(node, restype, 'reserve_length') },
// Reserve provision limits without investments
// Reserve provision limits based on resXX_range (or possibly available generation in case of unit_flow)
v_reserve.up(nuRescapable(restype, up_down, node, unit), s, f+df_reserves(node, restype, f, t), t)
......@@ -324,34 +325,30 @@ loop((restypeDirectionNode(restype, up_down, node), sft(s, f, t))${ ord(t) <= tS
and not (unit_investLP(unit) or unit_investMIP(unit))
and not ft_reservesFixed(node, restype, f+df_reserves(node, restype, f, t), t)
}
= min ( p_nuReserves(node, unit, restype, up_down) * [ p_gnu('elec', node, unit, 'maxGen') + p_gnu('elec', node, unit, 'maxCons') ], // Generator + consuming unit res_range limit
v_gen.up('elec', node, unit, s, f, t) - v_gen.lo('elec', node, unit, s, f, t) // Generator + consuming unit available unit_elec. output delta
= min ( p_nuReserves(node, unit, restype, up_down) * [ p_gnu(grid, node, unit, 'maxGen') + p_gnu(grid, node, unit, 'maxCons') ], // Generator + consuming unit res_range limit
v_gen.up(grid, node, unit, s, f, t) - v_gen.lo(grid, node, unit, s, f, t) // Generator + consuming unit available unit_elec. output delta
) // END min
;
// Reserve transfer upper bounds based on input p_nnReserves data, if investments are disabled
v_resTransferRightward.up(restypeDirectionNodeNode(restype, up_down, node, node_), s, f+df_reserves(node, restype, f, t), t)
${ not sum(grid, p_gnn(grid, node, node_, 'transferCapInvLimit')) // NOTE! This is not ideal, but the reserve sets and variables are currently lacking the grid dimension...
and sum(grid, gn2n_directional(grid, node, node_)) // NOTE! This is not ideal, but the reserve sets and variables are currently lacking the grid dimension...
${ not p_gnn(grid, node, node_, 'transferCapInvLimit')
and gn2n_directional(grid, node, node_)
and not [ ft_reservesFixed(node, restype, f+df_reserves(node, restype, f, t), t) // This set contains the combination of reserve types and time intervals that should be fixed
or ft_reservesFixed(node_, restype, f+df_reserves(node_, restype, f, t), t) // Commit reserve transfer as long as either end commits.
]
}
= sum(grid, // NOTE! This is not ideal, but the reserve sets and variables are currently lacking the grid dimension...
+ p_gnn(grid, node, node_, 'transferCap')
) // END sum(grid)
= p_gnn(grid, node, node_, 'transferCap')
* p_nnReserves(node, node_, restype, up_down);
v_resTransferLeftward.up(restypeDirectionNodeNode(restype, up_down, node, node_), s, f+df_reserves(node, restype, f, t), t)
${ not sum(grid, p_gnn(grid, node, node_, 'transferCapInvLimit')) // NOTE! This is not ideal, but the reserve sets and variables are currently lacking the grid dimension...
and sum(grid, gn2n_directional(grid, node, node_)) // NOTE! This is not ideal, but the reserve sets and variables are currently lacking the grid dimension...
${ not p_gnn(grid, node, node_, 'transferCapInvLimit')
and gn2n_directional(grid, node, node_)
and not [ ft_reservesFixed(node, restype, f+df_reserves(node, restype, f, t), t) // This set contains the combination of reserve types and time intervals that should be fixed
or ft_reservesFixed(node_, restype, f+df_reserves(node_, restype, f, t), t) // Commit reserve transfer as long as either end commits.
]
}
= sum(grid, // NOTE! This is not ideal, but the reserve sets and variables are currently lacking the grid dimension...
+ p_gnn(grid, node, node_, 'transferCap')
) // END sum(grid)
= p_gnn(grid, node, node_, 'transferCap')
* p_nnReserves(node, node_, restype, up_down);
// Fix non-flow unit reserves at the gate closure of reserves
......@@ -361,9 +358,9 @@ loop((restypeDirectionNode(restype, up_down, node), sft(s, f, t))${ ord(t) <= tS
}
= r_reserve(restype, up_down, node, unit, f+df_reserves(node, restype, f, t), t);
// Fix transfer of reserves at the gate closure of reserves
// Fix transfer of reserves at the gate closure of reserves, LOWER BOUND ONLY!
v_resTransferRightward.fx(restype, up_down, node, node_, s, f+df_reserves(node, restype, f, t), t)
$ { sum(grid, gn2n_directional(grid, node, node_)) // NOTE! This is not ideal, but the reserve sets and variables are currently lacking the grid dimension...
$ { gn2n_directional(grid, node, node_)
and [ ft_reservesFixed(node, restype, f+df_reserves(node, restype, f, t), t) // This set contains the combination of reserve types and time intervals that should be fixed
or ft_reservesFixed(node_, restype, f+df_reserves(node_, restype, f, t), t) // Commit reserve transfer as long as either end commits.
]
......@@ -371,7 +368,7 @@ loop((restypeDirectionNode(restype, up_down, node), sft(s, f, t))${ ord(t) <= tS
= r_resTransferRightward(restype, up_down, node, node_, f+df_reserves(node, restype, f, t), t);
v_resTransferLeftward.fx(restype, up_down, node, node_, s, f+df_reserves(node, restype, f, t), t)
$ { sum(grid, gn2n_directional(grid, node, node_)) // NOTE! This is not ideal, but the reserve sets and variables are currently lacking the grid dimension...
$ { gn2n_directional(grid, node, node_)
and [ ft_reservesFixed(node, restype, f+df_reserves(node, restype, f, t), t) // This set contains the combination of reserve types and time intervals that should be fixed
or ft_reservesFixed(node_, restype, f+df_reserves(node_, restype, f, t), t) // Commit reserve transfer as long as either end commits.
]
......
......@@ -32,15 +32,15 @@ execute_load 'ts_netload.gdx', ts_netLoad;
* Check if there is a change in netLoad
s_netLoadChanged = 0;
loop(node,
loop(gn(grid,node),
loop(t$(ord(t) = 1),
if (ts_netLoad(node, t) <>
// Calculates a moving window for net load using linearly increasing/decreasing weighting
sum((fRealization(f), t_)$(ord(t_) > ord(t) - 12 and ord(t_) <= ord(t) + 12),
(ts_energyDemand('elec', node, f, t_) -
(ts_energyDemand(grid, node, f, t_) -
sum(unit_flow(flow, unit_flow)$nu(unit_flow, node),
ts_cf(flow, node, f, t) *
p_data2d('elec', unit_flow, 'maxGen') *
p_data2d(grid, unit_flow, 'maxGen') *
p_data(unit_flow, 'availability')
)
) * (13 - abs(ord(t) - ord(t_))) // Weighting
......@@ -60,11 +60,11 @@ if (s_netLoadChanged = 1,
put log;
put 'Calculating smoothed net load...';
ts_netLoad(node, t) =
sum((fRealization(f), t_)$(ord(t_) > ord(t) - 12 and ord(t_) <= ord(t) + 12),
(ts_energyDemand('elec', node, f, t_) -
sum((fRealization(f), gn(grid, node), t_)$(ord(t_) > ord(t) - 12 and ord(t_) <= ord(t) + 12),
(ts_energyDemand(grid, node, f, t_) -
sum(unit_flow(flow, unit_flow)$nu(unit_flow, node),
ts_cf(flow, node, f, t) *
p_data2d('elec', unit_flow, 'maxGen') *
p_data2d(grid, unit_flow, 'maxGen') *
p_data(unit_flow, 'availability')
)
) * (13 - abs(ord(t) - ord(t_)))
......
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