Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LGOS/LSVS supervision instantiation counts existing instances incorrectly #1161

Closed
danyill opened this issue Feb 7, 2023 · 1 comment · Fixed by #1169
Closed

LGOS/LSVS supervision instantiation counts existing instances incorrectly #1161

danyill opened this issue Feb 7, 2023 · 1 comment · Fixed by #1169
Assignees
Labels
Kind: Bug Something isn't working Priority: Important Tackle eventually Status: Ready for development Checked by all co-developers

Comments

@danyill
Copy link
Collaborator

danyill commented Feb 7, 2023

Describe the bug

Currently we check several items as part of instantiating supervisions:

function isSupervisionAllowed(
controlBlock: Element,
subscriberIED: Element,
supervisionType: string
): boolean {
if (getSclSchemaVersion(subscriberIED.ownerDocument) === '2003') return false;
if (subscriberIED.querySelector(`LN[lnClass="${supervisionType}"]`) === null)
return false;
if (
Array.from(
subscriberIED.querySelectorAll(
`LN[lnClass="${supervisionType}"]>DOI>DAI>Val`
)
).find(val => val.textContent == controlBlockReference(controlBlock))
)
return false;
if (
maxSupervisions(subscriberIED, controlBlock) <=
instantiatedSupervisionsCount(subscriberIED, controlBlock, supervisionType)
)
return false;
return true;
}

One of these items is instantiatedSupervisionsCount:

export function instantiatedSupervisionsCount(
subscriberIED: Element,
controlBlock: Element,
supervisionType: string
): number {
const instantiatedValues = Array.from(
subscriberIED.querySelectorAll(
`LN[lnClass="${supervisionType}"]>DOI>DAI>Val`
)
).filter(val => val.textContent !== '');
return instantiatedValues.length;
}

With the following (slightly hand modified IID file), supervisions cannot be instantiated.

B30_valKind_valImport.zip

The reason for this is that the count function is showing a much larger number of supervisions than exist.

This is because we are counting all DOIs which have DAIs which have a Val. In this particular IED there are many DOI > DAI > Val within each LGOS.

<LN lnType="LGOS_4" lnClass="LGOS" inst="1" prefix="">
    <Private type="GE_Digital_Energy_UR LN_UUID">Master_LGOS1</Private>
    <DOI name="NamPlt">
        <DAI name="d" valKind="RO" valImport="true">
            <Val>Ctl</Val>
        </DAI>
    </DOI>
    <DOI name="Beh">
        <DAI name="d" valKind="RO" valImport="true">
            <Val>This logical node's behaviour</Val>
        </DAI>
        <DAI name="stVal" valKind="RO"/>
    </DOI>
    <DOI name="St">
        <DAI name="d" valKind="RO" valImport="true">
            <Val>RxGOOSE1 On operand</Val>
        </DAI>
        <DAI name="stVal" valKind="RO" sAddr="0:1441793,0"/>
    </DOI>
and so on...

There are enough supervision instances available, within the Services section: <SupSubscription maxGo="64" maxSv="16"/>

I think this query needs to be tightened up. When is a supervision instantiated? I think only when a DO GoCBRefhas a Val against the DA SetSrcRef.

Array.from(subscriberIED.querySelectorAll(`LN[lnClass="${supervisionType}"]>DOI>DAI>Val`))
(396)

Array.from(subscriberIED.querySelectorAll(`LN[lnClass="${supervisionType}"]>DOI[name="GoCBRef"]>DAI[name="setSrcRef"]>Val`))
12

I think this change would be sufficient (with appropriate modifications for the control block type):

const instantiatedValues = Array.from( 
     subscriberIED.querySelectorAll( 
-       `LN[lnClass="${supervisionType}"]>DOI>DAI>Val` 
+      `LN[lnClass="${supervisionType}"]>DOI[name="GoCBRef"]>DAI[name="setSrcRef"]>Val`
     ) 
   ).filter(val => val.textContent !== '');

To Reproduce

Steps to reproduce the behavior:

  1. Import an instance of the IED included in the above zip file.
  2. Include another IED, e.g. the attached: NR.zip
  3. Try to carry out a GOOSE subscription.
  4. No supervision occurs.

Expected behavior

A supervised GOOSE instance should appear with the supervision icon.

@danyill danyill added the Kind: Bug Something isn't working label Feb 7, 2023
@danyill danyill changed the title LGOS supervision instantiation counts existing instances incorrectly LGOS/LSVS supervision instantiation counts existing instances incorrectly Feb 7, 2023
@JakobVogelsang
Copy link
Collaborator

SORRY!!! It is on me @JakobVogelsang

@danyill danyill self-assigned this Feb 8, 2023
danyill added a commit that referenced this issue Mar 7, 2023
…stances, improve instance use counting and allow Val updates (#1169)

* Scope query for finding supervision instances more tightly, closes #1161
* Add base code, refactor LGOS/LSVS creation and update tests, closes #1162
* Improve schema conformance for adding the LGOS/LSVS element, thanks Jakob

---------

Co-authored-by: Christian Dinkel <christian.dinkel@omicronenergy.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kind: Bug Something isn't working Priority: Important Tackle eventually Status: Ready for development Checked by all co-developers
Projects
None yet
2 participants