-
Notifications
You must be signed in to change notification settings - Fork 4
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
tLN: Check if supervision can be created without passing a control block #80
Comments
Could you please tell what for you counts as can do supervision for |
I think I should be able to create a new (empty) supervision LN in an IED (with no control block if):
Currently what I'm using is the following: /**
* Searches for first instantiated LGOS/LSVS LN for presence of DOI>DAI[valKind=Conf/RO][valImport=true]
* given a supervision type and if necessary then searches DataTypeTemplates for
* DOType>DA[valKind=Conf/RO][valImport=true] to determine if modifications to supervision are allowed.
* @param ied - SCL IED element.
* @param supervisionType - either 'LGOS' or 'LSVS' supervision LN classes.
* @returns boolean indicating if subscriptions are allowed.
*/
export function isSupervisionModificationAllowed(
ied: Element,
supervisionType: string
): boolean {
const firstSupervisionLN = ied.querySelector(
`LN[lnClass="${supervisionType}"]`
);
// no supervision logical nodes => no new supervision possible
if (firstSupervisionLN === null) return false;
// check if allowed to modify based on first instance properties
const supervisionName = supervisionType === 'LGOS' ? 'GoCBRef' : 'SvCBRef';
const instValKind = firstSupervisionLN!
.querySelector(`DOI[name="${supervisionName}"]>DAI[name="setSrcRef"]`)
?.getAttribute('valKind');
const instValImport = firstSupervisionLN!
.querySelector(`DOI[name="${supervisionName}"]>DAI[name="setSrcRef"]`)
?.getAttribute('valImport');
if (
(instValKind === 'RO' || instValKind === 'Conf') &&
instValImport === 'true'
)
return true;
// check if allowed to modify based on DataTypeTemplates for first instance
const rootNode = firstSupervisionLN?.ownerDocument;
const lNodeType = firstSupervisionLN.getAttribute('lnType');
const lnClass = firstSupervisionLN.getAttribute('lnClass');
const dObj = rootNode.querySelector(
`DataTypeTemplates > LNodeType[id="${lNodeType}"][lnClass="${lnClass}"] > DO[name="${
lnClass === 'LGOS' ? 'GoCBRef' : 'SvCBRef'
}"]`
);
if (dObj) {
const dORef = dObj.getAttribute('type');
const daObj = rootNode.querySelector(
`DataTypeTemplates > DOType[id="${dORef}"] > DA[name="setSrcRef"]`
);
if (daObj) {
return (
(daObj.getAttribute('valKind') === 'Conf' ||
daObj.getAttribute('valKind') === 'RO') &&
daObj.getAttribute('valImport') === 'true'
);
}
}
// definition missing
return false;
} For can instantiate a specific supervision (an LN with a control block is passed):
WDYT? This is effectively splitting what we do in half depending on whether you're creating a new instance or allocating an existing instance. I think it's still useful to be able to do both together... |
It would be generally useful to know if I can create supervisions without having to pass a control block.
As long as a supervision LN has been passed, this should be possible.
Although I worry
canInstantiateSubscriptionSupervision
is now quite complex, I'd like the control block to be an optional argument.Then, as an end user if I want to check I also have to pass a supervision instance (I do not propose a rewrite but perhaps our API is not granular enough, I would prefer to just pass an IED and a type, e.g. 'LGOS' or 'LSVS'). But since the standard says this must exist I think it is OK.
This has two uses:
The text was updated successfully, but these errors were encountered: