Skip to content

Commit

Permalink
Merge pull request #109 from com-pas/develop
Browse files Browse the repository at this point in the history
New Release
  • Loading branch information
Dennis Labordus authored Oct 4, 2021
2 parents 944ab86 + 0e89948 commit 32417d5
Show file tree
Hide file tree
Showing 12 changed files with 307 additions and 102 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.11
uses: actions/setup-java@v2.3.0
uses: actions/setup-java@v2.3.1
with:
distribution: 'zulu'
java-version: '11'
- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v18
uses: whelk-io/maven-settings-xml-action@v20
with:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ jobs:
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Extract tag name
id: extract_tagname
shell: bash
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
- name: Set up JDK 1.11
uses: actions/setup-java@v2.3.0
uses: actions/setup-java@v2.3.1
with:
distribution: 'zulu'
java-version: '11'
- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v18
uses: whelk-io/maven-settings-xml-action@v20
with:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up JDK 1.11
uses: actions/setup-java@v2.3.0
uses: actions/setup-java@v2.3.1
with:
distribution: 'zulu'
java-version: '11'
Expand All @@ -34,7 +34,7 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v18
uses: whelk-io/maven-settings-xml-action@v20
with:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
Expand Down
39 changes: 24 additions & 15 deletions MAPPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ There is an IEC document describing the mapping, namely IEC/TS 62361-102, but no
| id | name | |
| name | desc | |
| List&lt;cim:VoltageLevel&gt; | List&lt;TVoltageLevel&gt; | (1) |
| List&lt;*PowerTransformer*&gt; | List&lt;TPowerTransformer&gt; | |
| List&lt;cim:PowerTransformer&gt; | List&lt;TPowerTransformer&gt; | |

(1): The list of VoltageLevels that belong to the Substation.

Expand All @@ -29,46 +29,55 @@ There is an IEC document describing the mapping, namely IEC/TS 62361-102, but no
| nominalV | voltage.value | |
| 'k' | voltage.multiplier | |
| 'V' | voltage.unit | |
| List&lt;Bay&gt; | List&lt;TBay&gt; | (2) |
| List&lt;*PowerTransformer*&gt; | List&lt;TPowerTransformer&gt; | |
| List&lt;cim:Bay&gt; | List&lt;TBay&gt; | (2) |
| List&lt;cim:PowerTransformer&gt; | List&lt;TPowerTransformer&gt; | |

(1): The nomFreq will be set to 0 if there is a Switch connected to it of the type 'DCLineSegment'.
(2): The list of Bays that belong to the VoltageLevel.

| CIM Class | IEC Class | Remark |
| -------------------------------- | -------------------------------- | --------- |
| *cim:Bay* | *TBay* | |
| *cim:BusbarSection* | *TBay* | |
| name or id | name | |
| List&lt;cim:ConnectivityNode&gt; | List&lt;TConnectivityNode&gt; | (1) |
| List&lt;*Switches*&gt; | List&lt;TConductingEquipment&gt; | (2) |
| List&lt;*PowerTransformer*&gt; | List&lt;TPowerTransformer&gt; | |

(1): ConnectivityNode in IEC CIM can be linked to a Bay, but also to the VoltageLevel. In IEC 61850 a ConnectivityNode
can only be added to a Bay, so also the ConnectivityNode from the VoltageLevel are added to the Bay. This causes those
ConnectivityNode to be found under each Bay of that VoltageLevel.
(2): Switches in IEC CIM can be the following types, cim:Switch cim:Breaker cim:Disconnector cim:LoadBreakSwitch cim:
ProtectedSwitch.These classes are all mapped in the same way on IEC 61850
(1): The ConnectivityNodes that are linked to the BusbarSection through a Terminal of the BusbarSection.

