forked from OpenGridMap/CIM2Simulink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createSystem.m
4619 lines (4336 loc) · 210 KB
/
createSystem.m
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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% This script handles the generation of a Simulink model for large power
% systems.
%
% Author: First Name: Bernhard
% Last Name: Krop
% E-Mail: b.krop@gmx.de
%
% Last time updated: 06. March 2016
function createSystem()
% Use global variables.
global g_sTitle g_cObjects;
% Make variables global.
global g_iHeight g_iIterator g_iOffset g_iWidth g_dSystem g_cBlocks g_cTemporaryBlocks;
% Check whether a Simulink model with the same name is open.
if bdIsLoaded(g_sTitle)
warning('Another model with the name ''%s'' is open!', g_sTitle);
l_iCounter = 1;
while(bdIsLoaded([g_sTitle, num2str(l_iCounter)]))
l_iCounter = l_iCounter + 1;
end
g_sTitle = [g_sTitle, num2str(l_iCounter)];
end
% The Simulink model.
g_dSystem = new_system(g_sTitle);
% The width of each block.
g_iWidth = 30;
% The height of each block.
g_iHeight = 30;
% The offset between blocks.
g_iOffset = 50;
% Check if CIM objects exists.
if(size(g_cObjects) <= 1)
clearvars -global -except g_dSystem;
return;
end
% A cell which contains all information of already created blocks. It
% contains:
%
% The RDF-ID of the object;
% The name of the block;
% The path of the parent block;
% The number of blocks in the (sub)system.
g_cBlocks = {'', g_sTitle, '', 0};
% Blocks, which are created temporary and must be deleted at the end of
% this script, are stored in 'g_cTemporaryBlocks'. It contains:
%
% The RDF-ID of the object;
% The name of the block;
% The path of the parent block.
g_cTemporaryBlocks = cell(0, 3);
% Create enums.
Simulink.defineIntEnumType('Boolean', {'true', 'false'}, [0, 1]);
Simulink.defineIntEnumType('CoolantType', {'air', 'hydrogenGas', 'water'}, [0, 1, 2]);
Simulink.defineIntEnumType('FuelType', {'coal', 'gas', 'lignite', 'oil'}, [0, 1, 2, 3]);
Simulink.defineIntEnumType('GeneratorControlSource', {'unavailable', 'offAGC', 'onAGC', 'plantControl'}, [0, 1, 2, 3]);
Simulink.defineIntEnumType('ParametersFormType', {'timeConstantReactance', 'equivalentCircuit'}, [0, 1]);
Simulink.defineIntEnumType('PhaseCode', {'A', 'AB', 'ABC', 'ABCN', 'ABN', 'AC', 'ACN', 'AN', 'B', 'BC', 'BCN', 'BN', 'C', 'CN', 'N', 'splitSecondary12N', 'splitSecondary1N', 'splitSecondary2N'}, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]);
Simulink.defineIntEnumType('PhaseShuntConnectionKind', {'D', 'Y', 'Yn', 'I'}, [0, 1, 2, 3]);
Simulink.defineIntEnumType('RegulatingControlModeKind', {'activePower', 'admittance', 'currentFlow', 'fixed', 'powerFactor', 'reactivePower', 'temperature', 'timeScheduled', 'voltage'}, [0, 1, 2, 3, 4, 5, 6, 7, 8]);
Simulink.defineIntEnumType('SynchronousMachineOperatingMode', {'condenser', 'generator'}, [0, 1]);
Simulink.defineIntEnumType('SynchronousMachineType', {'condenser', 'generator', 'generator_or_condenser'}, [0, 1, 2]);
Simulink.defineIntEnumType('UnitMultiplier', {'p', 'n', 'micro', 'm', 'c', 'd', 'k', 'M', 'G', 'T', 'none'}, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
Simulink.defineIntEnumType('UnitSymbol', {'VA', 'W', 'VAr', 'VAh', 'Wh', 'VArh', 'V', 'ohm', 'A', 'F', 'H', 'degC', 's', 'min_', 'h', 'deg', 'rad', 'J', 'N', 'S', 'none', 'Hz', 'g', 'Pa', 'm', 'm2', 'm3'}, [0, 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]);
Simulink.defineIntEnumType('WindingConnection', {'D', 'Y', 'Z', 'Yn', 'Zn', 'A', 'I'}, [0, 1, 2, 3, 4, 5, 6]);
Simulink.defineIntEnumType('WindingType', {'primary', 'secondary', 'tertiary'}, [0, 1, 2]);
% Create all objects.
for g_iIterator = 1 : size(g_cObjects)
switch(g_cObjects{g_iIterator})
case ('ACLineSegment')
createACLineSegment();
case ('Analog')
createAnalog();
case ('BaseVoltage')
createBaseVoltage();
case ('Breaker')
createBreaker();
case ('BusbarSection')
createBusbarSection();
case ('ConnectivityNode')
createConnectivityNode();
case ('Disconnector')
createDisconnector();
case ('EnergySource')
createEnergySource();
case ('GeographicalRegion')
createGeographicalRegion();
case ('Line')
createLine();
case ('NonConformLoad')
createNonConformLoad();
case ('PowerTransformer')
createPowerTransformer();
case ('RegulatingControl')
createRegulatingControl();
case ('SubGeographicalRegion')
createSubGeographicalRegion();
case ('Substation')
createSubstation();
case ('SynchronousMachine')
createSynchronousMachine();
case ('Terminal')
createTerminal();
case ('ThermalGeneratingUnit')
createThermalGeneratingUnit();
case ('TransformerWinding')
createTransformerWinding();
case ('VoltageLevel')
createVoltageLevel();
otherwise
warning('Could not define class ''%s''!', g_cObjects{g_iIterator, 1});
continue;
end % End of switch.
end % End of for.
% Delete all temporary blocks.
for l_iI = 1 : size(g_cTemporaryBlocks)
delete_block(strcat(g_cTemporaryBlocks{l_iI, 3}, '/', g_cTemporaryBlocks{l_iI, 2}));
end
% Clean up everything, that is not needed anymore.
clearvars -global -except g_dSystem;
end % End of main function.
% This function returns the index of the position, based on the number of
% blocks.
% @param number The number of blocks in the current
% (sub)system.
% @return index A 1x2 cell with the index of the position. The
% left cell contains the x-position, the right
% one the y-position.
function index = getPositionIndex(number)
% Check input parameter.
if(~exist('number', 'var') || ~isnumeric(number))
index = {0, 0};
return;
end
% The current maximum length.
l_iLength = 1;
% Determine current dimension.
while(true)
if(number < (l_iLength * l_iLength))
break;
end
l_iLength = l_iLength + 1;
end
% Remove all positions of smaller dimensions.
number = number - ((l_iLength - 1) * (l_iLength - 1));
% Determine x- and y-position.
if(number < (l_iLength - 1))
l_iX = l_iLength - 1;
l_iY = number;
else
l_iX = number - (l_iLength - 1);
l_iY = l_iLength - 1;
end
% Clean up everthing, that is not needed anymore.
index = {l_iX, l_iY};
clearvars -except index;
end % End of function 'getPositionIndex'.
% This function parses all attributes of the current CIM object.
function parseAttributes()
% Use global variables.
global g_iIterator g_cObjects;
% Make variables global.
global g_cAttributes;
l_sAttributes = g_cObjects{g_iIterator, 3};
% Pre-allocate g_cAttributes.
l_cSize = size(strfind(l_sAttributes, '</')) + size(strfind(l_sAttributes, '/>'));
g_cAttributes = cell(l_cSize(2), 1);
% Parse attributes.
l_cFind = strfind(l_sAttributes, '>');
l_iI = 1;
while(size(l_cFind) > 0)
if(strcmp(l_sAttributes(l_cFind(1) - 1), '/'))
g_cAttributes{l_iI} = l_sAttributes(1 : l_cFind(1));
l_sAttributes = l_sAttributes(l_cFind(1) + 1 : end);
else
g_cAttributes{l_iI} = l_sAttributes(1 : l_cFind(2));
l_sAttributes = l_sAttributes(l_cFind(2) + 1 : end);
end
l_cFind = strfind(l_sAttributes, '>');
l_iI = l_iI + 1;
end
% Clean up everything, that is not needed anymore.
clearvars;
end % End of function 'parseAttributes'.
% This function copies temporary created blocks to its final destinations
% and deletes the original blocks.
% @param blocks A string containing the RDF-IDs of the blocks,
% which are to copy. The IDs are separated by a
% white space.
% @param path The path of the new parent block of the blocks,
% which are to copy.
% @param number The number of blocks, which are in the new
% parent. This is an optional parameter. If it is
% missing, it is assumed to be zero.
% @param delete True, if the temporary block has to be deleted.
% False, otherwise. This is an optional
% parameter. If it is missing, it is assumed to
% be true.
% @return newNumber The new number of blocks, which are now in the
% new parent.
function newNumber = copyBlocks(blocks, path, number, delete)
% Use global variables.
global g_iHeight g_iOffset g_iWidth g_cBlocks g_cTemporaryBlocks;
% Check number.
if(~exist('number', 'var') || ~isnumeric(number))
number = 0;
end
% Check delete.
if(~exist('delete', 'var') || ~islogical(delete))
delete = true;
end
% Only continue, if blocks and path exists and are strings.
if(exist('blocks', 'var') && ischar(blocks) && exist('path', 'var') && ischar(path))
l_cBlocks = strsplit(blocks);
l_cSize = size(l_cBlocks);
% Repeat for every block.
for l_iI = 1 : l_cSize(2)
% Search for the right block.
for l_iJ = 1 : size(g_cTemporaryBlocks)
if(strcmp(l_cBlocks{1, l_iI}, g_cTemporaryBlocks{l_iJ}))
% Copy the block.
l_cPos = getPositionIndex(number);
l_iLeft = l_cPos{1, 1} * (g_iOffset + g_iWidth) + g_iOffset;
l_iTop = l_cPos{1, 2} * (g_iOffset + g_iHeight) + g_iOffset;
l_aPosition = [l_iLeft, l_iTop, l_iLeft + g_iWidth, l_iTop + g_iHeight];
add_block(strcat(g_cTemporaryBlocks{l_iJ, 3}, '/', g_cTemporaryBlocks{l_iJ, 2}), strcat(path, '/', g_cTemporaryBlocks{l_iJ, 2}), 'Position', l_aPosition);
number = number + 1;
if(delete)
% Delete the temporary block.
delete_block(strcat(g_cTemporaryBlocks{l_iJ, 3}, '/', g_cTemporaryBlocks{l_iJ, 2}));
g_cTemporaryBlocks(l_iJ, :) = [];
% Correct the new path of the block in 'g_cBlocks'.
for l_iK = 1 : size(g_cBlocks)
if(strcmp(l_cBlocks{1, l_iI}, g_cBlocks{l_iK}))
g_cBlocks{l_iK, 3} = path;
break;
end
end
end
break;
end % End of if.
end % End of for.
end % End of for.
end % End of if.
% Clean up everything, that is not needed anymore.
newNumber = number;
clearvars -except newNumber;
end % End of function 'copyBlocks'.
% The following functions are creating CIM objects in Simulink. For
% example, createBaseVoltage creates either a DC or an AC Voltage Source.
function createACLineSegment()
% Use global variables.
global g_iHeight g_iIterator g_iOffset g_iWidth g_cAttributes g_cBlocks g_cObjects g_cTemporaryBlocks g_sTitle;
% Attributes of...
% ...IdentifiedObject:
global g_sDescription g_sName;
% ...Equipment:
global g_sEquipmentContainer;
% ...ConductingEquipment:
global g_sPhases;
% ...Conductor:
global g_sLength;
% ...ACLineSegment:
l_sCapacitance = '[0 0]';
l_sFrequency = '50.0';
l_sR = '0.0';
l_sR0 = '0.0';
l_sX = '0.0';
l_sX0 = '0.0';
parseAttributes();
createConductor();
% Identify attributes.
for l_iI = 1 : size(g_cAttributes)
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.b0ch');
if(size(l_cFind) > 0)
% @Note:
% Currently not used.
%l_sB0ch = g_cAttributes{l_iI}(l_cFind(1) + 23 : l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.bch');
if(size(l_cFind) > 0)
% @Note:
% Currently not used.
%l_sBch = g_cAttributes{l_iI}(l_cFind(1) + 22 : l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.Clamp');
if(size(l_cFind) > 0)
% @Note:
% Currently not used.
%l_sClamp = g_cAttributes{l_iI}(l_cFind(1) + 39 : end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.ConductorAssets');
if(size(l_cFind) > 0)
% @Note:
% Currently not used.
%l_sConductorAssets = g_cAttributes{l_iI}(l_cFind(1) + 49 : end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.ConductorInfo');
if(size(l_cFind) > 0)
% @Note:
% Currently not used.
%l_sConductorInfo = g_cAttributes{l_iI}(l_cFind(1) + 47 : end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.Cut');
if(size(l_cFind) > 0)
% @Note:
% Currently not used.
%l_sCut = g_cAttributes{l_iI}(l_cFind(1) + 37 : end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.g0ch');
if(size(l_cFind) > 0)
% @Note:
% Currently not used.
%l_sG0ch = g_cAttributes{l_iI}(l_cFind(1) + 23 : l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.gch');
if(size(l_cFind) > 0)
% @Note:
% Currently not used.
%l_sGch = g_cAttributes{l_iI}(l_cFind(1) + 22 : l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.PhaseImpedance');
if(size(l_cFind) > 0)
% @Note:
% Currently not used.
%l_sPhaseImpedance = g_cAttributes{l_iI}(l_cFind(1) + 48 : end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.r0');
if(size(l_cFind) > 0)
l_sR0 = g_cAttributes{l_iI}(l_cFind(1) + 21 : l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.r');
if(size(l_cFind) > 0)
l_sR = g_cAttributes{l_iI}(l_cFind(1) + 20 : l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.SequenceImpedance');
if(size(l_cFind) > 0)
% @Note:
% Currently not used.
%l_sSequenceImpedance = g_cAttributes{l_iI}(l_cFind(1) + 51 : end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.x0');
if(size(l_cFind) > 0)
l_sX0 = g_cAttributes{l_iI}(l_cFind(1) + 21 : l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ACLineSegment.x');
if(size(l_cFind) > 0)
l_sX = g_cAttributes{l_iI}(l_cFind(1) + 20 : l_cFind(2) - 3);
continue;
end
end % End of for.
% @Equipment.EquipmentContainer:
% Every Equipment must be contained by a EquipmentContainer. If
% Equipment.EquipmentContainer doesn't exist, this Equipment will be
% created temporarily at the top level of the system.
if(~strcmp(g_sEquipmentContainer, ''))
for l_iI = 1 : size(g_cBlocks)
if(strcmp(g_sEquipmentContainer, g_cBlocks{l_iI}))
l_sParent = strcat(g_cBlocks{l_iI, 3}, '/', g_cBlocks{l_iI, 2});
break;
end
end
end
if(~exist('l_sParent', 'var'))
l_sParent = g_sTitle;
l_iI = 1;
end
% @ConductingEquipment.phases:
% The carried phases of this ACLineSegment.
switch(g_sPhases)
case('A')
g_sPhases = '1';
case('AB')
g_sPhases = '2';
case('AC')
g_sPhases = '2';
case('AN')
g_sPhases = '1';
case('ABC')
g_sPhases = '3';
case('ABN')
g_sPhases = '2';
case('ACN')
g_sPhases = '2';
case('ABCN')
g_sPhases = '3';
case('B')
g_sPhases = '1';
case('BC')
g_sPhases = '2';
case('BN')
g_sPhases = '1';
case('BCN')
g_sPhases = '2';
case('C')
g_sPhases = '1';
case('CN')
g_sPhases = '1';
case('splitSecondary1N')
g_sPhases = '1';
case('splitSecondary2N')
g_sPhases = '1';
case('splitSecondary12N')
g_sPhases = '2';
otherwise
g_sPhases = '1';
end
% @Conductor.length:
% The segment length (in m) for calculating line section capabilities.
% In Simulink, the length is needed in km. Therefore, it will be
% divided by 1000.
g_sLength = num2str(str2double(g_sLength) / 1000.0);
% @ACLineSegment.r, @ACLineSegment.r0:
% The positive and zero resistance of the entire line segment. In
% Simulink, resistance / km is needed. Therefore the resistances will
% devided by the length.
if(str2double(g_sLength) ~= 0)
l_sR = num2str(str2double(l_sR) / str2double(g_sLength));
l_sR0 = num2str(str2double(l_sR0) / str2double(g_sLength));
end
l_sResistance = strcat('[', l_sR, {' '}, l_sR0, ']');
% @ACLineSegment.x, @ACLineSegment.x0:
% The positive and zero reactance of the entire line segment. In
% Simulink, inductance per km is needed. The inductance can be
% calculated out of the reactances by the formula
% "L = X / (2 * PI * f)". f = 50 is assumed. To get the inductance per
% km, it has to be devided by the length.
l_sL = num2str(str2double(l_sX) / (2 * pi * str2double(l_sFrequency)));
l_sL0 = num2str(str2double(l_sX0) / (2 * pi * str2double(l_sFrequency)));
if(str2double(g_sLength) ~= 0)
l_sL = num2str(str2double(l_sL) / str2double(g_sLength));
l_sL0 = num2str(str2double(l_sL0) / str2double(g_sLength));
end
l_sInductance = strcat('[', l_sL, {' '}, l_sL0, ']');
% Create this ACLineSegment.
l_cPos = getPositionIndex(g_cBlocks{l_iI, 4});
l_iLeft = l_cPos{1, 1} * (g_iOffset + g_iWidth) + g_iOffset;
l_iTop = l_cPos{1, 2} * (g_iOffset + g_iHeight) + g_iOffset;
l_aPosition = [l_iLeft, l_iTop, l_iLeft + g_iWidth, l_iTop + g_iHeight];
add_block('powerlib/Elements/Distributed Parameters Line', strcat(l_sParent, '/', g_sName), 'Position', l_aPosition);
set_param(strcat(l_sParent, '/', g_sName), 'Description', g_sDescription, 'Phases', g_sPhases, 'Length', g_sLength, 'Resistance', l_sResistance{1}, 'Inductance', l_sInductance{1}, 'Frequency', l_sFrequency, 'Capacitance', l_sCapacitance);
% Update g_cBlocks and g_cTemporaryBlocks.
g_cBlocks{l_iI, 4} = g_cBlocks{l_iI, 4} + 1;
g_cBlocks = vertcat(g_cBlocks, {g_cObjects{g_iIterator}, g_sName, l_sParent, 0});
if(strcmp(l_sParent, g_sTitle))
g_cTemporaryBlocks = vertcat(g_cTemporaryBlocks, {g_cObjects{g_iIterator}, g_sName, l_sParent});
end
% Clean up everything, that is not needed anymore.
clearvars -global -except g_iHeight g_iIterator g_iOffset g_iWidth g_dSystem g_sTitle g_cBlocks g_cObjects g_cTemporaryBlocks;
end % End of function 'createACLineSegment'.
function createAnalog()
% Use global variables.
global g_iIterator g_iHeight g_iWidth g_iOffset g_cAttributes g_cObjects g_cBlocks;
parseAttributes();
% Identify attributes.
for l_iI = 1:size(g_cAttributes)
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:IdentifiedObject.aliasName');
if(size(l_cFind) > 0)
if(exist('l_sName', 'var'))
l_sName = strcat(l_sName, ' (', g_cAttributes{l_iI}(l_cFind(1) + 31:l_cFind(2) - 3), ')');
else
l_sName = strcat('(', g_cAttributes{l_iI}(l_cFind(1) + 31:l_cFind(2) - 3), ')');
end
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:IdentifiedObject.name');
if(size(l_cFind) > 0)
if(exist('l_sName', 'var'))
l_sName = strcat(g_cAttributes{l_iI}(l_cFind(1) + 26:l_cFind(2) - 3), ' ', l_sName);
else
l_sName = g_cAttributes{l_iI}(l_cFind(1) + 26:l_cFind(2) - 3);
end
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Measurement.MemberOf_PowerSystemResource');
if(size(l_cFind) > 0)
l_sMemberOf_PowerSystemResource = g_cAttributes{l_iI}(l_cFind(1) + 60:end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Measurement.measurementType');
if(size(l_cFind) > 0)
l_sMeasurementType = g_cAttributes{l_iI}(l_cFind(1) + 32:l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Measurement.phases');
if(size(l_cFind) > 0)
l_sPhases = g_cAttributes{l_iI}(l_cFind(1) + 23:l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Measurement.Terminal');
if(size(l_cFind) > 0)
l_sTerminal = g_cAttributes{l_iI}(l_cFind(1) + 40:end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Measurement.unitMultiplier');
if(size(l_cFind) > 0)
l_sUnitMultiplier = g_cAttributes{l_iI}(l_cFind(1) + 46:end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Measurement.unitSymbol');
if(size(l_cFind) > 0)
l_sUnitSymbol = g_cAttributes{l_iI}(l_cFind(1) + 42:end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Analog.LimitSets');
if(size(l_cFind) > 0)
l_cFind = strfind(g_cAttributes{l_iI}, '"');
l_cSize = size(l_cFind);
l_cLimitSets = cell(l_cSize(1, 2) / 2, 1);
l_iJ = 1;
while (l_iJ < l_cSize(1, 2))
l_cLimitSets{(l_iJ + 1) / 2} = g_cAttributes{l_iI}(l_cFind(l_iJ) + 2:l_cFind(l_iJ + 1) - 1);
l_iJ = l_iJ + 2;
end
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Analog.maxValue');
if(size(l_cFind) > 0)
l_sMaxValue = g_cAttributes{l_iI}(l_cFind(1) + 20:l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Analog.minValue');
if(size(l_cFind) > 0)
l_sMinValue = g_cAttributes{l_iI}(l_cFind(1) + 20:l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Analog.normalValue');
if(size(l_cFind) > 0)
l_sNormalValue = g_cAttributes{l_iI}(l_cFind(1) + 23:l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Analog.positiveFlowIn');
if(size(l_cFind) > 0)
l_sPositiveFlowIn = strcat('Boolean.', g_cAttributes{l_iI}(l_cFind(1) + 26:l_cFind(2) - 3));
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Analog.SetPoint');
if(size(l_cFind) > 0)
l_sSetPoint = g_cAttributes{l_iI}(l_cFind(1) + 40:end - 3);
continue;
end
% Could not identify the attribute.
warning('Could not identify attribute for Analog! (RDF-ID: %s)', g_cObjects{g_iIterator,2});
end % End of for.
% Create this Analog.
% Every Analog is part of a PowerSystemResource. Therefore,
% Measurement.MemberOf_PowerSystemResource has to exist. If it doesn't
% exist, this block cannot be created.
if(~exist('l_sMemberOf_PowerSystemResource', 'var'))
warning('Could not create Analog, because PowerSystemResource is missing! (RDF-ID: %s)', g_cObjects{g_iIterator,2});
return;
end
for l_iI = 1:size(g_cBlocks)
if(strcmp(g_cBlocks{l_iI, 1}, l_sMemberOf_PowerSystemResource))
l_sParent = strcat(g_cBlocks{l_iI, 3}, '/', g_cBlocks{l_iI, 2});
break;
end
end
if(~exist('l_sParent', 'var'))
warning('Could not create Analog, because could not find PowerSystemResource, belonging to RDF-Resource! (RDF-ID: %s)', g_cObjects{g_iIterator, 2});
return;
end
% The name of the block in following format: IdentifiedObject.name
% (IdentifiedObject.aliasName). If both variables don't exist, it is
% the name of the class, followed by the value of 'g_iIterator'.
if(~exist('l_sName', 'var'))
l_sName = strcat('Analog', g_iIterator);
end
% The type of measurement of this Analog. If
% Measurement.measurementType exists, it is appended to the name of the
% block via [ and ].
if(exist('l_sMeasurementType', 'var'))
l_sName = strcat(l_sName, ' [', l_sMeasurementType, ']');
end
% Now, the block for this Analog can be created. Because it contains
% some Constants, it is a Subsystem.
l_cPos = getPositionIndex(g_cBlocks{l_iI, 4});
l_iLeft = l_cPos{1, 1} * (g_iOffset + g_iWidth) + g_iOffset;
l_iTop = l_cPos{1, 2} * (g_iOffset + g_iHeight) + g_iOffset;
l_aPosition = [l_iLeft, l_iTop, l_iLeft + g_iWidth, l_iTop + g_iHeight];
add_block('built-in/Subsystem', strcat(l_sParent, '/', l_sName), 'Position', l_aPosition);
% The kind of phases, this Analog measures. If Measurement.phases
% doesn't exist, it is assumed to be 'ABCN'.
l_cPos = getPositionIndex(0);
l_iLeft = l_cPos{1, 1} * (g_iOffset + g_iWidth) + g_iOffset;
l_iTop = l_cPos{1, 2} * (g_iOffset + g_iHeight) + g_iOffset;
l_aPosition = [l_iLeft, l_iTop, l_iLeft + g_iWidth, l_iTop + g_iHeight];
add_block('simulink/Sources/Enumerated Constant', strcat(l_sParent, '/', l_sName, '/phases'), 'Position', l_aPosition);
if(exist('l_sPhases', 'var'))
set_param(strcat(l_sParent, '/', l_sName, '/phases'), 'OutDataTypeStr', 'Enum: PhaseCode', 'Value', l_sPhases);
else
set_param(strcat(l_sParent, '/', l_sName, '/phases'), 'OutDataTypeStr', 'Enum: PhaseCode', 'Value', 'PhaseCode.ABCN');
end
% The unit multiplier of this Analog. If Measurement.unitMultiplier
% doesn't exist, it is set to 'none'.
l_cPos = getPositionIndex(1);
l_iLeft = l_cPos{1, 1} * (g_iOffset + g_iWidth) + g_iOffset;
l_iTop = l_cPos{1, 2} * (g_iOffset + g_iHeight) + g_iOffset;
l_aPosition = [l_iLeft, l_iTop, l_iLeft + g_iWidth, l_iTop + g_iHeight];
add_block('simulink/Sources/Enumerated Constant', strcat(l_sParent, '/', l_sName, '/unitMultiplier'), 'Position', l_aPosition);
if(exist('l_sUnitMultiplier', 'var'))
set_param(strcat(l_sParent, '/', l_sName, '/unitMultiplier'), 'OutDataTypeStr', 'Enum: UnitMultiplier', 'Value', l_sUnitMultiplier);
else
set_param(strcat(l_sParent, '/', l_sName, '/unitMultiplier'), 'OutDataTypeStr', 'Enum: UnitMultiplier', 'Value', 'UnitMultiplier.none');
end
% The unit symbol of this Analog. If Measurement.unitSymbol doesn't
% exist, it is set to 'none'.
l_cPos = getPositionIndex(2);
l_iLeft = l_cPos{1, 1} * (g_iOffset + g_iWidth) + g_iOffset;
l_iTop = l_cPos{1, 2} * (g_iOffset + g_iHeight) + g_iOffset;
l_aPosition = [l_iLeft, l_iTop, l_iLeft + g_iWidth, l_iTop + g_iHeight];
add_block('simulink/Sources/Enumerated Constant', strcat(l_sParent, '/', l_sName, '/unitSymbol'), 'Position', l_aPosition);
if(exist('l_sUnitSymbol', 'var'))
set_param(strcat(l_sParent, '/', l_sName, '/unitSymbol'), 'OutDataTypeStr', 'Enum: UnitSymbol', 'Value', l_sUnitSymbol);
else
set_param(strcat(l_sParent, '/', l_sName, '/unitSymbol'), 'OutDataTypeStr', 'Enum: UnitSymbol', 'Value', 'UnitSymbol.none');
end
% The Terminal, this Analog is connected with. It is assumed, that the
% Terminal already exists, if Measurment.Terminal exists.
if(exist('l_sTerminal', 'var'))
for l_iJ = 1:size(g_cBlocks)
if(strcmp(g_cBlocks{l_iJ, 1}, l_sTerminal))
l_sT = strcat(g_cBlocks{l_iJ, 3}, g_cBlocks{l_iJ, 2});
break;
end
end
if(exist('l_sT', 'var'))
% TODO: Connect the found Terminal with this Analog.
warning('Connections from Analogs to Terminals are currently not implemented!');
else
warning('Could not find Terminal, belonging to RDF-Resource, for Analog! (RDF-ID: %s)', g_cObjects{g_iIterator, 2});
end
end
% The normal measurement value of this Analog (Analog.normalValue) and
% it's boundaries (Analog.minValue and Analog.maxValue).
l_cPos = getPositionIndex(3);
l_iLeft = l_cPos{1, 1} * (g_iOffset + g_iWidth) + g_iOffset;
l_iTop = l_cPos{1, 2} * (g_iOffset + g_iHeight) + g_iOffset;
l_aPosition = [l_iLeft, l_iTop, l_iLeft + g_iWidth, l_iTop + g_iHeight];
add_block('built-in/Constant', strcat(l_sParent, '/', l_sName, '/value'), 'Position', l_aPosition);
if(exist('l_sNormalValue', 'var'))
if(exist('l_sMinValue', 'var'))
if(exist('l_sMaxValue', 'var'))
set_param(strcat(l_sParent, '/', l_sName, '/value'), 'Value', l_sNormalValue, 'OutMin', l_sMinValue, 'OutMax', l_sMaxValue);
else
set_param(strcat(l_sParent, '/', l_sName, '/value'), 'Value', l_sNormalValue, 'OutMin', l_sMinValue);
end
else
if(exist('l_sMaxValue', 'var'))
set_param(strcat(l_sParent, '/', l_sName, '/value'), 'Value', l_sNormalValue, 'OutMax', l_sMaxValue);
else
set_param(strcat(l_sParent, '/', l_sName, '/value'), 'Value', l_sNormalValue);
end
end
else
if(exist('l_sMinValue', 'var'))
if(exist('l_sMaxValue', 'var'))
set_param(strcat(l_sParent, '/', l_sName, '/value'), 'Value', l_sMinValue, 'OutMin', l_sMinValue, 'OutMax', l_sMaxValue);
else
set_param(strcat(l_sParent, '/', l_sName, '/value'), 'Value', l_sMinValue, 'OutMin', l_sMinValue);
end
else
if(exist('l_sMaxValue', 'var'))
set_param(strcat(l_sParent, '/', l_sName, '/value'), 'Value', l_sMaxValue, 'OutMax', l_sMaxValue);
end
end
end % End of if.
% The Analog.positiveFlowIn indicates, whether the measured value flows
% into the PowerSystemResource. If it doesn't exist, it is assumed to
% be true.
l_cPos = getPositionIndex(4);
l_iLeft = l_cPos{1, 1} * (g_iOffset + g_iWidth) + g_iOffset;
l_iTop = l_cPos{1, 2} * (g_iOffset + g_iHeight) + g_iOffset;
l_aPosition = [l_iLeft, l_iTop, l_iLeft + g_iWidth, l_iTop + g_iHeight];
add_block('simulink/Sources/Enumerated Constant', strcat(l_sParent, '/', l_sName, '/positiveFlowIn'), 'Position', l_aPosition);
if(exist('l_sPositiveFlowIn', 'var'))
set_param(strcat(l_sParent, '/', l_sName, '/positiveFlowIn'), 'OutDataTypeStr', 'Enum: Boolean', 'Value', l_sPositiveFlowIn);
else
set_param(strcat(l_sParent, '/', l_sName, '/positiveFlowIn'), 'OutDataTypeStr', 'Enum: Boolean', 'Value', 'Boolean.true');
end
% The SetPoint, this Analog is connected with. It is assumed, that the
% SetPoint already exists, if Analog.SetPoint exists.
if(exist('l_sSetPoint', 'var'))
for l_iJ = 1:size(g_cBlocks)
if(strcmp(g_cBlocks{l_iJ, 1}, l_sSetPoint))
l_sSP = strcat(g_cBlocks{l_iJ, 3}, g_cBlocks{l_iJ, 2});
break;
end
end
if(exist('l_sSP', 'var'))
% TODO: Implement creation of SetPoints.
% TODO: Connect the found SetPoint with this Analog.
warning('Connections from Analogs to SetPoints are currently not implemented!');
else
warning('Could not find SetPoint, belonging to RDF-Resource, for Analog! (RDF-ID: %s)', g_cObjects{g_iIterator, 2});
end
end
% The LimitSets, this Analog is connected with. It is assumed, that the
% AnalogLimitSets already exists, if Analog.LimitSets exists.
if(exist('l_cLimitSets', 'var'))
for l_iJ = 1:size(l_cLimitSets)
for l_iK = 1:size(g_cBlocks)
if(strcmp(g_cBlocks{l_iK, 1}, l_cLimitSets{l_iJ}))
l_sLS = strcat(g_cBlocks{l_iK, 3}, g_cBlocks{l_iK, 2});
break;
end
end
if(exist('l_sLS', 'var'))
% TODO: Implement creation of AnalogLimitSets.
% TODO: Connect the found AnalogLimitSet with this Analog.
warning('Connection from Analogs to AnalogLimitSets are currently not implemented!');
else
warning('Could not find AnalogLimitSet, belonging to RDF-Resource, for Analog! (RDF-ID: %s)', g_cObjects{g_iIterator, 2});
end
clearvars l_sLS;
end
end
% Clean up everything, that is not needed anymore.
g_cBlocks{l_iI, 4} = g_cBlocks{l_iI, 4} + 1;
g_cBlocks = cat(1, g_cBlocks, {g_cObjects{g_iIterator, 2}, l_sName, l_sParent, 5});
clearvars -except g_iIterator g_iHeight g_iWidth g_iOffset g_cObjects g_cBlocks;
end % End of function 'createAnalog'.
function createBaseVoltage()
% Use global variables.
global g_iHeight g_iIterator g_iOffset g_iWidth g_sTitle g_cAttributes g_cBlocks g_cObjects g_cTemporaryBlocks;
% Attributes of...
% ...IdentifiedObject:
global g_sDescription g_sName;
% ...BaseVoltage:
l_sIsDC = 'false';
l_sNominalVoltage = '0.0';
parseAttributes();
createIdentifiedObject();
% Identify attributes.
for l_iI = 1 : size(g_cAttributes)
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:BaseVoltage.ConductingEquipment');
if(size(l_cFind) > 0)
l_sConductingEquipment = g_cAttributes{l_iI}(l_cFind(1) + 51 : end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:BaseVoltage.isDC');
if(size(l_cFind) > 0)
l_sIsDC = g_cAttributes{l_iI}(l_cFind(1) + 21 : l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:BaseVoltage.nominalVoltage');
if(size(l_cFind) > 0)
l_sNominalVoltage = g_cAttributes{l_iI}(l_cFind(1) + 31 : l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:BaseVoltage.TopologicalNode');
if(size(l_cFind) > 0)
% @Note:
% Currently not used.
%l_sTopologicalNode = g_cAttributes{l_iI}(l_cFind(1) + 47 : end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:BaseVoltage.VoltageLevel');
if(size(l_cFind) > 0)
l_sVoltageLevel = g_cAttributes{l_iI}(l_cFind(1) + 44 : end - 3);
continue;
end
end % End of for.
% @BaseVoltage.ConductingEquipment, @BaseVoltage.VoltageLevel:
% Every BaseVoltage must be contained by a VoltageLevel or a
% ConductingEquipment. If neither BaseVoltage.CondcutingEquipment nor
% BaseVoltag.VoltageLevel exists, this BaseVoltage will be created
% temporarily at the top level of the system.
if(exist('l_sVoltageLevel', 'var'))
l_sParent = l_sVoltageLevel;
else
if(exist('l_sConductingEquipment', 'var'))
l_sParent = l_sConductingEquipment;
else
l_sParent = '';
end
end
if(~strcmp(l_sParent, ''))
for l_iI = 1 : size(g_cBlocks)
if(strcmp(l_sParent, g_cBlocks{l_iI}))
l_sP = strcat(g_cBlocks{l_iI, 3}, '/', g_cBlocks{l_iI, 2});
break;
end
end
end
if(~exist('l_sP', 'var'))
l_sP = g_sTitle;
l_iI = 1;
end
% @BaseVoltage.isDC:
% indicates whether the BaseVoltage is a dc or an ac source. If it
% doesn't exist, it is assumed to be false.
if(strcmpi(l_sIsDC, 'true'))
l_bIsDC = true;
else
l_bIsDC = false;
end
% Create this BaseVoltage.
l_cPos = getPositionIndex(g_cBlocks{l_iI, 4});
l_iLeft = l_cPos{1, 1} * (g_iOffset + g_iWidth) + g_iOffset;
l_iTop = l_cPos{1, 2} * (g_iOffset + g_iHeight) + g_iOffset;
l_aPosition = [l_iLeft, l_iTop, l_iLeft + g_iWidth, l_iTop + g_iHeight];
if(l_bIsDC)
add_block('fl_lib/Electrical/Electrical Sources/DC Voltage Source', strcat(l_sP, '/', g_sName), 'Position', l_aPosition);
set_param(strcat(l_sP, '/', g_sName), 'Description', g_sDescription, 'v0', l_sNominalVoltage);
else
add_block('fl_lib/Electrical/Electrical Sources/AC Voltage Source', strcat(l_sP, '/', g_sName), 'Position', l_aPosition);
set_param(strcat(l_sP, '/', g_sName), 'Description', g_sDescription, 'amp', l_sNominalVoltage);
end
% Update g_cBlocks and g_cTemporaryBlocks.
g_cBlocks{l_iI, 4} = g_cBlocks{l_iI, 4} + 1;
g_cBlocks = vertcat(g_cBlocks, {g_cObjects{g_iIterator, 2}, g_sName, l_sP, 0});
if(strcmp(l_sP, g_sTitle))
g_cTemporaryBlocks = vertcat(g_cTemporaryBlocks, {g_cObjects{g_iIterator, 2}, g_sName, l_sP});
end
% Clean up everything, that is not needed anymore.
clearvars -global -except g_iHeight g_iIterator g_iOffset g_iWidth g_dSystem g_sTitle g_cBlocks g_cObjects g_cTemporaryBlocks;
end % End of function 'createBaseVoltage'.
function createBreaker()
% Use global variables.
global g_iIterator g_iHeight g_iWidth g_iOffset g_cAttributes g_cObjects g_cBlocks;
parseAttributes();
% Identify attributes.
for l_iI = 1:size(g_cAttributes)
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:IdentifiedObject.aliasName');
if(size(l_cFind) > 0)
if(exist('l_sName', 'var'))
l_sName = strcat(l_sName, ' (', g_cAttributes{l_iI}(l_cFind(1) + 31:l_cFind(2) - 3), ')');
else
l_sName = strcat('(', g_cAttributes{l_iI}(l_cFind(1) + 31:l_cFind(2) - 3), ')');
end
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:IdentifiedObject.name');
if(size(l_cFind) > 0)
if(exist('l_sName', 'var'))
l_sName = strcat(g_cAttributes{l_iI}(l_cFind(1) + 26:l_cFind(2) - 3), ' ', l_sName);
else
l_sName = g_cAttributes{l_iI}(l_cFind(1) + 26:l_cFind(2) - 3);
end
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:PowerSystemResource.PSRType');
if(size(l_cFind) > 0)
l_sPSRType = g_cAttributes{l_iI}(l_cFind(1) + 47:end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Equipment.aggregate');
if(size(l_cFind) > 0)
l_sAggregate = strcat('Boolean.', g_cAttributes{l_iI}(l_cFind(1) + 24:l_cFind(2) - 3));
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Equipment.MemberOf_EquipmentContainer');
if(size(l_cFind) > 0)
l_sMemberOf_EquipmentContainer = g_cAttributes{l_iI}(l_cFind(1) + 57:end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Equipment.normallyInService');
if(size(l_cFind) > 0)
l_sNormallyInService = strcat('Boolean.', g_cAttributes{l_iI}(l_cFind(1) + 32:l_cFind(2) - 3));
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ConductingEquipment.BaseVoltage');
if(size(l_cFind) > 0)
l_sBaseVoltage = g_cAttributes{l_iI}(l_cFind(1) + 51:end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Switch.MemberOf_CompositeSwitch');
if(size(l_cFind) > 0)
l_sMemberOf_CompositeSwitch = g_cAttributes{l_iI}(l_cFind(1) + 51:end - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Switch.normalOpen');
if(size(l_cFind) > 0)
l_sNormalOpen = strcat('Boolean.', g_cAttributes{l_iI}(l_cFind(1) + 22:l_cFind(2) - 3));
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Switch.ratedCurrent');
if(size(l_cFind) > 0)
l_sRatedCurrent = g_cAttributes{l_iI}(l_cFind(1) + 24:l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Switch.retained');
if(size(l_cFind) > 0)
l_sRetained = strcat('Boolean.', g_cAttributes{l_iI}(l_cFind(1) + 20:l_cFind(2) - 3));
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Switch.switchOnCount');
if(size(l_cFind) > 0)
l_sSwitchOnCount = g_cAttributes{l_iI}(l_cFind(1) + 25:l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Switch.switchOnDate');
if(size(l_cFind) > 0)
l_sSwitchOnDate = g_cAttributes{l_iI}(l_cFind(1) + 24:l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:ProtectedSwitch.breakingCapacity');
if(size(l_cFind) > 0)
l_sBreakingCapacity = g_cAttributes{l_iI}(l_cFind(1) + 37:l_cFind(2) - 3);
continue;
end
l_cFind = strfind(g_cAttributes{l_iI}, 'cim:Breaker.inTransitTime');
if(size(l_cFind) > 0)
l_sInTransitTime = g_cAttributes{l_iI}(l_cFind(1) + 26:l_cFind(2) - 3);
continue;
end
warning('Could not identify attribute for Breaker! (RDF-ID: %s)', g_cObjects{g_iIterator,2});
end % End of for.
% Create this Breaker.
% Every Breaker must be contained by a CompositeSwitch or an
% EquipmentContainer. If Switch.MemberOf_CompositeSwitch and
% Equipment.MemberOf_EquipmentContainer doesn't exist, this Breaker