public static EurostagFakeNodes build(Network network, EurostagEchExportConfig config) { Objects.requireNonNull(network); Objects.requireNonNull(config); BiMap<String, String> fakeNodesMap = HashBiMap.create(new HashMap<>()); AtomicLongMap<String> countUsesMap = AtomicLongMap.create(); //adds 2 default fake nodes fakeNodesMap.put(EchUtil.FAKE_NODE_NAME1, EchUtil.FAKE_NODE_NAME1); countUsesMap.getAndIncrement(EchUtil.FAKE_NODE_NAME1); fakeNodesMap.put(EchUtil.FAKE_NODE_NAME2, EchUtil.FAKE_NODE_NAME2); countUsesMap.getAndIncrement(EchUtil.FAKE_NODE_NAME2); Identifiables.sort(network.getVoltageLevels()).stream().map(VoltageLevel::getId).forEach(vlId -> fakeNodesMap.put(vlId, newEsgId(fakeNodesMap, vlId))); return new EurostagFakeNodes(fakeNodesMap, countUsesMap, network); }
public static Path createTopoCacheDir(Network network, Interval histoInterval, double correlationThreshold, double probabilityThreshold) throws IOException { return PlatformConfig.defaultCacheManager().newCacheEntry("topo") .withKey(histoInterval.toString()) .withKey(Double.toString(correlationThreshold)) .withKey(Double.toString(probabilityThreshold)) .withKeys(StreamSupport.stream(network.getVoltageLevels().spliterator(), false) .map(Identifiable::getId) .sorted() .collect(Collectors.toList())) .build() .create(); }
public static Set<Zone> getZone(ActionsContingencies actionContingencies, Network network) { Set<Zone> zones = new HashSet<Zone>(); Zones xmlZones = actionContingencies.getZones(); Iterable<VoltageLevel> voltageLevels = network.getVoltageLevels(); for (VoltageLevel vl: voltageLevels) { String networkVoltagelevelId = vl.getId(); for (Zone z :xmlZones.getZone()) { if (z.getVoltageLevels() != null) { for (eu.itesla_project.iidm.actions_contingencies.xml.mapping.VoltageLevel zvl : z.getVoltageLevels().getVoltageLevel()) { if (networkVoltagelevelId.equals(zvl.getID())) { zones.add(z); break; } } } } } return zones; }
/** * Automatically find the best slack bus list */ public static Bus selectSlackbus(Network network, EurostagEchExportConfig config) { // avoid buses connected to a switch because of Eurostag LF crash (LU factorisation issue) Set<String> busesToAvoid = new HashSet<>(); for (VoltageLevel vl : network.getVoltageLevels()) { for (Switch s : EchUtil.getSwitches(vl, config)) { busesToAvoid.add(EchUtil.getBus1(vl, s.getId(), config).getId()); busesToAvoid.add(EchUtil.getBus2(vl, s.getId(), config).getId()); } } Bus bus = selectSlackbusCriteria1(network, config, busesToAvoid); if (bus == null) { bus = selectSlackbusCriteria1(network, config, Collections.emptySet()); } return bus; }
for (VoltageLevel vl : network.getVoltageLevels()) { vl.getProperties().setProperty(CASE_DATE, network.getCaseDate().toString()); vl.getProperties().setProperty(FORECAST_DISTANCE, Integer.toString(network.getForecastDistance()));
for (VoltageLevel station : network.getVoltageLevels()) { if (station.getName().equals(connectingStation)) {
public void build(Network network) { // build a unique topology for each of the substation reflecting history Map<String, UniqueTopology> uniqueTopos = build(); // remove from the reference network equipments not in the history, i.e always disconnected in the history cleanNetwork(network, uniqueTopos); // apply unique topology to the network for (VoltageLevel vl : network.getVoltageLevels()) { UniqueTopology uniqueTopo = uniqueTopos.get(vl.getId()); // uniqueTopo.print(System.out); uniqueTopo.apply(network); } Networks.printBalanceSummary("unique topo", network, LOGGER); new UniqueTopologyChecker(network, topoHisto, uniqueTopos, dict).check(); }
public static void fixVoltageLimits(Network network, HistoDbClient histoDbClient, Interval interval) throws IOException, InterruptedException { for (VoltageLevel vl : network.getVoltageLevels()) { attributeIds.add(createVoltageAttributeId(vl)); for (VoltageLevel vl : network.getVoltageLevels()) { HistoDbNetworkAttributeId attributeId = createVoltageAttributeId(vl);
for (VoltageLevel vl : Lists.newArrayList(network.getVoltageLevels())) { if (!uniqueTopos.containsKey(vl.getId())) { substationsRemoved.add(vl.getId());
for (VoltageLevel vl : network.getVoltageLevels()) { for (Switch s : EchUtil.getSwitches(vl, config)) { Bus bus1 = EchUtil.getBus1(vl, s.getId(), config);
for (VoltageLevel station : network.getVoltageLevels()) { if (station.getName().equals(pilotStation)) {
for (VoltageLevel station : network.getVoltageLevels()) { if (station.getName().equals(pilotPoint)) {
try (HistoDbClient histoDbClient = config.getHistoDbClientFactoryClass().newInstance().create()) { Set<HistoDbAttributeId> attrIds = new LinkedHashSet<>(); for (VoltageLevel vl : network.getVoltageLevels()) { attrIds.add(new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.V)); for (VoltageLevel vl : network.getVoltageLevels()) { HistoDbNetworkAttributeId attrId = new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.V); double min = stats.getValue(HistoDbStatsType.MIN, attrId, Float.NaN) / vl.getNominalV();
for (VoltageLevel vl : latestNetwork.getVoltageLevels()) { if (equipIds != null && !equipIds.contains(vl.getId())) { continue;
for (VoltageLevel vl : Identifiables.sort(network.getVoltageLevels())) { for (Switch sw : Identifiables.sort(EchUtil.getSwitches(vl, config))) { Bus bus1 = EchUtil.getBus1(vl, sw.getId(), config);
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)); } } }
connectCouplingList = Identifiables.sort(_network.getVoltageLevels()); exportConnectCouplingDevices(writerMo, modContext, modelicaModelsList, modelicaSim);
new Column("id"), new Column(DESCRIPTION))) { for (VoltageLevel vl : network.getVoltageLevels()) { int num = mapper.getInt(AmplSubset.VOLTAGE_LEVEL, vl.getId()); double nomV = vl.getNominalV();