@@ -313,6 +313,70 @@ export type StudyUpdated = {
313
313
force : number ; //IntRange<0, 1>;
314
314
} & StudyUpdateNotification ;
315
315
316
+ export enum EquipmentUpdateType {
317
+ LINES = 'lines' ,
318
+ TIE_LINES = 'tieLines' ,
319
+ TWO_WINDINGS_TRANSFORMERS = 'twoWindingsTransformers' ,
320
+ THREE_WINDINGS_TRANSFORMERS = 'threeWindingsTransformers' ,
321
+ GENERATORS = 'generators' ,
322
+ LOADS = 'loads' ,
323
+ BATTERIES = 'batteries' ,
324
+ DANGLING_LINES = 'danglingLines' ,
325
+ HVDC_LINES = 'hvdcLines' ,
326
+ LCC_CONVERTER_STATIONS = 'lccConverterStations' ,
327
+ VSC_CONVERTER_STATIONS = 'vscConverterStations' ,
328
+ SHUNT_COMPENSATORS = 'shuntCompensators' ,
329
+ STATIC_VAR_COMPENSATORS = 'staticVarCompensators' ,
330
+ VOLTAGE_LEVELS = 'voltageLevels' ,
331
+ SUBSTATIONS = 'substations' ,
332
+ BUSES = 'buses' ,
333
+ BUSBAR_SECTIONS = 'busbarSections' ,
334
+ BRANCHES = 'branches' , // LINE + TWO_WINDINGS_TRANSFORMER
335
+ }
336
+
337
+ function getEquipmentTypeFromUpdateType ( updateType : EquipmentUpdateType ) : SpreadsheetEquipmentType | undefined {
338
+ switch ( updateType ) {
339
+ case EquipmentUpdateType . LINES :
340
+ return SpreadsheetEquipmentType . LINE ;
341
+ case EquipmentUpdateType . TIE_LINES :
342
+ return SpreadsheetEquipmentType . TIE_LINE ;
343
+ case EquipmentUpdateType . TWO_WINDINGS_TRANSFORMERS :
344
+ return SpreadsheetEquipmentType . TWO_WINDINGS_TRANSFORMER ;
345
+ case EquipmentUpdateType . THREE_WINDINGS_TRANSFORMERS :
346
+ return SpreadsheetEquipmentType . THREE_WINDINGS_TRANSFORMER ;
347
+ case EquipmentUpdateType . GENERATORS :
348
+ return SpreadsheetEquipmentType . GENERATOR ;
349
+ case EquipmentUpdateType . LOADS :
350
+ return SpreadsheetEquipmentType . LOAD ;
351
+ case EquipmentUpdateType . BATTERIES :
352
+ return SpreadsheetEquipmentType . BATTERY ;
353
+ case EquipmentUpdateType . DANGLING_LINES :
354
+ return SpreadsheetEquipmentType . DANGLING_LINE ;
355
+ case EquipmentUpdateType . HVDC_LINES :
356
+ return SpreadsheetEquipmentType . HVDC_LINE ;
357
+ case EquipmentUpdateType . LCC_CONVERTER_STATIONS :
358
+ return SpreadsheetEquipmentType . LCC_CONVERTER_STATION ;
359
+ case EquipmentUpdateType . VSC_CONVERTER_STATIONS :
360
+ return SpreadsheetEquipmentType . VSC_CONVERTER_STATION ;
361
+ case EquipmentUpdateType . SHUNT_COMPENSATORS :
362
+ return SpreadsheetEquipmentType . SHUNT_COMPENSATOR ;
363
+ case EquipmentUpdateType . STATIC_VAR_COMPENSATORS :
364
+ return SpreadsheetEquipmentType . STATIC_VAR_COMPENSATOR ;
365
+ case EquipmentUpdateType . VOLTAGE_LEVELS :
366
+ return SpreadsheetEquipmentType . VOLTAGE_LEVEL ;
367
+ case EquipmentUpdateType . SUBSTATIONS :
368
+ return SpreadsheetEquipmentType . SUBSTATION ;
369
+ case EquipmentUpdateType . BUSES :
370
+ return SpreadsheetEquipmentType . BUS ;
371
+ case EquipmentUpdateType . BUSBAR_SECTIONS :
372
+ return SpreadsheetEquipmentType . BUSBAR_SECTION ;
373
+ case EquipmentUpdateType . BRANCHES :
374
+ return SpreadsheetEquipmentType . BRANCH ;
375
+ default :
376
+ return ;
377
+ }
378
+ }
379
+
316
380
export interface OneBusShortCircuitAnalysisDiagram {
317
381
diagramId : string ;
318
382
nodeId : UUID ;
@@ -1373,10 +1437,10 @@ export const reducer = createReducer(initialState, (builder) => {
1373
1437
builder . addCase ( UPDATE_EQUIPMENTS , ( state , action : UpdateEquipmentsAction ) => {
1374
1438
// for now, this action receives an object containing all equipments from a substation
1375
1439
// it will be modified when the notifications received after a network modification are more precise
1376
- // equipmentType : type of equipment updated
1440
+ // updatedEquipmentType : type of equipment updated
1377
1441
// equipments: list of updated equipments of type <equipmentType>
1378
- for ( const [ equipmentType , equipments ] of Object . entries ( action . equipments ) as [
1379
- SpreadsheetEquipmentType ,
1442
+ for ( const [ updatedEquipmentType , equipments ] of Object . entries ( action . equipments ) as [
1443
+ EquipmentUpdateType ,
1380
1444
Identifiable [ ] ,
1381
1445
] [ ] ) {
1382
1446
let updatedEquipments ;
@@ -1386,6 +1450,10 @@ export const reducer = createReducer(initialState, (builder) => {
1386
1450
updatedEquipments = [ equipments ] ;
1387
1451
}
1388
1452
1453
+ const equipmentType = getEquipmentTypeFromUpdateType ( updatedEquipmentType ) ;
1454
+ if ( ! equipmentType ) {
1455
+ continue ;
1456
+ }
1389
1457
const currentEquipment : Identifiable [ ] | undefined =
1390
1458
state . spreadsheetNetwork [ equipmentType ] ?. equipmentsByNodeId [ action . nodeId ] ;
1391
1459
0 commit comments