8
8
9
9
import com .google .common .collect .Sets ;
10
10
import com .powsybl .commons .PowsyblException ;
11
- import com .powsybl .commons .reporter .Report ;
12
11
import com .powsybl .commons .reporter .Reporter ;
13
12
import com .powsybl .commons .reporter .ReporterModel ;
14
- import com .powsybl .commons .reporter .TypedValue ;
15
13
import com .powsybl .iidm .network .Bus ;
16
14
import com .powsybl .iidm .network .Network ;
17
15
import com .powsybl .iidm .network .VariantManagerConstants ;
@@ -113,21 +111,6 @@ private Network getNetwork(UUID networkUuid, String variantId) {
113
111
return network ;
114
112
}
115
113
116
- public static void addRestrictedVoltageLevelReport (Map <String , Double > voltageLevelsIdsRestricted , Reporter reporter ) {
117
- if (!voltageLevelsIdsRestricted .isEmpty ()) {
118
- String joinedVoltageLevelsIds = voltageLevelsIdsRestricted .entrySet ()
119
- .stream ()
120
- .map (entry -> entry .getKey () + " : " + entry .getValue ())
121
- .collect (Collectors .joining (", " ));
122
-
123
- reporter .report (Report .builder ()
124
- .withKey ("restrictedVoltageLevels" )
125
- .withDefaultMessage (String .format ("The modifications to the low limits for certain voltage levels have been restricted to avoid negative voltage limits: %s" , joinedVoltageLevelsIds ))
126
- .withSeverity (TypedValue .WARN_SEVERITY )
127
- .build ());
128
- }
129
- }
130
-
131
114
private Pair <Network , OpenReacResult > run (VoltageInitRunContext context , UUID resultUuid ) throws Exception {
132
115
Objects .requireNonNull (context );
133
116
@@ -136,18 +119,16 @@ private Pair<Network, OpenReacResult> run(VoltageInitRunContext context, UUID re
136
119
getNetwork (context .getNetworkUuid (), context .getVariantId ()));
137
120
138
121
AtomicReference <Reporter > rootReporter = new AtomicReference <>(Reporter .NO_OP );
139
- Reporter reporter = Reporter .NO_OP ;
140
122
if (context .getReportUuid () != null ) {
141
123
String rootReporterId = context .getReporterId () == null ? VOLTAGE_INIT_TYPE_REPORT : context .getReporterId () + "@" + context .getReportType ();
142
124
rootReporter .set (new ReporterModel (rootReporterId , rootReporterId ));
143
- reporter = rootReporter .get ().createSubReporter (context .getReportType (), VOLTAGE_INIT_TYPE_REPORT , VOLTAGE_INIT_TYPE_REPORT , context .getReportUuid ().toString ());
125
+ context . setRootReporter ( rootReporter .get ().createSubReporter (context .getReportType (), VOLTAGE_INIT_TYPE_REPORT , VOLTAGE_INIT_TYPE_REPORT , context .getReportUuid ().toString () ));
144
126
// Delete any previous VoltageInit computation logs
145
127
voltageInitObserver .observe ("report.delete" , () ->
146
128
reportService .deleteReport (context .getReportUuid (), context .getReportType ()));
147
129
}
148
130
CompletableFuture <OpenReacResult > future = runVoltageInitAsync (context , network , resultUuid );
149
131
if (context .getReportUuid () != null ) {
150
- addRestrictedVoltageLevelReport (context .getVoltageLevelsIdsRestricted (), reporter );
151
132
voltageInitObserver .observe ("report.send" , () ->
152
133
reportService .sendReport (context .getReportUuid (), rootReporter .get ()));
153
134
}
0 commit comments