-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Problem statement
The current version for strategic scenarios results in a problem when we have different types of TimeStructures in the TreeNodes. The problem is most likely related to the constructor for StrategicScenario, and there specifically coupled to the created Tuple as it is not a NTuple.
Consider the following structure:
day = SimpleTimes(24, 1) # A single day with hourly resolution
week = SimpleTimes(168, 1) # A week with hourly resolution
scen = OperationalScenarios(2, [day, week], [7, 1]/8)
repr = RepresentativePeriods(4, 8760, scen)
ts = TwoLevelTree(
TreeNode(5, repr, [0.7, 0.05, 0.1, 0.15], [
TreeNode(5, repr, TreeNode(5, repr, TreeNode(5, week))),
TreeNode(2, week, TreeNode(8, week, TreeNode(5, week))),
TreeNode(4, scen, [
TreeNode(6, week, TreeNode(5, week)),
TreeNode(6, week, 2, TreeNode(5, week))
]
),
TreeNode(5, repr, 2, TreeNode(8, repr, TreeNode(5, week)))
]),
; op_per_strat=8760.0)In this situation, we have a weird subtype structure for the StrategicScenario, that is, the NTuple is not possible to be defined equally. I think the problem is that that typeof(ts) = TwoLevelTree{Int64, Int64, TimeStruct.StratNode{Int64, Int64, OP} where OP<:TimeStructure{Int64}}, and hence, typeof(strategic_scenarios(ts)) = TimeStruct.StratScens{Int64, Int64, TimeStruct.StratNode{Int64, Int64, OP} where OP<:TimeStructure{Int64}}. Specifically, there where is problematic as it won't define an NTuple, but a Tuple.
The problem is most likely introduced through #83. I will try to investigate what type of fixes can solve the issue, but it is a bit of a problem regarding the parametric composite type introduced in #83 for StrategicScenario.
An alternative would be remove the composite type or change it, but as far as I recall this would lead to other unintended consequences as it was initially included to have the equalities working as highlighted in #83. I will investigate it a bit in the coming days. This is just for your information @hellemo and @trulsf.