Open
Description
When I get the identity for a GSE
or SMV
element, there is no clear path in it for a specific ConnectedAP
:
identity(address)
'MUSV smvcb1'
selector('SMV', identity(address))
'SMV[ldInst="MUSV"][cbName="smvcb1"]'
As a result, the identity of these elements as described is not unique, it must be qualified by the ConnectedAP
and possibly the SubNetwork
.
Similarly, the code for selector in open-scd
seems to have the same limitations.
Lines 172 to 184 in 2df4a18
I've not written an identity/selector function before but I think what we need is something like:
export function controlBlockIdentity(e: Element): string {
const [ldInst, cbName] = ['ldInst', 'cbName'].map(name =>
e.getAttribute(name)
);
return `${identity(e.parentElement)}>${ldInst} ${cbName}`;
}
export function controlBlockSelector(
tagName: SCLTag,
identity: string
): string {
const [parentIdentity, cbIdentity] = identity.split('>');
const [ldInst, cbName] = cbIdentity.split(' ');
if (!ldInst || !cbName) return voidSelector;
const parents = relatives[tagName].parents.map(parent =>
selector(parent, parentIdentity)
);
return crossProduct(
parents,
['>'],
[`${tagName}[ldInst="${ldInst}"][cbName="${cbName}"]`]
)
.map(strings => strings.join(''))
.join(',');
}
If that seems about right I am happy to do a PR.
Activity
ca-d commentedon Aug 30, 2023
@JakobVogelsang is this correct in terms of the SCL standard? Also, would you want to move to the
find
API before receiving a PR on this issue, now thatopen-scd
has transitioned to it as well?JakobVogelsang commentedon Sep 7, 2023
I would.