Skip to content

Commit 626a60d

Browse files
author
Dennis Labordus
authored
Merge pull request #42 from com-pas/develop
Create a new release
2 parents f4bfa2a + 643cd78 commit 626a60d

File tree

15 files changed

+544
-541
lines changed

15 files changed

+544
-541
lines changed

.github/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SPDX-FileCopyrightText: 2022 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
changelog:
6+
exclude:
7+
labels:
8+
- wontfix
9+
- duplicate
10+
- invalid
11+
categories:
12+
- title: New Features
13+
labels:
14+
- enhancement
15+
- title: Bugfixes
16+
labels:
17+
- bug
18+
- title: Tooling changes
19+
labels:
20+
- tooling
21+
- title: Dependency updates
22+
labels:
23+
- dependencies
24+
- title: Other Changes
25+
labels:
26+
- "*"

.github/workflows/automate-projects.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
name: Add issues and pull request to project boards
66

7-
on: [ issues, pull_request ]
7+
on: [ issues, pull_request, pull_request_target ]
88

99
jobs:
1010
github-actions-automate-projects:
1111
runs-on: ubuntu-latest
12+
13+
if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
1214
steps:
1315
- name: add-new-issues-to-repository-based-project-column
1416
uses: docker://takanabe/github-actions-automate-projects:v0.0.1
@@ -19,7 +21,7 @@ jobs:
1921
GITHUB_PROJECT_COLUMN_NAME: To do
2022
- name: add-new-pull-request-to-repository-based-project-column
2123
uses: docker://takanabe/github-actions-automate-projects:v0.0.1
22-
if: github.event_name == 'pull_request' && github.event.action == 'opened'
24+
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'opened'
2325
env:
2426
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2527
GITHUB_PROJECT_URL: https://github.com/com-pas/compas-scl-auto-alignment/projects/1
@@ -33,7 +35,7 @@ jobs:
3335
GITHUB_PROJECT_COLUMN_NAME: To do
3436
- name: add-new-pull-request-to-organization-based-project-column
3537
uses: docker://takanabe/github-actions-automate-projects:v0.0.1
36-
if: github.event_name == 'pull_request' && github.event.action == 'opened'
38+
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'opened'
3739
env:
3840
GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_ACTION_SECRET }}
3941
GITHUB_PROJECT_URL: https://github.com/orgs/com-pas/projects/2

.github/workflows/build-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
restore-keys: ${{ runner.os }}-m2
3939

4040
- name: Set up JDK 1.11
41-
uses: actions/setup-java@v2.4.0
41+
uses: actions/setup-java@v2.5.0
4242
with:
4343
distribution: 'zulu'
4444
java-version: '11'

.github/workflows/release-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
4343
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
4444
- name: Set up JDK 1.11
45-
uses: actions/setup-java@v2.4.0
45+
uses: actions/setup-java@v2.5.0
4646
with:
4747
distribution: 'zulu'
4848
java-version: '11'

.github/workflows/sonarcloud-analysis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,26 @@ on:
1212
branches:
1313
- 'main'
1414
- 'develop'
15+
pull_request_target:
16+
branches:
17+
- 'main'
18+
- 'develop'
1519

1620
jobs:
1721
build:
1822
name: SonarCloud
1923
runs-on: ubuntu-latest
2024
timeout-minutes: 15
2125

26+
if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
2227
steps:
2328
- name: Checkout
2429
uses: actions/checkout@v2
2530
with:
2631
fetch-depth: 0
2732

2833
- name: Set up JDK 1.11
29-
uses: actions/setup-java@v2.4.0
34+
uses: actions/setup-java@v2.5.0
3035
with:
3136
distribution: 'zulu'
3237
java-version: '11'
@@ -58,4 +63,5 @@ jobs:
5863
-Dsonar.projectKey=com-pas_compas-scl-auto-alignment \
5964
-Dsonar.organization=com-pas \
6065
-Dsonar.host.url=https://sonarcloud.io \
66+
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }} \
6167
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar

pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ SPDX-License-Identifier: Apache-2.0
2020
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2121
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2222