| CIM Class | IEC Class | Remark |
| -------------------------------- | -------------------------------- | --------- |
| *cim:PowerTransformer* | *TPowerTransformer* | |
| *cim:Bay* | *TBay* | |
| name or id | name | |
| description | desc | |
| 'PTR' | type | |
| List&lt;cim:ConnectivityNode&gt; | List&lt;TConnectivityNode&gt; | (1) |
| List&lt;*Switches*&gt; | List&lt;TConductingEquipment&gt; | (2) |
| List&lt;cim:PowerTransformer&gt; | List&lt;TPowerTransformer&gt; | |

(1): The ConnectivityNodes that are linked to the Bay thought the terminals of the switches of the Bay.
(2): Switches in IEC CIM can be the following types, cim:Switch, cim:Breaker, cim:Disconnector, cim:LoadBreakSwitch and
cim:ProtectedSwitch. These classes are all mapped in the same way on IEC 61850

| CIM Class | IEC Class | Remark |
| ----------------------------------- | -------------------------------- | --------- |
| *cim:PowerTransformer* | *TPowerTransformer* | |
| name or id | name | |
| description | desc | |
| 'PTR' | type | |
| List&lt;cim:PowerTransformerEnd&gt; | List&lt;TTransformerWinding&gt; | |

| CIM Class | IEC Class | Remark |
| -------------------------------- | -------------------------------- | --------- |
| *cim:PowerTransformerEnd* | *TTransformerWinding* | |
| name or id (PowerTransformer) + | | |
| '_' + endNumber | name | |
| 'PTW' | type | |
| cim:RatioTapChanger or | | |
| cim:PhaseTapChanger | tapChanger | |
| Terminal | List&lt;TTerminal&gt; | (1) |

(1): The terminal found in IEC CIM will be added as List to IEC 61850.

| CIM Class | IEC Class | Remark |
| -------------------------------- | -------------------------------- | --------- |
| *cim:RatioTapChanger* | *TTapChanger* | |
| *cim:RatioTapChanger* or | | |
| *cim:PhaseTapChanger* | *TTapChanger* | |
| name or id | name | |
| 'LTC' | type | |
Expand Down
5 changes: 3 additions & 2 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ SPDX-License-Identifier: Apache-2.0

<properties>
<quarkus.platform.version>2.2.3.Final</quarkus.platform.version>

<quarkus.container-image.group>lfenergycompas</quarkus.container-image.group>
<quarkus.container-image.name>compas-cim-mapping</quarkus.container-image.name>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -197,8 +200,6 @@ SPDX-License-Identifier: Apache-2.0
<properties>
<!-- Properties only used for publishing a native docker image (default to Docker Hub) -->
<quarkus.container-image.build>true</quarkus.container-image.build>
<quarkus.container-image.group>lfenergycompas</quarkus.container-image.group>
<quarkus.container-image.name>compas-cim-mapping</quarkus.container-image.name>
<quarkus.container-image.push>true</quarkus.container-image.push>
<quarkus.container-image.additional-tags>latest</quarkus.container-image.additional-tags>
</properties>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SPDX-License-Identifier: Apache-2.0
<compas.core.version>0.4.0</compas.core.version>
<jakarta-cdi-api.version>2.0.2</jakarta-cdi-api.version>
<slf4j.version>1.7.32</slf4j.version>
<powsybl.version>4.3.1</powsybl.version>
<powsybl.version>4.4.0</powsybl.version>
<mapstruct.version>1.4.2.Final</mapstruct.version>

