private void checkBusBalance3wStarBus( BranchTestCase w1, BranchTestCase w2, BranchTestCase w3, Bus starBus, double toleranceBalance, String label) { w1.bus2 = starBus; w2.bus2 = starBus; w3.bus2 = starBus; BranchData r1 = checkTestCase(label, w1); BranchData r2 = checkTestCase(label, w2); BranchData r3 = checkTestCase(label, w3); Flow f1 = flow(r1, Side.TWO); Flow f2 = flow(r2, Side.TWO); Flow f3 = flow(r3, Side.TWO); checkBusBalance(label, toleranceBalance, f1, f2, f3); }
@Test public void testCAS2EntsoeLoadFlowExplicitLineAndPhaseShifter() { BranchTestCase line = cas2EntsoeLoadFlowExplicitLine(); BranchTestCase pst = cas2EntsoeLoadFlowExplicitPhaseShiftTransformer(); Flow load = cas2EntsoeLoadFlowExplicitLoad(); Flow generator = cas2EntsoeLoadFlowExplicitGenerator(); // Obtain flows at both ends of line and phase shifter BranchData pline = piModelFlows(line); BranchData ppst = piModelFlows(pst); // And check bus balance at each side // At end1 (load) the mismatch should be zero // because load values are given with all significant digits // and voltages have been copied from Excel documentation, // where they have sufficient precision // At end2 (generator, slack bus) the mismatch should be small: // generator injection in P and Q are provided with low precision // (P with 10e-2, Q with 10e-4) LOG.debug(""); LOG.debug("Balance at ends of parallel branches " + pline.getId() + ", " + ppst.getId()); Flow line1 = flow(pline, Side.ONE); Flow line2 = flow(pline, Side.TWO); Flow pst1 = flow(ppst, Side.ONE); Flow pst2 = flow(ppst, Side.TWO); checkBusBalance("End 1", TOLERANCE_BALANCE_EXACT, TOLERANCE_BALANCE_EXACT, line1, pst1, load); checkBusBalance("End 2", 1e-2, 1e-4, line2, pst2, generator); }
@Test public void testCAS2EntsoeLoadFlowExplicitLineAndPhaseShifterMovedToEnd1() { BranchTestCase line = cas2EntsoeLoadFlowExplicitLine(); BranchTestCase pst = cas2EntsoeLoadFlowExplicitPhaseShiftTransformer(); Flow load = cas2EntsoeLoadFlowExplicitLoad(); Flow generator = cas2EntsoeLoadFlowExplicitGenerator(); // Move phase shift from end 2 to end 1 pst.branch.end1.tap.rho = 1 / pst.branch.end2.tap.rho; pst.branch.end1.tap.alpha = -pst.branch.end2.tap.alpha; double rho2square = pst.branch.end2.tap.rho * pst.branch.end2.tap.rho; double dz = 100 * (1 / rho2square - 1); double dy = 100 * (rho2square - 1); pst.branch.end1.tap.r = dz; pst.branch.end1.tap.x = dz; pst.branch.end1.tap.g = dy; pst.branch.end1.tap.b = dy; pst.branch.end2.tap.rho = 1; pst.branch.end2.tap.alpha = 0; BranchData pline = piModelFlows(line); BranchData ppst = piModelFlows(pst); LOG.debug(""); LOG.debug("Balance at ends of parallel branches " + pline.getId() + ", " + ppst.getId()); LOG.debug("After moving phase shifter to side 1"); Flow line1 = flow(pline, Side.ONE); Flow line2 = flow(pline, Side.TWO); Flow pst1 = flow(ppst, Side.ONE); Flow pst2 = flow(ppst, Side.TWO); checkBusBalance("End 1", TOLERANCE_BALANCE_EXACT, TOLERANCE_BALANCE_EXACT, line1, pst1, load); checkBusBalance("End 2", 1e-2, 1e-4, line2, pst2, generator); }