private EsgLoad createLoad(ConnectionBus bus, String loadId, double p0, double q0) { EsgConnectionStatus status = bus.isConnected() ? EsgConnectionStatus.CONNECTED : EsgConnectionStatus.NOT_CONNECTED; return new EsgLoad(status, new Esg8charName(dictionary.getEsgId(loadId)), new Esg8charName(dictionary.getEsgId(bus.getId())), 0f, 0f, p0, 0f, 0f, q0); }
Esg8charName nodeName = load.getZnodlo(); Esg8charName loadName = load.getZnamlo(); if (nodeName == null || "".equals(nodeName.toString())) { LOGGER.error("Unconnected load in Esg network :" + loadName.toString()); } else { EsgNode esgNode = networkEch.getNode(nodeName.toString()); if (esgNode.getVbase() <= 100) { // Only HV loads concernedLoads.add(loadName.toString()); EsgNode esgNode = networkEch.getNode(nodeName.toString()); double vCurHV = esgNode.getVinit(); int ktap8 = (int) Math.round(firstPlot + (lastPlot - firstPlot) / (vB - vT) * (vCurHV - vT)); double qf = qi - ucc / 100 * (pi * pi + qi * qi) / rate * 1 / (vInit * vInit); Esg8charName lvNodeName = new Esg8charName(loadName.toString().toUpperCase()); // Upper Case for Eurostag 5.1.1 networkEch.addNode(new EsgNode(esgNode.getArea(), lvNodeName, vBase, vInit, 0, false)); EsgBranchName transfoName = new EsgBranchName(nodeName, lvNodeName, '1');
private EsgNode createNode(String busId, String countryIsoCode, double nominalV, double v, double angle, boolean slackBus) { return new EsgNode(new Esg2charName(countryIsoCode), new Esg8charName(dictionary.getEsgId(busId)), nominalV, Double.isNaN(v) ? 1.0 : v / nominalV, Double.isNaN(angle) ? 0.0 : angle, slackBus); }
public void addCapacitorsOrReactorBanks(EsgCapacitorOrReactorBank bank) { if (capacitorsOrReactorBanks.containsKey(bank.getZnamba().toString())) { throw new IllegalArgumentException("Capacitor or reactor bank '" + bank.getZnamba() + "' already exists"); } capacitorsOrReactorBanks.put(bank.getZnamba().toString(), bank); }
private void createAdditionalBank(EsgNetwork esgNetwork, TwoWindingsTransformer twt, String nodeName, Set<String> additionalBanksIds, double rcapba, double plosba) { if ((Math.abs(plosba) > G_EPSILON) || (Math.abs(rcapba) > B_EPSILON)) { //simple new bank naming: 4 first letters of the node name, 7th letter of the node name, 'C', 2 digits order code String nnodeName = Strings.padEnd(nodeName, 8, ' '); String newBankNamePrefix = nnodeName.substring(0, 4) + nnodeName.charAt(6) + 'C'; String newBankName = newBankNamePrefix + "00"; int counter = 1; while (additionalBanksIds.contains(newBankName)) { String newCounter = String.format("%02d", counter++); if (newCounter.length() > 2) { throw new RuntimeException("Renaming error " + nodeName + " -> " + newBankName); } newBankName = newBankNamePrefix + newCounter; } additionalBanksIds.add(newBankName); LOGGER.info("create additional bank with id: {} at node: {}, for twt: {} ( B={}, G={} ); rcapba={}, plosba={}", newBankName, nodeName, twt, twt.getB(), twt.getG(), rcapba, plosba); esgNetwork.addCapacitorsOrReactorBanks(new EsgCapacitorOrReactorBank(new Esg8charName(newBankName), new Esg8charName(nodeName), 1, plosba, rcapba, 1, EsgCapacitorOrReactorBank.RegulatingMode.NOT_REGULATING)); } }
private EsgLine createLine(String id, ConnectionBus bus1, ConnectionBus bus2, double nominalV, double r, double x, double g, double b, EsgGeneralParameters parameters) { EsgBranchConnectionStatus status = getStatus(bus1, bus2); float rate = parameters.getSnref(); double vnom2 = Math.pow(nominalV, 2); double rb = r * parameters.getSnref() / vnom2; double rxb = x * parameters.getSnref() / vnom2; double gs = g / parameters.getSnref() * vnom2; double bs = b / parameters.getSnref() * vnom2; return new EsgLine(new EsgBranchName(new Esg8charName(dictionary.getEsgId(bus1.getId())), new Esg8charName(dictionary.getEsgId(bus2.getId())), parallelIndexes.getParallelIndex(id)), status, rb, rxb, gs, bs, rate); }
public void addACDCVscConverter(EsgACDCVscConverter vscConverter) { if (vscConverters.containsKey(vscConverter.getZnconv().toString())) { throw new IllegalArgumentException("ACDCVscConverter '" + vscConverter.getZnconv() + "' already exists"); } vscConverters.put(vscConverter.getZnconv().toString(), vscConverter); }
private EsgDissymmetricalBranch createDissymmetricalBranch(String id, ConnectionBus bus1, ConnectionBus bus2, double nominalV, double r, double x, double g1, double b1, double g2, double b2, EsgGeneralParameters parameters) { EsgBranchConnectionStatus status = getStatus(bus1, bus2); float rate = parameters.getSnref(); double vnom2 = Math.pow(nominalV, 2); double rb = (r * parameters.getSnref()) / vnom2; double rxb = (x * parameters.getSnref()) / vnom2; double gs1 = (g1 / parameters.getSnref()) * vnom2; double bs1 = (b1 / parameters.getSnref()) * vnom2; double gs2 = (g2 / parameters.getSnref()) * vnom2; double bs2 = (b2 / parameters.getSnref()) * vnom2; return new EsgDissymmetricalBranch(new EsgBranchName(new Esg8charName(dictionary.getEsgId(bus1.getId())), new Esg8charName(dictionary.getEsgId(bus2.getId())), parallelIndexes.getParallelIndex(id)), status, rb, rxb, gs1, bs1, rate, rb, rxb, gs2, bs2); }
private void createCouplingDevices(EsgNetwork esgNetwork) { for (VoltageLevel vl : Identifiables.sort(network.getVoltageLevels())) { for (Switch sw : Identifiables.sort(EchUtil.getSwitches(vl, config))) { Bus bus1 = EchUtil.getBus1(vl, sw.getId(), config); Bus bus2 = EchUtil.getBus2(vl, sw.getId(), config); //do not export the Switch if bus1==bus2 if (EchUtil.isSameBus(bus1, bus2)) { LOGGER.warn("skipping Switch: {}; bus1 is equal to bus2: {}", sw.getId(), bus1 != null ? bus1.getId() : bus1); continue; } // skip switches not in the main connected component if (config.isExportMainCCOnly() && (!EchUtil.isInMainCc(bus1) || !EchUtil.isInMainCc(bus2))) { LOGGER.warn("not in main component, skipping Switch: {} {} {}", bus1.getId(), bus2.getId(), sw.getId()); continue; } esgNetwork.addCouplingDevice(new EsgCouplingDevice(new EsgBranchName(new Esg8charName(dictionary.getEsgId(bus1.getId())), new Esg8charName(dictionary.getEsgId(bus2.getId())), parallelIndexes.getParallelIndex(sw.getId())), sw.isOpen() ? EsgCouplingDevice.ConnectionStatus.OPEN : EsgCouplingDevice.ConnectionStatus.CLOSED)); } } }
private void createBanks(EsgNetwork esgNetwork) { for (ShuntCompensator sc : Identifiables.sort(network.getShunts())) { // skip shunts not in the main connected component if (config.isExportMainCCOnly() && !EchUtil.isInMainCc(sc, config.isNoSwitch())) { LOGGER.warn("not in main component, skipping ShuntCompensator: {}", sc.getId()); continue; } ConnectionBus bus = ConnectionBus.fromTerminal(sc.getTerminal(), config, fakeNodes); //...number of steps in service int ieleba = bus.isConnected() ? sc.getCurrentSectionCount() : 0; // not really correct, because it can be connected with zero section, EUROSTAG should be modified... double vnom = sc.getTerminal().getVoltageLevel().getNominalV(); double plosba = 1000 * vnom * vnom * 0.; // no active lost in the iidm shunt compensator. Expressed in kw double rcapba = vnom * vnom * sc.getbPerSection(); int imaxba = sc.getMaximumSectionCount(); EsgCapacitorOrReactorBank.RegulatingMode xregba = EsgCapacitorOrReactorBank.RegulatingMode.NOT_REGULATING; esgNetwork.addCapacitorsOrReactorBanks(new EsgCapacitorOrReactorBank(new Esg8charName(dictionary.getEsgId(sc.getId())), new Esg8charName(dictionary.getEsgId(bus.getId())), ieleba, plosba, rcapba, imaxba, xregba)); } }
private void checkBranchName(EsgBranchName name) { if (getNode(name.getNode1Name().toString()) == null) { throw new RuntimeException("Line '" + name + "' reference an unknown connection node '" + name.getNode1Name() + "'"); } if (getNode(name.getNode2Name().toString()) == null) { throw new RuntimeException("Line '" + name + "' reference an unknown connection node '" + name.getNode2Name() + "'"); } }
dictionary.addIfNotExist(dl.getId(), new EsgBranchName(new Esg8charName(dictionary.getEsgId(bus1.getId())), new Esg8charName(dictionary.getEsgId(bus2.getId())), '1').toString()); new EsgBranchName(new Esg8charName(dictionary.getEsgId(bus1.getId())), new Esg8charName(dictionary.getEsgId(bus2.getId())), parallelIndexes.getParallelIndex(sw.getId())).toString()); EsgBranchName ebname = new EsgBranchName(new Esg8charName(dictionary.getEsgId(bus1.getId())), new Esg8charName(dictionary.getEsgId(bus2.getId())), parallelIndexes.getParallelIndex(l.getId())); dictionary.addIfNotExist(l.getId(), ebname.toString()); dictionary.addIfNotExist(twt.getId(), new EsgBranchName(new Esg8charName(dictionary.getEsgId(bus1.getId())), new Esg8charName(dictionary.getEsgId(bus2.getId())), parallelIndexes.getParallelIndex(twt.getId())).toString());
if (transformer.getZbusr() != null && getNode(transformer.getZbusr().toString()) == null) { throw new RuntimeException("Transformer '" + transformer.getName() + "' reference an unknown regulating node '" + transformer.getZbusr() + "'"); if (getNode(load.getZnodlo().toString()) == null) { throw new RuntimeException("Load '" + load.getZnamlo() + "' reference an unknown connection node '" + load.getZnodlo() + "'"); if (getNode(generator.getZnodge().toString()) == null) { throw new RuntimeException("Generator '" + generator.getZnamge() + "' reference an unknown connection node '" + generator.getZnodge() + "'"); if (getNode(generator.getZregnoge().toString()) == null) { throw new RuntimeException("Generator '" + generator.getZnamge() + "' reference an unknown regulating node '" + generator.getZregnoge() + "'"); if (getNode(bank.getZnodba().toString()) == null) { throw new RuntimeException("Capacitor or reactor bank '" + bank.getZnamba() + "' reference an unknown connection node '" + bank.getZnodba() + "'"); if (getNode(svc.getZnodsvc().toString()) == null) { throw new RuntimeException("Static VAR compensator '" + svc.getZnamsvc() + "' reference an unknown connection node '" + svc.getZnodsvc() + "'"); for (EsgGenerator g : getGenerators()) { if (g.getXregge() == EsgRegulatingMode.REGULATING && Math.abs(g.getQgmax() - g.getQgmin()) < MIN_REACTIVE_RANGE) { minReactiveRangePb.add(g.getZnamge().toString()); g.setXregge(EsgRegulatingMode.NOT_REGULATING);
esgNetwork.addGenerator(new EsgGenerator(new Esg8charName(dictionary.getEsgId(g.getId())), new Esg8charName(dictionary.getEsgId(bus.getId())), pgmin, pgen, pgmax, qgmin, qgen, qgmax, mode, vregge, new Esg8charName(dictionary.getEsgId(regulatingBus.getId())), qgensh, status)); } catch (Throwable t) {