Skip to content
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

upgrade powsybl network store v1.22.0 and add regulating point for ratio and phase tap changers #84

Merged
merged 47 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0aa2200
move regulating from regulating equipment to regulatingPoint
EtienneLt Dec 4, 2024
6a21a2b
review and fix
EtienneLt Dec 9, 2024
74a1430
Merge branch 'main' into move-boolean-regulating-from-equipment-to-re…
EtienneLt Dec 9, 2024
548cd0e
fix changelog
EtienneLt Dec 10, 2024
47ee001
fix sql migration
EtienneLt Dec 10, 2024
405bb5f
fix
EtienneLt Dec 10, 2024
58d0535
add regulating point for ratio and phase tap changers
EtienneLt Nov 27, 2024
2609208
add test for three winding transformer
EtienneLt Nov 27, 2024
efe2df9
fix
EtienneLt Dec 6, 2024
acca310
fix and refactor
EtienneLt Dec 11, 2024
fe9ecfb
fix
EtienneLt Dec 12, 2024
a29c5ce
Optimize deleting equipment list
Dec 18, 2024
43d1b1b
Merge branch 'main' into delete_equipment_list
Dec 18, 2024
0567ddd
upgrade to powsybl dependencies 2024.4.0
FranckLecuyer Dec 18, 2024
0e0e536
fix checkstyle
Dec 18, 2024
aa88bf6
add APIs
Dec 22, 2024
618caf6
Add tests
Dec 22, 2024
6264d16
fix
Dec 22, 2024
d1b33df
upgrade to powsybl ws dependencies 2.17.0
FranckLecuyer Dec 23, 2024
0687090
add tests
Dec 23, 2024
00399ff
review fix
Dec 24, 2024
a5d3055
code clean up
Dec 26, 2024
753066a
review code
Dec 26, 2024
7efe1cc
fx
Dec 26, 2024
f93e604
fix
Dec 26, 2024
d6dc17d
remove code
Dec 26, 2024
feced26
review fix
Dec 26, 2024
158c43a
fix and review
EtienneLt Jan 6, 2025
2c1ac74
Changes after changes in network-store-client
FranckLecuyer Jan 9, 2025
7ee294c
dependency management order
EtienneLt Jan 9, 2025
b311477
change NO_TAP_CHANGER to NONE enum
EtienneLt Jan 9, 2025
04cf0ee
Add commits from PR : https://github.com/powsybl/powsybl-network-stor…
Dec 26, 2024
d01571f
Merge branch 'main' into add-regulating-point-for-transformers
EtienneLt Jan 10, 2025
9c054f3
Merge remote-tracking branch 'origin/delete_equipment_list' into add-…
EtienneLt Jan 10, 2025
93e9e4c
fix
EtienneLt Jan 10, 2025
cad773c
Merge remote-tracking branch 'origin/upgrade_to_powsybl_dependencies_…
EtienneLt Jan 10, 2025
f740294
fix tests
EtienneLt Jan 10, 2025
996f65d
Merge branch 'main' into add-regulating-point-for-transformers
EtienneLt Jan 16, 2025
8c9f00d
adapt to changing list to set for regulating equipments
EtienneLt Jan 17, 2025
d722c79
harmonize twt attributes
EtienneLt Jan 17, 2025
a5cc7c2
renamme methods
EtienneLt Jan 21, 2025
c453146
fix getRegulatingEquipments for three windings transformers
EtienneLt Jan 23, 2025
136d038
Merge branch 'main' into add-regulating-point-for-transformers
EtienneLt Jan 29, 2025
7407f1d
Merge branch 'main' into add-regulating-point-for-transformers
EtienneLt Jan 30, 2025
5c9826f
upgrade powsybl ws dependencies to v2.18.0
EtienneLt Feb 5, 2025
bbf017e
Merge branch 'main' into add-regulating-point-for-transformers
EtienneLt Feb 5, 2025
127ce17
fix test broken when upgrading network-store-version
EtienneLt Feb 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public final class QueryCatalog {
static final String EQUIPMENT_TYPE_COLUMN = "equipmentType";
static final String REGULATING_EQUIPMENT_TYPE_COLUMN = "regulatingEquipmentType";
static final String REGULATED_EQUIPMENT_TYPE_COLUMN = "regulatedEquipmentType";
static final String REGULATING_EQUIPMENT_SUB_TYPE_COLUMN = "regulatingResourceSubType";
EtienneLt marked this conversation as resolved.
Show resolved Hide resolved
static final String EQUIPMENT_ID_COLUMN = "equipmentId";
static final String REGULATING_EQUIPMENT_ID = "regulatingEquipmentId";
static final String INDEX_COLUMN = "index";
Expand All @@ -46,6 +47,7 @@ public final class QueryCatalog {
static final String REGULATION_MODE = "regulationMode";
static final String SIDE_COLUMN = "side";
static final String LIMIT_TYPE_COLUMN = "limitType";
static final String REGULATING = "regulating";

private QueryCatalog() {
}
Expand Down Expand Up @@ -496,16 +498,19 @@ public static String buildDeleteReactiveCapabilityCurvePointsQuery() {
public static String buildInsertRegulatingPointsQuery() {
return "insert into " + REGULATING_POINT_TABLE + " (" +
NETWORK_UUID_COLUMN + " ," + VARIANT_NUM_COLUMN + ", " + REGULATING_EQUIPMENT_ID + ", " + REGULATING_EQUIPMENT_TYPE_COLUMN + ", " +
REGULATION_MODE + ", localTerminalConnectableId, localTerminalSide, regulatingterminalconnectableid, regulatingterminalside, " + REGULATED_EQUIPMENT_TYPE_COLUMN + ")" +
" values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
REGULATING_EQUIPMENT_SUB_TYPE_COLUMN + ", " + REGULATION_MODE +
", localTerminalConnectableId, localTerminalSide, regulatingterminalconnectableid, regulatingterminalside, " +
REGULATED_EQUIPMENT_TYPE_COLUMN + ", " + REGULATING + ")" +
" values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
}

public static String buildUpdateRegulatingPointsQuery() {
return "Update " + REGULATING_POINT_TABLE +
" set " + REGULATION_MODE + " = ?, " +
"regulatingterminalconnectableid = ?, " +
"regulatingterminalside = ?, " +
REGULATED_EQUIPMENT_TYPE_COLUMN + " = ? " +
REGULATED_EQUIPMENT_TYPE_COLUMN + " = ?, " +
REGULATING + " = ? " +
"where " +
NETWORK_UUID_COLUMN + " = ? AND " +
VARIANT_NUM_COLUMN + " = ? AND " +
Expand All @@ -515,21 +520,21 @@ public static String buildUpdateRegulatingPointsQuery() {

public static String buildCloneRegulatingPointsQuery() {
return "insert into " + REGULATING_POINT_TABLE + " (" + NETWORK_UUID_COLUMN + " ," + VARIANT_NUM_COLUMN + ", " +
REGULATING_EQUIPMENT_ID + ", " + REGULATING_EQUIPMENT_TYPE_COLUMN + ", " + REGULATION_MODE +
REGULATING_EQUIPMENT_ID + ", " + REGULATING_EQUIPMENT_TYPE_COLUMN + ", " + REGULATING_EQUIPMENT_SUB_TYPE_COLUMN + ", " + REGULATION_MODE +
", localTerminalConnectableId, localTerminalSide, regulatingTerminalConnectableId, regulatingTerminalSide, " +
REGULATED_EQUIPMENT_TYPE_COLUMN + ") select ?, ?" + ", " + REGULATING_EQUIPMENT_ID + ", " +
REGULATING_EQUIPMENT_TYPE_COLUMN + ", " + REGULATION_MODE +
REGULATED_EQUIPMENT_TYPE_COLUMN + ", " + REGULATING + ") select ?, ?" + ", " + REGULATING_EQUIPMENT_ID + ", " +
REGULATING_EQUIPMENT_TYPE_COLUMN + ", " + REGULATING_EQUIPMENT_SUB_TYPE_COLUMN + ", " + REGULATION_MODE +
", localTerminalConnectableId, localTerminalSide, regulatingTerminalConnectableId, regulatingTerminalSide, "
+ REGULATED_EQUIPMENT_TYPE_COLUMN + " from " + REGULATING_POINT_TABLE + " where " + NETWORK_UUID_COLUMN +
+ REGULATED_EQUIPMENT_TYPE_COLUMN + ", " + REGULATING + " from " + REGULATING_POINT_TABLE + " where " + NETWORK_UUID_COLUMN +
" = ? and " + VARIANT_NUM_COLUMN + " = ?";
}

public static String buildRegulatingPointsQuery() {
return "select " +
NETWORK_UUID_COLUMN + ", " +
VARIANT_NUM_COLUMN + ", " +
REGULATING_EQUIPMENT_ID + ", " + REGULATION_MODE + ", localterminalconnectableid, localterminalside, " +
"regulatingterminalconnectableid, regulatingterminalside, " + REGULATED_EQUIPMENT_TYPE_COLUMN +
REGULATING_EQUIPMENT_ID + ", " + REGULATING_EQUIPMENT_SUB_TYPE_COLUMN + ", " + REGULATION_MODE + ", localterminalconnectableid, localterminalside, " +
"regulatingterminalconnectableid, regulatingterminalside, " + REGULATING +
" from " + REGULATING_POINT_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " +
Expand All @@ -542,8 +547,8 @@ public static String buildRegulatingPointsWithInClauseQuery(String columnNameFor
}
return "select " + NETWORK_UUID_COLUMN + ", " +
VARIANT_NUM_COLUMN + ", " +
REGULATING_EQUIPMENT_ID + ", " + REGULATION_MODE + ", localterminalconnectableid, localterminalside, " +
"regulatingterminalconnectableid, regulatingterminalside, " + REGULATED_EQUIPMENT_TYPE_COLUMN
REGULATING_EQUIPMENT_ID + ", " + REGULATING_EQUIPMENT_SUB_TYPE_COLUMN + ", " + REGULATION_MODE + ", localterminalconnectableid, localterminalside, " +
"regulatingterminalconnectableid, regulatingterminalside, " + REGULATING
+ " from " + REGULATING_POINT_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " +
Expand Down Expand Up @@ -575,21 +580,18 @@ public static String buildDeleteRegulatingPointsVariantEquipmentINQuery(int numb
"?, ".repeat(numberOfValues - 1) + "?)";
}

// regulating equipments
public static String buildRegulatingEquipmentsQuery() {
return "select " + NETWORK_UUID_COLUMN + ", " + VARIANT_NUM_COLUMN + ", " + REGULATING_EQUIPMENT_ID + ", "
+ "regulatingterminalconnectableid," + REGULATING_EQUIPMENT_TYPE_COLUMN + " from " + REGULATING_POINT_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " +
REGULATED_EQUIPMENT_TYPE_COLUMN + " = ?";
+ "regulatingterminalconnectableid," + REGULATING_EQUIPMENT_TYPE_COLUMN + ", " + REGULATING_EQUIPMENT_SUB_TYPE_COLUMN
+ " from " + REGULATING_POINT_TABLE + " where " + NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " + REGULATED_EQUIPMENT_TYPE_COLUMN + " = ?";
}

public static String buildRegulatingEquipmentsForOneEquipmentQuery() {
return "select " + REGULATING_EQUIPMENT_ID + ", " + REGULATING_EQUIPMENT_TYPE_COLUMN
+ " from " + REGULATING_POINT_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " +
REGULATED_EQUIPMENT_TYPE_COLUMN + " = ? and " +
"regulatingterminalconnectableid = ?";
return "select " + REGULATING_EQUIPMENT_ID + ", " + REGULATING_EQUIPMENT_TYPE_COLUMN + ", " + REGULATING_EQUIPMENT_SUB_TYPE_COLUMN
+ " from " + REGULATING_POINT_TABLE + " where " + NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " + REGULATED_EQUIPMENT_TYPE_COLUMN + " = ? and " + "regulatingterminalconnectableid = ?";
}

public static String buildRegulatingEquipmentsWithInClauseQuery(String columnNameForInClause, int numberOfValues) {
Expand All @@ -598,7 +600,8 @@ public static String buildRegulatingEquipmentsWithInClauseQuery(String columnNam
}

return "select " + NETWORK_UUID_COLUMN + ", " + VARIANT_NUM_COLUMN + ", " + REGULATING_EQUIPMENT_ID + ", "
+ "regulatingterminalconnectableid," + REGULATING_EQUIPMENT_TYPE_COLUMN + " from " + REGULATING_POINT_TABLE + " where " +
+ "regulatingterminalconnectableid," + REGULATING_EQUIPMENT_TYPE_COLUMN + ", " + REGULATING_EQUIPMENT_SUB_TYPE_COLUMN
+ " from " + REGULATING_POINT_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " +
REGULATED_EQUIPMENT_TYPE_COLUMN + " = ? and " +
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright (c) 2024, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.powsybl.network.store.server.dto;

import com.powsybl.network.store.model.RegulatingTapChangerType;
import com.powsybl.network.store.model.ResourceType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.UUID;

/**
* @author Etienne Lesot <etienne.lesot at rte-france.com>
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RegulatingOwnerInfo {
EtienneLt marked this conversation as resolved.
Show resolved Hide resolved
private String equipmentId;

private ResourceType equipmentType;

private RegulatingTapChangerType equipmentSubType;
EtienneLt marked this conversation as resolved.
Show resolved Hide resolved

private UUID networkUuid;

private int variantNum;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<changeSet id="2986331049275-6" author="lesoteti">
<addColumn tableName="regulatingpoint">
<column name="regulating" type="boolean"/>
</addColumn>
<sqlFile
path="move_regulating_to_regulationPoint_20241204T110000Z.sql"
relativeToChangelogFile="true"
splitStatements="true"
stripComments="true"/>
<dropColumn tableName="generator" columnName="voltageregulatoron"/>
<dropColumn tableName="vscconverterstation" columnName="voltageregulatoron"/>
<dropColumn tableName="shuntcompensator" columnName="voltageregulatoron"/>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<changeSet id="2986331049275-7" author="admin">
EtienneLt marked this conversation as resolved.
Show resolved Hide resolved
<addColumn tableName="regulatingpoint">
<column name="regulatingresourcesubtype" type="VARCHAR" defaultValue="''">
EtienneLt marked this conversation as resolved.
Show resolved Hide resolved
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
<changeSet id="2986331049275-8" author="admin">
<dropPrimaryKey tableName="regulatingpoint"/>
<addPrimaryKey columnNames="networkuuid, variantnum, regulatingequipmenttype, regulatingresourcesubtype, regulatingequipmentid"
constraintName="regulatingpoint_pkey" tableName="regulatingpoint"/>
<sqlFile
path="twt_regulationPoint_20241205T110000Z.sql"
relativeToChangelogFile="true"
splitStatements="true"
stripComments="true"/>
<!-- twowindingstransformer -->
<!-- ratio -->
<dropColumn tableName="twowindingstransformer" columnName="ratiotapchangerregulationmode"/>
<dropColumn tableName="twowindingstransformer" columnName="ratiotapchangerterminalrefconnectableid"/>
<dropColumn tableName="twowindingstransformer" columnName="ratiotapchangerterminalrefside"/>
<dropColumn tableName="twowindingstransformer" columnName="ratiotapchangerregulating"/>
<!-- phase -->
<dropColumn tableName="twowindingstransformer" columnName="phasetapchangerregulationmode"/>
<dropColumn tableName="twowindingstransformer" columnName="phasetapchangerterminalrefconnectableid"/>
<dropColumn tableName="twowindingstransformer" columnName="phasetapchangerterminalrefside"/>
<dropColumn tableName="twowindingstransformer" columnName="phasetapchangerregulating"/>

<!-- threewindingstransformer -->
<!-- side 1 -->
<!-- ratio -->
<dropColumn tableName="threewindingstransformer" columnName="ratiotapchangerregulationmode1"/>
<dropColumn tableName="threewindingstransformer" columnName="ratiotapchangerterminalrefconnectableid1"/>
<dropColumn tableName="threewindingstransformer" columnName="ratiotapchangerterminalrefside1"/>
<dropColumn tableName="threewindingstransformer" columnName="ratiotapchangerregulating1"/>
<!-- phase -->
<dropColumn tableName="threewindingstransformer" columnName="phasetapchangerregulationmode1"/>
<dropColumn tableName="threewindingstransformer" columnName="phasetapchangerterminalrefconnectableid1"/>
<dropColumn tableName="threewindingstransformer" columnName="phasetapchangerterminalrefside1"/>
<dropColumn tableName="threewindingstransformer" columnName="phasetapchangerregulating1"/>

<!-- side 2 -->
<!-- ratio -->
<dropColumn tableName="threewindingstransformer" columnName="ratiotapchangerregulationmode2"/>
<dropColumn tableName="threewindingstransformer" columnName="ratiotapchangerterminalrefconnectableid2"/>
<dropColumn tableName="threewindingstransformer" columnName="ratiotapchangerterminalrefside2"/>
<dropColumn tableName="threewindingstransformer" columnName="ratiotapchangerregulating2"/>
<!-- phase -->
<dropColumn tableName="threewindingstransformer" columnName="phasetapchangerregulationmode2"/>
<dropColumn tableName="threewindingstransformer" columnName="phasetapchangerterminalrefconnectableid2"/>
<dropColumn tableName="threewindingstransformer" columnName="phasetapchangerterminalrefside2"/>
<dropColumn tableName="threewindingstransformer" columnName="phasetapchangerregulating2"/>

<!-- side 3 -->
<!-- ratio -->
<dropColumn tableName="threewindingstransformer" columnName="ratiotapchangerregulationmode3"/>
<dropColumn tableName="threewindingstransformer" columnName="ratiotapchangerterminalrefconnectableid3"/>
<dropColumn tableName="threewindingstransformer" columnName="ratiotapchangerterminalrefside3"/>
<dropColumn tableName="threewindingstransformer" columnName="ratiotapchangerregulating3"/>
<!-- phase -->
<dropColumn tableName="threewindingstransformer" columnName="phasetapchangerregulationmode3"/>
<dropColumn tableName="threewindingstransformer" columnName="phasetapchangerterminalrefconnectableid3"/>
<dropColumn tableName="threewindingstransformer" columnName="phasetapchangerterminalrefside3"/>
<dropColumn tableName="threewindingstransformer" columnName="phasetapchangerregulating3"/>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-- generator
update regulatingpoint
set regulating = (select generator.voltageregulatoron from generator
where regulatingpoint.regulatingequipmenttype = 'GENERATOR'
and regulatingpoint.regulatingequipmentid = generator.id
and regulatingpoint.networkuuid = generator.networkuuid
and regulatingpoint.variantnum = generator.variantnum)
where regulatingequipmenttype = 'GENERATOR';
-- vsc

update regulatingpoint
set regulating = (select vscconverterstation.voltageregulatoron from vscconverterstation
where regulatingpoint.regulatingequipmenttype = 'VSC_CONVERTER_STATION'
and regulatingpoint.regulatingequipmentid = vscconverterstation.id
and regulatingpoint.networkuuid = vscconverterstation.networkuuid
and regulatingpoint.variantnum = vscconverterstation.variantnum)
where regulatingequipmenttype = 'VSC_CONVERTER_STATION';
-- shunt
update regulatingpoint
set regulating = (select shuntcompensator.voltageregulatoron from shuntcompensator
where regulatingpoint.regulatingequipmenttype = 'SHUNT_COMPENSATOR'
and regulatingpoint.regulatingequipmentid = shuntcompensator.id
and regulatingpoint.networkuuid = shuntcompensator.networkuuid
and regulatingpoint.variantnum = shuntcompensator.variantnum)
where regulatingequipmenttype = 'SHUNT_COMPENSATOR';
-- svc
update regulatingpoint
set regulating = (CASE WHEN regulationmode = 'VOLTAGE'
THEN TRUE ELSE FALSE END)
where regulatingequipmenttype = 'STATIC_VAR_COMPENSATOR';
Loading
Loading