Skip to content

Upgrade to powsybl-dependencies v2025.0.0 #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

EstherDarkish
Copy link
Contributor

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • A PR or issue has been opened in all impacted repositories (if any)

Does this PR already have an issue describing the problem?

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

If yes, please check if the following requirements are fulfilled

  • The Breaking Change or Deprecated label has been added
  • The migration steps are described in the following section

What changes might users need to make in their application due to this PR? (migration steps)

Other information:

@Mathieu-Deharbe Mathieu-Deharbe self-requested a review April 18, 2025 07:14
@etiennehomer etiennehomer self-requested a review April 18, 2025 07:20
Signed-off-by: Etienne LESOT <[email protected]>
}

@Override
public void removeArea() {
Copy link
Contributor

Choose a reason for hiding this comment

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

this one pass now


@Override
public void throwRemovedVoltageLevel() {
// removed equipments is managed differently in powsybl core implementation
Copy link
Contributor

Choose a reason for hiding this comment

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

this one pass now

}

@Override
public void testGetAreaBoundary() {
Copy link
Contributor

Choose a reason for hiding this comment

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

this one pass now

}

@Override
public void testSetterGetterInMultiVariants() {
Copy link
Contributor

Choose a reason for hiding this comment

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

this one pass now


@Override
public void throwAddVoltageLevelOtherNetwork() {
// problem
Copy link
Contributor

Choose a reason for hiding this comment

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

// creation of subnetwork needed

@@ -684,7 +684,7 @@ void testSubstationUpdate() {

verify(mockedListener, times(1)).onUpdate(s, "country", INITIAL_VARIANT_ID, Country.FR, Country.BB);
verify(mockedListener, times(1)).onUpdate(s, "tso", INITIAL_VARIANT_ID, null, "New TSO");
verify(mockedListener, times(1)).onPropertyAdded(s, "geographicalTags", "paris");
// verify(mockedListener, times(1)).onPropertyAdded(s, "geographicalTags", "paris");
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not working anymore

Copy link
Contributor

Choose a reason for hiding this comment

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

To remove if it's the right thing to do

@@ -736,7 +736,7 @@ void substationTest() {

verify(mockedListener, times(1)).onUpdate(s1, "country", INITIAL_VARIANT_ID, Country.FR, Country.BE);
verify(mockedListener, times(1)).onUpdate(s1, "tso", INITIAL_VARIANT_ID, "TSO_FR", "TSO_BE");
verify(mockedListener, times(1)).onPropertyAdded(s1, "geographicalTags", "BELGIUM");
// verify(mockedListener, times(1)).onPropertyAdded(s1, "geographicalTags", "BELGIUM");
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not working anymore

Copy link
Contributor

Choose a reason for hiding this comment

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

To remove if it's the right thing to do

@@ -0,0 +1,62 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.1.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd" logicalFilePath="db/changelog/changesets/changelog_2022-09-26T06:45:00Z.xml">
<changeSet author="lesoteti" id="1664174319767-1">
Copy link
Contributor

@etiennehomer etiennehomer Apr 23, 2025

Choose a reason for hiding this comment

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

You don't delete column cgmescontrolareas ?
You want to do it later ?

Copy link
Contributor

@Mathieu-Deharbe Mathieu-Deharbe Apr 23, 2025

Choose a reason for hiding this comment

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

Same question but frankly I am happy to have it in order to check the migration etc.

<column name="areaid"/>
</createIndex>
</changeSet>
<changeSet id="lesoteti" author="1664174319767-4">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<changeSet id="lesoteti" author="1664174319767-4">
<changeSet id="1664174319767-4" author="lesoteti">

</createIndex>
</changeSet>
<changeSet id="lesoteti" author="1664174319767-4">
<addColumn tableName="battery">
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the old style for extensions storage. Should be in extension table. But that way, it's homogeneous with GeneratorShortcircuit...

@PostMapping(value = "/{networkId}/areas")
@Operation(summary = "Create areas")
@ApiResponses(@ApiResponse(responseCode = "201", description = "Successfully create areas"))
public ResponseEntity<Void> createAreas(@Parameter(description = "Network ID", required = true) @PathVariable("networkId") UUID networkId,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't get the area and areaboundary tables filled when I create a study from a cgmes case

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for me. I only have what has been migrated to those tables. I am going to test more precisely to be sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't deploy well the code. Ok now I have the data in area and areaboundary tables

Copy link
Contributor

Choose a reason for hiding this comment

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

I confirm the data missing but it seems to be a dependency missing somewhere. I give up.

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
Copy link
Contributor

Choose a reason for hiding this comment

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

You should get this version from powsybl-ws-dependencies. I think you won't need it when you gonna clean the PR and remove <powsybl-dependencies.version>2025.0.0</powsybl-dependencies.version>

@@ -0,0 +1,40 @@
-- set area
INSERT INTO area(networkuuid, variantnum, id, name, areatype, voltagelevelids, interchangetarget, fictitious,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should only be migrated for variantnum=0 ?
For exemple for a study we created with the root node and the first and that we migrated, we want areas and areaboundaries only in variantnum=0 I think

Copy link
Contributor

@Mathieu-Deharbe Mathieu-Deharbe left a comment

Choose a reason for hiding this comment

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

I got the following error when testing short circuit analysis :

java.lang.NoClassDefFoundError: com/powsybl/iidm/network/extensions/ShortCircuitExtension
at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na]
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027) ~[na:na]
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) ~[na:na]
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862) ~[na:na]
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760) ~[na:na]
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681) ~[na:na]
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[na:na]
at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na]
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027) ~[na:na]
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) ~[na:na]
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862) ~[na:na]
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760) ~[na:na]
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681) ~[na:na]
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[na:na]
at com.powsybl.network.store.iidm.impl.GeneratorImpl.createGeneratorShortCircuitExtension(GeneratorImpl.java:264) ~[powsybl-network-store-iidm-impl-1.25.0-SNAPSHOT.jar:na]
at com.powsybl.network.store.iidm.impl.GeneratorImpl.getExtension(GeneratorImpl.java:289) ~[powsybl-network-store-iidm-impl-1.25.0-SNAPSHOT.jar:na]

