@compas-oscd/open-scd 0.34.0 → 0.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/WizardDivider.js +37 -0
- package/dist/WizardDivider.js.map +1 -0
- package/dist/Wizarding.js +38 -0
- package/dist/Wizarding.js.map +1 -0
- package/dist/action-icon.js +220 -0
- package/dist/action-icon.js.map +1 -0
- package/dist/action-pane.js +176 -0
- package/dist/action-pane.js.map +1 -0
- package/dist/addons/Editor.js +106 -0
- package/dist/addons/Editor.js.map +1 -0
- package/dist/addons/History.js +490 -0
- package/dist/addons/History.js.map +1 -0
- package/dist/addons/Layout.js +619 -0
- package/dist/addons/Layout.js.map +1 -0
- package/dist/addons/Settings.js +465 -0
- package/dist/addons/Settings.js.map +1 -0
- package/dist/addons/Waiter.js +45 -0
- package/dist/addons/Waiter.js.map +1 -0
- package/dist/addons/Wizards.js +48 -0
- package/dist/addons/Wizards.js.map +1 -0
- package/dist/addons/editor/edit-action-to-v1-converter.js +96 -0
- package/dist/addons/editor/edit-action-to-v1-converter.js.map +1 -0
- package/dist/addons/editor/edit-v1-to-v2-converter.js +37 -0
- package/dist/addons/editor/edit-v1-to-v2-converter.js.map +1 -0
- package/dist/addons/history/get-log-text.js +26 -0
- package/dist/addons/history/get-log-text.js.map +1 -0
- package/dist/addons/menu-tabs/menu-tabs.js +74 -0
- package/dist/addons/menu-tabs/menu-tabs.js.map +1 -0
- package/dist/addons/plugin-manager/custom-plugin-dialog.js +177 -0
- package/dist/addons/plugin-manager/custom-plugin-dialog.js.map +1 -0
- package/dist/addons/plugin-manager/plugin-manager.js +165 -0
- package/dist/addons/plugin-manager/plugin-manager.js.map +1 -0
- package/dist/core/api/api.js +7 -0
- package/dist/core/api/api.js.map +1 -0
- package/dist/core/api/editor/subject.js +22 -0
- package/dist/core/api/editor/subject.js.map +1 -0
- package/dist/core/api/editor/xml-editor.js +82 -0
- package/dist/core/api/editor/xml-editor.js.map +1 -0
- package/dist/core/api/plugin-state-api.js +27 -0
- package/dist/core/api/plugin-state-api.js.map +1 -0
- package/dist/core/foundation/cyrb64.js +26 -0
- package/dist/core/foundation/cyrb64.js.map +1 -0
- package/dist/core/foundation/deprecated/edit-event.js +44 -0
- package/dist/core/foundation/deprecated/edit-event.js.map +1 -0
- package/dist/core/foundation/deprecated/editor.js +94 -0
- package/dist/core/foundation/deprecated/editor.js.map +1 -0
- package/dist/core/foundation/deprecated/history.js +17 -0
- package/dist/core/foundation/deprecated/history.js.map +1 -0
- package/dist/core/foundation/deprecated/open-event.js +9 -0
- package/dist/core/foundation/deprecated/open-event.js.map +1 -0
- package/dist/core/foundation/deprecated/settings.js +19 -0
- package/dist/core/foundation/deprecated/settings.js.map +1 -0
- package/dist/core/foundation/deprecated/validation.js +8 -0
- package/dist/core/foundation/deprecated/validation.js.map +1 -0
- package/dist/core/foundation/deprecated/waiter.js +12 -0
- package/dist/core/foundation/deprecated/waiter.js.map +1 -0
- package/dist/core/foundation/edit-completed-event.js +11 -0
- package/dist/core/foundation/edit-completed-event.js.map +1 -0
- package/dist/core/foundation/edit-event.js +8 -0
- package/dist/core/foundation/edit-event.js.map +1 -0
- package/dist/core/foundation/edit.js +31 -0
- package/dist/core/foundation/edit.js.map +1 -0
- package/dist/core/foundation/handle-edit.js +151 -0
- package/dist/core/foundation/handle-edit.js.map +1 -0
- package/dist/core/foundation/open-event.js +8 -0
- package/dist/core/foundation/open-event.js.map +1 -0
- package/dist/core/foundation/plugin.js +2 -0
- package/dist/core/foundation/plugin.js.map +1 -0
- package/dist/core/foundation.js +14 -0
- package/dist/core/foundation.js.map +1 -0
- package/dist/core/locales.js +21 -0
- package/dist/core/locales.js.map +1 -0
- package/dist/filtered-list.js +168 -0
- package/dist/filtered-list.js.map +1 -0
- package/dist/finder-list.js +207 -0
- package/dist/finder-list.js.map +1 -0
- package/dist/foundation/compare.js +273 -0
- package/dist/foundation/compare.js.map +1 -0
- package/dist/foundation/dai.js +127 -0
- package/dist/foundation/dai.js.map +1 -0
- package/dist/foundation/generators.js +67 -0
- package/dist/foundation/generators.js.map +1 -0
- package/dist/foundation/ied.js +84 -0
- package/dist/foundation/ied.js.map +1 -0
- package/dist/foundation/nsd.js +13 -0
- package/dist/foundation/nsd.js.map +1 -0
- package/dist/foundation/nsdoc.js +180 -0
- package/dist/foundation/nsdoc.js.map +1 -0
- package/dist/foundation/scl.js +64 -0
- package/dist/foundation/scl.js.map +1 -0
- package/dist/foundation.js +1922 -0
- package/dist/foundation.js.map +1 -0
- package/dist/icons/compare.js +11 -0
- package/dist/icons/compare.js.map +1 -0
- package/dist/icons/icons.js +611 -0
- package/dist/icons/icons.js.map +1 -0
- package/dist/icons/ied-icons.js +11 -0
- package/dist/icons/ied-icons.js.map +1 -0
- package/dist/icons/lnode.js +50 -0
- package/dist/icons/lnode.js.map +1 -0
- package/dist/open-scd.js +483 -0
- package/dist/open-scd.js.map +1 -0
- package/dist/openscd/src/WizardDivider.js +37 -0
- package/dist/openscd/src/WizardDivider.js.map +1 -0
- package/dist/openscd/src/Wizarding.js +38 -0
- package/dist/openscd/src/Wizarding.js.map +1 -0
- package/dist/openscd/src/action-icon.js +220 -0
- package/dist/openscd/src/action-icon.js.map +1 -0
- package/dist/openscd/src/action-pane.js +176 -0
- package/dist/openscd/src/action-pane.js.map +1 -0
- package/dist/openscd/src/addons/Editor.js +106 -0
- package/dist/openscd/src/addons/Editor.js.map +1 -0
- package/dist/openscd/src/addons/History.js +490 -0
- package/dist/openscd/src/addons/History.js.map +1 -0
- package/dist/openscd/src/addons/Layout.js +619 -0
- package/dist/openscd/src/addons/Layout.js.map +1 -0
- package/dist/openscd/src/addons/Settings.js +465 -0
- package/dist/openscd/src/addons/Settings.js.map +1 -0
- package/dist/openscd/src/addons/Waiter.js +45 -0
- package/dist/openscd/src/addons/Waiter.js.map +1 -0
- package/dist/openscd/src/addons/Wizards.js +48 -0
- package/dist/openscd/src/addons/Wizards.js.map +1 -0
- package/dist/openscd/src/addons/editor/edit-action-to-v1-converter.js +96 -0
- package/dist/openscd/src/addons/editor/edit-action-to-v1-converter.js.map +1 -0
- package/dist/openscd/src/addons/editor/edit-v1-to-v2-converter.js +37 -0
- package/dist/openscd/src/addons/editor/edit-v1-to-v2-converter.js.map +1 -0
- package/dist/openscd/src/addons/history/get-log-text.js +26 -0
- package/dist/openscd/src/addons/history/get-log-text.js.map +1 -0
- package/dist/openscd/src/addons/menu-tabs/menu-tabs.js +74 -0
- package/dist/openscd/src/addons/menu-tabs/menu-tabs.js.map +1 -0
- package/dist/openscd/src/addons/plugin-manager/custom-plugin-dialog.js +177 -0
- package/dist/openscd/src/addons/plugin-manager/custom-plugin-dialog.js.map +1 -0
- package/dist/openscd/src/addons/plugin-manager/plugin-manager.js +165 -0
- package/dist/openscd/src/addons/plugin-manager/plugin-manager.js.map +1 -0
- package/dist/openscd/src/filtered-list.js +168 -0
- package/dist/openscd/src/filtered-list.js.map +1 -0
- package/dist/openscd/src/finder-list.js +207 -0
- package/dist/openscd/src/finder-list.js.map +1 -0
- package/dist/openscd/src/foundation/compare.js +273 -0
- package/dist/openscd/src/foundation/compare.js.map +1 -0
- package/dist/openscd/src/foundation/dai.js +127 -0
- package/dist/openscd/src/foundation/dai.js.map +1 -0
- package/dist/openscd/src/foundation/generators.js +67 -0
- package/dist/openscd/src/foundation/generators.js.map +1 -0
- package/dist/openscd/src/foundation/ied.js +84 -0
- package/dist/openscd/src/foundation/ied.js.map +1 -0
- package/dist/openscd/src/foundation/nsd.js +13 -0
- package/dist/openscd/src/foundation/nsd.js.map +1 -0
- package/dist/openscd/src/foundation/nsdoc.js +180 -0
- package/dist/openscd/src/foundation/nsdoc.js.map +1 -0
- package/dist/openscd/src/foundation/scl.js +64 -0
- package/dist/openscd/src/foundation/scl.js.map +1 -0
- package/dist/openscd/src/foundation.js +1922 -0
- package/dist/openscd/src/foundation.js.map +1 -0
- package/dist/openscd/src/icons/compare.js +11 -0
- package/dist/openscd/src/icons/compare.js.map +1 -0
- package/dist/openscd/src/icons/icons.js +611 -0
- package/dist/openscd/src/icons/icons.js.map +1 -0
- package/dist/openscd/src/icons/ied-icons.js +11 -0
- package/dist/openscd/src/icons/ied-icons.js.map +1 -0
- package/dist/openscd/src/icons/lnode.js +50 -0
- package/dist/openscd/src/icons/lnode.js.map +1 -0
- package/dist/openscd/src/open-scd.js +483 -0
- package/dist/openscd/src/open-scd.js.map +1 -0
- package/dist/openscd/src/oscd-filter-button.js +89 -0
- package/dist/openscd/src/oscd-filter-button.js.map +1 -0
- package/dist/openscd/src/plain-compare-list.js +132 -0
- package/dist/openscd/src/plain-compare-list.js.map +1 -0
- package/dist/openscd/src/plugin-tag.js +23 -0
- package/dist/openscd/src/plugin-tag.js.map +1 -0
- package/dist/openscd/src/plugin.events.js +12 -0
- package/dist/openscd/src/plugin.events.js.map +1 -0
- package/dist/openscd/src/plugin.js +2 -0
- package/dist/openscd/src/plugin.js.map +1 -0
- package/dist/openscd/src/plugins.js +256 -0
- package/dist/openscd/src/plugins.js.map +1 -0
- package/dist/openscd/src/schemas.js +9325 -0
- package/dist/openscd/src/schemas.js.map +1 -0
- package/dist/openscd/src/themes.js +122 -0
- package/dist/openscd/src/themes.js.map +1 -0
- package/dist/openscd/src/translations/de.js +954 -0
- package/dist/openscd/src/translations/de.js.map +1 -0
- package/dist/openscd/src/translations/en.js +950 -0
- package/dist/openscd/src/translations/en.js.map +1 -0
- package/dist/openscd/src/translations/loader.js +10 -0
- package/dist/openscd/src/translations/loader.js.map +1 -0
- package/dist/openscd/src/wizard-checkbox.js +152 -0
- package/dist/openscd/src/wizard-checkbox.js.map +1 -0
- package/dist/openscd/src/wizard-dialog.js +374 -0
- package/dist/openscd/src/wizard-dialog.js.map +1 -0
- package/dist/openscd/src/wizard-select.js +115 -0
- package/dist/openscd/src/wizard-select.js.map +1 -0
- package/dist/openscd/src/wizard-textfield.js +191 -0
- package/dist/openscd/src/wizard-textfield.js.map +1 -0
- package/dist/openscd/src/wizards.js +196 -0
- package/dist/openscd/src/wizards.js.map +1 -0
- package/dist/oscd-filter-button.js +89 -0
- package/dist/oscd-filter-button.js.map +1 -0
- package/dist/plain-compare-list.js +132 -0
- package/dist/plain-compare-list.js.map +1 -0
- package/dist/plugin-tag.js +23 -0
- package/dist/plugin-tag.js.map +1 -0
- package/dist/plugin.events.js +12 -0
- package/dist/plugin.events.js.map +1 -0
- package/dist/plugin.js +2 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugins.js +256 -0
- package/dist/plugins.js.map +1 -0
- package/dist/schemas.js +9325 -0
- package/dist/schemas.js.map +1 -0
- package/dist/themes.js +122 -0
- package/dist/themes.js.map +1 -0
- package/dist/translations/de.js +954 -0
- package/dist/translations/de.js.map +1 -0
- package/dist/translations/en.js +950 -0
- package/dist/translations/en.js.map +1 -0
- package/dist/translations/loader.js +10 -0
- package/dist/translations/loader.js.map +1 -0
- package/dist/wizard-checkbox.js +152 -0
- package/dist/wizard-checkbox.js.map +1 -0
- package/dist/wizard-dialog.js +374 -0
- package/dist/wizard-dialog.js.map +1 -0
- package/dist/wizard-select.js +115 -0
- package/dist/wizard-select.js.map +1 -0
- package/dist/wizard-textfield.js +191 -0
- package/dist/wizard-textfield.js.map +1 -0
- package/dist/wizards.js +196 -0
- package/dist/wizards.js.map +1 -0
- package/dist/xml/src/foundation.js +67 -0
- package/dist/xml/src/foundation.js.map +1 -0
- package/dist/xml/src/index.js +2 -0
- package/dist/xml/src/index.js.map +1 -0
- package/package.json +99 -4
|
@@ -0,0 +1,1922 @@
|
|
|
1
|
+
import { directive } from 'lit-html';
|
|
2
|
+
import { Select } from '@material/mwc-select';
|
|
3
|
+
import { getChildElementsByTagName } from '@openscd/xml';
|
|
4
|
+
import { WizardTextField } from './wizard-textfield.js';
|
|
5
|
+
import { WizardSelect } from './wizard-select.js';
|
|
6
|
+
import { WizardCheckbox } from './wizard-checkbox.js';
|
|
7
|
+
export const wizardInputSelector = 'wizard-textfield, mwc-textfield, ace-editor, mwc-select, wizard-select, wizard-checkbox';
|
|
8
|
+
export function isWizardFactory(maybeFactory) {
|
|
9
|
+
return typeof maybeFactory === 'function';
|
|
10
|
+
}
|
|
11
|
+
/** @returns the validity of `input` depending on type. */
|
|
12
|
+
export function checkValidity(input) {
|
|
13
|
+
if (input instanceof WizardTextField || input instanceof Select)
|
|
14
|
+
return input.checkValidity();
|
|
15
|
+
else
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
/** reports the validity of `input` depending on type. */
|
|
19
|
+
export function reportValidity(input) {
|
|
20
|
+
if (input instanceof WizardTextField || input instanceof Select)
|
|
21
|
+
return input.reportValidity();
|
|
22
|
+
else
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
/** @returns the `value` or `maybeValue` of `input` depending on type. */
|
|
26
|
+
export function getValue(input) {
|
|
27
|
+
if (input instanceof WizardTextField ||
|
|
28
|
+
input instanceof WizardSelect ||
|
|
29
|
+
input instanceof WizardCheckbox)
|
|
30
|
+
return input.maybeValue;
|
|
31
|
+
else
|
|
32
|
+
return input.value ?? null;
|
|
33
|
+
}
|
|
34
|
+
/** @returns the `multiplier` of `input` if available. */
|
|
35
|
+
export function getMultiplier(input) {
|
|
36
|
+
if (input instanceof WizardTextField)
|
|
37
|
+
return input.multiplier;
|
|
38
|
+
else
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
export function newWizardEvent(wizardOrFactory, eventInitDict) {
|
|
42
|
+
if (!wizardOrFactory)
|
|
43
|
+
return new CustomEvent('wizard', {
|
|
44
|
+
bubbles: true,
|
|
45
|
+
composed: true,
|
|
46
|
+
...eventInitDict,
|
|
47
|
+
detail: { wizard: null, ...eventInitDict?.detail },
|
|
48
|
+
});
|
|
49
|
+
const wizard = isWizardFactory(wizardOrFactory)
|
|
50
|
+
? wizardOrFactory
|
|
51
|
+
: () => wizardOrFactory;
|
|
52
|
+
return new CustomEvent('wizard', {
|
|
53
|
+
bubbles: true,
|
|
54
|
+
composed: true,
|
|
55
|
+
...eventInitDict,
|
|
56
|
+
detail: { wizard, ...eventInitDict?.detail },
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export function newSubWizardEvent(wizardOrFactory) {
|
|
60
|
+
return newWizardEvent(wizardOrFactory, { detail: { subwizard: true } });
|
|
61
|
+
}
|
|
62
|
+
/** @returns a reference to `element` with segments delimited by '/'. */
|
|
63
|
+
// TODO(c-dinkel): replace with identity (FIXME)
|
|
64
|
+
export function referencePath(element) {
|
|
65
|
+
let path = '';
|
|
66
|
+
let nextParent = element.parentElement;
|
|
67
|
+
while (nextParent?.getAttribute('name')) {
|
|
68
|
+
path = '/' + nextParent.getAttribute('name') + path;
|
|
69
|
+
nextParent = nextParent.parentElement;
|
|
70
|
+
}
|
|
71
|
+
return path;
|
|
72
|
+
}
|
|
73
|
+
export function getSclSchemaVersion(doc) {
|
|
74
|
+
const scl = doc.documentElement;
|
|
75
|
+
const edition = (scl.getAttribute('version') ?? '2003') +
|
|
76
|
+
(scl.getAttribute('revision') ?? '') +
|
|
77
|
+
(scl.getAttribute('release') ?? '');
|
|
78
|
+
return edition;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Extract the 'name' attribute from the given XML element.
|
|
82
|
+
* @param element - The element to extract name from.
|
|
83
|
+
* @returns the name, or undefined if there is no name.
|
|
84
|
+
*/
|
|
85
|
+
export function getNameAttribute(element) {
|
|
86
|
+
const name = element.getAttribute('name');
|
|
87
|
+
return name ? name : undefined;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Extract the 'ldName' attribute from the given XML element.
|
|
91
|
+
* @param element - The element to extract ldName from.
|
|
92
|
+
* @returns the ldName, or undefined if there is no ldName.
|
|
93
|
+
*/
|
|
94
|
+
export function getLdNameAttribute(element) {
|
|
95
|
+
const name = element.getAttribute('ldName');
|
|
96
|
+
return name ? name : undefined;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Extract the 'desc' attribute from the given XML element.
|
|
100
|
+
* @param element - The element to extract description from.
|
|
101
|
+
* @returns the name, or undefined if there is no description.
|
|
102
|
+
*/
|
|
103
|
+
export function getDescriptionAttribute(element) {
|
|
104
|
+
const name = element.getAttribute('desc');
|
|
105
|
+
return name ? name : undefined;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Extract the 'pathName' attribute from the given XML element.
|
|
109
|
+
* @param element - The element to extract path name from.
|
|
110
|
+
* @returns the name, or undefined if there is no path name.
|
|
111
|
+
*/
|
|
112
|
+
export function getPathNameAttribute(element) {
|
|
113
|
+
const name = element.getAttribute('pathName');
|
|
114
|
+
return name ? name : undefined;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Extract the 'inst' attribute from the given XML element.
|
|
118
|
+
* @param element - The element to extract instance from.
|
|
119
|
+
* @returns the instance, or undefined if there is no instance.
|
|
120
|
+
*/
|
|
121
|
+
export function getInstanceAttribute(element) {
|
|
122
|
+
const inst = element.getAttribute('inst');
|
|
123
|
+
return inst ? inst : undefined;
|
|
124
|
+
}
|
|
125
|
+
export function pathParts(identity) {
|
|
126
|
+
const path = identity.split('>');
|
|
127
|
+
const end = path.pop() ?? '';
|
|
128
|
+
const start = path.join('>');
|
|
129
|
+
return [start, end];
|
|
130
|
+
}
|
|
131
|
+
const voidSelector = ':not(*)';
|
|
132
|
+
function hitemIdentity(e) {
|
|
133
|
+
return `${e.getAttribute('version')}\t${e.getAttribute('revision')}`;
|
|
134
|
+
}
|
|
135
|
+
function hitemSelector(tagName, identity) {
|
|
136
|
+
const [version, revision] = identity.split('\t');
|
|
137
|
+
if (!version || !revision)
|
|
138
|
+
return voidSelector;
|
|
139
|
+
return `${tagName}[version="${version}"][revision="${revision}"]`;
|
|
140
|
+
}
|
|
141
|
+
function terminalIdentity(e) {
|
|
142
|
+
return identity(e.parentElement) + '>' + e.getAttribute('connectivityNode');
|
|
143
|
+
}
|
|
144
|
+
function terminalSelector(tagName, identity) {
|
|
145
|
+
const [parentIdentity, connectivityNode] = pathParts(identity);
|
|
146
|
+
const parentSelectors = tags[tagName].parents.flatMap(parentTag => selector(parentTag, parentIdentity).split(','));
|
|
147
|
+
return crossProduct(parentSelectors, ['>'], [`${tagName}[connectivityNode="${connectivityNode}"]`])
|
|
148
|
+
.map(strings => strings.join(''))
|
|
149
|
+
.join(',');
|
|
150
|
+
}
|
|
151
|
+
function lNodeIdentity(e) {
|
|
152
|
+
const [iedName, ldInst, prefix, lnClass, lnInst, lnType] = [
|
|
153
|
+
'iedName',
|
|
154
|
+
'ldInst',
|
|
155
|
+
'prefix',
|
|
156
|
+
'lnClass',
|
|
157
|
+
'lnInst',
|
|
158
|
+
'lnType',
|
|
159
|
+
].map(name => e.getAttribute(name));
|
|
160
|
+
if (iedName === 'None')
|
|
161
|
+
return `${identity(e.parentElement)}>(${lnClass} ${lnType} ${lnInst})`;
|
|
162
|
+
return `${iedName} ${ldInst || '(Client)'}/${prefix ?? ''} ${lnClass} ${lnInst ?? ''}`;
|
|
163
|
+
}
|
|
164
|
+
function lNodeSelector(tagName, identity) {
|
|
165
|
+
if (identity.endsWith(')')) {
|
|
166
|
+
const [parentIdentity, childIdentity] = pathParts(identity);
|
|
167
|
+
const [lnClass, lnType, lnInst] = childIdentity
|
|
168
|
+
.substring(1, childIdentity.length - 1)
|
|
169
|
+
.split(' ');
|
|
170
|
+
if (!lnClass || !lnType)
|
|
171
|
+
return voidSelector;
|
|
172
|
+
const parentSelectors = tags[tagName].parents.flatMap(parentTag => selector(parentTag, parentIdentity).split(','));
|
|
173
|
+
return crossProduct(parentSelectors, ['>'], [`${tagName}[iedName="None"][lnClass="${lnClass}"][lnType="${lnType}"][lnInst="${lnInst}"]`])
|
|
174
|
+
.map(strings => strings.join(''))
|
|
175
|
+
.join(',');
|
|
176
|
+
}
|
|
177
|
+
const [iedName, ldInst, prefix, lnClass, lnInst] = identity.split(/[ /]/);
|
|
178
|
+
if (!iedName || !ldInst || !lnClass)
|
|
179
|
+
return voidSelector;
|
|
180
|
+
const [iedNameSelectors, ldInstSelectors, prefixSelectors, lnClassSelectors, lnInstSelectors,] = [
|
|
181
|
+
[`[iedName="${iedName}"]`],
|
|
182
|
+
ldInst === '(Client)'
|
|
183
|
+
? [':not([ldInst])', '[ldInst=""]']
|
|
184
|
+
: [`[ldInst="${ldInst}"]`],
|
|
185
|
+
prefix ? [`[prefix="${prefix}"]`] : [':not([prefix])', '[prefix=""]'],
|
|
186
|
+
[`[lnClass="${lnClass}"]`],
|
|
187
|
+
lnInst ? [`[lnInst="${lnInst}"]`] : [':not([lnInst])', '[lnInst=""]'],
|
|
188
|
+
];
|
|
189
|
+
return crossProduct([tagName], iedNameSelectors, ldInstSelectors, prefixSelectors, lnClassSelectors, lnInstSelectors)
|
|
190
|
+
.map(strings => strings.join(''))
|
|
191
|
+
.join(',');
|
|
192
|
+
}
|
|
193
|
+
function kDCIdentity(e) {
|
|
194
|
+
return `${identity(e.parentElement)}>${e.getAttribute('iedName')} ${e.getAttribute('apName')}`;
|
|
195
|
+
}
|
|
196
|
+
function kDCSelector(tagName, identity) {
|
|
197
|
+
const [parentIdentity, childIdentity] = pathParts(identity);
|
|
198
|
+
const [iedName, apName] = childIdentity.split(' ');
|
|
199
|
+
return `${selector('IED', parentIdentity)}>${tagName}[iedName="${iedName}"][apName="${apName}"]`;
|
|
200
|
+
}
|
|
201
|
+
function associationIdentity(e) {
|
|
202
|
+
return `${identity(e.parentElement)}>${e.getAttribute('associationID') ?? ''}`;
|
|
203
|
+
}
|
|
204
|
+
function associationSelector(tagName, identity) {
|
|
205
|
+
const [parentIdentity, associationID] = pathParts(identity);
|
|
206
|
+
if (!associationID)
|
|
207
|
+
return voidSelector;
|
|
208
|
+
return `${selector('Server', parentIdentity)}>${tagName}[associationID="${associationID}"]`;
|
|
209
|
+
}
|
|
210
|
+
function lDeviceIdentity(e) {
|
|
211
|
+
return `${identity(e.closest('IED'))}>>${e.getAttribute('inst')}`;
|
|
212
|
+
}
|
|
213
|
+
function lDeviceSelector(tagName, identity) {
|
|
214
|
+
const [iedName, inst] = identity.split('>>');
|
|
215
|
+
if (!inst)
|
|
216
|
+
return voidSelector;
|
|
217
|
+
return `IED[name="${iedName}"] ${tagName}[inst="${inst}"]`;
|
|
218
|
+
}
|
|
219
|
+
function iEDNameIdentity(e) {
|
|
220
|
+
const iedName = e.textContent;
|
|
221
|
+
const [apRef, ldInst, prefix, lnClass, lnInst] = [
|
|
222
|
+
'apRef',
|
|
223
|
+
'ldInst',
|
|
224
|
+
'prefix',
|
|
225
|
+
'lnClass',
|
|
226
|
+
'lnInst',
|
|
227
|
+
].map(name => e.getAttribute(name));
|
|
228
|
+
return `${identity(e.parentElement)}>${iedName} ${apRef ? apRef : ''} ${ldInst ? ldInst : ''}/${prefix ?? ''} ${lnClass ?? ''} ${lnInst ?? ''}`;
|
|
229
|
+
}
|
|
230
|
+
function iEDNameSelector(tagName, identity) {
|
|
231
|
+
const [parentIdentity, childIdentity] = pathParts(identity);
|
|
232
|
+
const [iedName, apRef, ldInst, prefix, lnClass, lnInst] = childIdentity.split(/[ /]/);
|
|
233
|
+
const [parentSelectors, apRefSelectors, ldInstSelectors, prefixSelectors, lnClassSelectors, lnInstSelectors,] = [
|
|
234
|
+
tags[tagName].parents.flatMap(parentTag => selector(parentTag, parentIdentity).split(',')),
|
|
235
|
+
[`${iedName}`],
|
|
236
|
+
apRef ? [`[apRef="${apRef}"]`] : [':not([apRef])', '[apRef=""]'],
|
|
237
|
+
ldInst ? [`[ldInst="${ldInst}"]`] : [':not([ldInst])', '[ldInst=""]'],
|
|
238
|
+
prefix ? [`[prefix="${prefix}"]`] : [':not([prefix])', '[prefix=""]'],
|
|
239
|
+
[`[lnClass="${lnClass}"]`],
|
|
240
|
+
lnInst ? [`[lnInst="${lnInst}"]`] : [':not([lnInst])', '[lnInst=""]'],
|
|
241
|
+
];
|
|
242
|
+
return crossProduct(parentSelectors, ['>'], [tagName], apRefSelectors, ldInstSelectors, prefixSelectors, lnClassSelectors, lnInstSelectors)
|
|
243
|
+
.map(strings => strings.join(''))
|
|
244
|
+
.join(',');
|
|
245
|
+
}
|
|
246
|
+
function fCDAIdentity(e) {
|
|
247
|
+
const [ldInst, prefix, lnClass, lnInst, doName, daName, fc, ix] = [
|
|
248
|
+
'ldInst',
|
|
249
|
+
'prefix',
|
|
250
|
+
'lnClass',
|
|
251
|
+
'lnInst',
|
|
252
|
+
'doName',
|
|
253
|
+
'daName',
|
|
254
|
+
'fc',
|
|
255
|
+
'ix',
|
|
256
|
+
].map(name => e.getAttribute(name));
|
|
257
|
+
const dataPath = `${ldInst}/${prefix ?? ''} ${lnClass} ${lnInst ?? ''}.${doName} ${daName ? daName : ''}`;
|
|
258
|
+
return `${identity(e.parentElement)}>${dataPath} (${fc}${ix ? ' [' + ix + ']' : ''})`;
|
|
259
|
+
}
|
|
260
|
+
function fCDASelector(tagName, identity) {
|
|
261
|
+
const [parentIdentity, childIdentity] = pathParts(identity);
|
|
262
|
+
const [ldInst, prefix, lnClass, lnInst] = childIdentity.split(/[ /.]/);
|
|
263
|
+
const matchDoDa = childIdentity.match(/.([A-Z][A-Za-z0-9.]*) ([A-Za-z0-9.]*) \(/);
|
|
264
|
+
const doName = matchDoDa && matchDoDa[1] ? matchDoDa[1] : '';
|
|
265
|
+
const daName = matchDoDa && matchDoDa[2] ? matchDoDa[2] : '';
|
|
266
|
+
const matchFx = childIdentity.match(/\(([A-Z]{2})/);
|
|
267
|
+
const matchIx = childIdentity.match(/ \[([0-9]{1,2})\]/);
|
|
268
|
+
const fc = matchFx && matchFx[1] ? matchFx[1] : '';
|
|
269
|
+
const ix = matchIx && matchIx[1] ? matchIx[1] : '';
|
|
270
|
+
const [parentSelectors, ldInstSelectors, prefixSelectors, lnClassSelectors, lnInstSelectors, doNameSelectors, daNameSelectors, fcSelectors, ixSelectors,] = [
|
|
271
|
+
tags[tagName].parents.flatMap(parentTag => selector(parentTag, parentIdentity).split(',')),
|
|
272
|
+
[`[ldInst="${ldInst}"]`],
|
|
273
|
+
prefix ? [`[prefix="${prefix}"]`] : [':not([prefix])', '[prefix=""]'],
|
|
274
|
+
[`[lnClass="${lnClass}"]`],
|
|
275
|
+
lnInst ? [`[lnInst="${lnInst}"]`] : [':not([lnInst])', '[lnInst=""]'],
|
|
276
|
+
[`[doName="${doName}"]`],
|
|
277
|
+
daName ? [`[daName="${daName}"]`] : [':not([daName])', '[daName=""]'],
|
|
278
|
+
[`[fc="${fc}"]`],
|
|
279
|
+
ix ? [`[ix="${ix}"]`] : [':not([ix])', '[ix=""]'],
|
|
280
|
+
];
|
|
281
|
+
return crossProduct(parentSelectors, ['>'], [tagName], ldInstSelectors, prefixSelectors, lnClassSelectors, lnInstSelectors, doNameSelectors, daNameSelectors, fcSelectors, ixSelectors)
|
|
282
|
+
.map(strings => strings.join(''))
|
|
283
|
+
.join(',');
|
|
284
|
+
}
|
|
285
|
+
function extRefIdentity(e) {
|
|
286
|
+
if (!e.parentElement)
|
|
287
|
+
return NaN;
|
|
288
|
+
const parentIdentity = identity(e.parentElement);
|
|
289
|
+
const iedName = e.getAttribute('iedName');
|
|
290
|
+
const intAddr = e.getAttribute('intAddr');
|
|
291
|
+
const intAddrIndex = Array.from(e.parentElement.querySelectorAll(`ExtRef[intAddr="${intAddr}"]`)).indexOf(e);
|
|
292
|
+
if (intAddr)
|
|
293
|
+
return `${parentIdentity}>${intAddr}[${intAddrIndex}]`;
|
|
294
|
+
const [ldInst, prefix, lnClass, lnInst, doName, daName, serviceType, srcLDInst, srcPrefix, srcLNClass, srcLNInst, srcCBName,] = [
|
|
295
|
+
'ldInst',
|
|
296
|
+
'prefix',
|
|
297
|
+
'lnClass',
|
|
298
|
+
'lnInst',
|
|
299
|
+
'doName',
|
|
300
|
+
'daName',
|
|
301
|
+
'serviceType',
|
|
302
|
+
'srcLDInst',
|
|
303
|
+
'srcPrefix',
|
|
304
|
+
'srcLNClass',
|
|
305
|
+
'srcLNInst',
|
|
306
|
+
'srcCBName',
|
|
307
|
+
].map(name => e.getAttribute(name));
|
|
308
|
+
const cbPath = srcCBName
|
|
309
|
+
? `${serviceType}:${srcCBName} ${srcLDInst ?? ''}/${srcPrefix ?? ''} ${srcLNClass ?? ''} ${srcLNInst ?? ''}`
|
|
310
|
+
: '';
|
|
311
|
+
const dataPath = `${iedName} ${ldInst}/${prefix ?? ''} ${lnClass} ${lnInst ?? ''} ${doName} ${daName ? daName : ''}`;
|
|
312
|
+
return `${parentIdentity}>${cbPath ? cbPath + ' ' : ''}${dataPath}${intAddr ? '@' + `${intAddr}` : ''}`;
|
|
313
|
+
}
|
|
314
|
+
function extRefSelector(tagName, identity) {
|
|
315
|
+
const [parentIdentity, childIdentity] = pathParts(identity);
|
|
316
|
+
const parentSelectors = tags[tagName].parents.flatMap(parentTag => selector(parentTag, parentIdentity).split(','));
|
|
317
|
+
if (childIdentity.endsWith(']')) {
|
|
318
|
+
const [intAddr] = childIdentity.split('[');
|
|
319
|
+
const intAddrSelectors = [`[intAddr="${intAddr}"]`];
|
|
320
|
+
return crossProduct(parentSelectors, ['>'], [tagName], intAddrSelectors)
|
|
321
|
+
.map(strings => strings.join(''))
|
|
322
|
+
.join(',');
|
|
323
|
+
}
|
|
324
|
+
let iedName, ldInst, prefix, lnClass, lnInst, doName, daName, serviceType, srcCBName, srcLDInst, srcPrefix, srcLNClass, srcLNInst, intAddr;
|
|
325
|
+
if (!childIdentity.includes(':') && !childIdentity.includes('@')) {
|
|
326
|
+
[iedName, ldInst, prefix, lnClass, lnInst, doName, daName] =
|
|
327
|
+
childIdentity.split(/[ /]/);
|
|
328
|
+
}
|
|
329
|
+
else if (childIdentity.includes(':') && !childIdentity.includes('@')) {
|
|
330
|
+
[
|
|
331
|
+
serviceType,
|
|
332
|
+
srcCBName,
|
|
333
|
+
srcLDInst,
|
|
334
|
+
srcPrefix,
|
|
335
|
+
srcLNClass,
|
|
336
|
+
srcLNInst,
|
|
337
|
+
iedName,
|
|
338
|
+
ldInst,
|
|
339
|
+
prefix,
|
|
340
|
+
lnClass,
|
|
341
|
+
lnInst,
|
|
342
|
+
doName,
|
|
343
|
+
daName,
|
|
344
|
+
] = childIdentity.split(/[ /:]/);
|
|
345
|
+
}
|
|
346
|
+
else if (!childIdentity.includes(':') && childIdentity.includes('@')) {
|
|
347
|
+
[iedName, ldInst, prefix, lnClass, lnInst, doName, daName, intAddr] =
|
|
348
|
+
childIdentity.split(/[ /@]/);
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
[
|
|
352
|
+
serviceType,
|
|
353
|
+
srcCBName,
|
|
354
|
+
srcLDInst,
|
|
355
|
+
srcPrefix,
|
|
356
|
+
srcLNClass,
|
|
357
|
+
srcLNInst,
|
|
358
|
+
iedName,
|
|
359
|
+
ldInst,
|
|
360
|
+
prefix,
|
|
361
|
+
lnClass,
|
|
362
|
+
lnInst,
|
|
363
|
+
doName,
|
|
364
|
+
daName,
|
|
365
|
+
intAddr,
|
|
366
|
+
] = childIdentity.split(/[ /:@]/);
|
|
367
|
+
}
|
|
368
|
+
const [iedNameSelectors, ldInstSelectors, prefixSelectors, lnClassSelectors, lnInstSelectors, doNameSelectors, daNameSelectors, serviceTypeSelectors, srcCBNameSelectors, srcLDInstSelectors, srcPrefixSelectors, srcLNClassSelectors, srcLNInstSelectors, intAddrSelectors,] = [
|
|
369
|
+
iedName ? [`[iedName="${iedName}"]`] : [':not([iedName])'],
|
|
370
|
+
ldInst ? [`[ldInst="${ldInst}"]`] : [':not([ldInst])', '[ldInst=""]'],
|
|
371
|
+
prefix ? [`[prefix="${prefix}"]`] : [':not([prefix])', '[prefix=""]'],
|
|
372
|
+
lnClass ? [`[lnClass="${lnClass}"]`] : [':not([lnClass])'],
|
|
373
|
+
lnInst ? [`[lnInst="${lnInst}"]`] : [':not([lnInst])', '[lnInst=""]'],
|
|
374
|
+
doName ? [`[doName="${doName}"]`] : [':not([doName])'],
|
|
375
|
+
daName ? [`[daName="${daName}"]`] : [':not([daName])', '[daName=""]'],
|
|
376
|
+
serviceType
|
|
377
|
+
? [`[serviceType="${serviceType}"]`]
|
|
378
|
+
: [':not([serviceType])', '[serviceType=""]'],
|
|
379
|
+
srcCBName
|
|
380
|
+
? [`[srcCBName="${srcCBName}"]`]
|
|
381
|
+
: [':not([srcCBName])', '[srcCBName=""]'],
|
|
382
|
+
srcLDInst
|
|
383
|
+
? [`[srcLDInst="${srcLDInst}"]`]
|
|
384
|
+
: [':not([srcLDInst])', '[srcLDInst=""]'],
|
|
385
|
+
srcPrefix
|
|
386
|
+
? [`[srcPrefix="${srcPrefix}"]`]
|
|
387
|
+
: [':not([srcPrefix])', '[srcPrefix=""]'],
|
|
388
|
+
srcLNClass
|
|
389
|
+
? [`[srcLNClass="${srcLNClass}"]`]
|
|
390
|
+
: [':not([srcLNClass])', '[srcLNClass=""]'],
|
|
391
|
+
srcLNInst
|
|
392
|
+
? [`[srcLNInst="${srcLNInst}"]`]
|
|
393
|
+
: [':not([srcLNInst])', '[srcLNInst=""]'],
|
|
394
|
+
intAddr ? [`[intAddr="${intAddr}"]`] : [':not([intAddr])', '[intAddr=""]'],
|
|
395
|
+
];
|
|
396
|
+
return crossProduct(parentSelectors, ['>'], [tagName], iedNameSelectors, ldInstSelectors, prefixSelectors, lnClassSelectors, lnInstSelectors, doNameSelectors, daNameSelectors, serviceTypeSelectors, srcCBNameSelectors, srcLDInstSelectors, srcPrefixSelectors, srcLNClassSelectors, srcLNInstSelectors, intAddrSelectors)
|
|
397
|
+
.map(strings => strings.join(''))
|
|
398
|
+
.join(',');
|
|
399
|
+
}
|
|
400
|
+
function lNIdentity(e) {
|
|
401
|
+
const [prefix, lnClass, inst] = ['prefix', 'lnClass', 'inst'].map(name => e.getAttribute(name));
|
|
402
|
+
return `${identity(e.parentElement)}>${prefix ?? ''} ${lnClass} ${inst}`;
|
|
403
|
+
}
|
|
404
|
+
function lNSelector(tagName, identity) {
|
|
405
|
+
const [parentIdentity, childIdentity] = pathParts(identity);
|
|
406
|
+
const parentSelectors = tags[tagName].parents.flatMap(parentTag => selector(parentTag, parentIdentity).split(','));
|
|
407
|
+
const [prefix, lnClass, inst] = childIdentity.split(' ');
|
|
408
|
+
if (!lnClass)
|
|
409
|
+
return voidSelector;
|
|
410
|
+
const [prefixSelectors, lnClassSelectors, instSelectors] = [
|
|
411
|
+
prefix ? [`[prefix="${prefix}"]`] : [':not([prefix])', '[prefix=""]'],
|
|
412
|
+
[`[lnClass="${lnClass}"]`],
|
|
413
|
+
[`[inst="${inst}"]`],
|
|
414
|
+
];
|
|
415
|
+
return crossProduct(parentSelectors, ['>'], [tagName], prefixSelectors, lnClassSelectors, instSelectors)
|
|
416
|
+
.map(strings => strings.join(''))
|
|
417
|
+
.join(',');
|
|
418
|
+
}
|
|
419
|
+
function clientLNIdentity(e) {
|
|
420
|
+
const [apRef, iedName, ldInst, prefix, lnClass, lnInst] = [
|
|
421
|
+
'apRef',
|
|
422
|
+
'iedName',
|
|
423
|
+
'ldInst',
|
|
424
|
+
'prefix',
|
|
425
|
+
'lnClass',
|
|
426
|
+
'lnInst',
|
|
427
|
+
].map(name => e.getAttribute(name));
|
|
428
|
+
return `${identity(e.parentElement)}>${iedName} ${apRef ? apRef : ''} ${ldInst}/${prefix ?? ''} ${lnClass} ${lnInst}`;
|
|
429
|
+
}
|
|
430
|
+
function clientLNSelector(tagName, identity) {
|
|
431
|
+
const [parentIdentity, childIdentity] = pathParts(identity);
|
|
432
|
+
const parentSelectors = tags[tagName].parents.flatMap(parentTag => selector(parentTag, parentIdentity).split(','));
|
|
433
|
+
const [iedName, apRef, ldInst, prefix, lnClass, lnInst] = childIdentity.split(/[ /]/);
|
|
434
|
+
const [iedNameSelectors, apRefSelectors, ldInstSelectors, prefixSelectors, lnClassSelectors, lnInstSelectors,] = [
|
|
435
|
+
iedName ? [`[iedName="${iedName}"]`] : [':not([iedName])', '[iedName=""]'],
|
|
436
|
+
apRef ? [`[apRef="${apRef}"]`] : [':not([apRef])', '[apRef=""]'],
|
|
437
|
+
ldInst ? [`[ldInst="${ldInst}"]`] : [':not([ldInst])', '[ldInst=""]'],
|
|
438
|
+
prefix ? [`[prefix="${prefix}"]`] : [':not([prefix])', '[prefix=""]'],
|
|
439
|
+
[`[lnClass="${lnClass}"]`],
|
|
440
|
+
lnInst ? [`[lnInst="${lnInst}"]`] : [':not([lnInst])', '[lnInst=""]'],
|
|
441
|
+
];
|
|
442
|
+
return crossProduct(parentSelectors, ['>'], [tagName], iedNameSelectors, apRefSelectors, ldInstSelectors, prefixSelectors, lnClassSelectors, lnInstSelectors)
|
|
443
|
+
.map(strings => strings.join(''))
|
|
444
|
+
.join(',');
|
|
445
|
+
}
|
|
446
|
+
function ixNamingIdentity(e) {
|
|
447
|
+
const [name, ix] = ['name', 'ix'].map(name => e.getAttribute(name));
|
|
448
|
+
return `${identity(e.parentElement)}>${name}${ix ? '[' + ix + ']' : ''}`;
|
|
449
|
+
}
|
|
450
|
+
function ixNamingSelector(tagName, identity, depth = -1) {
|
|
451
|
+
if (depth === -1)
|
|
452
|
+
depth = identity.split('>').length;
|
|
453
|
+
const [parentIdentity, childIdentity] = pathParts(identity);
|
|
454
|
+
const [_0, name, _1, ix] = childIdentity.match(/([^[]*)(\[([0-9]*)\])?/) ?? [];
|
|
455
|
+
if (!name)
|
|
456
|
+
return voidSelector;
|
|
457
|
+
if (depth === 0)
|
|
458
|
+
return `${tagName}[name="${name}"]`;
|
|
459
|
+
const parentSelectors = tags[tagName].parents
|
|
460
|
+
.flatMap(parentTag => parentTag === 'SDI'
|
|
461
|
+
? ixNamingSelector(parentTag, parentIdentity, depth - 1).split(',')
|
|
462
|
+
: selector(parentTag, parentIdentity).split(','))
|
|
463
|
+
.filter(selector => !selector.startsWith(voidSelector));
|
|
464
|
+
if (parentSelectors.length === 0)
|
|
465
|
+
return voidSelector;
|
|
466
|
+
const [nameSelectors, ixSelectors] = [
|
|
467
|
+
[`[name="${name}"]`],
|
|
468
|
+
ix ? [`[ix="${ix}"]`] : ['[ix=""]', ':not([ix])'],
|
|
469
|
+
];
|
|
470
|
+
return crossProduct(parentSelectors, ['>'], [tagName], nameSelectors, ixSelectors)
|
|
471
|
+
.map(strings => strings.join(''))
|
|
472
|
+
.join(',');
|
|
473
|
+
}
|
|
474
|
+
function valIdentity(e) {
|
|
475
|
+
if (!e.parentElement)
|
|
476
|
+
return NaN;
|
|
477
|
+
const sGroup = e.getAttribute('sGroup');
|
|
478
|
+
const index = Array.from(e.parentElement.children)
|
|
479
|
+
.filter(child => child.getAttribute('sGroup') === sGroup)
|
|
480
|
+
.findIndex(child => child.isSameNode(e));
|
|
481
|
+
return `${identity(e.parentElement)}>${sGroup ? sGroup + '.' : ''} ${index}`;
|
|
482
|
+
}
|
|
483
|
+
function valSelector(tagName, identity) {
|
|
484
|
+
const [parentIdentity, childIdentity] = pathParts(identity);
|
|
485
|
+
const [sGroup, indexText] = childIdentity.split(' ');
|
|
486
|
+
const index = parseFloat(indexText);
|
|
487
|
+
const parentSelectors = tags[tagName].parents.flatMap(parentTag => selector(parentTag, parentIdentity).split(','));
|
|
488
|
+
const [nameSelectors, ixSelectors] = [
|
|
489
|
+
sGroup ? [`[sGroup="${sGroup}"]`] : [''],
|
|
490
|
+
index ? [`:nth-child(${index + 1})`] : [''],
|
|
491
|
+
];
|
|
492
|
+
return crossProduct(parentSelectors, ['>'], [tagName], nameSelectors, ixSelectors)
|
|
493
|
+
.map(strings => strings.join(''))
|
|
494
|
+
.join(',');
|
|
495
|
+
}
|
|
496
|
+
function connectedAPIdentity(e) {
|
|
497
|
+
const [iedName, apName] = ['iedName', 'apName'].map(name => e.getAttribute(name));
|
|
498
|
+
return `${iedName} ${apName}`;
|
|
499
|
+
}
|
|
500
|
+
function connectedAPSelector(tagName, identity) {
|
|
501
|
+
const [iedName, apName] = identity.split(' ');
|
|
502
|
+
if (!iedName || !apName)
|
|
503
|
+
return voidSelector;
|
|
504
|
+
return `${tagName}[iedName="${iedName}"][apName="${apName}"]`;
|
|
505
|
+
}
|
|
506
|
+
function controlBlockIdentity(e) {
|
|
507
|
+
const [ldInst, cbName] = ['ldInst', 'cbName'].map(name => e.getAttribute(name));
|
|
508
|
+
return `${ldInst} ${cbName}`;
|
|
509
|
+
}
|
|
510
|
+
function controlBlockSelector(tagName, identity) {
|
|
511
|
+
const [ldInst, cbName] = identity.split(' ');
|
|
512
|
+
if (!ldInst || !cbName)
|
|
513
|
+
return voidSelector;
|
|
514
|
+
return `${tagName}[ldInst="${ldInst}"][cbName="${cbName}"]`;
|
|
515
|
+
}
|
|
516
|
+
function physConnIdentity(e) {
|
|
517
|
+
if (!e.parentElement)
|
|
518
|
+
return NaN;
|
|
519
|
+
if (!e.parentElement.querySelector('PhysConn[type="RedConn"]'))
|
|
520
|
+
return NaN;
|
|
521
|
+
const pcType = e.getAttribute('type');
|
|
522
|
+
if (e.parentElement.children.length > 1 &&
|
|
523
|
+
pcType !== 'Connection' &&
|
|
524
|
+
pcType !== 'RedConn')
|
|
525
|
+
return NaN;
|
|
526
|
+
return `${identity(e.parentElement)}>${pcType}`;
|
|
527
|
+
}
|
|
528
|
+
function physConnSelector(tagName, identity) {
|
|
529
|
+
const [parentIdentity, pcType] = pathParts(identity);
|
|
530
|
+
const [parentSelectors, typeSelectors] = [
|
|
531
|
+
tags[tagName].parents.flatMap(parentTag => selector(parentTag, parentIdentity).split(',')),
|
|
532
|
+
pcType ? [`[type="${pcType}"]`] : [''],
|
|
533
|
+
];
|
|
534
|
+
return crossProduct(parentSelectors, ['>'], [tagName], typeSelectors)
|
|
535
|
+
.map(strings => strings.join(''))
|
|
536
|
+
.join(',');
|
|
537
|
+
}
|
|
538
|
+
function pIdentity(e) {
|
|
539
|
+
if (!e.parentElement)
|
|
540
|
+
return NaN;
|
|
541
|
+
const eParent = e.parentElement;
|
|
542
|
+
const eType = e.getAttribute('type');
|
|
543
|
+
if (eParent.tagName === 'PhysConn')
|
|
544
|
+
return `${identity(e.parentElement)}>${eType}`;
|
|
545
|
+
const index = Array.from(e.parentElement.children)
|
|
546
|
+
.filter(child => child.getAttribute('type') === eType)
|
|
547
|
+
.findIndex(child => child.isSameNode(e));
|
|
548
|
+
return `${identity(e.parentElement)}>${eType} [${index}]`;
|
|
549
|
+
}
|
|
550
|
+
function pSelector(tagName, identity) {
|
|
551
|
+
const [parentIdentity, childIdentity] = pathParts(identity);
|
|
552
|
+
const [type] = childIdentity.split(' ');
|
|
553
|
+
const index = childIdentity &&
|
|
554
|
+
childIdentity.match(/\[([0-9]+)\]/) &&
|
|
555
|
+
childIdentity.match(/\[([0-9]+)\]/)[1]
|
|
556
|
+
? parseFloat(childIdentity.match(/\[([0-9]+)\]/)[1])
|
|
557
|
+
: NaN;
|
|
558
|
+
const [parentSelectors, typeSelectors, ixSelectors] = [
|
|
559
|
+
tags[tagName].parents.flatMap(parentTag => selector(parentTag, parentIdentity).split(',')),
|
|
560
|
+
[`[type="${type}"]`],
|
|
561
|
+
index ? [`:nth-child(${index + 1})`] : [''],
|
|
562
|
+
];
|
|
563
|
+
return crossProduct(parentSelectors, ['>'], [tagName], typeSelectors, ixSelectors)
|
|
564
|
+
.map(strings => strings.join(''))
|
|
565
|
+
.join(',');
|
|
566
|
+
}
|
|
567
|
+
function enumValIdentity(e) {
|
|
568
|
+
return `${identity(e.parentElement)}>${e.getAttribute('ord')}`;
|
|
569
|
+
}
|
|
570
|
+
function enumValSelector(tagName, identity) {
|
|
571
|
+
const [parentIdentity, ord] = pathParts(identity);
|
|
572
|
+
return `${selector('EnumType', parentIdentity)}>${tagName}[ord="${ord}"]`;
|
|
573
|
+
}
|
|
574
|
+
function protNsIdentity(e) {
|
|
575
|
+
return `${identity(e.parentElement)}>${e.getAttribute('type') || '8-MMS'}\t${e.textContent}`;
|
|
576
|
+
}
|
|
577
|
+
function protNsSelector(tagName, identity) {
|
|
578
|
+
const [parentIdentity, childIdentity] = pathParts(identity);
|
|
579
|
+
const [type, value] = childIdentity.split('\t');
|
|
580
|
+
const [parentSelectors] = [
|
|
581
|
+
tags[tagName].parents.flatMap(parentTag => selector(parentTag, parentIdentity).split(',')),
|
|
582
|
+
];
|
|
583
|
+
return crossProduct(parentSelectors, ['>'], [tagName], [`[type="${type}"]`], ['>'], [value])
|
|
584
|
+
.map(strings => strings.join(''))
|
|
585
|
+
.join(',');
|
|
586
|
+
}
|
|
587
|
+
function sCLIdentity() {
|
|
588
|
+
return '';
|
|
589
|
+
}
|
|
590
|
+
function sCLSelector() {
|
|
591
|
+
return ':root';
|
|
592
|
+
}
|
|
593
|
+
function namingIdentity(e) {
|
|
594
|
+
return e.parentElement.tagName === 'SCL'
|
|
595
|
+
? e.getAttribute('name')
|
|
596
|
+
: `${identity(e.parentElement)}>${e.getAttribute('name')}`;
|
|
597
|
+
}
|
|
598
|
+
function namingSelector(tagName, identity, depth = -1) {
|
|
599
|
+
if (depth === -1)
|
|
600
|
+
depth = identity.split('>').length;
|
|
601
|
+
const [parentIdentity, name] = pathParts(identity);
|
|
602
|
+
if (!name)
|
|
603
|
+
return voidSelector;
|
|
604
|
+
if (depth === 0)
|
|
605
|
+
return `${tagName}[name="${name}"]`;
|
|
606
|
+
const parents = tags[tagName].parents;
|
|
607
|
+
if (!parents)
|
|
608
|
+
return voidSelector;
|
|
609
|
+
const parentSelectors = parents
|
|
610
|
+
.flatMap(parentTag => tags[parentTag].selector === tags['Substation'].selector
|
|
611
|
+
? namingSelector(parentTag, parentIdentity, depth - 1).split(',')
|
|
612
|
+
: selector(parentTag, parentIdentity).split(','))
|
|
613
|
+
.filter(selector => !selector.startsWith(voidSelector));
|
|
614
|
+
if (parentSelectors.length === 0)
|
|
615
|
+
return voidSelector;
|
|
616
|
+
return crossProduct(parentSelectors, ['>'], [tagName], [`[name="${name}"]`])
|
|
617
|
+
.map(strings => strings.join(''))
|
|
618
|
+
.join(',');
|
|
619
|
+
}
|
|
620
|
+
function singletonIdentity(e) {
|
|
621
|
+
return identity(e.parentElement).toString();
|
|
622
|
+
}
|
|
623
|
+
function singletonSelector(tagName, identity) {
|
|
624
|
+
const parents = tags[tagName].parents;
|
|
625
|
+
if (!parents)
|
|
626
|
+
return voidSelector;
|
|
627
|
+
const parentSelectors = parents
|
|
628
|
+
.flatMap(parentTag => selector(parentTag, identity).split(','))
|
|
629
|
+
.filter(selector => !selector.startsWith(voidSelector));
|
|
630
|
+
if (parentSelectors.length === 0)
|
|
631
|
+
return voidSelector;
|
|
632
|
+
return crossProduct(parentSelectors, ['>'], [tagName])
|
|
633
|
+
.map(strings => strings.join(''))
|
|
634
|
+
.join(',');
|
|
635
|
+
}
|
|
636
|
+
function idNamingIdentity(e) {
|
|
637
|
+
return `#${e.id}`;
|
|
638
|
+
}
|
|
639
|
+
function idNamingSelector(tagName, identity) {
|
|
640
|
+
const id = identity.replace(/^#/, '');
|
|
641
|
+
if (!id)
|
|
642
|
+
return voidSelector;
|
|
643
|
+
return `${tagName}[id="${id}"]`;
|
|
644
|
+
}
|
|
645
|
+
const tAbstractConductingEquipment = [
|
|
646
|
+
'TransformerWinding',
|
|
647
|
+
'ConductingEquipment',
|
|
648
|
+
];
|
|
649
|
+
const tEquipment = [
|
|
650
|
+
'GeneralEquipment',
|
|
651
|
+
'PowerTransformer',
|
|
652
|
+
...tAbstractConductingEquipment,
|
|
653
|
+
];
|
|
654
|
+
const tEquipmentContainer = ['Substation', 'VoltageLevel', 'Bay'];
|
|
655
|
+
const tGeneralEquipmentContainer = ['Process', 'Line'];
|
|
656
|
+
const tAbstractEqFuncSubFunc = ['EqSubFunction', 'EqFunction'];
|
|
657
|
+
const tPowerSystemResource = [
|
|
658
|
+
'SubFunction',
|
|
659
|
+
'Function',
|
|
660
|
+
'TapChanger',
|
|
661
|
+
'SubEquipment',
|
|
662
|
+
...tEquipment,
|
|
663
|
+
...tEquipmentContainer,
|
|
664
|
+
...tGeneralEquipmentContainer,
|
|
665
|
+
...tAbstractEqFuncSubFunc,
|
|
666
|
+
];
|
|
667
|
+
const tLNodeContainer = ['ConnectivityNode', ...tPowerSystemResource];
|
|
668
|
+
const tCertificate = ['GOOSESecurity', 'SMVSecurity'];
|
|
669
|
+
const tNaming = ['SubNetwork', ...tCertificate, ...tLNodeContainer];
|
|
670
|
+
const tAbstractDataAttribute = ['BDA', 'DA'];
|
|
671
|
+
const tControlWithIEDName = ['SampledValueControl', 'GSEControl'];
|
|
672
|
+
const tControlWithTriggerOpt = ['LogControl', 'ReportControl'];
|
|
673
|
+
const tControl = [...tControlWithIEDName, ...tControlWithTriggerOpt];
|
|
674
|
+
const tControlBlock = ['GSE', 'SMV'];
|
|
675
|
+
const tUnNaming = [
|
|
676
|
+
'ConnectedAP',
|
|
677
|
+
'PhysConn',
|
|
678
|
+
'SDO',
|
|
679
|
+
'DO',
|
|
680
|
+
'DAI',
|
|
681
|
+
'SDI',
|
|
682
|
+
'DOI',
|
|
683
|
+
'Inputs',
|
|
684
|
+
'RptEnabled',
|
|
685
|
+
'Server',
|
|
686
|
+
'ServerAt',
|
|
687
|
+
'SettingControl',
|
|
688
|
+
'Communication',
|
|
689
|
+
'Log',
|
|
690
|
+
'LDevice',
|
|
691
|
+
'DataSet',
|
|
692
|
+
'AccessPoint',
|
|
693
|
+
'IED',
|
|
694
|
+
'NeutralPoint',
|
|
695
|
+
...tControl,
|
|
696
|
+
...tControlBlock,
|
|
697
|
+
...tAbstractDataAttribute,
|
|
698
|
+
];
|
|
699
|
+
const tAnyLN = ['LN0', 'LN'];
|
|
700
|
+
const tAnyContentFromOtherNamespace = [
|
|
701
|
+
'Text',
|
|
702
|
+
'Private',
|
|
703
|
+
'Hitem',
|
|
704
|
+
'AccessControl',
|
|
705
|
+
];
|
|
706
|
+
const tCert = ['Subject', 'IssuerName'];
|
|
707
|
+
const tDurationInMilliSec = ['MinTime', 'MaxTime'];
|
|
708
|
+
const tIDNaming = ['LNodeType', 'DOType', 'DAType', 'EnumType'];
|
|
709
|
+
const tServiceYesNo = [
|
|
710
|
+
'FileHandling',
|
|
711
|
+
'TimeSyncProt',
|
|
712
|
+
'CommProt',
|
|
713
|
+
'SGEdit',
|
|
714
|
+
'ConfSG',
|
|
715
|
+
'GetDirectory',
|
|
716
|
+
'GetDataObjectDefinition',
|
|
717
|
+
'DataObjectDirectory',
|
|
718
|
+
'GetDataSetValue',
|
|
719
|
+
'SetDataSetValue',
|
|
720
|
+
'DataSetDirectory',
|
|
721
|
+
'ReadWrite',
|
|
722
|
+
'TimerActivatedControl',
|
|
723
|
+
'GetCBValues',
|
|
724
|
+
'GSEDir',
|
|
725
|
+
'ConfLdName',
|
|
726
|
+
];
|
|
727
|
+
const tServiceWithMaxAndMaxAttributes = ['DynDataSet', 'ConfDataSet'];
|
|
728
|
+
const tServiceWithMax = [
|
|
729
|
+
'GSSE',
|
|
730
|
+
'GOOSE',
|
|
731
|
+
'ConfReportControl',
|
|
732
|
+
'SMVsc',
|
|
733
|
+
...tServiceWithMaxAndMaxAttributes,
|
|
734
|
+
];
|
|
735
|
+
const tServiceWithMaxNonZero = ['ConfLogControl', 'ConfSigRef'];
|
|
736
|
+
const tServiceSettings = [
|
|
737
|
+
'ReportSettings',
|
|
738
|
+
'LogSettings',
|
|
739
|
+
'GSESettings',
|
|
740
|
+
'SMVSettings',
|
|
741
|
+
];
|
|
742
|
+
const tBaseElement = ['SCL', ...tNaming, ...tUnNaming, ...tIDNaming];
|
|
743
|
+
const sCLTags = [
|
|
744
|
+
...tBaseElement,
|
|
745
|
+
...tAnyContentFromOtherNamespace,
|
|
746
|
+
'Header',
|
|
747
|
+
'LNode',
|
|
748
|
+
'Val',
|
|
749
|
+
'Voltage',
|
|
750
|
+
'Services',
|
|
751
|
+
...tCert,
|
|
752
|
+
...tDurationInMilliSec,
|
|
753
|
+
'Association',
|
|
754
|
+
'FCDA',
|
|
755
|
+
'ClientLN',
|
|
756
|
+
'IEDName',
|
|
757
|
+
'ExtRef',
|
|
758
|
+
'Protocol',
|
|
759
|
+
...tAnyLN,
|
|
760
|
+
...tServiceYesNo,
|
|
761
|
+
'DynAssociation',
|
|
762
|
+
'SettingGroups',
|
|
763
|
+
...tServiceWithMax,
|
|
764
|
+
...tServiceWithMaxNonZero,
|
|
765
|
+
...tServiceSettings,
|
|
766
|
+
'ConfLNs',
|
|
767
|
+
'ClientServices',
|
|
768
|
+
'SupSubscription',
|
|
769
|
+
'ValueHandling',
|
|
770
|
+
'RedProt',
|
|
771
|
+
'McSecurity',
|
|
772
|
+
'KDC',
|
|
773
|
+
'Address',
|
|
774
|
+
'P',
|
|
775
|
+
'ProtNs',
|
|
776
|
+
'EnumVal',
|
|
777
|
+
'Terminal',
|
|
778
|
+
'BitRate',
|
|
779
|
+
'Authentication',
|
|
780
|
+
'DataTypeTemplates',
|
|
781
|
+
'History',
|
|
782
|
+
'OptFields',
|
|
783
|
+
'SmvOpts',
|
|
784
|
+
'TrgOps',
|
|
785
|
+
'SamplesPerSec',
|
|
786
|
+
'SmpRate',
|
|
787
|
+
'SecPerSamples',
|
|
788
|
+
];
|
|
789
|
+
const tagSet = new Set(sCLTags);
|
|
790
|
+
function isSCLTag(tag) {
|
|
791
|
+
return tagSet.has(tag);
|
|
792
|
+
}
|
|
793
|
+
const tBaseNameSequence = ['Text', 'Private'];
|
|
794
|
+
const tNamingSequence = [...tBaseNameSequence];
|
|
795
|
+
const tUnNamingSequence = [...tBaseNameSequence];
|
|
796
|
+
const tIDNamingSequence = [...tBaseNameSequence];
|
|
797
|
+
const tAbstractDataAttributeSequence = [...tUnNamingSequence, 'Val'];
|
|
798
|
+
const tLNodeContainerSequence = [...tNamingSequence, 'LNode'];
|
|
799
|
+
const tPowerSystemResourceSequence = [...tLNodeContainerSequence];
|
|
800
|
+
const tEquipmentSequence = [...tPowerSystemResourceSequence];
|
|
801
|
+
const tEquipmentContainerSequence = [
|
|
802
|
+
...tPowerSystemResourceSequence,
|
|
803
|
+
'PowerTransformer',
|
|
804
|
+
'GeneralEquipment',
|
|
805
|
+
];
|
|
806
|
+
const tAbstractConductingEquipmentSequence = [
|
|
807
|
+
...tEquipmentSequence,
|
|
808
|
+
'Terminal',
|
|
809
|
+
];
|
|
810
|
+
const tControlBlockSequence = [...tUnNamingSequence, 'Address'];
|
|
811
|
+
const tControlSequence = [...tNamingSequence];
|
|
812
|
+
const tControlWithIEDNameSequence = [...tControlSequence, 'IEDName'];
|
|
813
|
+
const tAnyLNSequence = [
|
|
814
|
+
...tUnNamingSequence,
|
|
815
|
+
'DataSet',
|
|
816
|
+
'ReportControl',
|
|
817
|
+
'LogControl',
|
|
818
|
+
'DOI',
|
|
819
|
+
'Inputs',
|
|
820
|
+
'Log',
|
|
821
|
+
];
|
|
822
|
+
const tGeneralEquipmentContainerSequence = [
|
|
823
|
+
...tPowerSystemResourceSequence,
|
|
824
|
+
'GeneralEquipment',
|
|
825
|
+
'Function',
|
|
826
|
+
];
|
|
827
|
+
const tControlWithTriggerOptSequence = [...tControlSequence, 'TrgOps'];
|
|
828
|
+
const tAbstractEqFuncSubFuncSequence = [
|
|
829
|
+
...tPowerSystemResourceSequence,
|
|
830
|
+
'GeneralEquipment',
|
|
831
|
+
'EqSubFunction',
|
|
832
|
+
];
|
|
833
|
+
export const tags = {
|
|
834
|
+
AccessControl: {
|
|
835
|
+
identity: singletonIdentity,
|
|
836
|
+
selector: singletonSelector,
|
|
837
|
+
parents: ['LDevice'],
|
|
838
|
+
children: [],
|
|
839
|
+
},
|
|
840
|
+
AccessPoint: {
|
|
841
|
+
identity: namingIdentity,
|
|
842
|
+
selector: namingSelector,
|
|
843
|
+
parents: ['IED'],
|
|
844
|
+
children: [
|
|
845
|
+
...tNamingSequence,
|
|
846
|
+
'Server',
|
|
847
|
+
'LN',
|
|
848
|
+
'ServerAt',
|
|
849
|
+
'Services',
|
|
850
|
+
'GOOSESecurity',
|
|
851
|
+
'SMVSecurity',
|
|
852
|
+
],
|
|
853
|
+
},
|
|
854
|
+
Address: {
|
|
855
|
+
identity: singletonIdentity,
|
|
856
|
+
selector: singletonSelector,
|
|
857
|
+
parents: ['ConnectedAP', 'GSE', 'SMV'],
|
|
858
|
+
children: ['P'],
|
|
859
|
+
},
|
|
860
|
+
Association: {
|
|
861
|
+
identity: associationIdentity,
|
|
862
|
+
selector: associationSelector,
|
|
863
|
+
parents: ['Server'],
|
|
864
|
+
children: [],
|
|
865
|
+
},
|
|
866
|
+
Authentication: {
|
|
867
|
+
identity: singletonIdentity,
|
|
868
|
+
selector: singletonSelector,
|
|
869
|
+
parents: ['Server'],
|
|
870
|
+
children: [],
|
|
871
|
+
},
|
|
872
|
+
BDA: {
|
|
873
|
+
identity: namingIdentity,
|
|
874
|
+
selector: namingSelector,
|
|
875
|
+
parents: ['DAType'],
|
|
876
|
+
children: [...tAbstractDataAttributeSequence],
|
|
877
|
+
},
|
|
878
|
+
BitRate: {
|
|
879
|
+
identity: singletonIdentity,
|
|
880
|
+
selector: singletonSelector,
|
|
881
|
+
parents: ['SubNetwork'],
|
|
882
|
+
children: [],
|
|
883
|
+
},
|
|
884
|
+
Bay: {
|
|
885
|
+
identity: namingIdentity,
|
|
886
|
+
selector: namingSelector,
|
|
887
|
+
parents: ['VoltageLevel'],
|
|
888
|
+
children: [
|
|
889
|
+
...tEquipmentContainerSequence,
|
|
890
|
+
'ConductingEquipment',
|
|
891
|
+
'ConnectivityNode',
|
|
892
|
+
'Function',
|
|
893
|
+
],
|
|
894
|
+
},
|
|
895
|
+
ClientLN: {
|
|
896
|
+
identity: clientLNIdentity,
|
|
897
|
+
selector: clientLNSelector,
|
|
898
|
+
parents: ['RptEnabled'],
|
|
899
|
+
children: [],
|
|
900
|
+
},
|
|
901
|
+
ClientServices: {
|
|
902
|
+
identity: singletonIdentity,
|
|
903
|
+
selector: singletonSelector,
|
|
904
|
+
parents: ['Services'],
|
|
905
|
+
children: ['TimeSyncProt', 'McSecurity'],
|
|
906
|
+
},
|
|
907
|
+
CommProt: {
|
|
908
|
+
identity: singletonIdentity,
|
|
909
|
+
selector: singletonSelector,
|
|
910
|
+
parents: ['Services'],
|
|
911
|
+
children: [],
|
|
912
|
+
},
|
|
913
|
+
Communication: {
|
|
914
|
+
identity: singletonIdentity,
|
|
915
|
+
selector: singletonSelector,
|
|
916
|
+
parents: ['SCL'],
|
|
917
|
+
children: [...tUnNamingSequence, 'SubNetwork'],
|
|
918
|
+
},
|
|
919
|
+
ConductingEquipment: {
|
|
920
|
+
identity: namingIdentity,
|
|
921
|
+
selector: namingSelector,
|
|
922
|
+
parents: ['Process', 'Line', 'SubFunction', 'Function', 'Bay'],
|
|
923
|
+
children: [
|
|
924
|
+
...tAbstractConductingEquipmentSequence,
|
|
925
|
+
'EqFunction',
|
|
926
|
+
'SubEquipment',
|
|
927
|
+
],
|
|
928
|
+
},
|
|
929
|
+
ConfDataSet: {
|
|
930
|
+
identity: singletonIdentity,
|
|
931
|
+
selector: singletonSelector,
|
|
932
|
+
parents: ['Services'],
|
|
933
|
+
children: [],
|
|
934
|
+
},
|
|
935
|
+
ConfLdName: {
|
|
936
|
+
identity: singletonIdentity,
|
|
937
|
+
selector: singletonSelector,
|
|
938
|
+
parents: ['Services'],
|
|
939
|
+
children: [],
|
|
940
|
+
},
|
|
941
|
+
ConfLNs: {
|
|
942
|
+
identity: singletonIdentity,
|
|
943
|
+
selector: singletonSelector,
|
|
944
|
+
parents: ['Services'],
|
|
945
|
+
children: [],
|
|
946
|
+
},
|
|
947
|
+
ConfLogControl: {
|
|
948
|
+
identity: singletonIdentity,
|
|
949
|
+
selector: singletonSelector,
|
|
950
|
+
parents: ['Services'],
|
|
951
|
+
children: [],
|
|
952
|
+
},
|
|
953
|
+
ConfReportControl: {
|
|
954
|
+
identity: singletonIdentity,
|
|
955
|
+
selector: singletonSelector,
|
|
956
|
+
parents: ['Services'],
|
|
957
|
+
children: [],
|
|
958
|
+
},
|
|
959
|
+
ConfSG: {
|
|
960
|
+
identity: singletonIdentity,
|
|
961
|
+
selector: singletonSelector,
|
|
962
|
+
parents: ['SettingGroups'],
|
|
963
|
+
children: [],
|
|
964
|
+
},
|
|
965
|
+
ConfSigRef: {
|
|
966
|
+
identity: singletonIdentity,
|
|
967
|
+
selector: singletonSelector,
|
|
968
|
+
parents: ['Services'],
|
|
969
|
+
children: [],
|
|
970
|
+
},
|
|
971
|
+
ConnectedAP: {
|
|
972
|
+
identity: connectedAPIdentity,
|
|
973
|
+
selector: connectedAPSelector,
|
|
974
|
+
parents: ['SubNetwork'],
|
|
975
|
+
children: [...tUnNamingSequence, 'Address', 'GSE', 'SMV', 'PhysConn'],
|
|
976
|
+
},
|
|
977
|
+
ConnectivityNode: {
|
|
978
|
+
identity: namingIdentity,
|
|
979
|
+
selector: namingSelector,
|
|
980
|
+
parents: ['Bay', 'Line'],
|
|
981
|
+
children: [...tLNodeContainerSequence],
|
|
982
|
+
},
|
|
983
|
+
DA: {
|
|
984
|
+
identity: namingIdentity,
|
|
985
|
+
selector: namingSelector,
|
|
986
|
+
parents: ['DOType'],
|
|
987
|
+
children: [...tAbstractDataAttributeSequence],
|
|
988
|
+
},
|
|
989
|
+
DAI: {
|
|
990
|
+
identity: ixNamingIdentity,
|
|
991
|
+
selector: ixNamingSelector,
|
|
992
|
+
parents: ['DOI', 'SDI'],
|
|
993
|
+
children: [...tUnNamingSequence, 'Val'],
|
|
994
|
+
},
|
|
995
|
+
DAType: {
|
|
996
|
+
identity: idNamingIdentity,
|
|
997
|
+
selector: idNamingSelector,
|
|
998
|
+
parents: ['DataTypeTemplates'],
|
|
999
|
+
children: [...tIDNamingSequence, 'BDA', 'ProtNs'],
|
|
1000
|
+
},
|
|
1001
|
+
DO: {
|
|
1002
|
+
identity: namingIdentity,
|
|
1003
|
+
selector: namingSelector,
|
|
1004
|
+
parents: ['LNodeType'],
|
|
1005
|
+
children: [...tUnNamingSequence],
|
|
1006
|
+
},
|
|
1007
|
+
DOI: {
|
|
1008
|
+
identity: namingIdentity,
|
|
1009
|
+
selector: namingSelector,
|
|
1010
|
+
parents: [...tAnyLN],
|
|
1011
|
+
children: [...tUnNamingSequence, 'SDI', 'DAI'],
|
|
1012
|
+
},
|
|
1013
|
+
DOType: {
|
|
1014
|
+
identity: idNamingIdentity,
|
|
1015
|
+
selector: idNamingSelector,
|
|
1016
|
+
parents: ['DataTypeTemplates'],
|
|
1017
|
+
children: [...tIDNamingSequence, 'SDO', 'DA'],
|
|
1018
|
+
},
|
|
1019
|
+
DataObjectDirectory: {
|
|
1020
|
+
identity: singletonIdentity,
|
|
1021
|
+
selector: singletonSelector,
|
|
1022
|
+
parents: ['Services'],
|
|
1023
|
+
children: [],
|
|
1024
|
+
},
|
|
1025
|
+
DataSet: {
|
|
1026
|
+
identity: namingIdentity,
|
|
1027
|
+
selector: namingSelector,
|
|
1028
|
+
parents: [...tAnyLN],
|
|
1029
|
+
children: [...tNamingSequence, 'FCDA'],
|
|
1030
|
+
},
|
|
1031
|
+
DataSetDirectory: {
|
|
1032
|
+
identity: singletonIdentity,
|
|
1033
|
+
selector: singletonSelector,
|
|
1034
|
+
parents: ['Services'],
|
|
1035
|
+
children: [],
|
|
1036
|
+
},
|
|
1037
|
+
DataTypeTemplates: {
|
|
1038
|
+
identity: singletonIdentity,
|
|
1039
|
+
selector: singletonSelector,
|
|
1040
|
+
parents: ['SCL'],
|
|
1041
|
+
children: ['LNodeType', 'DOType', 'DAType', 'EnumType'],
|
|
1042
|
+
},
|
|
1043
|
+
DynAssociation: {
|
|
1044
|
+
identity: singletonIdentity,
|
|
1045
|
+
selector: singletonSelector,
|
|
1046
|
+
parents: ['Services'],
|
|
1047
|
+
children: [],
|
|
1048
|
+
},
|
|
1049
|
+
DynDataSet: {
|
|
1050
|
+
identity: singletonIdentity,
|
|
1051
|
+
selector: singletonSelector,
|
|
1052
|
+
parents: ['Services'],
|
|
1053
|
+
children: [],
|
|
1054
|
+
},
|
|
1055
|
+
EnumType: {
|
|
1056
|
+
identity: idNamingIdentity,
|
|
1057
|
+
selector: idNamingSelector,
|
|
1058
|
+
parents: ['DataTypeTemplates'],
|
|
1059
|
+
children: [...tIDNamingSequence, 'EnumVal'],
|
|
1060
|
+
},
|
|
1061
|
+
EnumVal: {
|
|
1062
|
+
identity: enumValIdentity,
|
|
1063
|
+
selector: enumValSelector,
|
|
1064
|
+
parents: ['EnumType'],
|
|
1065
|
+
children: [],
|
|
1066
|
+
},
|
|
1067
|
+
EqFunction: {
|
|
1068
|
+
identity: namingIdentity,
|
|
1069
|
+
selector: namingSelector,
|
|
1070
|
+
parents: [
|
|
1071
|
+
'GeneralEquipment',
|
|
1072
|
+
'TapChanger',
|
|
1073
|
+
'TransformerWinding',
|
|
1074
|
+
'PowerTransformer',
|
|
1075
|
+
'SubEquipment',
|
|
1076
|
+
'ConductingEquipment',
|
|
1077
|
+
],
|
|
1078
|
+
children: [...tAbstractEqFuncSubFuncSequence],
|
|
1079
|
+
},
|
|
1080
|
+
EqSubFunction: {
|
|
1081
|
+
identity: namingIdentity,
|
|
1082
|
+
selector: namingSelector,
|
|
1083
|
+
parents: ['EqSubFunction', 'EqFunction'],
|
|
1084
|
+
children: [...tAbstractEqFuncSubFuncSequence],
|
|
1085
|
+
},
|
|
1086
|
+
ExtRef: {
|
|
1087
|
+
identity: extRefIdentity,
|
|
1088
|
+
selector: extRefSelector,
|
|
1089
|
+
parents: ['Inputs'],
|
|
1090
|
+
children: [],
|
|
1091
|
+
},
|
|
1092
|
+
FCDA: {
|
|
1093
|
+
identity: fCDAIdentity,
|
|
1094
|
+
selector: fCDASelector,
|
|
1095
|
+
parents: ['DataSet'],
|
|
1096
|
+
children: [],
|
|
1097
|
+
},
|
|
1098
|
+
FileHandling: {
|
|
1099
|
+
identity: singletonIdentity,
|
|
1100
|
+
selector: singletonSelector,
|
|
1101
|
+
parents: ['Services'],
|
|
1102
|
+
children: [],
|
|
1103
|
+
},
|
|
1104
|
+
Function: {
|
|
1105
|
+
identity: namingIdentity,
|
|
1106
|
+
selector: namingSelector,
|
|
1107
|
+
parents: ['Bay', 'VoltageLevel', 'Substation', 'Process', 'Line'],
|
|
1108
|
+
children: [
|
|
1109
|
+
...tPowerSystemResourceSequence,
|
|
1110
|
+
'SubFunction',
|
|
1111
|
+
'GeneralEquipment',
|
|
1112
|
+
'ConductingEquipment',
|
|
1113
|
+
],
|
|
1114
|
+
},
|
|
1115
|
+
GeneralEquipment: {
|
|
1116
|
+
identity: namingIdentity,
|
|
1117
|
+
selector: namingSelector,
|
|
1118
|
+
parents: [
|
|
1119
|
+
'SubFunction',
|
|
1120
|
+
'Function',
|
|
1121
|
+
...tGeneralEquipmentContainer,
|
|
1122
|
+
...tAbstractEqFuncSubFunc,
|
|
1123
|
+
...tEquipmentContainer,
|
|
1124
|
+
],
|
|
1125
|
+
children: [...tEquipmentSequence, 'EqFunction'],
|
|
1126
|
+
},
|
|
1127
|
+
GetCBValues: {
|
|
1128
|
+
identity: singletonIdentity,
|
|
1129
|
+
selector: singletonSelector,
|
|
1130
|
+
parents: ['Services'],
|
|
1131
|
+
children: [],
|
|
1132
|
+
},
|
|
1133
|
+
GetDataObjectDefinition: {
|
|
1134
|
+
identity: singletonIdentity,
|
|
1135
|
+
selector: singletonSelector,
|
|
1136
|
+
parents: ['Services'],
|
|
1137
|
+
children: [],
|
|
1138
|
+
},
|
|
1139
|
+
GetDataSetValue: {
|
|
1140
|
+
identity: singletonIdentity,
|
|
1141
|
+
selector: singletonSelector,
|
|
1142
|
+
parents: ['Services'],
|
|
1143
|
+
children: [],
|
|
1144
|
+
},
|
|
1145
|
+
GetDirectory: {
|
|
1146
|
+
identity: singletonIdentity,
|
|
1147
|
+
selector: singletonSelector,
|
|
1148
|
+
parents: ['Services'],
|
|
1149
|
+
children: [],
|
|
1150
|
+
},
|
|
1151
|
+
GOOSE: {
|
|
1152
|
+
identity: singletonIdentity,
|
|
1153
|
+
selector: singletonSelector,
|
|
1154
|
+
parents: ['Services'],
|
|
1155
|
+
children: [],
|
|
1156
|
+
},
|
|
1157
|
+
GOOSESecurity: {
|
|
1158
|
+
identity: namingIdentity,
|
|
1159
|
+
selector: namingSelector,
|
|
1160
|
+
parents: ['AccessPoint'],
|
|
1161
|
+
children: [...tNamingSequence, 'Subject', 'IssuerName'],
|
|
1162
|
+
},
|
|
1163
|
+
GSE: {
|
|
1164
|
+
identity: controlBlockIdentity,
|
|
1165
|
+
selector: controlBlockSelector,
|
|
1166
|
+
parents: ['ConnectedAP'],
|
|
1167
|
+
children: [...tControlBlockSequence, 'MinTime', 'MaxTime'],
|
|
1168
|
+
},
|
|
1169
|
+
GSEDir: {
|
|
1170
|
+
identity: singletonIdentity,
|
|
1171
|
+
selector: singletonSelector,
|
|
1172
|
+
parents: ['Services'],
|
|
1173
|
+
children: [],
|
|
1174
|
+
},
|
|
1175
|
+
GSEControl: {
|
|
1176
|
+
identity: namingIdentity,
|
|
1177
|
+
selector: namingSelector,
|
|
1178
|
+
parents: ['LN0'],
|
|
1179
|
+
children: [...tControlWithIEDNameSequence, 'Protocol'],
|
|
1180
|
+
},
|
|
1181
|
+
GSESettings: {
|
|
1182
|
+
identity: singletonIdentity,
|
|
1183
|
+
selector: singletonSelector,
|
|
1184
|
+
parents: ['Services'],
|
|
1185
|
+
children: [],
|
|
1186
|
+
},
|
|
1187
|
+
GSSE: {
|
|
1188
|
+
identity: singletonIdentity,
|
|
1189
|
+
selector: singletonSelector,
|
|
1190
|
+
parents: ['Services'],
|
|
1191
|
+
children: [],
|
|
1192
|
+
},
|
|
1193
|
+
Header: {
|
|
1194
|
+
identity: singletonIdentity,
|
|
1195
|
+
selector: singletonSelector,
|
|
1196
|
+
parents: ['SCL'],
|
|
1197
|
+
children: ['Text', 'History'],
|
|
1198
|
+
},
|
|
1199
|
+
History: {
|
|
1200
|
+
identity: singletonIdentity,
|
|
1201
|
+
selector: singletonSelector,
|
|
1202
|
+
parents: ['Header'],
|
|
1203
|
+
children: ['Hitem'],
|
|
1204
|
+
},
|
|
1205
|
+
Hitem: {
|
|
1206
|
+
identity: hitemIdentity,
|
|
1207
|
+
selector: hitemSelector,
|
|
1208
|
+
parents: ['History'],
|
|
1209
|
+
children: [],
|
|
1210
|
+
},
|
|
1211
|
+
IED: {
|
|
1212
|
+
identity: namingIdentity,
|
|
1213
|
+
selector: namingSelector,
|
|
1214
|
+
parents: ['SCL'],
|
|
1215
|
+
children: [...tUnNamingSequence, 'Services', 'AccessPoint', 'KDC'],
|
|
1216
|
+
},
|
|
1217
|
+
IEDName: {
|
|
1218
|
+
identity: iEDNameIdentity,
|
|
1219
|
+
selector: iEDNameSelector,
|
|
1220
|
+
parents: ['GSEControl', 'SampledValueControl'],
|
|
1221
|
+
children: [],
|
|
1222
|
+
},
|
|
1223
|
+
Inputs: {
|
|
1224
|
+
identity: singletonIdentity,
|
|
1225
|
+
selector: singletonSelector,
|
|
1226
|
+
parents: [...tAnyLN],
|
|
1227
|
+
children: [...tUnNamingSequence, 'ExtRef'],
|
|
1228
|
+
},
|
|
1229
|
+
IssuerName: {
|
|
1230
|
+
identity: singletonIdentity,
|
|
1231
|
+
selector: singletonSelector,
|
|
1232
|
+
parents: ['GOOSESecurity', 'SMVSecurity'],
|
|
1233
|
+
children: [],
|
|
1234
|
+
},
|
|
1235
|
+
KDC: {
|
|
1236
|
+
identity: kDCIdentity,
|
|
1237
|
+
selector: kDCSelector,
|
|
1238
|
+
parents: ['IED'],
|
|
1239
|
+
children: [],
|
|
1240
|
+
},
|
|
1241
|
+
LDevice: {
|
|
1242
|
+
identity: lDeviceIdentity,
|
|
1243
|
+
selector: lDeviceSelector,
|
|
1244
|
+
parents: ['Server'],
|
|
1245
|
+
children: [...tUnNamingSequence, 'LN0', 'LN', 'AccessControl'],
|
|
1246
|
+
},
|
|
1247
|
+
LN: {
|
|
1248
|
+
identity: lNIdentity,
|
|
1249
|
+
selector: lNSelector,
|
|
1250
|
+
parents: ['AccessPoint', 'LDevice'],
|
|
1251
|
+
children: [...tAnyLNSequence],
|
|
1252
|
+
},
|
|
1253
|
+
LN0: {
|
|
1254
|
+
identity: singletonIdentity,
|
|
1255
|
+
selector: singletonSelector,
|
|
1256
|
+
parents: ['LDevice'],
|
|
1257
|
+
children: [
|
|
1258
|
+
...tAnyLNSequence,
|
|
1259
|
+
'GSEControl',
|
|
1260
|
+
'SampledValueControl',
|
|
1261
|
+
'SettingControl',
|
|
1262
|
+
],
|
|
1263
|
+
},
|
|
1264
|
+
LNode: {
|
|
1265
|
+
identity: lNodeIdentity,
|
|
1266
|
+
selector: lNodeSelector,
|
|
1267
|
+
parents: [...tLNodeContainer],
|
|
1268
|
+
children: [...tUnNamingSequence],
|
|
1269
|
+
},
|
|
1270
|
+
LNodeType: {
|
|
1271
|
+
identity: idNamingIdentity,
|
|
1272
|
+
selector: idNamingSelector,
|
|
1273
|
+
parents: ['DataTypeTemplates'],
|
|
1274
|
+
children: [...tIDNamingSequence, 'DO'],
|
|
1275
|
+
},
|
|
1276
|
+
Line: {
|
|
1277
|
+
identity: namingIdentity,
|
|
1278
|
+
selector: namingSelector,
|
|
1279
|
+
parents: ['Process', 'SCL'],
|
|
1280
|
+
children: [
|
|
1281
|
+
...tGeneralEquipmentContainerSequence,
|
|
1282
|
+
'Voltage',
|
|
1283
|
+
'ConductingEquipment',
|
|
1284
|
+
],
|
|
1285
|
+
},
|
|
1286
|
+
Log: {
|
|
1287
|
+
identity: namingIdentity,
|
|
1288
|
+
selector: namingSelector,
|
|
1289
|
+
parents: [...tAnyLN],
|
|
1290
|
+
children: [...tUnNamingSequence],
|
|
1291
|
+
},
|
|
1292
|
+
LogControl: {
|
|
1293
|
+
identity: namingIdentity,
|
|
1294
|
+
selector: namingSelector,
|
|
1295
|
+
parents: [...tAnyLN],
|
|
1296
|
+
children: [...tControlWithTriggerOptSequence],
|
|
1297
|
+
},
|
|
1298
|
+
LogSettings: {
|
|
1299
|
+
identity: singletonIdentity,
|
|
1300
|
+
selector: singletonSelector,
|
|
1301
|
+
parents: ['Services'],
|
|
1302
|
+
children: [],
|
|
1303
|
+
},
|
|
1304
|
+
MaxTime: {
|
|
1305
|
+
identity: singletonIdentity,
|
|
1306
|
+
selector: singletonSelector,
|
|
1307
|
+
parents: ['GSE'],
|
|
1308
|
+
children: [],
|
|
1309
|
+
},
|
|
1310
|
+
McSecurity: {
|
|
1311
|
+
identity: singletonIdentity,
|
|
1312
|
+
selector: singletonSelector,
|
|
1313
|
+
parents: ['GSESettings', 'SMVSettings', 'ClientServices'],
|
|
1314
|
+
children: [],
|
|
1315
|
+
},
|
|
1316
|
+
MinTime: {
|
|
1317
|
+
identity: singletonIdentity,
|
|
1318
|
+
selector: singletonSelector,
|
|
1319
|
+
parents: ['GSE'],
|
|
1320
|
+
children: [],
|
|
1321
|
+
},
|
|
1322
|
+
NeutralPoint: {
|
|
1323
|
+
identity: terminalIdentity,
|
|
1324
|
+
selector: terminalSelector,
|
|
1325
|
+
parents: ['TransformerWinding'],
|
|
1326
|
+
children: [...tUnNamingSequence],
|
|
1327
|
+
},
|
|
1328
|
+
OptFields: {
|
|
1329
|
+
identity: singletonIdentity,
|
|
1330
|
+
selector: singletonSelector,
|
|
1331
|
+
parents: ['ReportControl'],
|
|
1332
|
+
children: [],
|
|
1333
|
+
},
|
|
1334
|
+
P: {
|
|
1335
|
+
identity: pIdentity,
|
|
1336
|
+
selector: pSelector,
|
|
1337
|
+
parents: ['Address', 'PhysConn'],
|
|
1338
|
+
children: [],
|
|
1339
|
+
},
|
|
1340
|
+
PhysConn: {
|
|
1341
|
+
identity: physConnIdentity,
|
|
1342
|
+
selector: physConnSelector,
|
|
1343
|
+
parents: ['ConnectedAP'],
|
|
1344
|
+
children: [...tUnNamingSequence, 'P'],
|
|
1345
|
+
},
|
|
1346
|
+
PowerTransformer: {
|
|
1347
|
+
identity: namingIdentity,
|
|
1348
|
+
selector: namingSelector,
|
|
1349
|
+
parents: [...tEquipmentContainer],
|
|
1350
|
+
children: [
|
|
1351
|
+
...tEquipmentSequence,
|
|
1352
|
+
'TransformerWinding',
|
|
1353
|
+
'SubEquipment',
|
|
1354
|
+
'EqFunction',
|
|
1355
|
+
],
|
|
1356
|
+
},
|
|
1357
|
+
Private: {
|
|
1358
|
+
identity: () => NaN,
|
|
1359
|
+
selector: () => voidSelector,
|
|
1360
|
+
parents: [],
|
|
1361
|
+
children: [],
|
|
1362
|
+
},
|
|
1363
|
+
Process: {
|
|
1364
|
+
identity: namingIdentity,
|
|
1365
|
+
selector: namingSelector,
|
|
1366
|
+
parents: ['Process', 'SCL'],
|
|
1367
|
+
children: [
|
|
1368
|
+
...tGeneralEquipmentContainerSequence,
|
|
1369
|
+
'ConductingEquipment',
|
|
1370
|
+
'Substation',
|
|
1371
|
+
'Line',
|
|
1372
|
+
'Process',
|
|
1373
|
+
],
|
|
1374
|
+
},
|
|
1375
|
+
ProtNs: {
|
|
1376
|
+
identity: protNsIdentity,
|
|
1377
|
+
selector: protNsSelector,
|
|
1378
|
+
parents: ['DAType', 'DA'],
|
|
1379
|
+
children: [],
|
|
1380
|
+
},
|
|
1381
|
+
Protocol: {
|
|
1382
|
+
identity: singletonIdentity,
|
|
1383
|
+
selector: singletonSelector,
|
|
1384
|
+
parents: ['GSEControl', 'SampledValueControl'],
|
|
1385
|
+
children: [],
|
|
1386
|
+
},
|
|
1387
|
+
ReadWrite: {
|
|
1388
|
+
identity: singletonIdentity,
|
|
1389
|
+
selector: singletonSelector,
|
|
1390
|
+
parents: ['Services'],
|
|
1391
|
+
children: [],
|
|
1392
|
+
},
|
|
1393
|
+
RedProt: {
|
|
1394
|
+
identity: singletonIdentity,
|
|
1395
|
+
selector: singletonSelector,
|
|
1396
|
+
parents: ['Services'],
|
|
1397
|
+
children: [],
|
|
1398
|
+
},
|
|
1399
|
+
ReportControl: {
|
|
1400
|
+
identity: namingIdentity,
|
|
1401
|
+
selector: namingSelector,
|
|
1402
|
+
parents: [...tAnyLN],
|
|
1403
|
+
children: [...tControlWithTriggerOptSequence, 'OptFields', 'RptEnabled'],
|
|
1404
|
+
},
|
|
1405
|
+
ReportSettings: {
|
|
1406
|
+
identity: singletonIdentity,
|
|
1407
|
+
selector: singletonSelector,
|
|
1408
|
+
parents: ['Services'],
|
|
1409
|
+
children: [],
|
|
1410
|
+
},
|
|
1411
|
+
RptEnabled: {
|
|
1412
|
+
identity: singletonIdentity,
|
|
1413
|
+
selector: singletonSelector,
|
|
1414
|
+
parents: ['ReportControl'],
|
|
1415
|
+
children: [...tUnNamingSequence, 'ClientLN'],
|
|
1416
|
+
},
|
|
1417
|
+
SamplesPerSec: {
|
|
1418
|
+
identity: singletonIdentity,
|
|
1419
|
+
selector: singletonSelector,
|
|
1420
|
+
parents: ['SMVSettings'],
|
|
1421
|
+
children: [],
|
|
1422
|
+
},
|
|
1423
|
+
SampledValueControl: {
|
|
1424
|
+
identity: namingIdentity,
|
|
1425
|
+
selector: namingSelector,
|
|
1426
|
+
parents: ['LN0'],
|
|
1427
|
+
children: [...tControlWithIEDNameSequence, 'SmvOpts'],
|
|
1428
|
+
},
|
|
1429
|
+
SecPerSamples: {
|
|
1430
|
+
identity: singletonIdentity,
|
|
1431
|
+
selector: singletonSelector,
|
|
1432
|
+
parents: ['SMVSettings'],
|
|
1433
|
+
children: [],
|
|
1434
|
+
},
|
|
1435
|
+
SCL: {
|
|
1436
|
+
identity: sCLIdentity,
|
|
1437
|
+
selector: sCLSelector,
|
|
1438
|
+
parents: [],
|
|
1439
|
+
children: [
|
|
1440
|
+
...tBaseNameSequence,
|
|
1441
|
+
'Header',
|
|
1442
|
+
'Substation',
|
|
1443
|
+
'Communication',
|
|
1444
|
+
'IED',
|
|
1445
|
+
'DataTypeTemplates',
|
|
1446
|
+
'Line',
|
|
1447
|
+
'Process',
|
|
1448
|
+
],
|
|
1449
|
+
},
|
|
1450
|
+
SDI: {
|
|
1451
|
+
identity: ixNamingIdentity,
|
|
1452
|
+
selector: ixNamingSelector,
|
|
1453
|
+
parents: ['DOI', 'SDI'],
|
|
1454
|
+
children: [...tUnNamingSequence, 'SDI', 'DAI'],
|
|
1455
|
+
},
|
|
1456
|
+
SDO: {
|
|
1457
|
+
identity: namingIdentity,
|
|
1458
|
+
selector: namingSelector,
|
|
1459
|
+
parents: ['DOType'],
|
|
1460
|
+
children: [...tNamingSequence],
|
|
1461
|
+
},
|
|
1462
|
+
Server: {
|
|
1463
|
+
identity: singletonIdentity,
|
|
1464
|
+
selector: singletonSelector,
|
|
1465
|
+
parents: ['AccessPoint'],
|
|
1466
|
+
children: [
|
|
1467
|
+
...tUnNamingSequence,
|
|
1468
|
+
'Authentication',
|
|
1469
|
+
'LDevice',
|
|
1470
|
+
'Association',
|
|
1471
|
+
],
|
|
1472
|
+
},
|
|
1473
|
+
ServerAt: {
|
|
1474
|
+
identity: singletonIdentity,
|
|
1475
|
+
selector: singletonSelector,
|
|
1476
|
+
parents: ['AccessPoint'],
|
|
1477
|
+
children: [...tUnNamingSequence],
|
|
1478
|
+
},
|
|
1479
|
+
Services: {
|
|
1480
|
+
identity: singletonIdentity,
|
|
1481
|
+
selector: singletonSelector,
|
|
1482
|
+
parents: ['IED', 'AccessPoint'],
|
|
1483
|
+
children: [
|
|
1484
|
+
'DynAssociation',
|
|
1485
|
+
'SettingGroups',
|
|
1486
|
+
'GetDirectory',
|
|
1487
|
+
'GetDataObjectDefinition',
|
|
1488
|
+
'DataObjectDirectory',
|
|
1489
|
+
'GetDataSetValue',
|
|
1490
|
+
'SetDataSetValue',
|
|
1491
|
+
'DataSetDirectory',
|
|
1492
|
+
'ConfDataSet',
|
|
1493
|
+
'DynDataSet',
|
|
1494
|
+
'ReadWrite',
|
|
1495
|
+
'TimerActivatedControl',
|
|
1496
|
+
'ConfReportControl',
|
|
1497
|
+
'GetCBValues',
|
|
1498
|
+
'ConfLogControl',
|
|
1499
|
+
'ReportSettings',
|
|
1500
|
+
'LogSettings',
|
|
1501
|
+
'GSESettings',
|
|
1502
|
+
'SMVSettings',
|
|
1503
|
+
'GSEDir',
|
|
1504
|
+
'GOOSE',
|
|
1505
|
+
'GSSE',
|
|
1506
|
+
'SMVsc',
|
|
1507
|
+
'FileHandling',
|
|
1508
|
+
'ConfLNs',
|
|
1509
|
+
'ClientServices',
|
|
1510
|
+
'ConfLdName',
|
|
1511
|
+
'SupSubscription',
|
|
1512
|
+
'ConfSigRef',
|
|
1513
|
+
'ValueHandling',
|
|
1514
|
+
'RedProt',
|
|
1515
|
+
'TimeSyncProt',
|
|
1516
|
+
'CommProt',
|
|
1517
|
+
],
|
|
1518
|
+
},
|
|
1519
|
+
SetDataSetValue: {
|
|
1520
|
+
identity: singletonIdentity,
|
|
1521
|
+
selector: singletonSelector,
|
|
1522
|
+
parents: ['Services'],
|
|
1523
|
+
children: [],
|
|
1524
|
+
},
|
|
1525
|
+
SettingControl: {
|
|
1526
|
+
identity: singletonIdentity,
|
|
1527
|
+
selector: singletonSelector,
|
|
1528
|
+
parents: ['LN0'],
|
|
1529
|
+
children: [...tUnNamingSequence],
|
|
1530
|
+
},
|
|
1531
|
+
SettingGroups: {
|
|
1532
|
+
identity: singletonIdentity,
|
|
1533
|
+
selector: singletonSelector,
|
|
1534
|
+
parents: ['Services'],
|
|
1535
|
+
children: ['SGEdit', 'ConfSG'],
|
|
1536
|
+
},
|
|
1537
|
+
SGEdit: {
|
|
1538
|
+
identity: singletonIdentity,
|
|
1539
|
+
selector: singletonSelector,
|
|
1540
|
+
parents: ['SettingGroups'],
|
|
1541
|
+
children: [],
|
|
1542
|
+
},
|
|
1543
|
+
SmpRate: {
|
|
1544
|
+
identity: singletonIdentity,
|
|
1545
|
+
selector: singletonSelector,
|
|
1546
|
+
parents: ['SMVSettings'],
|
|
1547
|
+
children: [],
|
|
1548
|
+
},
|
|
1549
|
+
SMV: {
|
|
1550
|
+
identity: controlBlockIdentity,
|
|
1551
|
+
selector: controlBlockSelector,
|
|
1552
|
+
parents: ['ConnectedAP'],
|
|
1553
|
+
children: [...tControlBlockSequence],
|
|
1554
|
+
},
|
|
1555
|
+
SmvOpts: {
|
|
1556
|
+
identity: singletonIdentity,
|
|
1557
|
+
selector: singletonSelector,
|
|
1558
|
+
parents: ['SampledValueControl'],
|
|
1559
|
+
children: [],
|
|
1560
|
+
},
|
|
1561
|
+
SMVsc: {
|
|
1562
|
+
identity: singletonIdentity,
|
|
1563
|
+
selector: singletonSelector,
|
|
1564
|
+
parents: ['Services'],
|
|
1565
|
+
children: [],
|
|
1566
|
+
},
|
|
1567
|
+
SMVSecurity: {
|
|
1568
|
+
identity: namingIdentity,
|
|
1569
|
+
selector: namingSelector,
|
|
1570
|
+
parents: ['AccessPoint'],
|
|
1571
|
+
children: [...tNamingSequence, 'Subject', 'IssuerName'],
|
|
1572
|
+
},
|
|
1573
|
+
SMVSettings: {
|
|
1574
|
+
identity: singletonIdentity,
|
|
1575
|
+
selector: singletonSelector,
|
|
1576
|
+
parents: ['Services'],
|
|
1577
|
+
children: ['SmpRate', 'SamplesPerSec', 'SecPerSamples', 'McSecurity'],
|
|
1578
|
+
},
|
|
1579
|
+
SubEquipment: {
|
|
1580
|
+
identity: namingIdentity,
|
|
1581
|
+
selector: namingSelector,
|
|
1582
|
+
parents: [
|
|
1583
|
+
'TapChanger',
|
|
1584
|
+
'PowerTransformer',
|
|
1585
|
+
'ConductingEquipment',
|
|
1586
|
+
'TransformerWinding',
|
|
1587
|
+
...tAbstractConductingEquipment,
|
|
1588
|
+
],
|
|
1589
|
+
children: [...tPowerSystemResourceSequence, 'EqFunction'],
|
|
1590
|
+
},
|
|
1591
|
+
SubFunction: {
|
|
1592
|
+
identity: namingIdentity,
|
|
1593
|
+
selector: namingSelector,
|
|
1594
|
+
parents: ['SubFunction', 'Function'],
|
|
1595
|
+
children: [
|
|
1596
|
+
...tPowerSystemResourceSequence,
|
|
1597
|
+
'GeneralEquipment',
|
|
1598
|
+
'ConductingEquipment',
|
|
1599
|
+
'SubFunction',
|
|
1600
|
+
],
|
|
1601
|
+
},
|
|
1602
|
+
SubNetwork: {
|
|
1603
|
+
identity: namingIdentity,
|
|
1604
|
+
selector: namingSelector,
|
|
1605
|
+
parents: ['Communication'],
|
|
1606
|
+
children: [...tNamingSequence, 'BitRate', 'ConnectedAP'],
|
|
1607
|
+
},
|
|
1608
|
+
Subject: {
|
|
1609
|
+
identity: singletonIdentity,
|
|
1610
|
+
selector: singletonSelector,
|
|
1611
|
+
parents: ['GOOSESecurity', 'SMVSecurity'],
|
|
1612
|
+
children: [],
|
|
1613
|
+
},
|
|
1614
|
+
Substation: {
|
|
1615
|
+
identity: namingIdentity,
|
|
1616
|
+
selector: namingSelector,
|
|
1617
|
+
parents: ['SCL'],
|
|
1618
|
+
children: [...tEquipmentContainerSequence, 'VoltageLevel', 'Function'],
|
|
1619
|
+
},
|
|
1620
|
+
SupSubscription: {
|
|
1621
|
+
identity: singletonIdentity,
|
|
1622
|
+
selector: singletonSelector,
|
|
1623
|
+
parents: ['Services'],
|
|
1624
|
+
children: [],
|
|
1625
|
+
},
|
|
1626
|
+
TapChanger: {
|
|
1627
|
+
identity: namingIdentity,
|
|
1628
|
+
selector: namingSelector,
|
|
1629
|
+
parents: ['TransformerWinding'],
|
|
1630
|
+
children: [...tPowerSystemResourceSequence, 'SubEquipment', 'EqFunction'],
|
|
1631
|
+
},
|
|
1632
|
+
Terminal: {
|
|
1633
|
+
identity: terminalIdentity,
|
|
1634
|
+
selector: terminalSelector,
|
|
1635
|
+
parents: [...tEquipment],
|
|
1636
|
+
children: [...tUnNamingSequence],
|
|
1637
|
+
},
|
|
1638
|
+
Text: {
|
|
1639
|
+
identity: singletonIdentity,
|
|
1640
|
+
selector: singletonSelector,
|
|
1641
|
+
parents: sCLTags.filter(tag => tag !== 'Text' && tag !== 'Private'),
|
|
1642
|
+
children: [],
|
|
1643
|
+
},
|
|
1644
|
+
TimerActivatedControl: {
|
|
1645
|
+
identity: singletonIdentity,
|
|
1646
|
+
selector: singletonSelector,
|
|
1647
|
+
parents: ['Services'],
|
|
1648
|
+
children: [],
|
|
1649
|
+
},
|
|
1650
|
+
TimeSyncProt: {
|
|
1651
|
+
identity: singletonIdentity,
|
|
1652
|
+
selector: singletonSelector,
|
|
1653
|
+
parents: ['Services', 'ClientServices'],
|
|
1654
|
+
children: [],
|
|
1655
|
+
},
|
|
1656
|
+
TransformerWinding: {
|
|
1657
|
+
identity: namingIdentity,
|
|
1658
|
+
selector: namingSelector,
|
|
1659
|
+
parents: ['PowerTransformer'],
|
|
1660
|
+
children: [
|
|
1661
|
+
...tAbstractConductingEquipmentSequence,
|
|
1662
|
+
'TapChanger',
|
|
1663
|
+
'NeutralPoint',
|
|
1664
|
+
'EqFunction',
|
|
1665
|
+
'SubEquipment',
|
|
1666
|
+
],
|
|
1667
|
+
},
|
|
1668
|
+
TrgOps: {
|
|
1669
|
+
identity: singletonIdentity,
|
|
1670
|
+
selector: singletonSelector,
|
|
1671
|
+
parents: ['ReportControl'],
|
|
1672
|
+
children: [],
|
|
1673
|
+
},
|
|
1674
|
+
Val: {
|
|
1675
|
+
identity: valIdentity,
|
|
1676
|
+
selector: valSelector,
|
|
1677
|
+
parents: ['DAI', 'DA', 'BDA'],
|
|
1678
|
+
children: [],
|
|
1679
|
+
},
|
|
1680
|
+
ValueHandling: {
|
|
1681
|
+
identity: singletonIdentity,
|
|
1682
|
+
selector: singletonSelector,
|
|
1683
|
+
parents: ['Services'],
|
|
1684
|
+
children: [],
|
|
1685
|
+
},
|
|
1686
|
+
Voltage: {
|
|
1687
|
+
identity: singletonIdentity,
|
|
1688
|
+
selector: singletonSelector,
|
|
1689
|
+
parents: ['VoltageLevel'],
|
|
1690
|
+
children: [],
|
|
1691
|
+
},
|
|
1692
|
+
VoltageLevel: {
|
|
1693
|
+
identity: namingIdentity,
|
|
1694
|
+
selector: namingSelector,
|
|
1695
|
+
parents: ['Substation'],
|
|
1696
|
+
children: [...tEquipmentContainerSequence, 'Voltage', 'Bay', 'Function'],
|
|
1697
|
+
},
|
|
1698
|
+
};
|
|
1699
|
+
export function getReference(parent, tag) {
|
|
1700
|
+
const parentTag = parent.tagName;
|
|
1701
|
+
const children = Array.from(parent.children);
|
|
1702
|
+
if (parentTag === 'Services' ||
|
|
1703
|
+
parentTag === 'SettingGroups' ||
|
|
1704
|
+
!isSCLTag(parentTag))
|
|
1705
|
+
return children.find(child => child.tagName === tag) ?? null;
|
|
1706
|
+
const sequence = tags[parentTag]?.children ?? [];
|
|
1707
|
+
let index = sequence.findIndex(element => element === tag);
|
|
1708
|
+
if (index < 0)
|
|
1709
|
+
return null;
|
|
1710
|
+
let nextSibling;
|
|
1711
|
+
while (index < sequence.length && !nextSibling) {
|
|
1712
|
+
nextSibling = children.find(child => child.tagName === sequence[index]);
|
|
1713
|
+
index++;
|
|
1714
|
+
}
|
|
1715
|
+
return nextSibling ?? null;
|
|
1716
|
+
}
|
|
1717
|
+
function selector(tagName, identity) {
|
|
1718
|
+
if (typeof identity !== 'string')
|
|
1719
|
+
return voidSelector;
|
|
1720
|
+
if (isSCLTag(tagName))
|
|
1721
|
+
return tags[tagName].selector(tagName, identity);
|
|
1722
|
+
return tagName;
|
|
1723
|
+
}
|
|
1724
|
+
export function find(root, tagName, identity) {
|
|
1725
|
+
if (typeof identity !== 'string' || !isSCLTag(tagName))
|
|
1726
|
+
return null;
|
|
1727
|
+
const element = root.querySelector(tags[tagName].selector(tagName, identity));
|
|
1728
|
+
if (element === null || isPublic(element))
|
|
1729
|
+
return element;
|
|
1730
|
+
return (Array.from(root.querySelectorAll(tags[tagName].selector(tagName, identity))).find(isPublic) ?? null);
|
|
1731
|
+
}
|
|
1732
|
+
/** @returns a string uniquely identifying `e` in its document, or NaN if `e`
|
|
1733
|
+
* is unidentifiable. */
|
|
1734
|
+
export function identity(e) {
|
|
1735
|
+
if (e === null)
|
|
1736
|
+
return NaN;
|
|
1737
|
+
if (e.closest('Private'))
|
|
1738
|
+
return NaN;
|
|
1739
|
+
const tag = e.tagName;
|
|
1740
|
+
if (isSCLTag(tag))
|
|
1741
|
+
return tags[tag].identity(e);
|
|
1742
|
+
return NaN;
|
|
1743
|
+
}
|
|
1744
|
+
/** @returns whether `a` and `b` are considered identical by IEC-61850 */
|
|
1745
|
+
export function isSame(a, b) {
|
|
1746
|
+
if (a.tagName === 'Private')
|
|
1747
|
+
return isSame(a.parentElement, b.parentElement) && a.isEqualNode(b);
|
|
1748
|
+
return a.tagName === b.tagName && identity(a) === identity(b);
|
|
1749
|
+
}
|
|
1750
|
+
export function isEqual(a, b) {
|
|
1751
|
+
if (a.closest('Private') || b.closest('Private'))
|
|
1752
|
+
return a.isEqualNode(b);
|
|
1753
|
+
const attributeNames = new Set(a.getAttributeNames().concat(b.getAttributeNames()));
|
|
1754
|
+
for (const name of attributeNames)
|
|
1755
|
+
if (a.getAttribute(name) !== b.getAttribute(name))
|
|
1756
|
+
return false;
|
|
1757
|
+
if (a.childElementCount === 0)
|
|
1758
|
+
return (b.childElementCount === 0 &&
|
|
1759
|
+
a.textContent?.trim() === b.textContent?.trim());
|
|
1760
|
+
const aChildren = Array.from(a.children);
|
|
1761
|
+
const bChildren = Array.from(b.children);
|
|
1762
|
+
for (const aChild of aChildren) {
|
|
1763
|
+
const twindex = bChildren.findIndex(bChild => isEqual(aChild, bChild));
|
|
1764
|
+
if (twindex === -1)
|
|
1765
|
+
return false;
|
|
1766
|
+
bChildren.splice(twindex, 1);
|
|
1767
|
+
}
|
|
1768
|
+
for (const bChild of bChildren)
|
|
1769
|
+
if (!aChildren.find(aChild => isEqual(bChild, aChild)))
|
|
1770
|
+
return false;
|
|
1771
|
+
return true;
|
|
1772
|
+
}
|
|
1773
|
+
/** A directive rendering its argument `rendered` only if `rendered !== {}`. */
|
|
1774
|
+
export const ifImplemented = directive(rendered => (part) => {
|
|
1775
|
+
if (Object.keys(rendered).length)
|
|
1776
|
+
part.setValue(rendered);
|
|
1777
|
+
else
|
|
1778
|
+
part.setValue('');
|
|
1779
|
+
});
|
|
1780
|
+
const nameStartChar = '[:_A-Za-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]' +
|
|
1781
|
+
'|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]' +
|
|
1782
|
+
'|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]';
|
|
1783
|
+
const nameChar = nameStartChar + '|[.0-9\\-]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040]';
|
|
1784
|
+
const name = nameStartChar + '(' + nameChar + ')*';
|
|
1785
|
+
const nmToken = '\\S+';
|
|
1786
|
+
export const patterns = {
|
|
1787
|
+
string: '([\u0009-\u000A]|[\u000D]|[\u0020-\u007E]|[\u0085]|[\u00A0-\uD7FF]' +
|
|
1788
|
+
'|[\uE000-\uFFFD])*',
|
|
1789
|
+
normalizedString: '([\u0020-\u007E]|[\u0085]|[\u00A0-\uD7FF]|[\uE000-\uFFFD])*',
|
|
1790
|
+
name,
|
|
1791
|
+
nmToken,
|
|
1792
|
+
names: name + '( ' + name + ')*',
|
|
1793
|
+
nmTokens: nmToken + '( ' + nmToken + ')*',
|
|
1794
|
+
decimal: '[+\\-]?[0-9]+(([.][0-9]*)?|([.][0-9]+))',
|
|
1795
|
+
unsigned: '[+]?[0-9]+(([.][0-9]*)?|([.][0-9]+))',
|
|
1796
|
+
integer: '[+\\-]?[0-9]+([0-9]*)',
|
|
1797
|
+
alphanumericFirstUpperCase: '[A-Z][0-9,A-Z,a-z]*',
|
|
1798
|
+
alphanumericFirstLowerCase: '[a-z][0-9,A-Z,a-z]*',
|
|
1799
|
+
lnClass: '(LLN0)|[A-Z]{4,4}',
|
|
1800
|
+
};
|
|
1801
|
+
/** Sorts selected `ListItem`s to the top and disabled ones to the bottom. */
|
|
1802
|
+
export function compareNames(a, b) {
|
|
1803
|
+
if (typeof a === 'string' && typeof b === 'string')
|
|
1804
|
+
return a.localeCompare(b);
|
|
1805
|
+
if (typeof a === 'object' && typeof b === 'string')
|
|
1806
|
+
return (a.getAttribute('name') ?? '').localeCompare(b);
|
|
1807
|
+
if (typeof a === 'string' && typeof b === 'object')
|
|
1808
|
+
return a.localeCompare(b.getAttribute('name'));
|
|
1809
|
+
if (typeof a === 'object' && typeof b === 'object')
|
|
1810
|
+
return (a.getAttribute('name') ?? '').localeCompare(b.getAttribute('name') ?? '');
|
|
1811
|
+
return 0;
|
|
1812
|
+
}
|
|
1813
|
+
/** @returns the cartesian product of `arrays` */
|
|
1814
|
+
export function crossProduct(...arrays) {
|
|
1815
|
+
return arrays.reduce((a, b) => a.flatMap(d => b.map(e => [d, e].flat())), [[]]);
|
|
1816
|
+
}
|
|
1817
|
+
/** @returns the depth of `t` if it is an object or array, zero otherwise. */
|
|
1818
|
+
export function depth(t, mem = new WeakSet()) {
|
|
1819
|
+
if (mem.has(t))
|
|
1820
|
+
return Infinity;
|
|
1821
|
+
else
|
|
1822
|
+
switch (t?.constructor) {
|
|
1823
|
+
case Object:
|
|
1824
|
+
case Array:
|
|
1825
|
+
mem.add(t);
|
|
1826
|
+
return (1 +
|
|
1827
|
+
Math.max(-1, ...Object.values(t).map(_ => depth(_, mem))));
|
|
1828
|
+
default:
|
|
1829
|
+
return 0;
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
export function findFCDAs(extRef) {
|
|
1833
|
+
if (extRef.tagName !== 'ExtRef' || extRef.closest('Private'))
|
|
1834
|
+
return [];
|
|
1835
|
+
const [iedName, ldInst, prefix, lnClass, lnInst, doName, daName] = [
|
|
1836
|
+
'iedName',
|
|
1837
|
+
'ldInst',
|
|
1838
|
+
'prefix',
|
|
1839
|
+
'lnClass',
|
|
1840
|
+
'lnInst',
|
|
1841
|
+
'doName',
|
|
1842
|
+
'daName',
|
|
1843
|
+
].map(name => extRef.getAttribute(name));
|
|
1844
|
+
const ied = Array.from(extRef.ownerDocument.getElementsByTagName('IED')).find(element => element.getAttribute('name') === iedName && !element.closest('Private'));
|
|
1845
|
+
if (!ied)
|
|
1846
|
+
return [];
|
|
1847
|
+
return Array.from(ied.getElementsByTagName('FCDA'))
|
|
1848
|
+
.filter(item => !item.closest('Private'))
|
|
1849
|
+
.filter(fcda => (fcda.getAttribute('ldInst') ?? '') === (ldInst ?? '') &&
|
|
1850
|
+
(fcda.getAttribute('prefix') ?? '') === (prefix ?? '') &&
|
|
1851
|
+
(fcda.getAttribute('lnClass') ?? '') === (lnClass ?? '') &&
|
|
1852
|
+
(fcda.getAttribute('lnInst') ?? '') === (lnInst ?? '') &&
|
|
1853
|
+
(fcda.getAttribute('doName') ?? '') === (doName ?? '') &&
|
|
1854
|
+
(fcda.getAttribute('daName') ?? '') === (daName ?? ''));
|
|
1855
|
+
}
|
|
1856
|
+
const serviceTypeControlBlockTags = {
|
|
1857
|
+
GOOSE: ['GSEControl'],
|
|
1858
|
+
SMV: ['SampledValueControl'],
|
|
1859
|
+
Report: ['ReportControl'],
|
|
1860
|
+
NONE: ['LogControl', 'GSEControl', 'SampledValueControl', 'ReportControl'],
|
|
1861
|
+
};
|
|
1862
|
+
export function findControlBlocks(extRef) {
|
|
1863
|
+
const fcdas = findFCDAs(extRef);
|
|
1864
|
+
const cbTags = serviceTypeControlBlockTags[extRef.getAttribute('serviceType') ?? 'NONE'] ??
|
|
1865
|
+
[];
|
|
1866
|
+
const controlBlocks = new Set(fcdas.flatMap(fcda => {
|
|
1867
|
+
const dataSet = fcda.parentElement;
|
|
1868
|
+
const dsName = dataSet.getAttribute('name') ?? '';
|
|
1869
|
+
const anyLN = dataSet.parentElement;
|
|
1870
|
+
return cbTags
|
|
1871
|
+
.flatMap(tag => Array.from(anyLN.getElementsByTagName(tag)))
|
|
1872
|
+
.filter(cb => cb.getAttribute('datSet') === dsName);
|
|
1873
|
+
}));
|
|
1874
|
+
return controlBlocks;
|
|
1875
|
+
}
|
|
1876
|
+
export function isPublic(element) {
|
|
1877
|
+
return !element.closest('Private');
|
|
1878
|
+
}
|
|
1879
|
+
/** @returns the version of the SCL project */
|
|
1880
|
+
export function getVersion(element) {
|
|
1881
|
+
const header = Array.from(element.ownerDocument.getElementsByTagName('Header')).filter(item => !item.closest('Private'));
|
|
1882
|
+
return header[0].getAttribute('version') ?? '2003';
|
|
1883
|
+
}
|
|
1884
|
+
/** maximum value for `lnInst` attribute */
|
|
1885
|
+
const maxLnInst = 99;
|
|
1886
|
+
const lnInstRange = Array(maxLnInst)
|
|
1887
|
+
.fill(1)
|
|
1888
|
+
.map((_, i) => `${i + 1}`);
|
|
1889
|
+
/**
|
|
1890
|
+
* @param parent - The LNodes' parent element to be scanned once for `lnInst`
|
|
1891
|
+
* values already in use. Be sure to create a new generator every time the
|
|
1892
|
+
* children of this element change.
|
|
1893
|
+
* @returns a function generating increasing unused `lnInst` values for
|
|
1894
|
+
* `lnClass` LNodes within `parent` on subsequent invocations
|
|
1895
|
+
*/
|
|
1896
|
+
export function newLnInstGenerator(parent) {
|
|
1897
|
+
const generators = new Map();
|
|
1898
|
+
return (lnClass) => {
|
|
1899
|
+
if (!generators.has(lnClass)) {
|
|
1900
|
+
const lnInsts = new Set(getChildElementsByTagName(parent, 'LNode')
|
|
1901
|
+
.filter(lnode => lnode.getAttribute('lnClass') === lnClass)
|
|
1902
|
+
.map(lNode => lNode.getAttribute('lnInst')));
|
|
1903
|
+
generators.set(lnClass, () => {
|
|
1904
|
+
const uniqueLnInst = lnInstRange.find(lnInst => !lnInsts.has(lnInst));
|
|
1905
|
+
if (uniqueLnInst)
|
|
1906
|
+
lnInsts.add(uniqueLnInst);
|
|
1907
|
+
return uniqueLnInst;
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1910
|
+
return generators.get(lnClass)();
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
* @param lnElements - The LN elements to be scanned for `inst`
|
|
1915
|
+
* values already in use.
|
|
1916
|
+
* @returns first available inst value for LN or undefined if no inst is available
|
|
1917
|
+
*/
|
|
1918
|
+
export function minAvailableLogicalNodeInstance(lnElements) {
|
|
1919
|
+
const lnInsts = new Set(lnElements.map(ln => ln.getAttribute('inst') || ''));
|
|
1920
|
+
return lnInstRange.find(lnInst => !lnInsts.has(lnInst));
|
|
1921
|
+
}
|
|
1922
|
+
//# sourceMappingURL=foundation.js.map
|