Skip to content

Commit

Permalink
Merge pull request #59 from com-pas/develop
Browse files Browse the repository at this point in the history
Develop -> Master (Release)
  • Loading branch information
Dennis Labordus authored Aug 5, 2021
2 parents 6cd85d9 + 8113b87 commit 3641696
Show file tree
Hide file tree
Showing 61 changed files with 11,358 additions and 268 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
- name: Set version with Maven
run: mvn -B versions:set -DprocessAllModules=true -DnewVersion=${{ steps.extract_tagname.outputs.tagname }}
run: ./mvnw -B versions:set -DprocessAllModules=true -DnewVersion=${{ steps.extract_tagname.outputs.tagname }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy with Maven to GitHub Packages and Docker Hub
Expand Down
75 changes: 75 additions & 0 deletions MAPPING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<!--
SPDX-FileCopyrightText: 2021 Alliander N.V.
SPDX-License-Identifier: Apache-2.0
-->

# CIM Mapping

Below is an overview of the mapping done between IEC CIM Classes and IEC 61850 Classes and their properties.
There is an IEC document describing the mapping, namely IEC/TS 62361-102, but not all details are in there.

## Mapping IEC CIM to IEC 61850

| CIM Class | IEC Class | Remark |
| -------------------------------- | -------------------------------- | --------- |
| *cim:Substation* | *TSubstation* | |
| id | name | |
| name | desc | |
| List&lt;cim:VoltageLevel&gt; | List&lt;TVoltageLevel&gt; | (1) |

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

| CIM Class | IEC Class | Remark |
| -------------------------------- | -------------------------------- | --------- |
| *cim:VoltageLevel* | *TVoltageLevel* | |
| name or id | name | |
| nominalV | voltage.value | |
| List&lt;Bay&gt; | List&lt;TBay&gt; | (1) |

(1): The list of Bays that belong to the VoltageLevel.

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

(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

| CIM Class | IEC Class | Remark |
| -------------------------------- | -------------------------------- | --------- |
| *cim:ConnectivityNode* | *TConnectivityNode | |
| name or id | name | |
| - | pathName | (1) |

(1): The path name is derived from the names of all parent of that ConnectivityNode. In the context we keep a list of
all Naming Elements we passed before coming to that ConnectivityNode. In this way we can build the PathName of that
ConnectivityNode.

| CIM Class | IEC Class | Remark |
| -------------------------------- | -------------------------------- | --------- |
| *Switches* | *TConductingEquipment | (1) |
| name or id | name | |
| type | type | (2) |
| List&lt;cim:Terminal&gt; | List&lt;TTerminal&gt; | (3) |

(1): 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
(2): The mapping between types is described in 5.6.2 of IEC/TS 62361-102.
(3): The list of Terminal that belong to the Switch.

| CIM Class | IEC Class | Remark |
| -------------------------------- | -------------------------------- | --------- |
| *cim:Terminal* | *TTerminal | |
| name or id | name | |
| - | connectivityNode | (1) |
| - | CNodeName | (1) |

(1): Use the ID of the ConnectivityNode to find the name or pathName of that ConnectivityNode. A map is saved of all
ConnectivityNode that are processed for each Bay.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ SPDX-License-Identifier: Apache-2.0

# compas-cim-mapping

## Mapping between IEC CIM and IEC 61850

The Mapping between IEC CIM and IEC 61850 is described in [Mapping](MAPPING.md).

## Running the application in dev mode

Expand Down
14 changes: 13 additions & 1 deletion app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ SPDX-License-Identifier: Apache-2.0
<dependency>
<groupId>org.lfenergy.compas.cim.mapping</groupId>
<artifactId>service</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>scl2007b4</artifactId>
</dependency>
<dependency>
<groupId>org.lfenergy.compas.core</groupId>
<artifactId>rest-commons</artifactId>
</dependency>

<dependency>
Expand All @@ -64,6 +72,10 @@ SPDX-License-Identifier: Apache-2.0
<groupId>io.quarkus</groupId>
<artifactId>quarkus-container-image-docker</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
</dependency>

<!-- Test Dependencies -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.cim.mapping.rest;

import org.lfenergy.compas.cim.mapping.mapper.CimToSclMapper;
import org.lfenergy.compas.core.commons.ElementConverter;

import javax.enterprise.inject.Produces;

/**
* Create Beans from other dependencies that are used in the application.
*/
public class CompasCimMappingConfiguration {
@Produces
public ElementConverter createElementConverter() {
return new ElementConverter();
}

@Produces
public CimToSclMapper createCimToSclMapper() {
return CimToSclMapper.INSTANCE;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.cim.mapping.rest.v1;

import org.lfenergy.compas.cim.mapping.rest.model.GetRequest;
import org.lfenergy.compas.cim.mapping.rest.model.GetResponse;
import org.lfenergy.compas.cim.mapping.rest.v1.model.MapRequest;
import org.lfenergy.compas.cim.mapping.rest.v1.model.MapResponse;
import org.lfenergy.compas.cim.mapping.service.CompasCimMappingService;

import javax.inject.Inject;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
Expand All @@ -24,12 +25,12 @@ public CompasCimMappingResource(CompasCimMappingService compasCimMappingService)
}

@POST
@Path("/message")
@Path("/map")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public GetResponse getMessage(GetRequest request) {
var response = new GetResponse();
response.setMessage(compasCimMappingService.getMessage(request.getName()));
public MapResponse mapCimToScl(@Valid MapRequest request) {
var response = new MapResponse();
response.setScl(compasCimMappingService.map(request.getCimData()));
return response;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0

package org.lfenergy.compas.cim.mapping.rest.v1.model;

import org.lfenergy.compas.cim.mapping.model.CimData;

import javax.validation.Valid;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;

import static org.lfenergy.compas.cim.mapping.CimMappingConstants.CIM_MAPPING_SERVICE_V1_NS_URI;

@XmlRootElement(name = "MapRequest", namespace = CIM_MAPPING_SERVICE_V1_NS_URI)
@XmlAccessorType(XmlAccessType.FIELD)
public class MapRequest {
@Valid
@XmlElement(name = "CimData", namespace = CIM_MAPPING_SERVICE_V1_NS_URI)
private List<CimData> cimData;

public List<CimData> getCimData() {
return cimData;
}

public void setCimData(List<CimData> cimData) {
this.cimData = cimData;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0

package org.lfenergy.compas.cim.mapping.rest.v1.model;

import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.lfenergy.compas.scl2007b4.model.SCL;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import static org.lfenergy.compas.cim.mapping.CimMappingConstants.CIM_MAPPING_SERVICE_V1_NS_URI;
import static org.lfenergy.compas.cim.mapping.CimMappingConstants.SCL_NS_URI;

@XmlRootElement(name = "MapResponse", namespace = CIM_MAPPING_SERVICE_V1_NS_URI)
@XmlAccessorType(XmlAccessType.FIELD)
public class MapResponse {
@Schema(example = "SCL XML")
@XmlElement(name = "SCL", namespace = SCL_NS_URI)
protected SCL scl;

public SCL getScl() {
return scl;
}

public void setScl(SCL scl) {
this.scl = scl;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
@XmlSchema(
xmlns = {
@XmlNs(prefix = "cms", namespaceURI = CIM_MAPPING_SERVICE_V1_NS_URI)
}
)
package org.lfenergy.compas.cim.mapping.rest.v1.model;

import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlSchema;

import static org.lfenergy.compas.cim.mapping.CimMappingConstants.CIM_MAPPING_SERVICE_V1_NS_URI;
10 changes: 10 additions & 0 deletions app/src/main/resources/ValidationMessages.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2021 Alliander N.V.
#
# SPDX-License-Identifier: Apache-2.0

javax.validation.constraints.NotNull.message = Value must not be null.
javax.validation.constraints.NotBlank.message = Value must not be blank.

org.lfenergy.compas.CimDataNamePattern.message = Invalid name used for this cim data file.
org.lfenergy.compas.XmlAnyElementValid.unexpected.message = The XML Any Element contains unexpected elements. Element Name should be '{elementName}' with namespace '{elementNamespace}'.
org.lfenergy.compas.XmlAnyElementValid.moreElements.message = There are more or less Elements found then expected (between {min} and {max}) in the XML Any Element.
11 changes: 3 additions & 8 deletions app/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@
#
# SPDX-License-Identifier: Apache-2.0

quarkus.http.cors = false
quarkus.http.root-path = /compas-cim-mapping/
quarkus.http.cors = false
quarkus.http.root-path = /compas-cim-mapping/
quarkus.http.limits.max-body-size = 150M

quarkus.log.level = INFO
quarkus.log.category."org.lfenergy.compas.cim.mapping".level = INFO

# BaseX configuration
basex.host = localhost
basex.port = 1984
basex.username = admin
basex.password = admin

# Dev Profile overrides.
%dev.quarkus.http.port = 9091
%dev.quarkus.http.cors = true
Expand Down
Loading

0 comments on commit 3641696

Please sign in to comment.