In this code :

private <E extends Extension<Generator>> E createGeneratorShortCircuitExtension() {
        E extension = null;
        var resource = getResource();
        ShortCircuitAttributes attributes = resource.getAttributes().getGeneratorShortCircuitAttributes();
        if (attributes != null) {
            extension = (E) new GeneratorShortCircuitImpl((GeneratorImpl) getInjection());
        }
        return extension;
    }

But I had so many problems because of dependecy errors that I am not sure of anything. Just make sure that Charly tests short circuit analysis when he does the final merge.

@etiennehomer
Copy link
Contributor

I got the following error when testing short circuit analysis :

java.lang.NoClassDefFoundError: com/powsybl/iidm/network/extensions/ShortCircuitExtension at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na] at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027) ~[na:na] at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) ~[na:na] at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862) ~[na:na] at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760) ~[na:na] at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681) ~[na:na] at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) ~[na:na] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[na:na] at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na] at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027) ~[na:na] at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) ~[na:na] at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862) ~[na:na] at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760) ~[na:na] at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681) ~[na:na] at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) ~[na:na] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[na:na] at com.powsybl.network.store.iidm.impl.GeneratorImpl.createGeneratorShortCircuitExtension(GeneratorImpl.java:264) ~[powsybl-network-store-iidm-impl-1.25.0-SNAPSHOT.jar:na] at com.powsybl.network.store.iidm.impl.GeneratorImpl.getExtension(GeneratorImpl.java:289) ~[powsybl-network-store-iidm-impl-1.25.0-SNAPSHOT.jar:na]

In this code :

private <E extends Extension<Generator>> E createGeneratorShortCircuitExtension() {
        E extension = null;
        var resource = getResource();
        ShortCircuitAttributes attributes = resource.getAttributes().getGeneratorShortCircuitAttributes();
        if (attributes != null) {
            extension = (E) new GeneratorShortCircuitImpl((GeneratorImpl) getInjection());
        }
        return extension;
    }

But I had so many problems because of dependecy errors that I am not sure of anything. Just make sure that Charly tests short circuit analysis when he does the final merge.

Yes it's not so easy to test the whole chain. I could import a PF with success and check the battery short circuit extension in the database. I also ran a shortcircuit computation and the batteries were taken in account in the computation !

Copy link
Contributor

@Mathieu-Deharbe Mathieu-Deharbe left a comment

Choose a reason for hiding this comment

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

I didn't manage to test the conversion server because of dependencies problems. Therefore I was missing area data when creating a study from a cgmes case.

Just like short circuit computation, it should be tested again during the final merge.

Otherwise, test and code ok for me.

Comment on lines +1066 to +1067
Area cgmesControlAreas = network.getArea("ca1");
assertNull(cgmesControlAreas);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Area cgmesControlAreas = network.getArea("ca1");
assertNull(cgmesControlAreas);
Area cgmesControlArea = network.getArea("ca1");
assertNull(cgmesControlArea);

