-
Notifications
You must be signed in to change notification settings - Fork 5
/
ComplexTopology.groovy
174 lines (164 loc) · 4.97 KB
/
ComplexTopology.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
* © 2021. TU Dortmund University,
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
* Research group Distribution grid planning and operation
*/
package edu.ie3.test.common
import static edu.ie3.test.common.SystemParticipantTestData.emptySystemParticipants
import edu.ie3.datamodel.graph.SubGridGate
import edu.ie3.datamodel.graph.SubGridTopologyGraph
import edu.ie3.datamodel.models.input.connector.ConnectorPort
import edu.ie3.datamodel.models.input.container.GraphicElements
import edu.ie3.datamodel.models.input.container.JointGridContainer
import edu.ie3.datamodel.models.input.container.RawGridElements
import edu.ie3.datamodel.models.input.container.SubGridContainer
import org.jgrapht.graph.DirectedMultigraph
class ComplexTopology extends GridTestData {
public static final gridName = "complex_topology"
private static final RawGridElements rawGrid = new RawGridElements(
[
nodeA,
nodeB,
nodeC,
nodeD,
nodeE,
nodeF,
nodeG
] as Set,
[] as Set,
[
transformerBtoD,
transformerBtoE,
transformerCtoE,
transformerCtoF,
transformerCtoG
] as Set,
[transformerAtoBtoC] as Set,
[] as Set,
[] as Set)
public static final grid = new JointGridContainer(
gridName,
rawGrid,
emptySystemParticipants,
new GraphicElements(
[] as Set,
[] as Set))
public static final HashMap<Integer, SubGridContainer> expectedSubGrids = new HashMap<>()
public static final SubGridTopologyGraph expectedSubGridTopology
static {
expectedSubGrids.put(1, new SubGridContainer(
gridName,
1,
new RawGridElements(
[nodeA, nodeB, nodeC] as Set,
[] as Set,
[] as Set,
[transformerAtoBtoC] as Set,
[] as Set,
[] as Set),
emptySystemParticipants,
new GraphicElements(
[] as Set,
[] as Set)
)
)
expectedSubGrids.put(2, new SubGridContainer(
gridName,
2,
new RawGridElements(
[nodeA, nodeB, nodeC] as Set,
[] as Set,
[] as Set,
[transformerAtoBtoC] as Set,
[] as Set,
[] as Set),
emptySystemParticipants,
new GraphicElements(
[] as Set,
[] as Set)
)
)
expectedSubGrids.put(3, new SubGridContainer(
gridName,
3,
new RawGridElements(
[nodeA, nodeB, nodeC] as Set,
[] as Set,
[] as Set,
[transformerAtoBtoC] as Set,
[] as Set,
[] as Set),
emptySystemParticipants,
new GraphicElements(
[] as Set,
[] as Set)
)
)
expectedSubGrids.put(4, new SubGridContainer(
gridName,
4,
new RawGridElements(
[nodeB, nodeD] as Set,
[] as Set,
[transformerBtoD] as Set,
[] as Set,
[] as Set,
[] as Set),
emptySystemParticipants,
new GraphicElements(
[] as Set,
[] as Set)
)
)
expectedSubGrids.put(5, new SubGridContainer(
gridName,
5,
new RawGridElements(
[nodeB, nodeC, nodeE] as Set,
[] as Set,
[
transformerBtoE,
transformerCtoE
] as Set,
[] as Set,
[] as Set,
[] as Set),
emptySystemParticipants,
new GraphicElements(
[] as Set,
[] as Set)
)
)
expectedSubGrids.put(6, new SubGridContainer(
gridName,
6,
new RawGridElements(
[nodeC, nodeF, nodeG] as Set,
[] as Set,
[
transformerCtoF,
transformerCtoG
] as Set,
[] as Set,
[] as Set,
[] as Set),
emptySystemParticipants,
new GraphicElements(
[] as Set,
[] as Set)
)
)
DirectedMultigraph<SubGridContainer, SubGridGate> mutableGraph =
new DirectedMultigraph<>(SubGridGate)
/* Add all edges */
expectedSubGrids.values().forEach({ subGrid -> mutableGraph.addVertex(subGrid) })
mutableGraph.addEdge(expectedSubGrids.get(1), expectedSubGrids.get(2), SubGridGate.fromTransformer3W(transformerAtoBtoC, ConnectorPort.B))
mutableGraph.addEdge(expectedSubGrids.get(1), expectedSubGrids.get(3), SubGridGate.fromTransformer3W(transformerAtoBtoC, ConnectorPort.C))
mutableGraph.addEdge(expectedSubGrids.get(2), expectedSubGrids.get(4), SubGridGate.fromTransformer2W(transformerBtoD))
mutableGraph.addEdge(expectedSubGrids.get(2), expectedSubGrids.get(5), SubGridGate.fromTransformer2W(transformerBtoE))
mutableGraph.addEdge(expectedSubGrids.get(3), expectedSubGrids.get(5), SubGridGate.fromTransformer2W(transformerCtoE))
mutableGraph.addEdge(expectedSubGrids.get(3), expectedSubGrids.get(6), SubGridGate.fromTransformer2W(transformerCtoF))
mutableGraph.addEdge(expectedSubGrids.get(3), expectedSubGrids.get(6), SubGridGate.fromTransformer2W(transformerCtoG))
expectedSubGridTopology = new SubGridTopologyGraph(mutableGraph)
}
}