Skip to content

Commit

Permalink
Change considered non impedance branches values in ACOPF (#91)
Browse files Browse the repository at this point in the history
* Wip
* Clean
* Add comments/doc
* Update doc

---------

Signed-off-by: p-arvy <pierre.arvy@artelys.com>
  • Loading branch information
p-arvy authored Jan 8, 2025
1 parent 64f81df commit 00686f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion docs/optimizer/preprocessing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ Let $V_{s}^{min}$ (resp. $V_{s}^{max}$) be the low (resp. high) voltage limit of

Branches with an impedance magnitude, **calculated in per unit**, lower than the configurable threshold `Znull` (see section [Configuration of the run](inputs.md#configuration-of-the-run)) are considered as non-impedant.
These branches will have their reactance replaced by the threshold `Znull` (in p.u.), **even if the reactance specified in `ampl_network_branches.txt` is negative**.
Note that for lines considered as non-impedant and connecting two different nominal voltage levels, the conductances and susceptances are cancelled in order to avoid numerical instabilities.

## Impedance of transformers

In the calculations of the ACOPF (see [AC optimal powerflow](acOptimalPowerflow.md)), the transformers with an impedance (specified in `ampl_network_branches.txt`) considered as null (see [Zero-impedance threshold](#zero-impedance-threshold)) **are treated as lines**. Then, the transformation ratios/phase shifts are ignored, as well as the impedance specified in the tap changer table `ampl_network_tct.txt`.
In the calculations of the ACOPF (see [AC optimal powerflow](acOptimalPowerflow.md)), the impedance specified in tap changer table `ampl_network_tct.txt` is ignored for transformers with an impedance (specified in `ampl_network_branches.txt`) considered as null (see [Zero-impedance threshold](#zero-impedance-threshold)). Note that the transformer ratios and phase shiftings are considered anyway.

For phase shifters transformers considered as impedant, the reactance values from the tap changer table (in `ampl_network_tct.txt`) replace the reactance specified in `ampl_network_branches.txt`. The resistance is then calculated proportionally.
For the ratio tap changers, the impedance stays as specified in `ampl_network_branches.txt`. **Please notice there is no specified handling for cases where resistance and/or reactance is negative or if there is both a ratio tap changer and a phase shift transformer on the same branch.**
Expand Down
17 changes: 9 additions & 8 deletions open-reac/src/main/resources/openreac/commons.mod
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,21 @@ param branch_X_mod{(qq,m,n) in ALL_BRANCHCC} :=
else branch_X[1,qq,m,n];
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
# If in BRANCHZNULL and Vnom1 != Vnom2, 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,20 @@ 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

0 comments on commit 00686f2

Please sign in to comment.