Comment on lines +457 to +459
public TableMapping getAreaMappings() {
return areaMappings;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

All those get functions could be replaced with a single @Getter at the beginning of this class.

@Operation(summary = "Create areas")
@ApiResponses(@ApiResponse(responseCode = "201", description = "Successfully create areas"))
public ResponseEntity<Void> createAreas(@Parameter(description = "Network ID", required = true) @PathVariable("networkId") UUID networkId,
@Parameter(description = "Tie line resources", required = true) @RequestBody List<Resource<AreaAttributes>> areaResources) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@Parameter(description = "Tie line resources", required = true) @RequestBody List<Resource<AreaAttributes>> areaResources) {
@Parameter(description = "Area resources", required = true) @RequestBody List<Resource<AreaAttributes>> areaResources) {


@GetMapping(value = "/{networkId}/{variantNum}/areas", produces = APPLICATION_JSON_VALUE)
@Operation(summary = "Get areas")
@ApiResponses(@ApiResponse(responseCode = "200", description = "Successfully get tie line list"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@ApiResponses(@ApiResponse(responseCode = "200", description = "Successfully get tie line list"))
@ApiResponses(@ApiResponse(responseCode = "200", description = "Successfully get area list"))

@ApiResponses(@ApiResponse(responseCode = "200", description = "Successfully get tie line list"))
public ResponseEntity<TopLevelDocument<AreaAttributes>> getAreas(@Parameter(description = "Network ID", required = true) @PathVariable("networkId") UUID networkId,
@Parameter(description = "Variant number", required = true) @PathVariable("variantNum") int variantNum,
@Parameter(description = "Max number of tie lines to get") @RequestParam(required = false) Integer limit) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@Parameter(description = "Max number of tie lines to get") @RequestParam(required = false) Integer limit) {
@Parameter(description = "Max number of area to get") @RequestParam(required = false) Integer limit) {

Comment on lines +599 to +608
String baseQuiery = "select " + AREA_ID_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " +
"boundarydanglinglineid, terminalconnectableid, terminalside, ac " +
"from AreaBoundary where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? ";
if (columnNameForWhereClause != null) {
baseQuiery += " and " + columnNameForWhereClause + " = ?";
}
return baseQuiery;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
String baseQuiery = "select " + AREA_ID_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " +
"boundarydanglinglineid, terminalconnectableid, terminalside, ac " +
"from AreaBoundary where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? ";
if (columnNameForWhereClause != null) {
baseQuiery += " and " + columnNameForWhereClause + " = ?";
}
return baseQuiery;
String baseQuery = "select " + AREA_ID_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " +
"boundarydanglinglineid, terminalconnectableid, terminalside, ac " +
"from AreaBoundary where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? ";
if (columnNameForWhereClause != null) {
baseQuery += " and " + columnNameForWhereClause + " = ?";
}
return baseQuery;

return "insert into AreaBoundary(" + AREA_ID_COLUMN + ", " + NETWORK_UUID_COLUMN + ", "
+ VARIANT_NUM_COLUMN + ", boundarydanglinglineid, terminalconnectableid, terminalside, ac) select " +
AREA_ID_COLUMN +
", ?, ?, boundarydanglinglineid, terminalconnectableid, terminalside, ac from AreaBoundary where " + NETWORK_UUID_COLUMN +
Copy link
Contributor

Choose a reason for hiding this comment

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

Table names in this file seem to have usually their first letter in lower case. But I guess it is not important given that in the end they all end in complete lower case in the database...

updateAreaBoundaries(networkUuid, resources);
}

public void updateAreaBoundaries(UUID networkUuid, List<Resource<AreaAttributes>> resources) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this to the area boundaries functions.

}
}

public Map<OwnerInfo, List<AreaBoundaryAttributes>> getAreaBoundaries(UUID networkUuid, int variantNum, String columnNameForWhereClause, String valueForWhereClause) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is used everywhere and kind of too late but I think it would have been cleaner to have a small structure which would be a pair of data to handle those where criteria. Only one parameter instead of 2, and it is null or both members (column and values list) have to be not null.

Comment on lines +3735 to +3737
protected void insertAreaBoundariesInAreas(UUID networkUuid, List<Resource<AreaAttributes>> areas, Map<OwnerInfo, List<AreaBoundaryAttributes>> areaBoundries) {

if (!areaBoundries.isEmpty() && !areas.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
protected void insertAreaBoundariesInAreas(UUID networkUuid, List<Resource<AreaAttributes>> areas, Map<OwnerInfo, List<AreaBoundaryAttributes>> areaBoundries) {
if (!areaBoundries.isEmpty() && !areas.isEmpty()) {
protected void insertAreaBoundariesInAreas(UUID networkUuid, List<Resource<AreaAttributes>> areas, Map<OwnerInfo, List<AreaBoundaryAttributes>> areaBoundaries) {
if (!areaBoundaries.isEmpty() && !areas.isEmpty()) {

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