23-
<compiler-plugin.version>3.8.1</compiler-plugin.version>
23+
<compiler-plugin.version>3.9.0</compiler-plugin.version>
2424
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
2525
<sonarqube-plugin.version>3.2.0</sonarqube-plugin.version>
2626

27-
<compas.core.version>0.6.0</compas.core.version>
27+
<compas.core.version>0.7.0</compas.core.version>
2828

29-
<quarkus.platform.version>2.4.2.Final</quarkus.platform.version>
30-
<slf4j.version>1.7.32</slf4j.version>
31-
<powsybl.sld.version>2.5.1</powsybl.sld.version>
29+
<quarkus.platform.version>2.6.2.Final</quarkus.platform.version>
30+
<slf4j.version>1.7.33</slf4j.version>
31+
<powsybl.sld.version>2.7.0</powsybl.sld.version>
3232
<gson.version>2.8.9</gson.version>
3333
<openpojo.version>0.9.1</openpojo.version>
3434
</properties>
@@ -134,7 +134,7 @@ SPDX-License-Identifier: Apache-2.0
134134
<plugin>
135135
<groupId>org.jboss.jandex</groupId>
136136
<artifactId>jandex-maven-plugin</artifactId>
137-
<version>1.2.1</version>
137+
<version>1.2.2</version>
138138
<executions>
139139
<execution>
140140
<id>make-index</id>
@@ -148,7 +148,7 @@ SPDX-License-Identifier: Apache-2.0
148148
<plugin>
149149
<groupId>org.apache.maven.plugins</groupId>
150150
<artifactId>maven-jar-plugin</artifactId>
151-
<version>3.2.0</version>
151+
<version>3.2.2</version>
152152
</plugin>
153153
</plugins>
154154
</pluginManagement>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// SPDX-FileCopyrightText: 2021 Alliander N.V.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
package org.lfenergy.compas.scl.auto.alignment.builder;
5+
6+
import com.powsybl.sld.model.BaseGraph;
7+
import com.powsybl.sld.model.Node;
8+
9+
import java.util.Map;
10+
11+
public abstract class AbstractGraphBuilder<G extends BaseGraph> {
12+
private G graph;
13+
private final Map<String, Node> path2Node;
14+
15+
protected AbstractGraphBuilder(Map<String, Node> path2Node) {
16+
this.path2Node = path2Node;
17+
}
18+
19+
public G getGraph() {
20+
return graph;
21+
}
22+
23+
protected void setGraph(G graph) {
24+
this.graph = graph;
25+
}
26+
27+
protected void addNode(String path, Node node) {
28+
path2Node.put(path, node);
29+
}
30+
31+
protected Node getNodeByPath(String path) {
32+
return path2Node.get(path);
33+
}
34+
35+
protected Map<String, Node> getPath2Node() {
36+
return path2Node;
37+
}
38+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
// SPDX-FileCopyrightText: 2021 Alliander N.V.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
package org.lfenergy.compas.scl.auto.alignment.builder;
5+
6+
import com.powsybl.sld.model.*;
7+
import org.lfenergy.compas.scl.auto.alignment.exception.SclAutoAlignmentException;
8+
import org.lfenergy.compas.scl.auto.alignment.model.*;
9+
10+
import java.util.HashMap;
11+
import java.util.List;
12+
import java.util.Map;
13+
14+
import static org.lfenergy.compas.scl.auto.alignment.exception.SclAutoAlignmentErrorCode.VOLTAGELEVEL_NOT_FOUND_ERROR_CODE;
15+
16+
public class SubstationGraphBuilder extends AbstractGraphBuilder<SubstationGraph> {
17+
private final GenericSubstation substation;
18+
19+
private final Map<String, VoltageLevelGraphBuilder> voltageLevelGraphBuilderMap = new HashMap<>();
20+
21+
public SubstationGraphBuilder(GenericSubstation substation) {
22+
this(substation, new HashMap<>());
23+
}
24+
25+
public SubstationGraphBuilder(GenericSubstation substation,
26+
Map<String, Node> path2Node) {
27+
super(path2Node);
28+
this.substation = substation;
29+
30+
setGraph(SubstationGraph.create(substation.getFullName()));
31+
32+
createSubstation();
33+
}
34+
35+
private void createSubstation() {
36+
substation.getVoltageLevels().forEach(this::createVoltageLevelGraph);
37+
substation.getPowerTransformers().forEach(this::createPowerTransformer);
38+
}
39+
40+
private void createVoltageLevelGraph(GenericVoltageLevel voltageLevel) {
41+
var voltageLevelBuilder = new VoltageLevelGraphBuilder(voltageLevel, substation, getPath2Node());
42+
getGraph().addVoltageLevel(voltageLevelBuilder.getGraph());
43+
voltageLevelGraphBuilderMap.put(voltageLevel.getFullName(), voltageLevelBuilder);
44+
}
45+
46+
private VoltageLevelGraphBuilder getVoltageLevelBuilder(GenericTransformerWinding transformerWinding) {
47+
var connectivityNode = transformerWinding.getTerminals().get(0).getConnectivityNode();
48+
return substation.getVoltageLevels().stream()
49+
.map(GenericVoltageLevel::getBays)
50+
.flatMap(List::stream)
51+
.map(GenericBay::getConductingEquipments)
52+
.flatMap(List::stream)
53+
.map(GenericConductingEquipment::getTerminals)
54+
.flatMap(List::stream)
55+
.filter(terminal -> connectivityNode.equals(terminal.getConnectivityNode()))
56+
.findFirst()
57+
.map(terminal -> ((GenericConductingEquipment) terminal.getParent()).getParent().getParent())
58+
.map(genericVoltageLevel -> voltageLevelGraphBuilderMap.get(genericVoltageLevel.getFullName()))
59+
.orElseThrow(() -> new SclAutoAlignmentException(VOLTAGELEVEL_NOT_FOUND_ERROR_CODE, "No voltage level found."));
60+
}
61+
62+
private void createPowerTransformer(GenericPowerTransformer powerTransformer) {
63+
if (powerTransformer.isFeeder2WT()) {
64+
var tws = powerTransformer.getTransformerWindings();
65+
getGraph().addMultiTermNode(
66+
Middle2WTNode.create(powerTransformer.getFullName(),
67+
powerTransformer.getFullName(),
68+
getGraph(),
69+
getFeeder2WTLegNode(tws.get(0)),
70+
getFeeder2WTLegNode(tws.get(1)),
71+
getVoltageLevelBuilder(tws.get(0)).getGraph().getVoltageLevelInfos(),
72+
getVoltageLevelBuilder(tws.get(1)).getGraph().getVoltageLevelInfos(),
73+
false));
74+
} else if (powerTransformer.isFeeder3WT()) {
75+
var tws = powerTransformer.getTransformerWindings();
76+
getGraph().addMultiTermNode(
77+
Middle3WTNode.create(powerTransformer.getFullName(),
78+
powerTransformer.getFullName(),
79+
getGraph(),
80+
getFeeder3WTLegNode(tws.get(0)),
81+
getFeeder3WTLegNode(tws.get(1)),
82+
getFeeder3WTLegNode(tws.get(2)),
83+
getVoltageLevelBuilder(tws.get(0)).getGraph().getVoltageLevelInfos(),
84+
getVoltageLevelBuilder(tws.get(1)).getGraph().getVoltageLevelInfos(),
85+
getVoltageLevelBuilder(tws.get(2)).getGraph().getVoltageLevelInfos()));
86+
}
87+
}
88+
89+
private Feeder2WTLegNode getFeeder2WTLegNode(GenericTransformerWinding transformerWinding) {
90+
var connectivityNode = transformerWinding.getTerminals().get(0).getConnectivityNode();
91+
return (Feeder2WTLegNode) getNodeByPath(connectivityNode);
92+
}
93+
94+
private Feeder3WTLegNode getFeeder3WTLegNode(GenericTransformerWinding transformerWinding) {
95+
var connectivityNode = transformerWinding.getTerminals().get(0).getConnectivityNode();
96+
return (Feeder3WTLegNode) getNodeByPath(connectivityNode);
97+
}
98+
}

0 commit comments

Comments
 (0)