Skip to content

Mapping branches in new UCT#6

Merged
murgeyseb merged 38 commits intomainfrom
ucteMapping
Jun 16, 2025
Merged

Mapping branches in new UCT#6
murgeyseb merged 38 commits intomainfrom
ucteMapping

Conversation

@Sebasss-h
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread src/main/java/com/rte_france/trm_algorithm/UcteMapping.java Outdated
Comment thread src/main/java/com/rte_france/trm_algorithm/UcteMapping.java Outdated
Comment thread src/main/java/com/rte_france/trm_algorithm/UcteMapping.java Outdated
Comment thread src/test/java/com/rte_france/trm_algorithm/UcteMappingTest.java Outdated
Comment thread src/test/java/com/rte_france/trm_algorithm/UcteMappingTest.java Outdated
Comment thread src/test/java/com/rte_france/trm_algorithm/UcteMappingTest.java Outdated
Sebasss-h and others added 3 commits April 24, 2025 11:39
Simplified the logic for multi-line mappings by restructuring the test case to use streamlined mapping methods and improved assertions. Added clear `Given-When-Then` test structure, enhancing code readability and maintainability.
Replaced direct access to elementName with Optional to prevent potential null pointer exceptions. This ensures safer handling when retrieving and processing the property from networkMarketBased. Default values are used if elementName is absent.
Comment thread src/test/java/com/rte_france/trm_algorithm/UcteMappingTest.java Outdated
@terriervik terriervik requested review from murgeyseb and removed request for murgeyseb May 6, 2025 09:05
@terriervik
Copy link
Copy Markdown
Collaborator

@murgeyseb FYI

Copy link
Copy Markdown
Collaborator

@terriervik terriervik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, please see my comments

Comment thread src/main/java/com/rte_france/trm_algorithm/id_mapping/IdentifiableMapp.java Outdated
Comment thread src/main/java/com/rte_france/trm_algorithm/id_mapping/IdentifiableMapp.java Outdated
@@ -0,0 +1,87 @@
/*
* Copyright (c) 2024, RTE (http://www.rte-france.com)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this copyright be 2025 (same for all new classes in this PR)?

(@murgeyseb I don't know the correct policy)

Comment thread src/main/java/com/rte_france/trm_algorithm/id_mapping/MappingResults.java Outdated
Comment thread src/main/java/com/rte_france/trm_algorithm/id_mapping/UcteMapping.java Outdated
}

@Test
void testRealNetwork() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should be deleted.

}

@Test
void testNewMappingMap() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test to this method (assertSomething), or delete it.

Comment thread src/test/java/com/rte_france/trm_algorithm/id_mapping/UcteMappingTest.java Outdated
new MappingResults("FFNHV311 FFNHV211 1", "FFNHV211 FFNHV311 1", true),
new MappingResults("FFNGEN71 FFNHV111 1", "FFNGEN71 FFNHV111 1", true),
new MappingResults("FFNHV211 FFNLOA31 L", "FFNHV211 FFNLOA31 L", true));
//assertEquals(expectedMappingResults, mappingResults.mappingResults());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add an assertSomething at the end of this method, otherwise it is not a test.

* @author Sebastian Huaraca {@literal <sebastian.huaracalapa at rte-france.com>}
*/

public class UcteMappingTest {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general comment on this test class: could you please describe (in comments) what you precisely test in each method?
In particular, I am curious to see written which test method checks the following functionalities:
A/ same substation code (first 7 characters) for side 1 and for side 2 + same order code
B/ same substation code (first 7 characters) for side 1 and for side 2, both sides are inverted between the files + same order code
C/ A and B, but with different order code and same element name
D/ Line from network 1 missing in network 2
E/ Line from network 1 pointing at several elements from network 2
F/ others, if I forgot something :)

.filter(branchId -> Objects.isNull(marketBasedNetwork.getBranch(branchId)))
.sorted()
.toList();
.filter(branchId -> Objects.isNull(marketBasedNetwork.getBranch(branchId)))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this whitespaces added on lines 51 to 53 and 72 to 79

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Java indentation should be tab size 4, indent 4 and continuation indent 4
image

@Sebasss-h Sebasss-h changed the title [WIP] Mapping branches in new UCT Mapping branches in new UCT Jun 5, 2025
Comment thread src/main/java/com/rte_france/trm_algorithm/id_mapping/UcteMapper.java Outdated
}
}

private static String getOrderCode(String id) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happen if the id does not respect UCTE formet (e.g. modified network using script, or CGMES based network). Fail ?

Comment thread src/test/java/com/rte_france/trm_algorithm/id_mapping/UcteMapperTest.java Outdated
Comment thread src/main/java/com/rte_france/trm_algorithm/id_mapping/UcteMapper.java Outdated
Comment thread src/test/java/com/rte_france/trm_algorithm/id_mapping/UcteMapperTest.java Outdated
Copy link
Copy Markdown
Collaborator

@OpenSuze OpenSuze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some documentation in doc/algorithm.md ?

Comment thread pom.xml
<groupId>com.powsybl</groupId>
<artifactId>open-rao-crac-io-commons</artifactId>
<version>${powsybl.rao.version}</version>
<scope>test</scope>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the default scope and move this dependency into its section (in alphabetical order: line 83 I think) ?

.filter(branchId -> Objects.isNull(marketBasedNetwork.getBranch(branchId)))
.sorted()
.toList();
.filter(branchId -> Objects.isNull(marketBasedNetwork.getBranch(branchId)))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Java indentation should be tab size 4, indent 4 and continuation indent 4
image

Comment thread src/main/java/com/rte_france/trm_algorithm/id_mapping/IdentifiableMapping.java Outdated
Comment thread src/main/java/com/rte_france/trm_algorithm/id_mapping/IdentifiableMapping.java Outdated
Comment thread src/main/java/com/rte_france/trm_algorithm/id_mapping/IdentifiableMapping.java Outdated
Comment thread src/main/java/com/rte_france/trm_algorithm/id_mapping/IdentifiableMapping.java Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File not used in tests ? Add a test or remove this file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a test file in the ressources ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this image in the test documentation

Comment thread src/main/java/com/rte_france/trm_algorithm/TrmAlgorithm.java
Sebasss-h and others added 3 commits June 13, 2025 16:19
Removed unnecessary blank line for cleaner code. Adjusted indentation in lambda function for better readability and consistency.
Removed unnecessary blank line for cleaner code. Adjusted indentation in lambda function for better readability and consistency.
@murgeyseb murgeyseb merged commit a0c8002 into main Jun 16, 2025
1 check passed
@murgeyseb murgeyseb deleted the ucteMapping branch June 16, 2025 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants