Skip to content

Commit

Permalink
DEBUG log level to export debug files (#38)
Browse files Browse the repository at this point in the history
Signed-off-by: parvy <pierre.arvy@artelys.com>
  • Loading branch information
p-arvy authored Nov 23, 2023
1 parent f388d67 commit 93049c1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 30 deletions.
58 changes: 28 additions & 30 deletions open-reac/src/main/resources/openreac/reactiveopf.run
Original file line number Diff line number Diff line change
Expand Up @@ -1092,41 +1092,39 @@ then {
###############################################################################
include reactiveopfoutput.run;



# Write voltage information in debug file
printf "#bus_id;Vnom;V;Vlb;Vub;Vmin_mod;Vmax_mod;Vmin_OK;Vmax_OK;Vmin_ori;Vmax_ori;sQ1;sQ2;\n" > debug_bus.csv;
for {n in BUSCC} printf "%Q;%i;%.4f;%.4f;%.4f;%.4f;%.4f;%s;%s;%.4f;%.4f;%.2f;%.2f;\n",
bus_id[1,n],substation_Vnomi[1,bus_substation[1,n]],
V[n],V[n].lb,V[n].ub,
voltage_lower_bound[1,bus_substation[1,n]],
voltage_upper_bound[1,bus_substation[1,n]],
if V[n]<voltage_lower_bound[1,bus_substation[1,n]] then "NOK" else "OK",
if V[n]>voltage_upper_bound[1,bus_substation[1,n]] then "NOK" else "OK",
substation_Vmin[1,bus_substation[1,n]],substation_Vmax[1,bus_substation[1,n]],
if n in BUSCC_SLACK then max(slack1_balance_Q[n]-slack2_balance_Q[n],0) else -1,
if n in BUSCC_SLACK then max(slack2_balance_Q[n]-slack1_balance_Q[n],0) else -1
> debug_bus.csv;
;
close debug_bus.csv;
let fileOut := "debug_bus.csv";
printf{LOG_DEBUG} "#bus_id;Vnom;V;Vlb;Vub;Vmin_mod;Vmax_mod;Vmin_OK;Vmax_OK;Vmin_ori;Vmax_ori;sQ1;sQ2;\n" > (fileOut);
for {n in BUSCC}
printf{LOG_DEBUG} "%Q;%i;%.4f;%.4f;%.4f;%.4f;%.4f;%s;%s;%.4f;%.4f;%.2f;%.2f;\n",
bus_id[1,n],substation_Vnomi[1,bus_substation[1,n]],
V[n],V[n].lb,V[n].ub,
voltage_lower_bound[1,bus_substation[1,n]],
voltage_upper_bound[1,bus_substation[1,n]],
if V[n]<voltage_lower_bound[1,bus_substation[1,n]] then "NOK" else "OK",
if V[n]>voltage_upper_bound[1,bus_substation[1,n]] then "NOK" else "OK",
substation_Vmin[1,bus_substation[1,n]],substation_Vmax[1,bus_substation[1,n]],
if n in BUSCC_SLACK then max(slack1_balance_Q[n]-slack2_balance_Q[n],0) else -1,
if n in BUSCC_SLACK then max(slack2_balance_Q[n]-slack1_balance_Q[n],0) else -1
> (fileOut);
close (fileOut);

if 1==0 then {
# Write units which are not in uniton (debug only)
let fileOut := "reactiveopf_results_generators_Pnull.csv";
printf "#variant;num;bus;vRegul;V(pu);targetP(MW);targetQ(Mvar);P(MW);Q(MW);id;bus_id;\n" > (fileOut);
printf{(g,n) in UNITCC diff UNITON} "%i;%i;%i;%Q;%.3f;%.3f;%.3f;%.3f;%.3f;%Q;%Q;\n",
1,g,n,
unit_vregul[1,g,n],
V[n],
unit_Pc[1,g,n],
unit_Qc[1,g,n],
unit_P0[1,g,n],
unit_Q0[1,g,n],
unit_id[1,g,n],
bus_id[1,n]
> (fileOut);
printf{LOG_DEBUG} "#variant;num;bus;vRegul;V(pu);targetP(MW);targetQ(Mvar);P(MW);Q(MW);id;bus_id;\n" > (fileOut);
for {(g,n) in UNITCC diff UNITON}
printf{LOG_DEBUG} "%i;%i;%i;%Q;%.3f;%.3f;%.3f;%.3f;%.3f;%Q;%Q;\n",
1,g,n,
unit_vregul[1,g,n],
V[n],
unit_Pc[1,g,n],
unit_Qc[1,g,n],
unit_P0[1,g,n],
unit_Q0[1,g,n],
unit_id[1,g,n],
bus_id[1,n]
> (fileOut);
close (fileOut);
}


###############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,4 @@ if card(messagesInfo) > 0 then {
let temp1:=temp1+1;
}
}
close (fileOut);

0 comments on commit 93049c1

Please sign in to comment.