@@ -222,18 +222,7 @@ public OpenReacParameters buildOpenReacParameters(VoltageInitRunContext context,
222
222
voltageLevelModificationLimits , voltageLevelDefaultLimits ,
223
223
voltageLevel , context .getVoltageLevelsIdsRestricted ()));
224
224
225
- if (!context .getVoltageLevelsIdsRestricted ().isEmpty ()) {
226
- reporter .report (Report .builder ()
227
- .withKey ("restrictedVoltageLevels" )
228
- .withDefaultMessage ("The modifications to the low limits for certain voltage levels have been restricted to avoid negative voltage limits: ${joinedVoltageLevelsIds}" )
229
- .withValue ("joinedVoltageLevelsIds" , context .getVoltageLevelsIdsRestricted ()
230
- .entrySet ()
231
- .stream ()
232
- .map (entry -> entry .getKey () + " : " + entry .getValue ())
233
- .collect (Collectors .joining (", " )))
234
- .withSeverity (TypedValue .WARN_SEVERITY )
235
- .build ());
236
- }
225
+ logRestrictedVoltageLevels (reporter , context .getVoltageLevelsIdsRestricted ());
237
226
}
238
227
239
228
constantQGenerators .addAll (toEquipmentIdsList (context .getNetworkUuid (), context .getVariantId (), voltageInitParameters .getConstantQGenerators ()));
@@ -245,7 +234,62 @@ public OpenReacParameters buildOpenReacParameters(VoltageInitRunContext context,
245
234
.addVariableTwoWindingsTransformers (variableTwoWindingsTransformers )
246
235
.addVariableShuntCompensators (variableShuntCompensators );
247
236
248
- parameters .getSpecificVoltageLimits ()
237
+ logVoltageLimitsModified (reporter , network , parameters .getSpecificVoltageLimits ());
238
+ logFiltersCounters (reporter , counterMissingVoltageLimits , counterVoltageLimitModifications );
239
+
240
+ //The optimizer will attach reactive slack variables to all buses
241
+ parameters .setReactiveSlackBusesMode (ReactiveSlackBusesMode .ALL );
242
+
243
+ LOGGER .info ("Parameters built in {}s" , TimeUnit .NANOSECONDS .toSeconds (System .nanoTime () - startTime .get ()));
244
+ return parameters ;
245
+ }
246
+
247
+ private List <String > toEquipmentIdsList (UUID networkUuid , String variantId , List <FilterEquipmentsEmbeddable > filters ) {
248
+ if (filters == null || filters .isEmpty ()) {
249
+ return List .of ();
250
+ }
251
+ List <FilterEquipments > equipments = filterService .exportFilters (filters .stream ().map (FilterEquipmentsEmbeddable ::getFilterId ).toList (), networkUuid , variantId );
252
+ Set <String > ids = new HashSet <>();
253
+ equipments .forEach (filterEquipment ->
254
+ filterEquipment .getIdentifiableAttributes ().forEach (identifiableAttribute ->
255
+ ids .add (identifiableAttribute .getId ())
256
+ )
257
+ );
258
+ return new ArrayList <>(ids );
259
+ }
260
+
261
+ private static void logRestrictedVoltageLevels (final Reporter reporter , final Map <String , Double > voltageLevelsIdsRestricted ) {
262
+ if (!voltageLevelsIdsRestricted .isEmpty ()) {
263
+ reporter .report (Report .builder ()
264
+ .withKey ("restrictedVoltageLevels" )
265
+ .withDefaultMessage ("The modifications to the low limits for certain voltage levels have been restricted to avoid negative voltage limits: ${joinedVoltageLevelsIds}" )
266
+ .withValue ("joinedVoltageLevelsIds" , voltageLevelsIdsRestricted
267
+ .entrySet ()
268
+ .stream ()
269
+ .map (entry -> entry .getKey () + " : " + voltageToString (entry .getValue ()))
270
+ .collect (Collectors .joining (", " )))
271
+ .withSeverity (TypedValue .WARN_SEVERITY )
272
+ .build ());
273
+ }
274
+ }
275
+
276
+ private static void logFiltersCounters (final Reporter reporter , final MutableInt counterMissingVoltageLimits , final MutableInt counterVoltageLimitModifications ) {
277
+ reporter .report (Report .builder ()
278
+ .withKey ("missingVoltageLimits" )
279
+ .withDefaultMessage ("Missing voltage limits of ${nbMissingVoltageLimits} voltage levels have been replaced with user-defined default values." )
280
+ .withValue ("nbMissingVoltageLimits" , counterMissingVoltageLimits .longValue ())
281
+ .withSeverity (TypedValue .INFO_SEVERITY )
282
+ .build ());
283
+ reporter .report (Report .builder ()
284
+ .withKey ("voltageLimitModifications" )
285
+ .withDefaultMessage ("Voltage limits of ${nbVoltageLimitModifications} voltage levels have been modified according to user input." )
286
+ .withValue ("nbVoltageLimitModifications" , counterVoltageLimitModifications .longValue ())
287
+ .withSeverity (TypedValue .INFO_SEVERITY )
288
+ .build ());
289
+ }
290
+
291
+ private static void logVoltageLimitsModified (final Reporter reporter , final Network network , final List <VoltageLimitOverride > specificVoltageLimits ) {
292
+ specificVoltageLimits
249
293
.stream ()
250
294
.collect (HashMap <String , EnumMap <VoltageLimitType , VoltageLimitOverride >>::new ,
251
295
(map , voltageLimitOverride ) -> map
@@ -269,38 +313,6 @@ public OpenReacParameters buildOpenReacParameters(VoltageInitRunContext context,
269
313
.withSeverity (TypedValue .TRACE_SEVERITY )
270
314
.build ());
271
315
});
272
- reporter .report (Report .builder ()
273
- .withKey ("missingVoltageLimits" )
274
- .withDefaultMessage ("Missing voltage limits of ${nbMissingVoltageLimits} voltage levels have been replaced with user-defined default values." )
275
- .withValue ("nbMissingVoltageLimits" , counterMissingVoltageLimits .longValue ())
276
- .withSeverity (TypedValue .INFO_SEVERITY )
277
- .build ());
278
- reporter .report (Report .builder ()
279
- .withKey ("voltageLimitModifications" )
280
- .withDefaultMessage ("Voltage limits of ${nbVoltageLimitModifications} voltage levels have been modified according to user input." )
281
- .withValue ("nbVoltageLimitModifications" , counterVoltageLimitModifications .longValue ())
282
- .withSeverity (TypedValue .INFO_SEVERITY )
283
- .build ());
284
-
285
- //The optimizer will attach reactive slack variables to all buses
286
- parameters .setReactiveSlackBusesMode (ReactiveSlackBusesMode .ALL );
287
-
288
- LOGGER .info ("Parameters built in {}s" , TimeUnit .NANOSECONDS .toSeconds (System .nanoTime () - startTime .get ()));
289
- return parameters ;
290
- }
291
-
292
- private List <String > toEquipmentIdsList (UUID networkUuid , String variantId , List <FilterEquipmentsEmbeddable > filters ) {
293
- if (filters == null || filters .isEmpty ()) {
294
- return List .of ();
295
- }
296
- List <FilterEquipments > equipments = filterService .exportFilters (filters .stream ().map (FilterEquipmentsEmbeddable ::getFilterId ).toList (), networkUuid , variantId );
297
- Set <String > ids = new HashSet <>();
298
- equipments .forEach (filterEquipment ->
299
- filterEquipment .getIdentifiableAttributes ().forEach (identifiableAttribute ->
300
- ids .add (identifiableAttribute .getId ())
301
- )
302
- );
303
- return new ArrayList <>(ids );
304
316
}
305
317
306
318
private static String voltageToString (double voltage ) {
0 commit comments