From 8de9179ff2e9c3c6e7bb2f666c828adb60f399e0 Mon Sep 17 00:00:00 2001 From: Mathew Date: Wed, 24 Aug 2022 11:34:41 -0500 Subject: [PATCH 1/4] fixes dropdown menu for equipement types in Test config tab --- .../comm-outage/CommOutageEventForm.tsx | 51 +++++++++++------ .../fault/FaultEventForm.tsx | 55 +++++++++++++------ .../ScheduledCommandEventForm.tsx | 51 +++++++++++------ 3 files changed, 107 insertions(+), 50 deletions(-) diff --git a/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/comm-outage/CommOutageEventForm.tsx b/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/comm-outage/CommOutageEventForm.tsx index 4046fb68..d9ba8a82 100644 --- a/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/comm-outage/CommOutageEventForm.tsx +++ b/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/comm-outage/CommOutageEventForm.tsx @@ -65,23 +65,42 @@ export class CommOutageEventForm extends Component { previousModelDictionary = props.modelDictionary; } + const labels = []; + if (this.props.modelDictionary.capacitors.length > 0) { + labels.push({label: 'Capacitor', id: 'capacitors'}); + } + if (this.props.modelDictionary.disconnectors.length > 0) { + labels.push({label: 'disconnectors', id: 'disconnectors'}); + } + if (this.props.modelDictionary.switches.length > 0) { + labels.push({label: 'switches', id: 'switches'}); + } + if (this.props.modelDictionary.batteries.length > 0) { + labels.push({label: 'Battery', id: 'batteries'}); + } + if (this.props.modelDictionary.breakers.length > 0) { + labels.push({label: 'Breaker', id: 'breakers'}); + } + if (this.props.modelDictionary.fuses.length > 0) { + labels.push({label: 'Fuse', id: 'fuses'}); + } + if (this.props.modelDictionary.reclosers.length > 0) { + labels.push({label: 'Recloser', id: 'reclosers'}); + } + if (this.props.modelDictionary.regulators.length > 0) { + labels.push({label: 'Regulator', id: 'regulators'}); + } + if (this.props.modelDictionary.sectionalisers.length > 0) { + labels.push({label: 'Sectionaliser', id: 'sectionalisers'}); + } + if (this.props.modelDictionary.solarpanels.length > 0) { + labels.push({label: 'Solar Panel', id: 'solarpanels'}); + } + if (this.props.modelDictionary.synchronousmachines.length > 0) { + labels.push({label: 'Synchronous Machine', id: 'synchronousmachines'}); + } this.state = { - inputEquipmentTypeOptionBuilder: new SelectionOptionBuilder( - [ - { id: 'batteries', label: 'Battery' }, - { id: 'breakers', label: 'Breaker' }, - { id: 'capacitors', label: 'Capacitor' }, - { id: 'disconnectors', label: 'Disconnector' }, - { id: 'fuses', label: 'Fuse' }, - { id: 'reclosers', label: 'Recloser' }, - { id: 'regulators', label: 'Regulator' }, - { id: 'sectionalisers', label: 'Sectionaliser' }, - { id: 'solarpanels', label: 'Solar Panel' }, - { id: 'switches', label: 'Switch' }, - { id: 'synchronousmachines', label: 'Synchronous Machine' } - ], - type => type.label - ), + inputEquipmentTypeOptionBuilder: new SelectionOptionBuilder(labels, type => type.label), inputComponentOptionBuilder: SelectionOptionBuilder.defaultBuilder(), inputPhaseOptionBuilder: SelectionOptionBuilder.defaultBuilder(), inputAttributeOptionBuilder: SelectionOptionBuilder.defaultBuilder(), diff --git a/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/fault/FaultEventForm.tsx b/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/fault/FaultEventForm.tsx index ac0d9e70..f016a022 100644 --- a/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/fault/FaultEventForm.tsx +++ b/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/fault/FaultEventForm.tsx @@ -37,25 +37,44 @@ export class FaultEventForm extends Component { constructor(props: Props) { super(props); + const labels = []; + labels.push({label: 'ACLineSegment', id: 'ACLineSegment'}); + labels.push({label: 'PowerTransformer', id: 'PowerTransformer'}); + if (this.props.modelDictionary.capacitors.length > 0) { + labels.push({label: 'Capacitor', id: 'capacitors'}); + } + if (this.props.modelDictionary.disconnectors.length > 0) { + labels.push({label: 'disconnectors', id: 'disconnectors'}); + } + if (this.props.modelDictionary.switches.length > 0) { + labels.push({label: 'switches', id: 'switches'}); + } + if (this.props.modelDictionary.batteries.length > 0) { + labels.push({label: 'Battery', id: 'batteries'}); + } + if (this.props.modelDictionary.breakers.length > 0) { + labels.push({label: 'Breaker', id: 'breakers'}); + } + if (this.props.modelDictionary.fuses.length > 0) { + labels.push({label: 'Fuse', id: 'fuses'}); + } + if (this.props.modelDictionary.reclosers.length > 0) { + labels.push({label: 'Recloser', id: 'reclosers'}); + } + if (this.props.modelDictionary.regulators.length > 0) { + labels.push({label: 'Regulator', id: 'regulators'}); + } + if (this.props.modelDictionary.sectionalisers.length > 0) { + labels.push({label: 'Sectionaliser', id: 'sectionalisers'}); + } + if (this.props.modelDictionary.solarpanels.length > 0) { + labels.push({label: 'Solar Panel', id: 'solarpanels'}); + } + if (this.props.modelDictionary.synchronousmachines.length > 0) { + labels.push({label: 'Synchronous Machine', id: 'synchronousmachines'}); + } this.state = { - equipmentTypeOptionBuilder: new SelectionOptionBuilder( - [ - { label: 'ACLineSegment', id: 'ACLineSegment' }, - { label: 'Battery', id: 'batteries' }, - { label: 'Breaker', id: 'breakers' }, - { label: 'Capacitor', id: 'capacitors' }, - { label: 'Disconnector', id: 'disconnectors' }, - { label: 'Fuse', id: 'fuses' }, - { label: 'PowerTransformer', id: 'PowerTransformer' }, - { label: 'Recloser', id: 'reclosers' }, - { label: 'Regulator', id: 'regulators' }, - { label: 'Sectionaliser', id: 'sectionalisers' }, - { label: 'Solar Panel', id: 'solarpanels' }, - { label: 'Switch', id: 'switches' }, - { label: 'Synchronous Machine', id: 'synchronousmachines' } - ], - type => type.label - ), + equipmentTypeOptionBuilder: new SelectionOptionBuilder(labels, type => type.label), componentOptionBuilder: SelectionOptionBuilder.defaultBuilder(), phaseOptionBuilder: SelectionOptionBuilder.defaultBuilder(), faultKindOptionBuilder: new SelectionOptionBuilder( diff --git a/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/scheduled-command/ScheduledCommandEventForm.tsx b/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/scheduled-command/ScheduledCommandEventForm.tsx index 4c54cd2b..d209daf4 100644 --- a/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/scheduled-command/ScheduledCommandEventForm.tsx +++ b/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/scheduled-command/ScheduledCommandEventForm.tsx @@ -44,23 +44,42 @@ export class ScheduledCommandEventForm extends Component { constructor(props: Props) { super(props); + const labels = []; + if (this.props.modelDictionary.capacitors.length > 0) { + labels.push({label: 'Capacitor', id: 'capacitors'}); + } + if (this.props.modelDictionary.disconnectors.length > 0) { + labels.push({label: 'disconnectors', id: 'disconnectors'}); + } + if (this.props.modelDictionary.switches.length > 0) { + labels.push({label: 'switches', id: 'switches'}); + } + if (this.props.modelDictionary.batteries.length > 0) { + labels.push({label: 'Battery', id: 'batteries'}); + } + if (this.props.modelDictionary.breakers.length > 0) { + labels.push({label: 'Breaker', id: 'breakers'}); + } + if (this.props.modelDictionary.fuses.length > 0) { + labels.push({label: 'Fuse', id: 'fuses'}); + } + if (this.props.modelDictionary.reclosers.length > 0) { + labels.push({label: 'Recloser', id: 'reclosers'}); + } + if (this.props.modelDictionary.regulators.length > 0) { + labels.push({label: 'Regulator', id: 'regulators'}); + } + if (this.props.modelDictionary.sectionalisers.length > 0) { + labels.push({label: 'Sectionaliser', id: 'sectionalisers'}); + } + if (this.props.modelDictionary.solarpanels.length > 0) { + labels.push({label: 'Solar Panel', id: 'solarpanels'}); + } + if (this.props.modelDictionary.synchronousmachines.length > 0) { + labels.push({label: 'Synchronous Machine', id: 'synchronousmachines'}); + } this.state = { - componentTypeOptionBuilder: new SelectionOptionBuilder( - [ - { label: 'Battery', id: 'batteries' }, - { label: 'Breaker', id: 'breakers' }, - { label: 'Capacitor', id: 'capacitors' }, - { label: 'Disconnector', id: 'disconnectors' }, - { label: 'Fuse', id: 'fuses' }, - { label: 'Recloser', id: 'reclosers' }, - { label: 'Regulator', id: 'regulators' }, - { label: 'Sectionaliser', id: 'sectionalisers' }, - { label: 'Solar Panel', id: 'solarpanels' }, - { label: 'Switch', id: 'switches' }, - { label: 'Synchronous Machine', id: 'synchronousmachines' } - ], - type => type.label - ), + componentTypeOptionBuilder: new SelectionOptionBuilder(labels,type => type.label), componentOptionBuilder: SelectionOptionBuilder.defaultBuilder(), attributeOptionBuilder: SelectionOptionBuilder.defaultBuilder(), selectedComponentType: '' From 92e738fe637c6f640126686cb41b47672a40c4fb Mon Sep 17 00:00:00 2001 From: Mathew Date: Wed, 14 Sep 2022 10:52:07 -0500 Subject: [PATCH 2/4] fixed the attributes for synchronous machines --- .../models/component-attributes.ts | 4 ++++ .../scheduled-command/ScheduledCommandEventForm.tsx | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/client/src/app/simulation/simulation-configuration-editor/models/component-attributes.ts b/client/src/app/simulation/simulation-configuration-editor/models/component-attributes.ts index 6727e557..bbb64abf 100644 --- a/client/src/app/simulation/simulation-configuration-editor/models/component-attributes.ts +++ b/client/src/app/simulation/simulation-configuration-editor/models/component-attributes.ts @@ -21,5 +21,9 @@ export const COMPONENT_ATTRIBUTES = { ], switches: [ 'Switch.open' + ], + synchronousmachines: [ + 'RotatingMachine.p', + 'RotatingMachine.q' ] }; diff --git a/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/scheduled-command/ScheduledCommandEventForm.tsx b/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/scheduled-command/ScheduledCommandEventForm.tsx index d209daf4..a9504829 100644 --- a/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/scheduled-command/ScheduledCommandEventForm.tsx +++ b/client/src/app/simulation/simulation-configuration-editor/views/test-configuration-tab/scheduled-command/ScheduledCommandEventForm.tsx @@ -14,6 +14,7 @@ import { } from '@client:common/topology/model-dictionary'; import { ScheduledCommandEventFormService } from '../../../services/ScheduledCommandEventFormService'; +import { COMPONENT_ATTRIBUTES } from '../../../models/component-attributes'; import './ScheduledCommandEventForm.light.scss'; import './ScheduledCommandEventForm.dark.scss'; @@ -166,7 +167,13 @@ export class ScheduledCommandEventForm extends Component { componentName, mRID: selectedComponent.mRID }); - if (this.state.selectedComponentType !== 'Regulator') { + if (this.state.selectedComponentType === 'Synchronous Machine') { + this.setState({ + attributeOptionBuilder: new SelectionOptionBuilder( + COMPONENT_ATTRIBUTES['synchronousmachines'] + ) + }); + } else if (this.state.selectedComponentType !== 'Regulator') { this._formService.fetchAttributes( typeof selectedComponent.mRID === 'string' ? selectedComponent.mRID : selectedComponent.mRID[0], this.props.modelDictionary.mRID, @@ -220,7 +227,7 @@ export class ScheduledCommandEventForm extends Component { label='Component' selectionOptionBuilder={this.state.componentOptionBuilder} formControlModel={this.selectedComponentFormControl} /> - { + { this.state.selectedComponentType !== 'Regulator' ? ( - ) : ( - - ) - } +