diff --git a/MAPPING.md b/MAPPING.md
index 0121f02..9dfcdc4 100644
--- a/MAPPING.md
+++ b/MAPPING.md
@@ -59,7 +59,8 @@ ProtectedSwitch.These classes are all mapped in the same way on IEC 61850
| CIM Class | IEC Class | Remark |
| -------------------------------- | -------------------------------- | --------- |
| *cim:PowerTransformerEnd* | *TTransformerWinding* | |
-| name or id | name | |
+| name or id (PowerTransformer) + | | |
+| '_' + endNumber | name | |
| 'PTW' | type | |
| Terminal | List<TTerminal> | (1) |
diff --git a/README.md b/README.md
index 5f6f07e..5b1056a 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ The Mapping between IEC CIM and IEC 61850 is described in [Mapping](MAPPING.md).
You can run your application in dev mode that enables live coding using:
```shell script
-./mvnw package io.quarkus:quarkus-maven-plugin:2.0.0.Final:dev
+./mvnw package io.quarkus:quarkus-maven-plugin:2.2.3.Final:dev
```
> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.
diff --git a/app/pom.xml b/app/pom.xml
index 482fafc..be6baf7 100644
--- a/app/pom.xml
+++ b/app/pom.xml
@@ -18,7 +18,7 @@ SPDX-License-Identifier: Apache-2.0
jar
- 2.2.2.Final
+ 2.2.3.Final
diff --git a/service/src/main/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapper.java b/service/src/main/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapper.java
index 2bb7085..2eab8f8 100644
--- a/service/src/main/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapper.java
+++ b/service/src/main/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapper.java
@@ -150,7 +150,7 @@ protected void afterTransformerToTPowerTransformer(CgmesTransformer transformer,
.forEach(tTransformerWinding -> tPowerTransformer.getTransformerWinding().add(tTransformerWinding));
}
- @Mapping(target = "name", source = "nameOrId")
+ @Mapping(target = "name", source = "uniqueName")
@Mapping(target = "type", constant = "PTW")
protected abstract TTransformerWinding mapTransformerEndToTTransformerWinding(CgmesTransformerEnd transformerEnd,
@Context CimToSclMapperContext context);
diff --git a/service/src/main/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapperContext.java b/service/src/main/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapperContext.java
index c31a35e..6c2805d 100644
--- a/service/src/main/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapperContext.java
+++ b/service/src/main/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapperContext.java
@@ -30,6 +30,7 @@ public class CimToSclMapperContext {
public static final String DESCRIPTION_PROP = "description";
public static final String NOMINAL_VOLTAGE_PROP = "nominalVoltage";
public static final String TYPE_PROP = "type";
+ public static final String ENDNUMBER_PROP = "endNumber";
public static final String TERMINAL_1_PROP = "Terminal1";
public static final String TERMINAL_2_PROP = "Terminal2";
@@ -131,7 +132,8 @@ public List getTransformerEnds(String powerTransformerId) {
.map(propertyBag -> new CgmesTransformerEnd(
propertyBag.getId(TRANSFORMER_END_PROP),
propertyBag.get(NAME_PROP),
- propertyBag.getId(TERMINAL_PROP)))
+ propertyBag.getId(TERMINAL_PROP),
+ propertyBag.get(ENDNUMBER_PROP)))
.collect(Collectors.toList());
}
diff --git a/service/src/main/java/org/lfenergy/compas/cim/mapping/model/CgmesTransformerEnd.java b/service/src/main/java/org/lfenergy/compas/cim/mapping/model/CgmesTransformerEnd.java
index 33ff12f..2707e7e 100644
--- a/service/src/main/java/org/lfenergy/compas/cim/mapping/model/CgmesTransformerEnd.java
+++ b/service/src/main/java/org/lfenergy/compas/cim/mapping/model/CgmesTransformerEnd.java
@@ -5,10 +5,16 @@
public class CgmesTransformerEnd extends AbstractCgmesEntity {
private String terminalId;
+ private String endNumber;
- public CgmesTransformerEnd(String id, String name, String terminalId) {
+ public CgmesTransformerEnd(String id, String name, String terminalId, String endNumber) {
super(id, name);
this.terminalId = terminalId;
+ this.endNumber = endNumber;
+ }
+
+ public String getUniqueName() {
+ return getNameOrId() + "_" + getEndNumber();
}
public String getTerminalId() {
@@ -18,4 +24,12 @@ public String getTerminalId() {
public void setTerminalId(String terminalId) {
this.terminalId = terminalId;
}
+
+ public String getEndNumber() {
+ return endNumber;
+ }
+
+ public void setEndNumber(String endNumber) {
+ this.endNumber = endNumber;
+ }
}
diff --git a/service/src/main/java/org/lfenergy/compas/cim/mapping/service/CompasCimMappingService.java b/service/src/main/java/org/lfenergy/compas/cim/mapping/service/CompasCimMappingService.java
index c20047e..90a27e8 100644
--- a/service/src/main/java/org/lfenergy/compas/cim/mapping/service/CompasCimMappingService.java
+++ b/service/src/main/java/org/lfenergy/compas/cim/mapping/service/CompasCimMappingService.java
@@ -66,8 +66,8 @@ public SCL map(List cimData, String who) {
* @return The created SCL Model.
*/
SCL createBasicSCL(List cimData, String who) {
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssXXX");
- ObjectFactory factory = new ObjectFactory();
+ var formatter = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssXXX");
+ var factory = new ObjectFactory();
// Create the SCL and set some default values.
var scl = factory.createSCL();
@@ -76,7 +76,7 @@ SCL createBasicSCL(List cimData, String who) {
scl.setRelease((short) 4);
// Create the Header and set some default values.
- THeader header = factory.createTHeader();
+ var header = factory.createTHeader();
header.setId(UUID.randomUUID().toString());
header.setVersion(INITIAL_VERSION);
header.setRevision(INITIAL_REVISION);
@@ -91,7 +91,7 @@ SCL createBasicSCL(List cimData, String who) {
item.setWho(who);
// Add all CIM filenames that where used to create the SCL Content.
- String what = "SCL created from CIM File(s)";
+ var what = "SCL created from CIM File(s)";
if (cimData != null && !cimData.isEmpty()) {
what += ": " + cimData.stream()
.map(CimData::getName)
diff --git a/service/src/test/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapperContextTest.java b/service/src/test/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapperContextTest.java
index 2295905..1295c8f 100644
--- a/service/src/test/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapperContextTest.java
+++ b/service/src/test/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapperContextTest.java
@@ -139,12 +139,14 @@ void getTransformerEnds_WhenCalledWithKnownId_ThenPropertyBagsIsFilteredOnIdAndC
var tfeName = "Name Tfe";
var terminalId = "Known Terminal ID";
var tfId = "Known Transformer ID";
+ var endNumber = "1";
var bags = new PropertyBags();
- var bag = new PropertyBag(List.of(TRANSFORMER_END_PROP, NAME_PROP, POWER_TRANSFORMER_PROP, TERMINAL_PROP));
+ var bag = new PropertyBag(List.of(TRANSFORMER_END_PROP, NAME_PROP, POWER_TRANSFORMER_PROP, TERMINAL_PROP, ENDNUMBER_PROP));
bag.put(TRANSFORMER_END_PROP, tfeId);
bag.put(NAME_PROP, tfeName);
bag.put(POWER_TRANSFORMER_PROP, tfId);
bag.put(TERMINAL_PROP, terminalId);
+ bag.put(ENDNUMBER_PROP, endNumber);
bags.add(bag);
bag = new PropertyBag(List.of(TRANSFORMER_END_PROP, NAME_PROP, POWER_TRANSFORMER_PROP, TERMINAL_PROP));
@@ -152,6 +154,7 @@ void getTransformerEnds_WhenCalledWithKnownId_ThenPropertyBagsIsFilteredOnIdAndC
bag.put(NAME_PROP, "Other Name");
bag.put(POWER_TRANSFORMER_PROP, "Unknown Transformer ID");
bag.put(TERMINAL_PROP, "Other Terminal ID");
+ bag.put(ENDNUMBER_PROP, "2");
bags.add(bag);
when(cgmesModel.transformerEnds()).thenReturn(bags);
@@ -161,8 +164,10 @@ void getTransformerEnds_WhenCalledWithKnownId_ThenPropertyBagsIsFilteredOnIdAndC
assertEquals(1, result.size());
var ccn = result.get(0);
assertEquals(tfeId, ccn.getId());
+ assertEquals(tfeName + "_" + endNumber, ccn.getUniqueName());
assertEquals(tfeName, ccn.getName());
assertEquals(terminalId, ccn.getTerminalId());
+ assertEquals(endNumber, ccn.getEndNumber());
}
@Test
diff --git a/service/src/test/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapperTest.java b/service/src/test/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapperTest.java
index f591c1c..0365515 100644
--- a/service/src/test/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapperTest.java
+++ b/service/src/test/java/org/lfenergy/compas/cim/mapping/mapper/CimToSclMapperTest.java
@@ -127,7 +127,7 @@ private void assertPowerTransformer(TPowerTransformer powerTransformer) {
private void assertTransformerWinding(TTransformerWinding powerTransformerEnd) {
assertNotNull(powerTransformerEnd);
- assertEquals("T3", powerTransformerEnd.getName());
+ assertEquals("T3_1", powerTransformerEnd.getName());
assertEquals(TTransformerWindingEnum.PTW, powerTransformerEnd.getType());
}
@@ -241,16 +241,17 @@ void mapTransformerToTPowerTransformer_WhenCalledWithCgmesTransformer_ThenProper
@Test
void mapTransformerEndToTTransformerWinding_WhenCalledWithCgmesTransformerEnd_ThenPropertiesMappedToTTransformerWinding() {
var expectedName = "TheName";
+ var expectedEndNumber = "1";
- when(cgmesTransformerEnd.getNameOrId()).thenReturn(expectedName);
+ when(cgmesTransformerEnd.getUniqueName()).thenReturn(expectedName + "_" + expectedEndNumber);
var sclTransformerWinding = mapper.mapTransformerEndToTTransformerWinding(cgmesTransformerEnd, context);
assertNotNull(sclTransformerWinding);
- assertEquals(expectedName, sclTransformerWinding.getName());
+ assertEquals(expectedName + "_" + expectedEndNumber, sclTransformerWinding.getName());
assertEquals(TTransformerWindingEnum.PTW, sclTransformerWinding.getType());
verify(cgmesTransformerEnd, times(1)).getId();
- verify(cgmesTransformerEnd, times(1)).getNameOrId();
+ verify(cgmesTransformerEnd, times(1)).getUniqueName();
verify(cgmesTransformerEnd, times(1)).getTerminalId();
verifyNoMoreInteractions(cgmesTransformerEnd);
}