diff --git a/open-reac/src/main/resources/openreac/commons.mod b/open-reac/src/main/resources/openreac/commons.mod index 000a36a8..c871fc05 100644 --- a/open-reac/src/main/resources/openreac/commons.mod +++ b/open-reac/src/main/resources/openreac/commons.mod @@ -111,19 +111,19 @@ check {(qq,m,n) in ALL_BRANCHCC}: abs(branch_X_mod[qq,m,n]) > 0; # If in BRANCHZNULL, then set Gor/Gex/Bor/Bex to 0 param branch_Gor_mod{(qq,m,n) in ALL_BRANCHCC} := - if (qq,m,n) in BRANCHCC and (qq,m,n) in BRANCHZNULL then 0 + if (qq,m,n) in BRANCHCC and (qq,m,n) in BRANCHZNULL and substation_Vnomi[1,bus_substation[1,m]] != substation_Vnomi[1,bus_substation[1,n]] then 0 else branch_Gor[1,qq,m,n]; param branch_Gex_mod{(qq,m,n) in ALL_BRANCHCC} := - if (qq,m,n) in BRANCHCC and (qq,m,n) in BRANCHZNULL then 0 + if (qq,m,n) in BRANCHCC and (qq,m,n) in BRANCHZNULL and substation_Vnomi[1,bus_substation[1,m]] != substation_Vnomi[1,bus_substation[1,n]] then 0 else branch_Gex[1,qq,m,n]; param branch_Bor_mod{(qq,m,n) in ALL_BRANCHCC} := - if (qq,m,n) in BRANCHCC and (qq,m,n) in BRANCHZNULL then 0 + if (qq,m,n) in BRANCHCC and (qq,m,n) in BRANCHZNULL and substation_Vnomi[1,bus_substation[1,m]] != substation_Vnomi[1,bus_substation[1,n]] then 0 else branch_Bor[1,qq,m,n]; param branch_Bex_mod{(qq,m,n) in ALL_BRANCHCC} := - if (qq,m,n) in BRANCHCC and (qq,m,n) in BRANCHZNULL then 0 + if (qq,m,n) in BRANCHCC and (qq,m,n) in BRANCHZNULL and substation_Vnomi[1,bus_substation[1,m]] != substation_Vnomi[1,bus_substation[1,n]] then 0 else branch_Bex[1,qq,m,n]; # Busses with valid voltage value @@ -203,11 +203,11 @@ param branch_admi {(qq,m,n) in ALL_BRANCHCC} = # Later in this file, a variable branch_Ror_var will be created, to replace branch_Ror when it is not variable param branch_Ror {(qq,m,n) in ALL_BRANCHCC} = - ( if ((qq,m,n) in BRANCHCC_REGL) + ( if (branch_ptrRegl[1,qq,m,n] != -1) then tap_ratio[1,regl_table[1,branch_ptrRegl[1,qq,m,n]],regl_tap0[1,branch_ptrRegl[1,qq,m,n]]] else 1.0 ) - * ( if ((qq,m,n) in BRANCHCC_DEPH) + * ( if (branch_ptrDeph[1,qq,m,n] != -1) then tap_ratio[1,deph_table[1,branch_ptrDeph[1,qq,m,n]],deph_tap0[1,branch_ptrDeph[1,qq,m,n]]] else 1.0 ) @@ -215,7 +215,7 @@ param branch_Ror {(qq,m,n) in ALL_BRANCHCC} = param branch_Rex {(q,m,n) in ALL_BRANCHCC} = 1; # In IIDM, everything is in bus1 so ratio at bus2 is always 1 param branch_dephor {(qq,m,n) in ALL_BRANCHCC} = - if ((qq,m,n) in BRANCHCC_DEPH) + if (branch_ptrDeph[1,qq,m,n] != -1) then tap_angle [1,deph_table[1,branch_ptrDeph[1,qq,m,n]],deph_tap0[1,branch_ptrDeph[1,qq,m,n]]] else 0; param branch_dephex {(qq,m,n) in ALL_BRANCHCC} = 0; # In IIDM, everything is in bus1 so dephase at bus2 is always 0 diff --git a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java index d6fb60fe..fa0d1f38 100644 --- a/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java +++ b/open-reac/src/test/java/com/powsybl/openreac/optimization/AbstractOpenReacRunnerTest.java @@ -12,7 +12,6 @@ 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; @@ -32,7 +31,6 @@ 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; @@ -135,9 +133,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); }