Skip to content

Commit

Permalink
Add resources for branches tests
Browse files Browse the repository at this point in the history
Signed-off-by: p-arvy <pierre.arvy@artelys.com>
  • Loading branch information
p-arvy committed Dec 16, 2024
1 parent 79c470a commit 7f77212
Show file tree
Hide file tree
Showing 46 changed files with 657 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.powsybl.commons.test.ComparisonUtils;
import com.powsybl.computation.ComputationManager;
import com.powsybl.computation.local.LocalCommandExecutor;
import com.powsybl.computation.local.LocalComputationConfig;
import com.powsybl.computation.local.LocalComputationManager;
import com.powsybl.iidm.network.*;
import com.powsybl.loadflow.LoadFlow;
Expand All @@ -31,6 +32,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ForkJoinPool;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -133,9 +135,9 @@ protected OpenReacResult runOpenReac(Network network, String subFolder, OpenReac
}
LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor(outputFileNames);
// To really run open reac, use the commentede line below. Be sure that open-reac/src/test/resources/com/powsybl/config/test/config.yml contains your ampl path
try (ComputationManager computationManager = new LocalComputationManager()) {
// try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir),
// localCommandExecutor, ForkJoinPool.commonPool())) {
// try (ComputationManager computationManager = new LocalComputationManager()) {
try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir),
localCommandExecutor, ForkJoinPool.commonPool())) {
return OpenReacRunner.run(network, network.getVariantManager().getWorkingVariantId(), parameters,
new OpenReacConfig(true), computationManager, reportNode, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public class OpenReacBranchWithOneSideOpenedTest extends AbstractOpenReacRunnerT
void testOpenLineSide1OpenReac() throws IOException {
Network network = VoltageControlNetworkFactory.createWithSimpleRemoteControl();
network.getLine("l43").setG2(0.1f).setB2(0.1f).getTerminal1().disconnect();
testAllModifAndLoadFlow(network, "openreac-output-real-network", new OpenReacParameters(), ReportNode.NO_OP);
testAllModifAndLoadFlow(network, "optimization/opened-branches/line-open-side-1", new OpenReacParameters(), ReportNode.NO_OP);
}

@Test
void testZeroImpedanceOpenBranchSide2OpenReac() throws IOException {
Network network = VoltageControlNetworkFactory.createWithTwoVoltageControls();
network.getLine("l45").setX(1e-8).setB1(1).setG1(0.1).getTerminal2().disconnect();

OpenReacResult result = runOpenReac(network, "");
OpenReacResult result = runOpenReac(network, "optimization/opened-branches/zero-impedance-open-side-2");
// opened branch is considered as non impedant
assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_branch_in_AC_CC_side_2_opened")));
assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_branch_with_zero_or_small_impedance")));
Expand All @@ -58,7 +58,7 @@ void testZeroImpedanceOpenBranchSide1OpenReac() throws IOException {
Network network = VoltageControlNetworkFactory.createNetworkWith2T2wt();
network.getTwoWindingsTransformer("T2wT2").setR(0.0).setX(1e-8).setG(0.01).setB(0.1).getTerminal1().disconnect();

OpenReacResult result = runOpenReac(network, "");
OpenReacResult result = runOpenReac(network, "optimization/opened-branches/zero-impedance-open-side-1");
// opened branch is considered as non impedance branch
assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_branch_in_AC_CC_side_1_opened")));
assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_branch_with_zero_or_small_impedance")));
Expand All @@ -74,7 +74,7 @@ void testRatioTapChangerOpenSide2OpenReac() throws IOException {
Network network = VoltageControlNetworkFactory.createNetworkWithT2wt();
network.getTwoWindingsTransformer("T2wT").getTerminal2().disconnect();

OpenReacResult result = runOpenReac(network, "");
OpenReacResult result = runOpenReac(network, "optimization/opened-branches/rtc-open-side-2");
// verify ratio tap changer is considered in optimization
assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_branch_in_AC_CC_side_2_opened")));
assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_transformers_with_fixed_ratio")));
Expand All @@ -90,7 +90,7 @@ void testRatioTapChangerOpenSide1OpenReac() throws IOException {
Network network = VoltageControlNetworkFactory.createNetworkWith2T2wt();
network.getTwoWindingsTransformer("T2wT1").getTerminal1().disconnect();

OpenReacResult result = runOpenReac(network, "");
OpenReacResult result = runOpenReac(network, "optimization/opened-branches/rtc-open-side-1");
// verify ratio tap changer on T2wT1 is ignored in optimization
assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_branch_in_AC_CC_side_1_opened")));
assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_transformers_with_fixed_ratio")));
Expand All @@ -111,7 +111,7 @@ void testRatioTapChangerNotOptimizedOnOpenBranch() throws IOException {
OpenReacParameters parameters = new OpenReacParameters();
// try to optimize both ratio tap changers
parameters.addVariableTwoWindingsTransformers(List.of("T2wT1", "T2wT2"));
OpenReacResult result = runOpenReac(network, "", parameters, false);
OpenReacResult result = runOpenReac(network, "optimization/opened-branches/rtc-not-optimized", parameters, false);

// verify only one rtc has been optimized
assertEquals(1, Integer.parseInt(result.getIndicators().get("nb_transformers_with_variable_ratio")));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
final_status OK
dcopf_status OK

ctime_start 'Wed Dec 04 17:57:29 2024'
ctime_start 'Mon Dec 16 15:57:37 2024'
last_solve_result_num 0
nb_iter_last 8
nb_iter_total 8
_ampl_elapsed_time 0.141000
_total_solve_time 0.015625
_ampl_elapsed_time 0.139000
_total_solve_time 0.046875
total_time 0

operatingSystem windows
OS 'Windows_NT'
COMPUTERNAME 'ARTELYS-PC253'
directory 'C:\Users\parvy\AppData\Local\Temp\ampl_16228844043131338938'
directory 'C:\Users\parvy\AppData\Local\Temp\ampl_13101968519622524908'

log_level_ampl INFO
log_level_knitro 2
Expand Down Expand Up @@ -48,9 +48,11 @@ nb_bus_with_voltage_value 0
nb_bus_with_reactive_slacks 3
nb_bus_without_reactive_slacks 0
nb_branch_in_data_file 4
nb_branch_in_AC_CC 2
nb_branch_with_nonsmall_impedance 1
nb_branch_with_zero_or_small_impedance 1
nb_branch_in_AC_CC 4
nb_branch_in_AC_CC_side_1_opened 1
nb_branch_in_AC_CC_side_2_opened 1
nb_branch_with_nonsmall_impedance 2
nb_branch_with_zero_or_small_impedance 2
nb_unit_in_data_file 3
nb_unit_in_AC_CC 2
nb_unit_up_and_running 2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#variant;num;bus;vRegul;V(pu);targetP(MW);targetQ(Mvar);P(MW);Q(MW);
1;1;2;'true';0.500;2.0;0.7;-2.0;-0.7;
1;2;3;'true';0.500;2.0;0.7;-2.0;-0.7;
1;3;4;'true';0.512;2.0;0.7;-2.0;-0.7;
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
final_status OK
dcopf_status OK

ctime_start 'Mon Dec 16 14:48:51 2024'
last_solve_result_num 0
nb_iter_last 6
nb_iter_total 6
_ampl_elapsed_time 0.109000
_total_solve_time 0.015625
total_time 0

operatingSystem windows
OS 'Windows_NT'
COMPUTERNAME 'ARTELYS-PC253'
directory 'C:\Users\parvy\AppData\Local\Temp\ampl_14517614006499333001'

log_level_ampl INFO
log_level_knitro 2
objective_choice 0
ratio_voltage_target 0.500000
coeff_alpha 1.000000
Pnull 0.010000
Znull 0.000100
epsilon_nominal_voltage 1.000000
min_plausible_low_voltage_limit 0.500000
max_plausible_high_voltage_limit 1.500000
ignore_voltage_bounds 0.000000
buses_with_reactive_slacks ALL
PQmax 9000.000000
defaultPmax 1000.000000
defaultPmin 0.000000
defaultQmaxPmaxRatio 0.300000
defaultQmin -300.000000
defaultQmax 300.000000
minimalQPrange 1.000000
default_variable_scaling_factor 1.000000
default_constraint_scaling_factor 1.000000
reactive_slack_variable_scaling_factor 0.100000
transformer_ratio_variable_scaling_factor 0.001000
shunt_variable_scaling_factor 0.100000

nb_substations 4
nb_bus_in_data_file 4
nb_bus_in_ACDC_CC 4
nb_bus_in_AC_CC 4
nb_bus_in_ACDC_but_out_AC_CC 0
nb_bus_with_voltage_value 0
nb_bus_with_reactive_slacks 4
nb_bus_without_reactive_slacks 0
nb_branch_in_data_file 4
nb_branch_in_AC_CC 4
nb_branch_in_AC_CC_side_1_opened 1
nb_branch_in_AC_CC_side_2_opened 0
nb_branch_with_nonsmall_impedance 2
nb_branch_with_zero_or_small_impedance 2
nb_unit_in_data_file 3
nb_unit_in_AC_CC 3
nb_unit_up_and_running 3
nb_unit_with_variable_reactive_power 3
nb_unit_with_fixed_reactive_power 0
nb_load_in_data_file 2
nb_load_in_AC_CC 2
nb_shunt_in_data_file 0
nb_shunt_connectable_or_in_AC_CC 0
nb_shunt_with_fixed_value 0
nb_shunt_with_variable_value 0
nb_transformers_with_variable_ratio 0
nb_transformers_with_fixed_ratio 0
nb_svc_in_data_file 0
nb_svc_in_AC_CC 0
nb_svc_up_and_operating 0
nb_vsc_converter_in_data_file 0
nb_vsc_converter_up_and_running 0
nb_lcc_converter_in_data_file 0
nb_lcc_converter_up_and_running 0
nb_batteries 0
sum_batteries_pmax 0.0
sum_batteries_pmin 0.0

max_teta_dc 0.02
max_teta_ac 0.08
teta_max 3.02
min_teta_dc -0.00
min_teta_ac -0.00
teta_min -3.00
max_delta_teta_dc -0.000003
max_delta_teta_ac -0.000012
min_delta_teta_dc -0.020000
min_delta_teta_ac -0.078526

nb_reactive_slacks 0
nb_slacks_condensator 0
sum_slacks_condensator 0.0
nb_slacks_self 0
sum_slacks_self 0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#variant;num;tap;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#variant;num;bus;b(pu);Q(Mvar);section;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#variant;num;bus;vRegul;V(pu);Q(Mvar);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#variant;bus;V(pu);theta(rad);id;
1;1;0.500;-0.000;"b1_vl_0";
1;2;0.500;0.000;"b2_vl_0";
1;3;0.500;-0.000;"b3_vl_0";
1;4;0.512;0.079;"b4_vl_0";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#variant;num;bus;vRegul;targetV(pu);targetQ(Mvar);P(MW);Q(Mvar);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#variant;num;bus;vRegul;V(pu);targetP(MW);targetQ(Mvar);P(MW);Q(MW);
1;1;1;'true';0.906;25.0;7.6;-25.3;-7.6;
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
final_status OK
dcopf_status OK

ctime_start 'Mon Dec 16 14:51:03 2024'
last_solve_result_num 0
nb_iter_last 6
nb_iter_total 6
_ampl_elapsed_time 0.078000
_total_solve_time 0.046875
total_time 0

operatingSystem windows
OS 'Windows_NT'
COMPUTERNAME 'ARTELYS-PC253'
directory 'C:\Users\parvy\AppData\Local\Temp\ampl_11159029444846276223'

log_level_ampl INFO
log_level_knitro 2
objective_choice 0
ratio_voltage_target 0.500000
coeff_alpha 1.000000
Pnull 0.010000
Znull 0.000100
epsilon_nominal_voltage 1.000000
min_plausible_low_voltage_limit 0.500000
max_plausible_high_voltage_limit 1.500000
ignore_voltage_bounds 0.000000
buses_with_reactive_slacks ALL
PQmax 9000.000000
defaultPmax 1000.000000
defaultPmin 0.000000
defaultQmaxPmaxRatio 0.300000
defaultQmin -300.000000
defaultQmax 300.000000
minimalQPrange 1.000000
default_variable_scaling_factor 1.000000
default_constraint_scaling_factor 1.000000
reactive_slack_variable_scaling_factor 0.100000
transformer_ratio_variable_scaling_factor 0.001000
shunt_variable_scaling_factor 0.100000

nb_substations 3
nb_bus_in_data_file 3
nb_bus_in_ACDC_CC 3
nb_bus_in_AC_CC 3
nb_bus_in_ACDC_but_out_AC_CC 0
nb_bus_with_voltage_value 0
nb_bus_with_reactive_slacks 3
nb_bus_without_reactive_slacks 0
nb_branch_in_data_file 3
nb_branch_in_AC_CC 3
nb_branch_in_AC_CC_side_1_opened 0
nb_branch_in_AC_CC_side_2_opened 1
nb_branch_with_nonsmall_impedance 3
nb_branch_with_zero_or_small_impedance 0
nb_unit_in_data_file 1
nb_unit_in_AC_CC 1
nb_unit_up_and_running 1
nb_unit_with_variable_reactive_power 1
nb_unit_with_fixed_reactive_power 0
nb_load_in_data_file 2
nb_load_in_AC_CC 2
nb_shunt_in_data_file 0
nb_shunt_connectable_or_in_AC_CC 0
nb_shunt_with_fixed_value 0
nb_shunt_with_variable_value 0
nb_transformers_with_variable_ratio 1
nb_transformers_with_fixed_ratio 1
nb_svc_in_data_file 0
nb_svc_in_AC_CC 0
nb_svc_up_and_operating 0
nb_vsc_converter_in_data_file 0
nb_vsc_converter_up_and_running 0
nb_lcc_converter_in_data_file 0
nb_lcc_converter_up_and_running 0
nb_batteries 0
sum_batteries_pmax 0.0
sum_batteries_pmin 0.0

max_teta_dc 0.01
max_teta_ac 0.02
teta_max 3.01
min_teta_dc -0.05
min_teta_ac -0.08
teta_min -3.05
max_delta_teta_dc 0.045914
max_delta_teta_ac 0.081650
min_delta_teta_dc 0.009298
min_delta_teta_ac 0.017208

nb_reactive_slacks 0
nb_slacks_condensator 0
sum_slacks_condensator 0.0
nb_slacks_self 0
sum_slacks_self 0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#variant;num;tap;
1;3;1;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#variant;num;bus;b(pu);Q(Mvar);section;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#variant;num;bus;vRegul;V(pu);Q(Mvar);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#variant;bus;V(pu);theta(rad);id;
1;1;0.906;0.017;"VL_1_0";
1;2;0.900;0.000;"VL_2_0";
1;3;0.695;-0.082;"VL_3_0";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#variant;num;bus;vRegul;targetV(pu);targetQ(Mvar);P(MW);Q(Mvar);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#variant;num;bus;vRegul;V(pu);targetP(MW);targetQ(Mvar);P(MW);Q(MW);
1;1;1;'true';0.907;25.0;8.7;-24.7;-8.7;
Loading

0 comments on commit 7f77212

Please sign in to comment.