forked from powerdata/com.powerdata.openpa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCloneModelBuilder.java
390 lines (344 loc) · 17.9 KB
/
CloneModelBuilder.java
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
package com.powerdata.openpa;
import java.lang.reflect.Array;
import java.util.EnumMap;
import java.util.Map;
import java.util.Set;
import com.powerdata.openpa.impl.AreaListI;
import com.powerdata.openpa.impl.BusListI;
import com.powerdata.openpa.impl.GenListI;
import com.powerdata.openpa.impl.IslandListI;
import com.powerdata.openpa.impl.LineListI;
import com.powerdata.openpa.impl.LoadListI;
import com.powerdata.openpa.impl.ModelBuilderI;
import com.powerdata.openpa.impl.OwnerListI;
import com.powerdata.openpa.impl.PhaseShifterListI;
import com.powerdata.openpa.impl.SVCListI;
import com.powerdata.openpa.impl.SeriesCapListI;
import com.powerdata.openpa.impl.SeriesReacListI;
import com.powerdata.openpa.impl.ShuntCapListI;
import com.powerdata.openpa.impl.ShuntReacListI;
import com.powerdata.openpa.impl.StationListI;
import com.powerdata.openpa.impl.SwitchListI;
import com.powerdata.openpa.impl.SwitchedShuntListI;
import com.powerdata.openpa.impl.TransformerListI;
import com.powerdata.openpa.impl.TwoTermDCLineListI;
import com.powerdata.openpa.impl.VoltageLevelListI;
public class CloneModelBuilder extends ModelBuilderI
{
PAModel _srcmdl;
@FunctionalInterface
protected interface DataLoader<R>
{
R load() throws PAModelException;
}
protected Map<ColumnMeta,DataLoader<?>> _col = new EnumMap<>(ColumnMeta.class);
Set<ColumnMeta> _local;
public CloneModelBuilder(PAModel srcmdl, Set<ColumnMeta> local)
{
_srcmdl = srcmdl;
_local = local;
}
@Override
protected void loadPrep()
{
_col.put(ColumnMeta.BusID, () -> _srcmdl.getBuses().getID());
_col.put(ColumnMeta.BusNAME, () -> _srcmdl.getBuses().getName());
_col.put(ColumnMeta.BusVM, () -> _srcmdl.getBuses().getVM());
_col.put(ColumnMeta.BusVA, () -> _srcmdl.getBuses().getVA());
_col.put(ColumnMeta.BusFREQSRCPRI, () -> _srcmdl.getBuses().getFreqSrcPri());
_col.put(ColumnMeta.BusAREA, () -> _m.getAreas().getIndexesFromKeys(
extractKeys(_srcmdl.getBuses().getArea())));
_col.put(ColumnMeta.BusOWNER, () -> _m.getOwners().getIndexesFromKeys(
extractKeys(_srcmdl.getBuses().getOwner())));
_col.put(ColumnMeta.BusSTATION, () -> _m.getStations().getIndexesFromKeys(
extractKeys(_srcmdl.getBuses().getStation())));
_col.put(ColumnMeta.BusVLEV, () -> _m.getVoltageLevels().getIndexesFromKeys(
extractKeys(_srcmdl.getBuses().getVoltageLevel())));
_col.put(ColumnMeta.GenID, () -> _srcmdl.getGenerators().getID());
_col.put(ColumnMeta.GenNAME, () -> _srcmdl.getGenerators().getName());
_col.put(ColumnMeta.GenBUS, () -> extractIndex(_srcmdl.getGenerators().getBus()));
_col.put(ColumnMeta.GenP, () -> _srcmdl.getGenerators().getP());
_col.put(ColumnMeta.GenQ, () -> _srcmdl.getGenerators().getQ());
_col.put(ColumnMeta.GenOOS, () -> _srcmdl.getGenerators().isOutOfSvc());
_col.put(ColumnMeta.GenTYPE, () -> _srcmdl.getGenerators().getType());
_col.put(ColumnMeta.GenMODE, () -> _srcmdl.getGenerators().getMode());
_col.put(ColumnMeta.GenOPMINP, () -> _srcmdl.getGenerators().getOpMinP());
_col.put(ColumnMeta.GenOPMAXP, () -> _srcmdl.getGenerators().getOpMaxP());
_col.put(ColumnMeta.GenMINQ, () -> _srcmdl.getGenerators().getMinQ());
_col.put(ColumnMeta.GenMAXQ, () -> _srcmdl.getGenerators().getMaxQ());
_col.put(ColumnMeta.GenPS, () -> _srcmdl.getGenerators().getPS());
_col.put(ColumnMeta.GenQS, () -> _srcmdl.getGenerators().getQS());
_col.put(ColumnMeta.GenAVR, () -> _srcmdl.getGenerators().isRegKV());
_col.put(ColumnMeta.GenVS, () -> _srcmdl.getGenerators().getVS());
_col.put(ColumnMeta.GenREGBUS, () -> extractIndex(_srcmdl.getGenerators().getRegBus()));
_col.put(ColumnMeta.LoadID, () -> _srcmdl.getLoads().getID());
_col.put(ColumnMeta.LoadNAME, () -> _srcmdl.getLoads().getName());
_col.put(ColumnMeta.LoadBUS, () -> extractIndex(_srcmdl.getLoads().getBus()));
_col.put(ColumnMeta.LoadP, () -> _srcmdl.getLoads().getP());
_col.put(ColumnMeta.LoadQ, () -> _srcmdl.getLoads().getQ());
_col.put(ColumnMeta.LoadOOS, () -> _srcmdl.getLoads().isOutOfSvc());
_col.put(ColumnMeta.LoadPMAX, () -> _srcmdl.getLoads().getMaxP());
_col.put(ColumnMeta.LoadQMAX, () -> _srcmdl.getLoads().getMaxQ());
_col.put(ColumnMeta.ShcapID, () -> _srcmdl.getShuntCapacitors().getID());
_col.put(ColumnMeta.ShcapNAME, () -> _srcmdl.getShuntCapacitors().getName());
_col.put(ColumnMeta.ShcapBUS, () -> extractIndex(_srcmdl.getShuntCapacitors().getBus()));
_col.put(ColumnMeta.ShcapP, () -> _srcmdl.getShuntCapacitors().getP());
_col.put(ColumnMeta.ShcapQ, () -> _srcmdl.getShuntCapacitors().getQ());
_col.put(ColumnMeta.ShcapOOS, () -> _srcmdl.getShuntCapacitors().isOutOfSvc());
_col.put(ColumnMeta.ShcapB, () -> _srcmdl.getShuntCapacitors().getB());
_col.put(ColumnMeta.ShreacID, () -> _srcmdl.getShuntReactors().getID());
_col.put(ColumnMeta.ShreacNAME, () -> _srcmdl.getShuntReactors().getName());
_col.put(ColumnMeta.ShreacBUS, () -> extractIndex(_srcmdl.getShuntReactors().getBus()));
_col.put(ColumnMeta.ShreacP, () -> _srcmdl.getShuntReactors().getP());
_col.put(ColumnMeta.ShreacQ, () -> _srcmdl.getShuntReactors().getQ());
_col.put(ColumnMeta.ShreacOOS, () -> _srcmdl.getShuntReactors().isOutOfSvc());
_col.put(ColumnMeta.ShreacB, () -> _srcmdl.getShuntReactors().getB());
_col.put(ColumnMeta.SvcID, () -> _srcmdl.getSVCs().getID());
_col.put(ColumnMeta.SvcNAME, () -> _srcmdl.getSVCs().getName());
_col.put(ColumnMeta.SvcBUS, () -> extractIndex(_srcmdl.getSVCs().getBus()));
_col.put(ColumnMeta.SvcP, () -> _srcmdl.getSVCs().getP());
_col.put(ColumnMeta.SvcQ, () -> _srcmdl.getSVCs().getQ());
_col.put(ColumnMeta.SvcOOS, () -> _srcmdl.getSVCs().isOutOfSvc());
_col.put(ColumnMeta.SvcQMIN, () -> _srcmdl.getSVCs().getMinQ());
_col.put(ColumnMeta.SvcQMAX, () -> _srcmdl.getSVCs().getMaxQ());
_col.put(ColumnMeta.SvcAVR, () -> _srcmdl.getSVCs().isRegKV());
_col.put(ColumnMeta.SvcVS, () -> _srcmdl.getSVCs().getVS());
_col.put(ColumnMeta.SvcQS, () -> _srcmdl.getSVCs().getQS());
_col.put(ColumnMeta.SvcREGBUS, () -> extractIndex(_srcmdl.getSVCs().getRegBus()));
_col.put(ColumnMeta.SvcSLOPE, () -> _srcmdl.getSVCs().getSlope());
_col.put(ColumnMeta.SvcOMODE, () -> _srcmdl.getSVCs().getOutputMode());
_col.put(ColumnMeta.AreaID, () -> _srcmdl.getAreas().getID());
_col.put(ColumnMeta.AreaNAME, () -> _srcmdl.getAreas().getName());
_col.put(ColumnMeta.OwnerID, () -> _srcmdl.getOwners().getID());
_col.put(ColumnMeta.OwnerNAME, () -> _srcmdl.getOwners().getName());
_col.put(ColumnMeta.StationID, () -> _srcmdl.getStations().getID());
_col.put(ColumnMeta.StationNAME, () -> _srcmdl.getStations().getName());
_col.put(ColumnMeta.VlevID, () -> _srcmdl.getVoltageLevels().getID());
_col.put(ColumnMeta.VlevNAME, () -> _srcmdl.getVoltageLevels().getName());
_col.put(ColumnMeta.VlevBASKV, () -> _srcmdl.getVoltageLevels().getBaseKV());
_col.put(ColumnMeta.LineID, () -> _srcmdl.getLines().getID());
_col.put(ColumnMeta.LineNAME, () -> _srcmdl.getLines().getName());
_col.put(ColumnMeta.LineBUSFROM, () -> extractIndex(_srcmdl.getLines().getFromBus()));
_col.put(ColumnMeta.LineBUSTO, () -> extractIndex(_srcmdl.getLines().getToBus()));
_col.put(ColumnMeta.LineOOS, () -> _srcmdl.getLines().isOutOfSvc());
_col.put(ColumnMeta.LinePFROM, () -> _srcmdl.getLines().getFromP());
_col.put(ColumnMeta.LineQFROM, () -> _srcmdl.getLines().getFromQ());
_col.put(ColumnMeta.LinePTO, () -> _srcmdl.getLines().getToP());
_col.put(ColumnMeta.LineQTO, () -> _srcmdl.getLines().getToQ());
_col.put(ColumnMeta.LineR, () -> _srcmdl.getLines().getR());
_col.put(ColumnMeta.LineX, () -> _srcmdl.getLines().getX());
_col.put(ColumnMeta.LineBFROM, () -> _srcmdl.getLines().getFromBchg());
_col.put(ColumnMeta.LineBTO, () -> _srcmdl.getLines().getToBchg());
_col.put(ColumnMeta.LineRATLT, () -> _srcmdl.getLines().getLTRating());
_col.put(ColumnMeta.SercapID, () -> _srcmdl.getSeriesCapacitors().getID());
_col.put(ColumnMeta.SercapNAME, () -> _srcmdl.getSeriesCapacitors().getName());
_col.put(ColumnMeta.SercapBUSFROM, () -> extractIndex(_srcmdl.getSeriesCapacitors().getFromBus()));
_col.put(ColumnMeta.SercapBUSTO, () -> extractIndex(_srcmdl.getSeriesCapacitors().getToBus()));
_col.put(ColumnMeta.SercapOOS, () -> _srcmdl.getSeriesCapacitors().isOutOfSvc());
_col.put(ColumnMeta.SercapPFROM, () -> _srcmdl.getSeriesCapacitors().getFromP());
_col.put(ColumnMeta.SercapQFROM, () -> _srcmdl.getSeriesCapacitors().getFromQ());
_col.put(ColumnMeta.SercapPTO, () -> _srcmdl.getSeriesCapacitors().getToP());
_col.put(ColumnMeta.SercapQTO, () -> _srcmdl.getSeriesCapacitors().getToQ());
_col.put(ColumnMeta.SercapR, () -> _srcmdl.getSeriesCapacitors().getR());
_col.put(ColumnMeta.SercapX, () -> _srcmdl.getSeriesCapacitors().getX());
_col.put(ColumnMeta.SercapRATLT, () -> _srcmdl.getSeriesCapacitors().getLTRating());
_col.put(ColumnMeta.SerreacID, () -> _srcmdl.getSeriesReactors().getID());
_col.put(ColumnMeta.SerreacNAME, () -> _srcmdl.getSeriesReactors().getName());
_col.put(ColumnMeta.SerreacBUSFROM, () -> extractIndex(_srcmdl.getSeriesReactors().getFromBus()));
_col.put(ColumnMeta.SerreacBUSTO, () -> extractIndex(_srcmdl.getSeriesReactors().getToBus()));
_col.put(ColumnMeta.SerreacOOS, () -> _srcmdl.getSeriesReactors().isOutOfSvc());
_col.put(ColumnMeta.SerreacPFROM, () -> _srcmdl.getSeriesReactors().getFromP());
_col.put(ColumnMeta.SerreacQFROM, () -> _srcmdl.getSeriesReactors().getFromQ());
_col.put(ColumnMeta.SerreacPTO, () -> _srcmdl.getSeriesReactors().getToP());
_col.put(ColumnMeta.SerreacQTO, () -> _srcmdl.getSeriesReactors().getToQ());
_col.put(ColumnMeta.SerreacR, () -> _srcmdl.getSeriesReactors().getR());
_col.put(ColumnMeta.SerreacX, () -> _srcmdl.getSeriesReactors().getX());
_col.put(ColumnMeta.SerreacRATLT, () -> _srcmdl.getSeriesReactors().getLTRating());
_col.put(ColumnMeta.PhashID, () -> _srcmdl.getPhaseShifters().getID());
_col.put(ColumnMeta.PhashNAME, () -> _srcmdl.getPhaseShifters().getName());
_col.put(ColumnMeta.PhashBUSFROM, () -> extractIndex(_srcmdl.getPhaseShifters().getFromBus()));
_col.put(ColumnMeta.PhashBUSTO, () -> extractIndex(_srcmdl.getPhaseShifters().getToBus()));
_col.put(ColumnMeta.PhashOOS, () -> _srcmdl.getPhaseShifters().isOutOfSvc());
_col.put(ColumnMeta.PhashPFROM, () -> _srcmdl.getPhaseShifters().getFromP());
_col.put(ColumnMeta.PhashQFROM, () -> _srcmdl.getPhaseShifters().getFromQ());
_col.put(ColumnMeta.PhashPTO, () -> _srcmdl.getPhaseShifters().getToP());
_col.put(ColumnMeta.PhashQTO, () -> _srcmdl.getPhaseShifters().getToQ());
_col.put(ColumnMeta.PhashR, () -> _srcmdl.getPhaseShifters().getR());
_col.put(ColumnMeta.PhashX, () -> _srcmdl.getPhaseShifters().getX());
_col.put(ColumnMeta.PhashGMAG, () -> _srcmdl.getPhaseShifters().getGmag());
_col.put(ColumnMeta.PhashBMAG, () -> _srcmdl.getPhaseShifters().getBmag());
_col.put(ColumnMeta.PhashCTRLMODE, () -> _srcmdl.getPhaseShifters().getControlMode());
_col.put(ColumnMeta.PhashANG, () -> _srcmdl.getPhaseShifters().getShift());
_col.put(ColumnMeta.PhashTAPFROM, () -> _srcmdl.getPhaseShifters().getFromTap());
_col.put(ColumnMeta.PhashTAPTO, () -> _srcmdl.getPhaseShifters().getToTap());
_col.put(ColumnMeta.PhashRATLT, () -> _srcmdl.getPhaseShifters().getLTRating());
_col.put(ColumnMeta.TfmrID, () -> _srcmdl.getTransformers().getID());
_col.put(ColumnMeta.TfmrNAME, () -> _srcmdl.getTransformers().getName());
_col.put(ColumnMeta.TfmrBUSFROM, () -> extractIndex(_srcmdl.getTransformers().getFromBus()));
_col.put(ColumnMeta.TfmrBUSTO, () -> extractIndex(_srcmdl.getTransformers().getToBus()));
_col.put(ColumnMeta.TfmrOOS, () -> _srcmdl.getTransformers().isOutOfSvc());
_col.put(ColumnMeta.TfmrPFROM, () -> _srcmdl.getTransformers().getFromP());
_col.put(ColumnMeta.TfmrQFROM, () -> _srcmdl.getTransformers().getFromQ());
_col.put(ColumnMeta.TfmrPTO, () -> _srcmdl.getTransformers().getToP());
_col.put(ColumnMeta.TfmrQTO, () -> _srcmdl.getTransformers().getToQ());
_col.put(ColumnMeta.TfmrR, () -> _srcmdl.getTransformers().getR());
_col.put(ColumnMeta.TfmrX, () -> _srcmdl.getTransformers().getX());
_col.put(ColumnMeta.TfmrGMAG, () -> _srcmdl.getTransformers().getGmag());
_col.put(ColumnMeta.TfmrBMAG, () -> _srcmdl.getTransformers().getBmag());
_col.put(ColumnMeta.TfmrANG, () -> _srcmdl.getTransformers().getShift());
_col.put(ColumnMeta.TfmrTAPFROM, () -> _srcmdl.getTransformers().getFromTap());
_col.put(ColumnMeta.TfmrTAPTO, () -> _srcmdl.getTransformers().getToTap());
_col.put(ColumnMeta.TfmrMNTPFROM, () -> _srcmdl.getTransformers().getFromMinTap());
_col.put(ColumnMeta.TfmrMNTPTO, () -> _srcmdl.getTransformers().getToMinTap());
_col.put(ColumnMeta.TfmrMXTPFROM, () -> _srcmdl.getTransformers().getFromMaxTap());
_col.put(ColumnMeta.TfmrMXTPTO, () -> _srcmdl.getTransformers().getToMaxTap());
_col.put(ColumnMeta.TfmrSTEPFROM, () -> _srcmdl.getTransformers().getFromStepSize());
_col.put(ColumnMeta.TfmrSTEPTO, () -> _srcmdl.getTransformers().getToStepSize());
_col.put(ColumnMeta.TfmrRATLT, () -> _srcmdl.getTransformers().getLTRating());
_col.put(ColumnMeta.TfmrMINREGKV, () -> _srcmdl.getTransformers().getMinKV());
_col.put(ColumnMeta.TfmrMAXREGKV, () -> _srcmdl.getTransformers().getMaxKV());
_col.put(ColumnMeta.TfmrREGBUS, () -> extractIndex(_srcmdl.getTransformers().getRegBus()));
_col.put(ColumnMeta.TfmrREGENAB, () -> _srcmdl.getTransformers().isRegEnabled());
_col.put(ColumnMeta.TfmrHASREG, () -> _srcmdl.getTransformers().hasLTC());
_col.put(ColumnMeta.TfmrREGSIDE, () -> _srcmdl.getTransformers().getRegSide());
_col.put(ColumnMeta.SwID, () -> _srcmdl.getSwitches().getID());
_col.put(ColumnMeta.SwNAME, () -> _srcmdl.getSwitches().getName());
_col.put(ColumnMeta.SwBUSFROM, () -> extractIndex(_srcmdl.getSwitches().getFromBus()));
_col.put(ColumnMeta.SwBUSTO, () -> extractIndex(_srcmdl.getSwitches().getToBus()));
_col.put(ColumnMeta.SwOOS, () -> _srcmdl.getSwitches().isOutOfSvc());
_col.put(ColumnMeta.SwPFROM, () -> _srcmdl.getSwitches().getFromP());
_col.put(ColumnMeta.SwQFROM, () -> _srcmdl.getSwitches().getFromQ());
_col.put(ColumnMeta.SwPTO, () -> _srcmdl.getSwitches().getToP());
_col.put(ColumnMeta.SwQTO, () -> _srcmdl.getSwitches().getToQ());
_col.put(ColumnMeta.SwSTATE, () -> _srcmdl.getSwitches().getState());
_col.put(ColumnMeta.SwOPLD, () -> _srcmdl.getSwitches().isOperableUnderLoad());
_col.put(ColumnMeta.SwENAB, () -> _srcmdl.getSwitches().isEnabled());
}
<T extends BaseObject> int[] extractIndex(T[] obj)
{
int n = obj.length;
int[] rv = new int[n];
for(int i=0; i < n; ++i)
rv[i] = obj[i].getIndex();
return rv;
}
@Override
protected BusListI loadBuses() throws PAModelException
{
return new BusListI(_m, _srcmdl.getBuses().getKeys());
}
@Override
protected SwitchListI loadSwitches() throws PAModelException
{
return new SwitchListI(_m, _srcmdl.getSwitches().getKeys());
}
@Override
protected LineListI loadLines() throws PAModelException
{
return new LineListI(_m, _srcmdl.getLines().getKeys());
}
@Override
protected AreaListI loadAreas() throws PAModelException
{
return new AreaListI(_m, _srcmdl.getAreas().getKeys(), extractKeys(_srcmdl.getBuses().getArea()));
}
<T extends BaseObject> int[] extractKeys(T[] obj)
{
int n = obj.length;
int[] rv = new int[n];
for(int i=0; i < n; ++i)
rv[i] = obj[i].getKey();
return rv;
}
@Override
protected OwnerListI loadOwners() throws PAModelException
{
return new OwnerListI(_m, _srcmdl.getOwners().getKeys(), extractKeys(_srcmdl.getBuses().getOwner()));
}
@Override
protected StationListI loadStations() throws PAModelException
{
return new StationListI(_m, _srcmdl.getStations().getKeys(), extractKeys(_srcmdl.getBuses().getStation()));
}
@Override
protected VoltageLevelListI loadVoltageLevels() throws PAModelException
{
return new VoltageLevelListI(_m, _srcmdl.getVoltageLevels().getKeys(),
extractKeys(_srcmdl.getBuses().getVoltageLevel()));
}
@Override
protected IslandList loadIslands() throws PAModelException
{
return new IslandListI(_m);
}
@Override
protected SVCListI loadSVCs() throws PAModelException
{
return new SVCListI(_m, _srcmdl.getSVCs().getKeys());
}
@Override
protected SwitchedShuntListI loadSwitchedShunts() throws PAModelException
{
return new SwitchedShuntListI(_m, _srcmdl.getSwitchedShunts().getKeys());
}
@Override
protected TwoTermDCLineListI loadTwoTermDCLines() throws PAModelException
{
return new TwoTermDCLineListI(_m, _srcmdl.getTwoTermDCLines().getKeys());
}
@Override
protected ShuntCapListI loadShuntCapacitors() throws PAModelException
{
return new ShuntCapListI(_m, _srcmdl.getShuntCapacitors().getKeys());
}
@Override
protected ShuntReacListI loadShuntReactors() throws PAModelException
{
return new ShuntReacListI(_m, _srcmdl.getShuntReactors().getKeys());
}
@Override
protected LoadListI loadLoads() throws PAModelException
{
return new LoadListI(_m, _srcmdl.getLoads().getKeys());
}
@Override
protected GenListI loadGens() throws PAModelException
{
return new GenListI(_m, _srcmdl.getGenerators().getKeys());
}
@Override
protected SeriesCapListI loadSeriesCapacitors() throws PAModelException
{
return new SeriesCapListI(_m, _srcmdl.getSeriesCapacitors().getKeys());
}
@Override
protected SeriesReacListI loadSeriesReactors() throws PAModelException
{
return new SeriesReacListI(_m, _srcmdl.getSeriesReactors().getKeys());
}
@Override
protected PhaseShifterListI loadPhaseShifters() throws PAModelException
{
return new PhaseShifterListI(_m, _srcmdl.getPhaseShifters().getKeys());
}
@Override
protected TransformerListI loadTransformers() throws PAModelException
{
return new TransformerListI(_m, _srcmdl.getTransformers().getKeys());
}
@SuppressWarnings("unchecked")
@Override
protected <R> R load(ListMetaType ltype, ColumnMeta ctype, int[] keys) throws PAModelException
{
R r = (R) _col.get(ctype).load();
if (_local.contains(ctype))
{
Class<?> t = r.getClass().getComponentType();
int len = keys.length;
R v = (R) Array.newInstance(t, len);
System.arraycopy(r, 0, v, 0, len);
r = v;
}
return r;
}
}