@@ -154,11 +154,13 @@ export default class CompasAutogenerateSubstation extends LitElement {
154
154
155
155
//Get all the substation names by splitting the names on the '__' (seperator) and getting the characters in front of it
156
156
const substationNames = this . extractNames (
157
- this . iedNames . map ( FullName =>
158
- FullName . includes ( this . substationSeperator )
159
- ? FullName ?. split ( this . substationSeperator ) [ 0 ]
160
- : ''
161
- )
157
+ this . iedNames
158
+ . filter (
159
+ value =>
160
+ value . includes ( this . substationSeperator ) &&
161
+ ! value . split ( this . substationSeperator ) [ 1 ] . startsWith ( 'A00' )
162
+ )
163
+ . map ( FullName => FullName ?. split ( this . substationSeperator ) [ 0 ] )
162
164
) ;
163
165
this . createSubstations ( substationNames ) ;
164
166
}
@@ -215,7 +217,9 @@ export default class CompasAutogenerateSubstation extends LitElement {
215
217
substationContent . map ( FullName =>
216
218
FullName ?. substring ( 0 , this . voltageLevelNameLength )
217
219
)
218
- ) ;
220
+ ) . filter ( value => ! value . startsWith ( 'A00' ) ) ;
221
+
222
+ if ( voltageLevelNames . length == 0 ) return ;
219
223
220
224
voltageLevelNames . forEach ( name => {
221
225
const desc = 'Voltage Level generated by CoMPAS' ;
@@ -342,12 +346,9 @@ export default class CompasAutogenerateSubstation extends LitElement {
342
346
* @returns filtered content
343
347
*/
344
348
extractNames ( content : string [ ] ) {
345
- //Check for empty elements
346
- const elementNames = content . filter ( Boolean ) ;
347
-
348
- //return list of names after filtering out the duplicate elements
349
- return elementNames . filter (
350
- ( value , index ) => value && elementNames . indexOf ( < string > value ) === index
349
+ //return list of names after filtering out the empty and duplicate elements
350
+ return content . filter (
351
+ ( value , index ) => value && content . indexOf ( < string > value ) === index
351
352
) ;
352
353
}
353
354
}
0 commit comments