Skip to content

Commit ff6240d

Browse files
authored
Fix: issue with open RTCs on sides 2 in preprocessing (#122)
* Fix: issue with open RTCs on sides 2 in preprocessing Signed-off-by: lamoletoscar <lamoletoscar@proton.me>
1 parent 7d30b8c commit ff6240d

File tree

1 file changed

+34
-14
lines changed

1 file changed

+34
-14
lines changed

open-reac/src/main/resources/openreac/acopf_preprocessing.run

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
###############################################################################
1212
# Reactive OPF
13-
# Author: Jean Maeght 2022 2023
14-
# Author: Manuel Ruiz 2023 2024
13+
# Author: Jean Maeght 2022 2023
14+
# Author: Manuel Ruiz 2023 2024
15+
# Author: Oscar Lamolet 2025
1516
###############################################################################
1617

1718

@@ -44,18 +45,37 @@ let temp1 := min{(t,r) in REGL} regl_ratio_min[1,r];
4445
let temp2 := max{(t,r) in REGL} regl_ratio_max[1,r];
4546
printf{LOG_INFO} "Minimal transformer ratio : %.3f\n",temp1;
4647
printf{LOG_INFO} "Maximal transformer ratio : %.3f\n",temp2;
47-
for {(qq,m,n) in BRANCHCC_REGL: qq in PARAM_TRANSFORMERS_RATIO_VARIABLE
48-
and not regl_ratio_min[1,branch_ptrRegl[1,qq,m,n]] < regl_ratio_max[1,branch_ptrRegl[1,qq,m,n]]}
49-
{
50-
let messageInfo := sprintf (
51-
"Transformer %Q %Q(%ikV)->%Q(%ikV) cstratio=%.3f ratio_min=%.3f ratio_max=%.3f should have variable ratio but min and max are equal",
52-
branch_id[1,qq,m,n],
53-
substation_id[1,bus_substation[1,m]],substation_Vnomi[1,bus_substation[1,m]],
54-
substation_id[1,bus_substation[1,n]],substation_Vnomi[1,bus_substation[1,n]],
55-
branch_cstratio[1,qq,m,n],
56-
regl_ratio_min[1,branch_ptrRegl[1,qq,m,n]],regl_ratio_max[1,branch_ptrRegl[1,qq,m,n]]);
57-
printf{LOG_WARNING} "%s\n",messageInfo;
58-
let messagesInfo := messagesInfo union {messageInfo};
48+
param subex_idx;
49+
for {(qq,m,n) in BRANCHCC_REGL_FIX: qq in PARAM_TRANSFORMERS_RATIO_VARIABLE} {
50+
# Determination of substation side 2 (side 2 open case management)
51+
if n != -1 then {
52+
let subex_idx := bus_substation[1,n];
53+
} else {
54+
let subex_idx := branch_subex[1,qq,m,n];
55+
}
56+
# Case 1: RTC with side 2 disconnected
57+
if (qq,m,n) in BRANCHCC_WITH_SIDE_2_OPENED then {
58+
let messageInfo := sprintf(
59+
"Transformer %Q %Q(%ikV)->%Q(%ikV) has side 2 disconnected, RTC will be fixed in optimization",
60+
branch_id[1,qq,m,n],
61+
substation_id[1,bus_substation[1,m]], substation_Vnomi[1,bus_substation[1,m]],
62+
substation_id[1,subex_idx], substation_Vnomi[1,subex_idx]);
63+
printf{LOG_WARNING} "%s\n", messageInfo;
64+
let messagesInfo := messagesInfo union {messageInfo};
65+
}
66+
# Case 2: RTC with min=max
67+
else if not (regl_ratio_min[1,branch_ptrRegl[1,qq,m,n]] < regl_ratio_max[1,branch_ptrRegl[1,qq,m,n]]) then {
68+
let messageInfo := sprintf(
69+
"Transformer %Q %Q(%ikV)->%Q(%ikV) cstratio=%.3f ratio_min=%.3f ratio_max=%.3f should have variable ratio but min and max are equal",
70+
branch_id[1,qq,m,n],
71+
substation_id[1,bus_substation[1,m]], substation_Vnomi[1,bus_substation[1,m]],
72+
substation_id[1,subex_idx], substation_Vnomi[1,subex_idx],
73+
branch_cstratio[1,qq,m,n],
74+
regl_ratio_min[1,branch_ptrRegl[1,qq,m,n]],
75+
regl_ratio_max[1,branch_ptrRegl[1,qq,m,n]]);
76+
printf{LOG_WARNING} "%s\n", messageInfo;
77+
let messagesInfo := messagesInfo union {messageInfo};
78+
}
5979
}
6080
for {(qq,m,n) in BRANCHCC_REGL: regl_ratio_min[1,branch_ptrRegl[1,qq,m,n]] <= temp1 * 1.01
6181
or regl_ratio_max[1,branch_ptrRegl[1,qq,m,n]] >= temp2 * 0.99 }

0 commit comments

Comments
 (0)