Skip to content

Commit 6e6bab3

Browse files
authored
Merge pull request #546 from com-pas/develop
Release 0.2.47
2 parents 2214d74 + c9ef2a6 commit 6e6bab3

File tree

17 files changed

+453
-76
lines changed

17 files changed

+453
-76
lines changed

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-FileCopyrightText: 2025 RTE FRANCE
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# All members of the @com-pas/rte team are code owners for this repository
6+
7+
* @com-pas/rte

CODE_OF_CONDUCT.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2025 RTE FRANCE
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
7+
# Code of Conduct
8+
9+
This project follows the CoMPAS Code of Conduct. Please see the [Code of Conduct documentation](https://com-pas.github.io/contributing/#code-of-conduct) for details on our community standards and expectations.

GOVERNANCE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2025 RTE FRANCE
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
7+
# Governance
8+
9+
This project follows the CoMPAS governance model. See the [governance documentation](https://com-pas.github.io/contributing/GOVERNANCE.html) for details.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
SPDX-FileCopyrightText: 2021 Alliander N.V.
2+
SPDX-FileCopyrightText: 2025 RTE FRANCE
33
44
SPDX-License-Identifier: Apache-2.0
55
-->

SUPPORT.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2025 RTE FRANCE
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
7+
# Support
8+
9+
For support and help, see the [CoMPAS contributing guide](https://com-pas.github.io/contributing/SUPPORT.html).
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// SPDX-FileCopyrightText: 2023 2024 RTE FRANCE
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
package org.lfenergy.compas.sct.commons;
6+
7+
import lombok.extern.slf4j.Slf4j;
8+
import org.lfenergy.compas.scl2007b4.model.SCL;
9+
import org.lfenergy.compas.scl2007b4.model.TBay;
10+
import org.lfenergy.compas.scl2007b4.model.TSubstation;
11+
12+
import java.util.Optional;
13+
import java.util.function.Predicate;
14+
import java.util.stream.Stream;
15+
16+
@Slf4j
17+
public class BayService {
18+
19+
public Stream<TBay> getBays(SCL scl) {
20+
return scl.getSubstation().stream().flatMap(this::getBays);
21+
}
22+
23+
public Stream<TBay> getBays(TSubstation tSubstation) {
24+
return tSubstation.getVoltageLevel().stream()
25+
.flatMap(tVoltageLevel -> tVoltageLevel.getBay().stream());
26+
}
27+
28+
public Stream<TBay> getFilteredBays(TSubstation tSubstation, Predicate<TBay> bayPredicate) {
29+
return getBays(tSubstation).filter(bayPredicate);
30+
}
31+
32+
public Optional<TBay> findBay(TSubstation tSubstation, Predicate<TBay> bayPredicate) {
33+
return getFilteredBays(tSubstation, bayPredicate).findFirst();
34+
}
35+
36+
public Optional<TBay> findBay(TSubstation tSubstation, String bayName) {
37+
return findBay(tSubstation, bay -> bay.getName().equals(bayName));
38+
}
39+
40+
}

sct-commons/src/main/java/org/lfenergy/compas/sct/commons/ExtRefEditorService.java

Lines changed: 52 additions & 57 deletions
Large diffs are not rendered by default.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// SPDX-FileCopyrightText: 2023 2024 RTE FRANCE
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
package org.lfenergy.compas.sct.commons;
6+
7+
import lombok.extern.slf4j.Slf4j;
8+
import org.apache.commons.lang3.StringUtils;
9+
import org.lfenergy.compas.scl2007b4.model.*;
10+
11+
import java.util.Optional;
12+
import java.util.function.Predicate;
13+
import java.util.stream.Stream;
14+
15+
@Slf4j
16+
public class LNodeService {
17+
18+
public Stream<TLNode> getLNodes(TBay tBay) {
19+
return tBay.getFunction().stream()
20+
.flatMap(tFunction -> tFunction.getLNode().stream());
21+
}
22+
23+
public Stream<TLNode> getFilteredLNodes(TBay tBay, Predicate<TLNode> tlNodePredicate) {
24+
return getLNodes(tBay).filter(tlNodePredicate);
25+
}
26+
27+
public Optional<TLNode> findLNode(TBay tBay, Predicate<TLNode> tlNodePredicate) {
28+
return getFilteredLNodes(tBay, tlNodePredicate).findFirst();
29+
}
30+
31+
public boolean matchesLnode(TLNode tlNode, String iedName, String ldInst, TAnyLN tAnyLN) {
32+
return switch (tAnyLN) {
33+
case TLN ln -> matchesLnode(tlNode, iedName, ldInst, ln.getLnClass().isEmpty() ? "" : ln.getLnClass().getFirst(), ln.getInst(), ln.getPrefix());
34+
case LN0 ln0 -> matchesLnode(tlNode, iedName, ldInst, TLLN0Enum.LLN_0.value(), ln0.getInst(), "");
35+
default -> throw new IllegalStateException("Unexpected value: " + tAnyLN);
36+
};
37+
}
38+
39+
public boolean matchesLnode(TLNode tlNode, String iedName, String ldInst, String lnClass, String lnInst, String lnPrefix) {
40+
return tlNode.getIedName().equals(iedName)
41+
&& tlNode.getLdInst().equals(ldInst)
42+
&& tlNode.getLnClass().contains(lnClass)
43+
&& StringUtils.trimToEmpty(lnInst).equals(StringUtils.trimToEmpty(tlNode.getLnInst()))
44+
&& StringUtils.trimToEmpty(lnPrefix).equals(StringUtils.trimToEmpty(tlNode.getPrefix()));
45+
}
46+
47+
}

sct-commons/src/main/java/org/lfenergy/compas/sct/commons/LnService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
public class LnService implements LnEditor {
2727

2828
private static final DoLinkedToDaFilter DAI_FILTER_MOD_STVAL = DoLinkedToDaFilter.from(MOD_DO_NAME, STVAL_DA_NAME);
29-
private static final String LNODE_STATUS_PRIVATE_TYPE = "COMPAS-LNodeStatus";
29+
public static final String LNODE_STATUS_PRIVATE_TYPE = "COMPAS-LNodeStatus";
3030

3131
public Stream<TAnyLN> getAnylns(TLDevice tlDevice) {
3232
return Stream.concat(Stream.of(tlDevice.getLN0()), tlDevice.getLN().stream());
@@ -58,10 +58,10 @@ public Optional<TLN> findLn(TLDevice tlDevice, Predicate<TLN> lnPredicate) {
5858

5959
public boolean matchesLn(TAnyLN tAnyLN, String lnClass, String lnInst, String lnPrefix) {
6060
return switch (tAnyLN) {
61-
case TLN ln -> lnClass.equals(ln.getLnClass().getFirst())
61+
case TLN ln -> ln.getLnClass().contains(lnClass)
6262
&& StringUtils.trimToEmpty(lnInst).equals(StringUtils.trimToEmpty(ln.getInst()))
6363
&& (StringUtils.trimToEmpty(lnPrefix).equals(StringUtils.trimToEmpty(ln.getPrefix())));
64-
case LN0 ignored -> lnClass.equals(TLLN0Enum.LLN_0.value());
64+
case LN0 ignored -> TLLN0Enum.LLN_0.value().equals(lnClass);
6565
default -> throw new IllegalStateException("Unexpected value: " + tAnyLN);
6666
};
6767
}

sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ln/AbstractLNAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ protected void updateExtRefBindingInfo(TExtRef extRef, ExtRefInfo extRefInfo) {
293293
extRef.setDoName(bindingInfo.getDoName().toString());
294294
}
295295

296-
extRef.setPrefix(bindingInfo.getPrefix());
296+
extRef.setPrefix(StringUtils.trimToNull(bindingInfo.getPrefix()));
297297
// invalid source info
298298
removeExtRefSourceBinding(extRef);
299299
isSrcReset = true;
@@ -306,7 +306,7 @@ protected void updateExtRefBindingInfo(TExtRef extRef, ExtRefInfo extRefInfo) {
306306
extRef.getSrcLNClass().add(sourceInfo.getSrcLNClass());
307307
}
308308
extRef.setSrcLDInst(sourceInfo.getSrcLDInst());
309-
extRef.setSrcPrefix(sourceInfo.getSrcPrefix());
309+
extRef.setSrcPrefix(StringUtils.trimToNull(sourceInfo.getSrcPrefix()));
310310
extRef.setSrcCBName(sourceInfo.getSrcCBName());
311311
}
312312
}

0 commit comments

Comments
 (0)