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);
if (EchUtil.isSameBus(bus1, bus2)) {
LOGGER.warn("skipping Switch: {}; bus1 is equal to bus2: {}", sw.getId(), bus1 != null ? bus1.getId() : bus1);
continue;
}
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));
}
}
}