You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following function was introduced in EnergyModelsInvestment through PR 58, but not used as it was no longer necessary. It can however be a nice function to have within TimeStruct.
However, in this case, it would be beneficial to also include it for RepresentativePeriods and SimpleTimes (it is not relevant for OperationalScenarios as these are parallel). This issue is just to keep track of the developed code.
""" _predecessor_periods(𝒯::TwoLevel) _predecessor_periods(𝒯::TwoLevelTree)Return a dictionary mapping each strategic period to the strategic periods preceding it onthe same scenario path. For a linear time structure, the predecessors are all earlierstrategic periods. For a tree structure, only ancestor periods on the corresponding pathare included."""function_predecessor_periods(𝒯::TwoLevel)
sps =collect(strat_periods(𝒯))
returnDict(t_inv => sps[1:(idx-1)] for (idx, t_inv) ∈enumerate(sps))
endfunction_predecessor_periods(𝒯::TwoLevelTree)
sps_pre =Dict()
for scenario ∈strategic_scenarios(𝒯)
path =collect(strat_periods(scenario))
for (idx, period) ∈enumerate(path)
!haskey(sps_pre, period) && (sps_pre[period] = path[1:(idx-1)])
endendreturn sps_pre
end
Activity