public static void printBalanceSummary(String title, Network network, Logger logger) { ConnectedPower balanceMainCC = new ConnectedPower(); ConnectedPower balanceOtherCC = new ConnectedPower(); addBuses(network, balanceMainCC, balanceOtherCC); addLoads(network, balanceMainCC, balanceOtherCC); addDanglingLines(network, balanceMainCC, balanceOtherCC); addGenerators(network, balanceMainCC, balanceOtherCC); addShuntCompensators(network, balanceMainCC, balanceOtherCC); logOtherCC(logger, title, () -> writeInTable(balanceMainCC, balanceOtherCC), balanceOtherCC); }
private static BranchData legBranchData(String twtId, Side side, Leg2or3 leg, double ratedU0, Complex starVoltage, double epsilonX, boolean applyReactanceCorrection) { // All (gk, bk) are zero in the IIDM model return legBranchData(twtId, side, leg, 0, 0, ratedU0, starVoltage, epsilonX, applyReactanceCorrection); }
@Test public void test() { TwtData twtData = new TwtData(new TwtTestData().get3WTransformer(), 0, false); assertEquals(TwtTestData.P1, twtData.getComputedP(Side.ONE), .3); assertEquals(TwtTestData.Q1, twtData.getComputedQ(Side.ONE), .3); assertEquals(TwtTestData.P2, twtData.getComputedP(Side.TWO), .3); assertEquals(TwtTestData.Q2, twtData.getComputedQ(Side.TWO), .3); assertEquals(TwtTestData.P3, twtData.getComputedP(Side.THREE), .3); assertEquals(TwtTestData.Q3, twtData.getComputedQ(Side.THREE), .3); assertEquals(TwtTestData.STAR_U, twtData.getStarU(), .0001); assertEquals(TwtTestData.STAR_ANGLE, Math.toDegrees(twtData.getStarTheta()), .0001); }
private BranchData checkTestCase(String title, BranchTestCase t) { BranchData b = piModelFlows(t); logTestCase(title, t, b); assertEquals(t.expectedFlow1.p, b.getComputedP1(), t.config.toleranceFlow); assertEquals(t.expectedFlow1.q, b.getComputedQ1(), t.config.toleranceFlow); if (!Double.isNaN(t.expectedFlow2.p)) { assertEquals(t.expectedFlow2.p, b.getComputedP2(), t.config.toleranceFlow); } if (!Double.isNaN(t.expectedFlow2.q)) { assertEquals(t.expectedFlow2.q, b.getComputedQ2(), t.config.toleranceFlow); } return b; }
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; }
public static boolean isInMainCc(Bus bus) { return ConnectedComponents.getCcNum(bus) == ComponentConstants.MAIN_NUM; }
private void testCAS1EntsoeMicroGrid3wTx(CAS1EntsoeMicroGrid3wTxVariant variant) { LOG.debug(""); LOG.debug("CAS1 ENTSO-E MicroGrid 3-widing transformer, variant " + variant); BranchTestCase w380 = cas1EntsoeMicroGrid3wTxW380(variant); BranchTestCase w225 = cas1EntsoeMicroGrid3wTxW225(variant); BranchTestCase w21 = cas1EntsoeMicroGrid3wTxW21(variant); check3wTx(w380, w225, w21); }
private BranchTestCase cas2EntsoeLoadFlowExplicitLine() { BranchTestCase t = new BranchTestCase(); t.branch.id = "FFNOD0L41__FNO"; t.branch.end1.ratedU = 380; t.branch.end2.ratedU = 380; t.branch.end1.r = 4.1956; t.branch.end1.x = 12.73; // Voltage and angle for bus 1 have been taken from Excel documentation // with much more precision that the one found in SV data files t.bus1.u = cas2EntsoeLoadFLowExplicitU1(); t.bus1.theta = Math.toRadians(cas2EntsoeLoadFLowExplicitTheta1()); t.bus2.u = 397.1; t.bus2.theta = Math.toRadians(0); t.expectedFlow1.p = -534.9869; t.expectedFlow1.q = 153.1046; t.expectedFlow2.p = 543.2755; t.expectedFlow2.q = -127.9559; return t; }
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); }
public String toString(ShortIdDictionary dict) { return (dict != null ? dict.getShortId(id) : id) + ":" + duplicateIndex; }
@Test public void testCAS2EntsoeLoadFlowExplicitPhaseShiftTransformer() { checkTestCase("pst", cas2EntsoeLoadFlowExplicitPhaseShiftTransformer()); }
private void checkBusBalance(String title, double ptol, double qtol, Flow... flows) { logBusBalance(title, flows); Flow mismatch = sum(flows); assertEquals(0, mismatch.p, ptol); assertEquals(0, mismatch.q, qtol); }
private Flow cas2EntsoeLoadFlowExplicitGenerator() { Flow f = new Flow(); f.id = "Generator"; f.p = -341.54; f.q = 49.0468; return f; }
public void write(Path file) throws IOException { try (OutputStream os = Files.newOutputStream(file)) { write(os); } }
private void checkBusBalance(String title, double tolerance, Flow... flows) { checkBusBalance(title, tolerance, tolerance, flows); }
private BranchTestCase cas2EntsoeLoadFlowExplicitPhaseShiftTransformer() { BranchTestCase t = new BranchTestCase(); t.branch.id = "FNOD041__FNOD021__1_PT"; t.branch.end1.ratedU = 380; t.branch.end2.ratedU = 380; t.branch.end1.r = 4.1956; t.branch.end1.x = 12.73; t.bus1.u = cas2EntsoeLoadFLowExplicitU1(); t.bus1.theta = Math.toRadians(cas2EntsoeLoadFLowExplicitTheta1()); t.bus2.u = 397.1; t.bus2.theta = Math.toRadians(0); t.expectedFlow1.p = 202.9869; t.expectedFlow1.q = -75.1046; t.expectedFlow2.p = -201.7355; t.expectedFlow2.q = 78.9091; t.branch.end2.tap.rho = 0.997829; t.branch.end2.tap.alpha = Math.toRadians(-3.77605); return t; };
private Flow cas2EntsoeLoadFlowExplicitLoad() { Flow f = new Flow(); f.id = "Load"; f.p = 332.0; f.q = -78.0; return f; }
private static BranchData legBranchData(String twtId, Leg1 leg, Complex starVoltage, double epsilonX, boolean applyReactanceCorrection) { // In IIDM only the Leg1 has admittance to ground // And it is modeled at end corresponding to star bus return legBranchData(twtId, Side.ONE, leg, leg.getG(), leg.getB(), leg.getRatedU(), starVoltage, epsilonX, applyReactanceCorrection); }
private Flow sum(Flow... flows) { Flow sum = new Flow(); sum.id = "SUM"; for (Flow f : flows) { sum.p += f.p; sum.q += f.q; } return sum; }