Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
Signed-off-by: p-arvy <[email protected]>
  • Loading branch information
p-arvy committed Dec 18, 2024
1 parent f6a2cf5 commit f110c4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
14 changes: 7 additions & 7 deletions open-reac/src/main/resources/openreac/commons.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -203,19 +203,19 @@ 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
)
* (branch_cstratio[1,qq,m,n]);
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit f110c4a

Please sign in to comment.