public DataMiningFacadeParams(Network network, boolean generationSampled, boolean boundariesSampled, Interval interval) { gensIds = new ArrayList<>(); if (generationSampled) { for (Generator gen : network.getGenerators()) { if (gen.getEnergySource().isIntermittent()) { gensIds.add(gen.getId()); } } } // it seems that elements order in iidm model is not the same // after two subsequent network initialization from file Collections.sort(gensIds); loadsIds = new ArrayList<>(); for (Load load : network.getLoads()) { loadsIds.add(load.getId()); } Collections.sort(loadsIds); danglingLinesIds = new ArrayList<>(); if (boundariesSampled) { for (DanglingLine dl : network.getDanglingLines()) { danglingLinesIds.add(dl.getId()); } } Collections.sort(danglingLinesIds); countries = EnumSet.copyOf(network.getCountries()); this.interval = interval; }
private void writeDanglingLineCurrentLimits(TableFormatter formatter) throws IOException { for (DanglingLine dl : network.getDanglingLines()) { String branchId = dl.getId(); if (dl.getCurrentLimits() != null) { writeTemporaryCurrentLimits(dl.getCurrentLimits(), formatter, branchId, true, ""); } } }
for (DanglingLine dl2 : Lists.newArrayList(other.getDanglingLines())) { Map<String, DanglingLine> dl1byXnodeCode = new HashMap<>(); for (DanglingLine dl1 : getDanglingLines()) {
injections.add(sc); for (DanglingLine dl : network.getDanglingLines()) { injections.add(dl);
public void load(Network network, HistoDbClient histoDbClient) throws IOException, InterruptedException { Set<HistoDbAttributeId> attributeIds = new LinkedHashSet<>(); for (Load l : network.getLoads()) { if (l.getLoadType() != LoadType.FICTITIOUS) { attributeIds.add(new HistoDbNetworkAttributeId(l.getId(), HistoDbAttr.P)); } } for (DanglingLine dl : network.getDanglingLines()) { attributeIds.add(new HistoDbNetworkAttributeId(dl.getId(), HistoDbAttr.P0)); } for (Generator g : network.getGenerators()) { attributeIds.add(new HistoDbNetworkAttributeId(g.getId(), HistoDbAttr.P)); } HistoDbStats stats = histoDbClient.queryStats(attributeIds, histoInterval, HistoDbHorizon.SN, true); for (Load l : network.getLoads()) { String id = l.getId(); loadLimits.put(id, range(id, HistoDbAttr.P, stats)); } for (DanglingLine dl : network.getDanglingLines()) { String id = dl.getId(); danglingLineLimits.put(id, range(id, HistoDbAttr.P0, stats)); } for (Generator g : network.getGenerators()) { String id = g.getId(); generatorLimits.put(id, range(id, HistoDbAttr.P, stats)); } }
private static void addDanglingLines(Network network, ConnectedPower balanceMainCC, ConnectedPower balanceOtherCC) { for (DanglingLine dl : network.getDanglingLines()) { Terminal.BusBreakerView view = dl.getTerminal().getBusBreakerView(); if (view.getBus() != null) { if (view.getBus().isInMainConnectedComponent()) { balanceMainCC.connectedLoads.add(dl.getId()); balanceMainCC.connectedLoadVolume += dl.getP0(); } else { balanceOtherCC.connectedLoads.add(dl.getId()); balanceOtherCC.connectedLoadVolume += dl.getP0(); } } else { if (view.getConnectableBus().isInMainConnectedComponent()) { balanceMainCC.disconnectedLoads.add(dl.getId()); balanceMainCC.disconnectedLoadVolume += dl.getP0(); } else { balanceOtherCC.disconnectedLoads.add(dl.getId()); balanceOtherCC.disconnectedLoadVolume += dl.getP0(); } } } }
for (DanglingLine dl : network.getDanglingLines()) { if (exportConfig.isExportMainCCOnly() && !EchUtil.isInMainCc(dl, exportConfig.isNoSwitch())) { continue;
for (DanglingLine dl : Identifiables.sort(network.getDanglingLines())) {
private static void fillDanglingLines(StringToIntMapper<AmplSubset> mapper, Network network) { for (DanglingLine dl : network.getDanglingLines()) { mapper.newInt(AmplSubset.VOLTAGE_LEVEL, dl.getId()); mapper.newInt(AmplSubset.BUS, dl.getId()); mapper.newInt(AmplSubset.BRANCH, dl.getId()); mapper.newInt(AmplSubset.LOAD, dl.getId()); // limits if (dl.getCurrentLimits() != null) { createLimitsIds(mapper, dl.getCurrentLimits(), dl.getId(), ""); } } }
for (DanglingLine dl : Identifiables.sort(network.getDanglingLines())) { if (onlyMainCC) { Terminal t = dl.getTerminal();
Identifiables.sort(network.getDanglingLines()).forEach(dl -> { busIds.add(EchUtil.getBusId(dl)); loadIds.add(EchUtil.getLoadId(dl)); NAMING_STRATEGY.fillDictionary(dictionary, EurostagNamingStrategy.NameType.VSC, converterStationsIds); for (DanglingLine dl : Identifiables.sort(network.getDanglingLines())) {
private void createLoads(EsgNetwork esgNetwork) { for (Load l : Identifiables.sort(network.getLoads())) { // skip loads not in the main connected component if (config.isExportMainCCOnly() && !EchUtil.isInMainCc(l, config.isNoSwitch())) { LOGGER.warn("not in main component, skipping Load: {}", l.getId()); continue; } ConnectionBus bus = ConnectionBus.fromTerminal(l.getTerminal(), config, fakeNodes); esgNetwork.addLoad(createLoad(bus, l.getId(), l.getP0(), l.getQ0())); } for (DanglingLine dl : Identifiables.sort(network.getDanglingLines())) { // skip dls not in the main connected component if (config.isExportMainCCOnly() && !EchUtil.isInMainCc(dl, config.isNoSwitch())) { LOGGER.warn("not in main component, skipping DanglingLine: {}", dl.getId()); continue; } ConnectionBus bus = new ConnectionBus(true, EchUtil.getBusId(dl)); esgNetwork.addLoad(createLoad(bus, EchUtil.getLoadId(dl), dl.getP0(), dl.getQ0())); } }
public static void prepareBaseCase(Network network, OfflineWorkflowCreationParameters creationParameters, HistoDbClient histoDbClient) throws IOException, InterruptedException { clearSv(network); // connect loads and intermittent generation and boundary lines (so everything that can be sampled) for (Load l : network.getLoads()) { l.getTerminal().connect(); } if (creationParameters.isGenerationSampled()) { for (Generator g : network.getGenerators()) { if (g.getEnergySource().isIntermittent()) { g.getTerminal().connect(); } } } if (creationParameters.isBoundariesSampled()) { for (DanglingLine dl : network.getDanglingLines()) { dl.getTerminal().connect(); } } // TODO also override generator regulating status, phase shitfer regulating status and transformer regulating status? // resize voltage limits with historical data HistoDbUtil.fixVoltageLimits(network, histoDbClient, creationParameters.getHistoInterval()); // temporary workaround for Elia data, missing pmin, pmax HistoDbUtil.fixGeneratorActiveLimits(network, histoDbClient, creationParameters.getHistoInterval()); }
private void writeDanglingLineMiddleBuses(AmplExportContext context, TableFormatter formatter) throws IOException { for (DanglingLine dl : network.getDanglingLines()) { Terminal t = dl.getTerminal(); Bus b = AmplUtil.getBus(dl.getTerminal()); int middleCcNum = getDanglingLineMiddleBusComponentNum(context, dl); if (connectedComponentToExport(middleCcNum)) { String middleBusId = getDanglingLineMiddleBusId(dl); String middleVlId = getDanglingLineMiddleVoltageLevelId(dl); context.busIdsToExport.add(middleBusId); int middleBusNum = mapper.getInt(AmplSubset.BUS, middleBusId); int middleVlNum = mapper.getInt(AmplSubset.VOLTAGE_LEVEL, middleVlId); SV sv = new SV(t.getP(), t.getQ(), b != null ? b.getV() : Double.NaN, b != null ? b.getAngle() : Double.NaN).otherSide(dl); double nomV = t.getVoltageLevel().getNominalV(); double v = sv.getU() / nomV; double theta = Math.toRadians(sv.getA()); formatter.writeCell(variantIndex) .writeCell(middleBusNum) .writeCell(middleVlNum) .writeCell(middleCcNum) .writeCell(v) .writeCell(theta) .writeCell(0.0) // 0 MW injected at dangling line internal bus .writeCell(0.0) // 0 MVar injected at dangling line internal bus .writeCell(faultNum) .writeCell(actionNum) .writeCell(middleBusId); } } }
for (DanglingLine dl : network.getDanglingLines()) { boundariesP += dl.getP0(); boundariesQ += dl.getQ0();
addExtensions(num, l); for (DanglingLine dl : network.getDanglingLines()) { String middleBusId = getDanglingLineMiddleBusId(dl); String id = dl.getId();
for (DanglingLine dl : Identifiables.sort(network.getDanglingLines())) {
private void writeDanglingLines(AmplExportContext context, TableFormatter formatter) throws IOException { for (DanglingLine dl : network.getDanglingLines()) { Terminal t = dl.getTerminal(); Bus bus1 = AmplUtil.getBus(t);
sc.getTerminal().setP(Float.NaN).setQ(Float.NaN); for (DanglingLine dl : network.getDanglingLines()) { dl.getTerminal().setP(Float.NaN).setQ(Float.NaN);
for (DanglingLine dl : network.getDanglingLines()) { String vlId = getDanglingLineMiddleVoltageLevelId(dl); int num = mapper.getInt(AmplSubset.VOLTAGE_LEVEL, vlId);