@@ -4560,4 +4560,38 @@ void testHvdcRegularSeparation() {
4560
4560
assertActivePowerEquals (-195.600 , cs3 .getTerminal ());
4561
4561
assertActivePowerEquals (-104.400 , g4 .getTerminal ());
4562
4562
}
4563
+
4564
+ @ Test
4565
+ void testTwoGeneratorsAtSameBus () {
4566
+ Network network = FourBusNetworkFactory .createWithTwoGeneratorsAtBus2 ();
4567
+ network .getBusBreakerView ().getBus ("b2" )
4568
+ .getGeneratorStream ()
4569
+ .forEach (g -> {
4570
+ g .setTargetV (1.5 );
4571
+ g .newMinMaxReactiveLimits ()
4572
+ .setMinQ (-6.5 )
4573
+ .setMaxQ (6.5 )
4574
+ .add ();
4575
+ g .setTargetQ (1 );
4576
+
4577
+ });
4578
+
4579
+ List <StateMonitor > monitors = List .of (new StateMonitor (ContingencyContext .all (), Set .of ("l12" , "l23" ), Set .of ("b2_vl" ), Collections .emptySet ()));
4580
+ List <Contingency > contingencies = List .of (new Contingency ("g5" , new GeneratorContingency ("g5" )));
4581
+ SecurityAnalysisResult result = runSecurityAnalysis (network , contingencies , monitors );
4582
+ NetworkResult networkResult = result .getPostContingencyResults ().get (0 ).getNetworkResult ();
4583
+ double v = networkResult .getBusResult ("b2" ).getV ();
4584
+ double q = -networkResult .getBranchResult ("l12" ).getQ2 () - networkResult .getBranchResult ("l23" ).getQ1 ();
4585
+
4586
+ // test that G2 has reached its reactive limits
4587
+ assertEquals (1.294 , v , DELTA_V );
4588
+ assertEquals (-6.5 , q , 1e-2 ); // use precision in sync with default OpenLoadFlowParameters
4589
+
4590
+ // The N case is the same
4591
+ network .getGenerator ("g5" ).disconnect ();
4592
+ runLoadFlow (network , new LoadFlowParameters ());
4593
+ assertVoltageEquals (1.294 , network .getBusBreakerView ().getBus ("b2" ));
4594
+ assertReactivePowerEquals (-6.5 , network .getGenerator ("g2" ).getTerminal ());
4595
+
4596
+ }
4563
4597
}
0 commit comments