<!-- Test -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ protected abstract TVoltageLevel mapVoltageLevelToTVoltageLevel(CgmesVoltageLeve
protected void afterVoltageLevelToTVoltageLevel(CgmesVoltageLevel cgmesVoltageLevel,
@MappingTarget TVoltageLevel tVoltageLevel,
@Context CimToSclMapperContext context) {
context.getBusbarSectionsByEquipmentContainer(cgmesVoltageLevel.getId())
.stream()
.map(cgmesBusbarSection -> mapBusbarSectionBayToTBay(cgmesBusbarSection, cgmesVoltageLevel, tVoltageLevel, context))
.forEach(tBay -> tVoltageLevel.getBay().add(tBay));

context.getBaysByVoltageLevel(cgmesVoltageLevel.getId())
.stream()
.map(bay -> mapBayToTBay(bay, cgmesVoltageLevel, tVoltageLevel, context))
Expand All @@ -100,6 +105,21 @@ protected void afterVoltageLevelToTVoltageLevel(CgmesVoltageLevel cgmesVoltageLe
.forEach(tPowerTransformer -> tVoltageLevel.getPowerTransformer().add(tPowerTransformer));
}

@Mapping(target = "name", source = "nameOrId")
protected abstract TBay mapBusbarSectionBayToTBay(CgmesBusbarSection cgmesBusbarSection,
@Context CgmesVoltageLevel cgmesVoltageLevel,
@Context TVoltageLevel tVoltageLevel,
@Context CimToSclMapperContext context);

@AfterMapping
protected void afterBusbarSectionBayToTBay(CgmesBusbarSection cgmesBusbarSection,
@MappingTarget TBay tBay,
@Context CimToSclMapperContext context) {
context.getConnectivityNodeByBusbarSection(cgmesBusbarSection.getId()).stream()
.map(cn -> mapConnectivityNodeToTConnectivityNode(cn, context, false))
.forEach(tConnectivityNode -> tBay.getConnectivityNode().add(tConnectivityNode));
}

@Mapping(target = "name", source = "nameOrId")
protected abstract TBay mapBayToTBay(CgmesBay cgmesBay,
@Context CgmesVoltageLevel cgmesVoltageLevel,
Expand All @@ -109,15 +129,13 @@ protected abstract TBay mapBayToTBay(CgmesBay cgmesBay,
@AfterMapping
protected void afterBayToTBay(CgmesBay cgmesBay,
@MappingTarget TBay tBay,
@Context CgmesVoltageLevel cgmesVoltageLevel,
@Context TVoltageLevel tVoltageLevel,
@Context CimToSclMapperContext context) {
// First we will process the Connectivity Nodes, because their path names are needed in the Terminal
// of a Conduction Equipment.
var cgmesConnectivityNodes = context.getConnectivityNode(cgmesVoltageLevel.getId());
cgmesConnectivityNodes.addAll(context.getConnectivityNode(cgmesBay.getId()));
cgmesConnectivityNodes.stream()
.map(cn -> mapConnectivityNodeToTConnectivityNode(cn, context))
context.getConnectivityNodeByBay(cgmesBay.getId())
.stream()
.map(cn -> mapConnectivityNodeToTConnectivityNode(cn, context, true))
.forEach(tConnectivityNode -> tBay.getConnectivityNode().add(tConnectivityNode));

// Now we can process the Conduction Equipment with their terminals.
Expand Down Expand Up @@ -181,15 +199,19 @@ protected abstract TTapChanger mapTapChangerToTTapChanger(CgmesTapChanger tapCha

@Mapping(target = "name", source = "nameOrId")
protected abstract TConnectivityNode mapConnectivityNodeToTConnectivityNode(CgmesConnectivityNode cgmesConnectivityNode,
@Context CimToSclMapperContext context);
@Context CimToSclMapperContext context,
@Context boolean rememberConnectivityNode);

@AfterMapping
protected void afterConnectivityNodeToTConnectivityNode(CgmesConnectivityNode cgmesConnectivityNode,
@MappingTarget TConnectivityNode tConnectivityNode,
@Context CimToSclMapperContext context) {
@Context CimToSclMapperContext context,
@Context boolean rememberConnectivityNode) {
var pathName = context.createPathName();
tConnectivityNode.setPathName(pathName);
context.saveTConnectivityNode(cgmesConnectivityNode.getId(), tConnectivityNode);
if (rememberConnectivityNode) {
context.saveTConnectivityNode(cgmesConnectivityNode.getId(), tConnectivityNode);
}
}

@Mapping(target = "name", source = "nameOrId")
Expand Down
Loading

0 comments on commit 32417d5

Please sign in to comment.