Skip to content

Commit

Permalink
970 tapchanger editor (#1166)
Browse files Browse the repository at this point in the history
* feat(tapchanger-editor.ts):editor_added

* feat(tapchanger-editor.test.ts):setup

* feat(TapChanger-editor):editor_and_unit_test

---------

Co-authored-by: Pascal Wilbrink <pascal.wilbrink@alliander.com>
  • Loading branch information
marcvanraalte and pascalwilbrink authored Feb 9, 2023
1 parent d3fc039 commit e1b9568
Show file tree
Hide file tree
Showing 5 changed files with 450 additions and 0 deletions.
86 changes: 86 additions & 0 deletions src/editors/substation/tapchanger-editor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import {
customElement,
html,
LitElement,
TemplateResult,
property,
state,
} from 'lit-element';

import '../../action-pane.js';
import './eq-function-editor.js';
import './l-node-editor.js';
import './sub-equipment-editor.js';
import { getChildElementsByTagName } from '../../foundation.js';

@customElement('tapchanger-editor')
export class TapChangerEditor extends LitElement {
/** The document being edited as provided to editor by [[`Zeroline`]]. */
@property({ attribute: false })
doc!: XMLDocument;
/** SCL element TransformerWinding */
@property({ attribute: false })
element!: Element;
/** Whether `EqFunction` and `SubEquipment` are rendered */
@property({ type: Boolean })
showfunctions = false;

@state()
get header(): string {
const name = this.element.getAttribute('name') ?? '';
const desc = this.element.getAttribute('desc');

return `TapChanger.${name} ${desc ? `—TapChanger.${desc}` : ''}`;
}

private renderLNodes(): TemplateResult {
const lNodes = getChildElementsByTagName(this.element, 'LNode');

return lNodes.length
? html`<div class="container lnode">
${lNodes.map(
lNode =>
html`<l-node-editor
.doc=${this.doc}
.element=${lNode}
></l-node-editor>`
)}
</div>`
: html``;
}

renderEqFunctions(): TemplateResult {
if (!this.showfunctions) return html``;

const eqFunctions = getChildElementsByTagName(this.element, 'EqFunction');
return html` ${eqFunctions.map(
eqFunction =>
html`<eq-function-editor
.doc=${this.doc}
.element=${eqFunction}
?showfunctions=${this.showfunctions}
></eq-function-editor>`
)}`;
}

private renderSubEquipments(): TemplateResult {
if (!this.showfunctions) return html``;
const subEquipments = getChildElementsByTagName(
this.element,
'SubEquipment'
);

return html` ${subEquipments.map(
subEquipment =>
html`<sub-equipment-editor
.doc=${this.doc}
.element=${subEquipment}
></sub-equipment-editor>`
)}`;
}

render(): TemplateResult {
return html`<action-pane label=${this.header}> ${this.renderLNodes()}
${this.renderEqFunctions()} ${this.renderSubEquipments()}</action-icon>`;
}
}
19 changes: 19 additions & 0 deletions src/editors/substation/transformer-winding-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import { Menu } from '@material/mwc-menu';

import '../../action-icon.js';
import '../../action-pane.js';
import './eq-function-editor.js';
import './l-node-editor.js';
import './tapchanger-editor.js';

import { styles } from './foundation.js';
import {
Expand Down Expand Up @@ -131,6 +134,21 @@ export class TransformerWindingEditor extends LitElement {
: html``;
}

private renderTapChanger(): TemplateResult {
if (!this.showfunctions) return html``;
const tapChangers = getChildElementsByTagName(this.element, 'TapChanger');
return tapChangers.length
? html` ${tapChangers.map(
tapChanger =>
html`<tapchanger-editor
.doc=${this.doc}
.element=${tapChanger}
?showfunctions=${this.showfunctions}
></tapchanger-editor>`
)}`
: html``;
}

private renderAddButtons(): TemplateResult[] {
return childTags(this.element).map(
child =>
Expand Down Expand Up @@ -174,6 +192,7 @@ export class TransformerWindingEditor extends LitElement {
></abbr
>
${this.renderLNodes()} ${this.renderEqFunctions()}
${this.renderTapChanger()}
</action-pane> `;
}

Expand Down
267 changes: 267 additions & 0 deletions test/testfiles/editors/substation/TapChanger.scd
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
<SCL xmlns="http://www.iec.ch/61850/2003/SCL" version="2007" revision="B" release="4">
<Header id="general_equipment"/>
<Substation xmlns="http://www.iec.ch/61850/2003/SCL" name="AA1" desc="">
<VoltageLevel name="E1" desc="" nomFreq="50" numPhases="3">
<PowerTransformer name="pTransVolt" type="PTR">
<TransformerWinding name="some" type="PTW">
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI" />
<EqFunction name="eqFunc">
<EqSubFunction name="eqSubFunc">
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI" />
</EqSubFunction>
</EqFunction>
</TransformerWinding>
<TransformerWinding name="withTapChanger1" type="PTW">
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI" />
<TapChanger name="tapChComplet" desc="My TapChanger" type="LTC" virtual="true">
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI" />
<EqFunction name="eqFunc">
<EqSubFunction name="eqSubFunc">
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI" />
</EqSubFunction>
</EqFunction>
</TapChanger>
</TransformerWinding>
<TransformerWinding name="withTapChanger2" type="PTW">
<TapChanger name="tapChangerHalf" type="LTC">
<SubEquipment name="subsEquWithinTapChanger" />
</TapChanger>
</TransformerWinding>
</PowerTransformer>
<Voltage unit="V" multiplier="k">110</Voltage>
<Bay name="Q01" desc="">
<PowerTransformer name="pTransBay" type="PTR">
<TransformerWinding name="some" type="PTW">
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI" />
<EqFunction name="eqFunc">
<EqSubFunction name="eqSubFunc">
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI" />
</EqSubFunction>
</EqFunction>
</TransformerWinding>
</PowerTransformer>
</Bay>
<Bay name="Q02" desc="">
<Function name="F1">
<SubFunction name="Sub1">
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI"/>
</SubFunction>
</Function>
</Bay>
<Bay name="Q03" desc="">
<Function name="F1">
<SubFunction name="Sub1">
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI"/>
</SubFunction>
</Function>
</Bay>
</VoltageLevel>
</Substation>
<DataTypeTemplates>
<LNodeType lnClass="CSWI" id="OpenSCD_CSWI" desc="Switch control: single phase">
<DO name="Mod" type="OpenSCD_ENC_Mod"/>
<DO name="Beh" type="OpenSCD_ENS_Beh"/>
<DO name="Health" type="OpenSCD_ENS_Health"/>
<DO name="NamPlt" type="OpenSCD_LPL_noLD"/>
<DO name="LocKey" type="OpenSCD_SPS_simple"/>
<DO name="Loc" type="OpenSCD_SPS_simple"/>
<DO name="LocSta" type="OpenSCD_SPC_LocSta"/>
<DO name="Pos" type="OpenSCD_DPC"/>
<DO name="OpOpn" transient="true" type="OpenSCD_ACT_threephase_control"/>
<DO name="OpCls" transient="true" type="OpenSCD_ACT_threephase_control"/>
<DO name="SelOpn" type="OpenSCD_SPS_simple"/>
<DO name="SelCls" type="OpenSCD_SPS_simple"/>
<DO name="PosA" type="OpenSCD_DPC_statusonly"/>
<DO name="PosB" type="OpenSCD_DPC_statusonly"/>
<DO name="PosC" type="OpenSCD_DPC_statusonly"/>
</LNodeType>
<DOType cdc="DPC" id="OpenSCD_DPC_statusonly">
<DA name="stVal" bType="Dbpos" dchg="true" fc="ST"/>
<DA name="q" bType="Quality" qchg="true" fc="ST"/>
<DA name="t" bType="Timestamp" fc="ST"/>
<DA name="ctlModel" bType="Enum" fc="CF" type="OpenSCD_StatusOnly">
<Val>status-only</Val>
</DA>
</DOType>
<DOType cdc="ACT" id="OpenSCD_ACT_threephase_control">
<DA name="general" bType="BOOLEAN" dchg="true" fc="ST"/>
<DA name="phsA" bType="BOOLEAN" dchg="true" fc="ST"/>
<DA name="phsB" bType="BOOLEAN" dchg="true" fc="ST"/>
<DA name="phsC" bType="BOOLEAN" dchg="true" fc="ST"/>
<DA name="q" bType="Quality" qchg="true" fc="ST"/>
<DA name="t" bType="Timestamp" fc="ST"/>
<DA name="originSrc" bType="Struct" type="OpenSCD_Originator" fc="ST"/>
</DOType>
<DOType cdc="DPC" id="OpenSCD_DPC">
<DA name="origin" bType="Struct" dchg="true" fc="ST" type="OpenSCD_Originator"/>
<DA name="stVal" bType="Enum" dchg="true" fc="ST" type="BehaviourModeKind"/>
<DA name="q" bType="Quality" qchg="true" fc="ST"/>
<DA name="t" bType="Timestamp" fc="ST"/>
<DA name="ctlModel" bType="Enum" fc="CF" type="CtlModelKind">
<Val>sbo-with-enhanced-security</Val>
</DA>
<DA name="sboTimeout" bType="INT32U" fc="CF">
<Val>30000</Val>
</DA>
<DA name="operTimeout" bType="INT32U" fc="CF">
<Val>600</Val>
</DA>
<DA name="pulseConfig" bType="Struct" fc="CO" type="OpenSCD_PulseConfig"/>
<DA name="SBOw" bType="Struct" fc="CO" type="OpenSCD_OperSBOw_Dbpos"/>
<DA name="Oper" bType="Struct" fc="CO" type="OpenSCD_OperSBOw_Dbpos"/>
<DA name="Cancel" bType="Struct" fc="CO" type="OpenSCD_Cancel_Dbpos"/>
</DOType>
<DOType cdc="SPC" id="OpenSCD_SPC_LocSta">
<DA name="stVal" bType="BOOLEAN" dchg="true" fc="ST"/>
<DA name="q" bType="Quality" qchg="true" fc="ST"/>
<DA name="t" bType="Timestamp" fc="ST"/>
<DA name="Oper" bType="Struct" type="OpenSCD_OperSBOw_SPC" fc="CO"/>
<DA name="Cancel" bType="Struct" type="OpenSCD_Cancel_SPC" fc="CO"/>
<DA name="operTimeout" bType="INT32U" fc="CF">
<Val>1000</Val>
</DA>
<DA name="ctlModel" bType="Enum" dchg="true" type="CtlModelKind" fc="CF">
<Val>direct-with-enhanced-security</Val>
</DA>
</DOType>
<DOType cdc="SPS" id="OpenSCD_SPS_simple">
<DA name="stVal" bType="BOOLEAN" dchg="true" fc="ST"/>
<DA name="q" bType="Quality" qchg="true" fc="ST"/>
<DA name="t" bType="Timestamp" fc="ST"/>
<DA name="d" bType="VisString255" fc="DC"/>
</DOType>
<DOType cdc="LPL" id="OpenSCD_LPL_noLD">
<DA name="vendor" bType="VisString255" fc="DC"/>
<DA name="swRev" bType="VisString255" fc="DC"/>
<DA name="d" bType="VisString255" fc="DC"/>
<DA name="configRev" bType="VisString255" fc="DC"/>
</DOType>
<DOType cdc="ENS" id="OpenSCD_ENS_Health">
<DA name="stVal" bType="Enum" dchg="true" fc="ST" type="HealthKind"/>
<DA name="q" bType="Quality" qchg="true" fc="ST"/>
<DA name="t" bType="Timestamp" fc="ST"/>
</DOType>
<DOType cdc="ENS" id="OpenSCD_ENS_Beh">
<DA name="stVal" bType="Enum" dchg="true" fc="ST" type="BehaviourModeKind"/>
<DA name="q" bType="Quality" qchg="true" fc="ST"/>
<DA name="t" bType="Timestamp" fc="ST"/>
</DOType>
<DOType cdc="ENC" id="OpenSCD_ENC_Mod">
<DA name="origin" bType="Struct" dchg="true" fc="ST" type="OpenSCD_Originator"/>
<DA name="stVal" bType="Enum" dchg="true" fc="ST" type="BehaviourModeKind"/>
<DA name="q" bType="Quality" qchg="true" fc="ST"/>
<DA name="t" bType="Timestamp" fc="ST"/>
<DA name="ctlModel" bType="Enum" fc="CF" type="CtlModelKind">
<Val>sbo-with-enhanced-security</Val>
</DA>
<DA name="sboTimeout" bType="INT32U" fc="CF">
<Val>30000</Val>
</DA>
<DA name="operTimeout" bType="INT32U" fc="CF">
<Val>600</Val>
</DA>
<DA name="SBOw" bType="Struct" fc="CO" type="OpenSCD_OperSBOw_BehaviourModeKind"/>
<DA name="Oper" bType="Struct" fc="CO" type="OpenSCD_OperSBOw_BehaviourModeKind"/>
<DA name="Cancel" bType="Struct" fc="CO" type="OpenSCD_Cancel_BehaviourModeKind"/>
</DOType>
<DAType id="OpenSCD_Cancel_Dbpos">
<BDA name="ctlVal" bType="Dbpos"/>
<BDA name="origin" bType="Struct" type="OpenSCD_Originator"/>
<BDA name="ctlNum" bType="INT8U"/>
<BDA name="T" bType="Timestamp"/>
<BDA name="Test" bType="BOOLEAN"/>
<ProtNs type="8-MMS">IEC 61850-8-1:2003</ProtNs>
</DAType>
<DAType id="OpenSCD_OperSBOw_Dbpos">
<BDA name="ctlVal" bType="Dbpos"/>
<BDA name="origin" bType="Struct" type="OpenSCD_Originator"/>
<BDA name="ctlNum" bType="INT8U"/>
<BDA name="T" bType="Timestamp"/>
<BDA name="Test" bType="BOOLEAN"/>
<BDA name="Check" bType="Check"/>
<ProtNs type="8-MMS">IEC 61850-8-1:2003</ProtNs>
</DAType>
<DAType id="OpenSCD_PulseConfig">
<BDA name="cmdQual" bType="Enum" type="OutputSignalKind"/>
<BDA name="onDur" bType="INT32U"/>
<BDA name="offDur" bType="INT32U"/>
<BDA name="numPls" bType="INT32U"/>
</DAType>
<DAType id="OpenSCD_Cancel_SPC">
<BDA name="ctlVal" bType="BOOLEAN"/>
<BDA name="origin" bType="Struct" type="OpenSCD_Originator"/>
<BDA name="ctlNum" bType="INT8U"/>
<BDA name="T" bType="Timestamp"/>
<BDA name="Test" bType="BOOLEAN"/>
<ProtNs type="8-MMS">IEC 61850-8-1:2003</ProtNs>
</DAType>
<DAType id="OpenSCD_OperSBOw_SPC">
<BDA name="ctlVal" bType="BOOLEAN"/>
<BDA name="origin" bType="Struct" type="OpenSCD_Originator"/>
<BDA name="ctlNum" bType="INT8U"/>
<BDA name="T" bType="Timestamp"/>
<BDA name="Test" bType="BOOLEAN"/>
<BDA name="Check" bType="Check"/>
<ProtNs type="8-MMS">IEC 61850-8-1:2003</ProtNs>
</DAType>
<DAType id="OpenSCD_Cancel_BehaviourModeKind">
<BDA name="ctlVal" bType="Enum" type="BehaviourModeKind"/>
<BDA name="origin" bType="Struct" type="OpenSCD_Originator"/>
<BDA name="ctlNum" bType="INT8U"/>
<BDA name="T" bType="Timestamp"/>
<BDA name="Test" bType="BOOLEAN"/>
<ProtNs type="8-MMS">IEC 61850-8-1:2003</ProtNs>
</DAType>
<DAType id="OpenSCD_OperSBOw_BehaviourModeKind">
<BDA name="ctlVal" bType="Enum" type="BehaviourModeKind"/>
<BDA name="origin" bType="Struct" type="OpenSCD_Originator"/>
<BDA name="ctlNum" bType="INT8U"/>
<BDA name="T" bType="Timestamp"/>
<BDA name="Test" bType="BOOLEAN"/>
<BDA name="Check" bType="Check"/>
<ProtNs type="8-MMS">IEC 61850-8-1:2003</ProtNs>
</DAType>
<DAType id="OpenSCD_Originator">
<BDA name="orCat" bType="Enum" type="OriginatorCategoryKind"/>
<BDA name="orIdent" bType="Octet64"/>
</DAType>
<EnumType id="OpenSCD_StatusOnly">
<EnumVal ord="0">status-only</EnumVal>
</EnumType>
<EnumType id="OutputSignalKind">
<EnumVal ord="0">pulse</EnumVal>
<EnumVal ord="1">persistent</EnumVal>
<EnumVal ord="2">persistent-feedback</EnumVal>
</EnumType>
<EnumType id="HealthKind">
<EnumVal ord="1">Ok</EnumVal>
<EnumVal ord="2">Warning</EnumVal>
<EnumVal ord="3">Alarm</EnumVal>
</EnumType>
<EnumType id="CtlModelKind">
<EnumVal ord="0">status-only</EnumVal>
<EnumVal ord="1">direct-with-normal-security</EnumVal>
<EnumVal ord="2">sbo-with-normal-security</EnumVal>
<EnumVal ord="3">direct-with-enhanced-security</EnumVal>
<EnumVal ord="4">sbo-with-enhanced-security</EnumVal>
</EnumType>
<EnumType id="BehaviourModeKind">
<EnumVal ord="1">on</EnumVal>
<EnumVal ord="2">blocked</EnumVal>
<EnumVal ord="3">test</EnumVal>
<EnumVal ord="4">test/blocked</EnumVal>
<EnumVal ord="5">off</EnumVal>
</EnumType>
<EnumType id="OriginatorCategoryKind">
<EnumVal ord="0">not-supported</EnumVal>
<EnumVal ord="1">bay-control</EnumVal>
<EnumVal ord="2">station-control</EnumVal>
<EnumVal ord="3">remote-control</EnumVal>
<EnumVal ord="4">automatic-bay</EnumVal>
<EnumVal ord="5">automatic-station</EnumVal>
<EnumVal ord="6">automatic-remote</EnumVal>
<EnumVal ord="7">maintenance</EnumVal>
<EnumVal ord="8">process</EnumVal>
</EnumType>
</DataTypeTemplates>
</SCL>
Loading

0 comments on commit e1b9568

Please sign in to comment.