private void completeTerminalData(Terminal terminal, Side side, BranchData branchData) { if (terminal.isConnected() && terminal.getBusView().getBus().isInMainConnectedComponent()) { if (Double.isNaN(terminal.getP())) { LOGGER.debug("Branch {}, Side {}: setting p = {}", branchData.getId(), side, branchData.getComputedP(side)); terminal.setP(branchData.getComputedP(side)); } if (Double.isNaN(terminal.getQ())) { LOGGER.debug("Branch {}, Side {}: setting q = {}", branchData.getId(), side, branchData.getComputedQ(side)); terminal.setQ(branchData.getComputedQ(side)); } } }
private Flow flow(BranchData b, Side side) { Flow f = new Flow(); f.id = b.getId(); f.p = b.getComputedP(side); f.q = b.getComputedQ(side); return f; }
LOG.debug("Results for " + title + " branch " + b.getId()); LOG.debug("End1"); LOG.debug(String.format(" V = %14.6f %14.6f",
@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); }
@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); }