Skip to content

Commit 563c19a

Browse files
fix: instantiate Omulti and Mmulti data objects
1 parent 122963d commit 563c19a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+738
-728
lines changed

tDataTypeTemplates/nsdToJson.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ describe("NSD to Json parsing function", () => {
2929
const data = nsdToJson(lnClass)!;
3030
const sClass = lnClassData[lnClass];
3131

32+
console.log(lnClass);
33+
3234
Object.keys(sClass).forEach((key) => {
3335
expect(data[key]).to.deep.equal(sClass[key]);
3436
});

tDataTypeTemplates/nsdToJson.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export function nsdToJson(
181181

182182
const doc74 = nsds && nsds["74"] ? nsds["74"] : defaultDoc74;
183183
const doc7420 = nsds && nsds["7420"] ? nsds["7420"] : defaultDoc7420;
184-
184+
185185
function getServiceConstructedAttributes(
186186
serviceDataAttribute: Element,
187187
): Element[] {
@@ -197,7 +197,7 @@ export function nsdToJson(
197197
);
198198
}
199199

200-
function getServiceDataAttributesType(type : string | null): Element[] {
200+
function getServiceDataAttributesType(type: string | null): Element[] {
201201
const doc81 = nsds && nsds["81"] ? nsds["81"] : defaultDoc81;
202202

203203
return Array.from(
@@ -209,7 +209,7 @@ export function nsdToJson(
209209

210210
function getServiceDataAttributes(dataObject: Element): Element[] {
211211
const type = dataObject.getAttribute("type");
212-
212+
213213
return getServiceDataAttributesType(type);
214214
}
215215

@@ -236,7 +236,7 @@ export function nsdToJson(
236236
return getSubDataAttributesType(type)
237237
}
238238

239-
function getDataAttributesType(type:string|null): Element[] {
239+
function getDataAttributesType(type: string | null): Element[] {
240240
const doc73 = nsds && nsds["73"] ? nsds["73"] : defaultDoc73;
241241

242242
if (
@@ -535,16 +535,24 @@ export function nsdToJson(
535535
return data;
536536
}
537537

538+
function dataObjectName(dataObject: Element): string {
539+
const multiInstances = ['Omulti', 'Mmulti']
540+
const instance = multiInstances.includes(dataObject.getAttribute("presCond")!) ? '1' : '';
541+
const name = dataObject.getAttribute("name")!;
542+
return `${name}${instance}`;
543+
}
544+
538545
function nsdDataObject(dataObject: Element): CdcDescription {
539-
const [name, type, descID, presCond, dsPresCond, transient] = [
540-
"name",
546+
const [type, descID, presCond, dsPresCond, transient] = [
541547
"type",
542548
"descID",
543549
"presCond",
544550
"dsPresCond",
545551
"transient",
546552
].map((attr) => dataObject.getAttribute(attr)!);
547553

554+
const name = dataObjectName(dataObject); // adopt when presCond is Omulti
555+
548556
const tagName = dataObject.tagName;
549557

550558
const presCondArgsID =
@@ -648,7 +656,7 @@ export function nsdToJson(
648656
}
649657

650658
if (lnClassOrCdc === undefined) return;
651-
else if (isSupportedCdc(lnClassOrCdc))
659+
else if (isSupportedCdc(lnClassOrCdc))
652660
return CdcChildren(lnClassOrCdc);
653661
else {
654662
const nsdLnClass74 = doc74.querySelector(`LNClass[name="${lnClassOrCdc}"]`);
@@ -659,11 +667,11 @@ export function nsdToJson(
659667

660668
const lnClassJson: LNodeDescription = {};
661669
getDataObjects(nsdLnClass).forEach((dataObject) => {
662-
const name = dataObject.getAttribute("name")!;
663-
670+
const name = dataObjectName(dataObject);
671+
664672
lnClassJson[name] = nsdDataObject(dataObject);
665673
});
666674

667675
return lnClassJson
668-
}
676+
}
669677
}

tDataTypeTemplates/nsdToJson/testJson/ANCR.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ export const ancr = {
7878
dsPresCond: "F",
7979
children: spsChildren,
8080
},
81-
BlkRef: {
81+
BlkRef1: {
8282
tagName: "DataObject",
83-
name: "BlkRef",
83+
name: "BlkRef1",
8484
type: "ORG",
8585
descID: "IEC61850_7_4.AbstractLNsCommon::FunctionLN.BlkRef.desc",
8686
presCond: "Omulti",
@@ -1781,9 +1781,9 @@ export const ancr = {
17811781
},
17821782
},
17831783
},
1784-
InRef: {
1784+
InRef1: {
17851785
tagName: "DataObject",
1786-
name: "InRef",
1786+
name: "InRef1",
17871787
type: "ORG",
17881788
descID: "IEC61850_7_4.AbstractLNsCommon::DomainLN.InRef.desc",
17891789
presCond: "Omulti",

tDataTypeTemplates/nsdToJson/testJson/ARCO.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ export const arco = {
7272
dsPresCond: "F",
7373
children: spsChildren,
7474
},
75-
BlkRef: {
75+
BlkRef1: {
7676
tagName: "DataObject",
77-
name: "BlkRef",
77+
name: "BlkRef1",
7878
type: "ORG",
7979
descID: "IEC61850_7_4.AbstractLNsCommon::FunctionLN.BlkRef.desc",
8080
presCond: "Omulti",
@@ -1775,9 +1775,9 @@ export const arco = {
17751775
},
17761776
},
17771777
},
1778-
InRef: {
1778+
InRef1: {
17791779
tagName: "DataObject",
1780-
name: "InRef",
1780+
name: "InRef1",
17811781
type: "ORG",
17821782
descID: "IEC61850_7_4.AbstractLNsCommon::DomainLN.InRef.desc",
17831783
presCond: "Omulti",

tDataTypeTemplates/nsdToJson/testJson/ARIS.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ export const aris = {
7474
dsPresCond: "F",
7575
children: spsChildren,
7676
},
77-
BlkRef: {
77+
BlkRef1: {
7878
tagName: "DataObject",
79-
name: "BlkRef",
79+
name: "BlkRef1",
8080
type: "ORG",
8181
descID: "IEC61850_7_4.AbstractLNsCommon::FunctionLN.BlkRef.desc",
8282
presCond: "Omulti",
@@ -1777,9 +1777,9 @@ export const aris = {
17771777
},
17781778
},
17791779
},
1780-
InRef: {
1780+
InRef1: {
17811781
tagName: "DataObject",
1782-
name: "InRef",
1782+
name: "InRef1",
17831783
type: "ORG",
17841784
descID: "IEC61850_7_4.AbstractLNsCommon::DomainLN.InRef.desc",
17851785
presCond: "Omulti",

tDataTypeTemplates/nsdToJson/testJson/ATCC.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ export const atcc = {
7979
dsPresCond: "F",
8080
children: spsChildren,
8181
},
82-
BlkRef: {
82+
BlkRef1: {
8383
tagName: "DataObject",
84-
name: "BlkRef",
84+
name: "BlkRef1",
8585
type: "ORG",
8686
descID: "IEC61850_7_4.AbstractLNsCommon::FunctionLN.BlkRef.desc",
8787
presCond: "Omulti",
@@ -1782,9 +1782,9 @@ export const atcc = {
17821782
},
17831783
},
17841784
},
1785-
InRef: {
1785+
InRef1: {
17861786
tagName: "DataObject",
1787-
name: "InRef",
1787+
name: "InRef1",
17881788
type: "ORG",
17891789
descID: "IEC61850_7_4.AbstractLNsCommon::DomainLN.InRef.desc",
17901790
presCond: "Omulti",
@@ -2033,9 +2033,9 @@ export const atcc = {
20332033
dsPresCond: "F",
20342034
children: spcChildren,
20352035
},
2036-
VRed: {
2036+
VRed1: {
20372037
tagName: "DataObject",
2038-
name: "VRed",
2038+
name: "VRed1",
20392039
type: "SPC",
20402040
descID: "IEC61850_7_4.LNGroupA::ATCC.VRed.desc",
20412041
deprecated: "true",

tDataTypeTemplates/nsdToJson/testJson/AVCO.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ export const avco = {
7575
dsPresCond: "F",
7676
children: spsChildren,
7777
},
78-
BlkRef: {
78+
BlkRef1: {
7979
tagName: "DataObject",
80-
name: "BlkRef",
80+
name: "BlkRef1",
8181
type: "ORG",
8282
descID: "IEC61850_7_4.AbstractLNsCommon::FunctionLN.BlkRef.desc",
8383
presCond: "Omulti",
@@ -1778,9 +1778,9 @@ export const avco = {
17781778
},
17791779
},
17801780
},
1781-
InRef: {
1781+
InRef1: {
17821782
tagName: "DataObject",
1783-
name: "InRef",
1783+
name: "InRef1",
17841784
type: "ORG",
17851785
descID: "IEC61850_7_4.AbstractLNsCommon::DomainLN.InRef.desc",
17861786
presCond: "Omulti",

tDataTypeTemplates/nsdToJson/testJson/CALH.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export const calh = {
1515
dsPresCond: "F",
1616
children: spsChildren,
1717
},
18-
BlkRef: {
18+
BlkRef1: {
1919
tagName: "DataObject",
20-
name: "BlkRef",
20+
name: "BlkRef1",
2121
type: "ORG",
2222
descID: "IEC61850_7_4.AbstractLNsCommon::FunctionLN.BlkRef.desc",
2323
presCond: "Omulti",
@@ -1718,9 +1718,9 @@ export const calh = {
17181718
},
17191719
},
17201720
},
1721-
InRef: {
1721+
InRef1: {
17221722
tagName: "DataObject",
1723-
name: "InRef",
1723+
name: "InRef1",
17241724
type: "ORG",
17251725
descID: "IEC61850_7_4.AbstractLNsCommon::DomainLN.InRef.desc",
17261726
presCond: "Omulti",

tDataTypeTemplates/nsdToJson/testJson/CCGR.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ export const ccgr = {
7474
dsPresCond: "F",
7575
children: spsChildren,
7676
},
77-
BlkRef: {
77+
BlkRef1: {
7878
tagName: "DataObject",
79-
name: "BlkRef",
79+
name: "BlkRef1",
8080
type: "ORG",
8181
descID: "IEC61850_7_4.AbstractLNsCommon::FunctionLN.BlkRef.desc",
8282
presCond: "Omulti",
@@ -1777,9 +1777,9 @@ export const ccgr = {
17771777
},
17781778
},
17791779
},
1780-
InRef: {
1780+
InRef1: {
17811781
tagName: "DataObject",
1782-
name: "InRef",
1782+
name: "InRef1",
17831783
type: "ORG",
17841784
descID: "IEC61850_7_4.AbstractLNsCommon::DomainLN.InRef.desc",
17851785
presCond: "Omulti",
@@ -2823,9 +2823,9 @@ export const ccgr = {
28232823
},
28242824
},
28252825
},
2826-
PmpCtl: {
2826+
PmpCtl1: {
28272827
tagName: "DataObject",
2828-
name: "PmpCtl",
2828+
name: "PmpCtl1",
28292829
type: "ENC",
28302830
underlyingType: "StageControlKind",
28312831
descID: "IEC61850_7_4.LNGroupC::CCGR.PmpCtl.desc",
@@ -4541,9 +4541,9 @@ export const ccgr = {
45414541
},
45424542
},
45434543
},
4544-
FanCtl: {
4544+
FanCtl1: {
45454545
tagName: "DataObject",
4546-
name: "FanCtl",
4546+
name: "FanCtl1",
45474547
type: "ENC",
45484548
underlyingType: "StageControlKind",
45494549
descID: "IEC61850_7_4.LNGroupC::CCGR.FanCtl.desc",

tDataTypeTemplates/nsdToJson/testJson/CILO.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export const cilo = {
1515
dsPresCond: "F",
1616
children: spsChildren,
1717
},
18-
BlkRef: {
18+
BlkRef1: {
1919
tagName: "DataObject",
20-
name: "BlkRef",
20+
name: "BlkRef1",
2121
type: "ORG",
2222
descID: "IEC61850_7_4.AbstractLNsCommon::FunctionLN.BlkRef.desc",
2323
presCond: "Omulti",
@@ -1718,9 +1718,9 @@ export const cilo = {
17181718
},
17191719
},
17201720
},
1721-
InRef: {
1721+
InRef1: {
17221722
tagName: "DataObject",
1723-
name: "InRef",
1723+
name: "InRef1",
17241724
type: "ORG",
17251725
descID: "IEC61850_7_4.AbstractLNsCommon::DomainLN.InRef.desc",
17261726
presCond: "Omulti",

0 commit comments

Comments
 (0)