public String getCountry() { return geographicalCode != null ? geographicalCode.getCountry().toString() : null; }
@Override public void serialize(SubjectInfoExtension extension, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { jsonGenerator.writeStartObject(); jsonGenerator.writeFieldName("countries"); jsonGenerator.writeStartArray(); for (Country country : extension.getCountries()) { jsonGenerator.writeString(country.name()); } jsonGenerator.writeEndArray(); jsonGenerator.writeFieldName("nominalVoltages"); jsonGenerator.writeStartArray(); for (double nominalVoltage : extension.getNominalVoltages()) { jsonGenerator.writeNumber(nominalVoltage); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); }
public static Optional<Country> fromRegionName(String gr) { if (gr == null) { return Optional.empty(); } if (gr.equals("D1") || gr.equals("D2") || gr.equals("D4") || gr.equals("D7") || gr.equals("D8")) { return Optional.of(Country.DE); } try { return Optional.of(Country.valueOf(gr)); } catch (IllegalArgumentException ignored) { // Ignore } return Optional.empty(); }
public static Country defaultCountry() { return Country.values()[0]; } }
assertEquals(LimitViolationType.values().length, filter.getViolationTypes().size()); filter.setCountries(null); assertEquals(Country.values().length, filter.getCountries().size()); try { filter.setViolationTypes(EnumSet.noneOf(LimitViolationType.class));
private MLCell injectionCountriesAsMLChar(List<StochasticVariable> stochasticVariables) { int colsSize = stochasticVariables.size() * 2; MLCell injectionsCountries = new MLCell("nat_ID", new int[]{1, colsSize}); int i = 0; for (StochasticVariable injection : stochasticVariables) { injectionsCountries.set(new MLChar("", injection.getCountry().name()), 0, i); i++; injectionsCountries.set(new MLChar("", injection.getCountry().name()), 0, i); // twice, for P and Q i++; } return injectionsCountries; }
private void loadCountriesConfig(JsonNode rootNode) { if (countryListView != null) { ArrayNode countriesNode = (ArrayNode) rootNode.get("countries"); Set<Country> visibleCountries = EnumSet.noneOf(Country.class); for (int i = 0; i < countriesNode.size(); i++) { visibleCountries.add(Country.valueOf(countriesNode.get(i).asText())); } for (Country country : countryListView.getItems()) { if (visibleCountries.contains(country)) { countryListView.getCheckModel().check(country); } else { countryListView.getCheckModel().clearCheck(country); } } } }
private EsgNode createNode(String busId, VoltageLevel vl, double v, double angle, boolean slackBus) { return createNode(busId, vl.getSubstation().getCountry().name(), vl.getNominalV(), v, angle, slackBus); }
@Override protected void writeRootElementAttributes(Substation s, Network n, NetworkXmlWriterContext context) throws XMLStreamException { context.getWriter().writeAttribute("country", context.getAnonymizer().anonymizeCountry(s.getCountry()).toString()); if (s.getTso() != null) { context.getWriter().writeAttribute("tso", context.getAnonymizer().anonymizeString(s.getTso())); } if (!s.getGeographicalTags().isEmpty()) { context.getWriter().writeAttribute("geographicalTags", s.getGeographicalTags().stream() .map(tag -> context.getAnonymizer().anonymizeString(tag)) .collect(Collectors.joining(","))); } }
if (countryListView != null) { for (int i : countryListView.getCheckModel().getCheckedIndices()) { countriesNode.add(countryListView.getCheckModel().getItem(i).name());
@Override protected Substation readRootElementAttributes(SubstationAdder adder, NetworkXmlReaderContext context) { Country country = context.getAnonymizer().deanonymizeCountry(Country.valueOf(context.getReader().getAttributeValue(null, "country"))); String tso = context.getAnonymizer().deanonymizeString(context.getReader().getAttributeValue(null, "tso")); String geographicalTags = context.getReader().getAttributeValue(null, "geographicalTags"); if (geographicalTags != null) { adder.setGeographicalTags(Arrays.stream(geographicalTags.split(",")) .map(tag -> context.getAnonymizer().deanonymizeString(tag)) .toArray(size -> new String[size])); } return adder.setCountry(country) .setTso(tso) .add(); }
private static Consumer<? super LimitViolation> writeLinePreContingencyViolations(Network network, TableFormatter formatter, boolean writeName) { return violation -> { try { formatter.writeEmptyCell() .writeCell(writeName ? violation.getSubjectName() : violation.getSubjectId()) .writeCell(LimitViolationHelper.getVoltageLevelId(violation, network, writeName)) .writeCell(LimitViolationHelper.getCountry(violation, network).name()) .writeCell((int) LimitViolationHelper.getNominalVoltage(violation, network)) .writeCell(violation.getLimitType().name()) .writeCell(getViolationName(violation)) .writeCell(violation.getValue()) .writeCell(getViolationLimit(violation)) .writeCell(getAbsValueLimit(violation)) .writeCell(getViolationRate(violation)); } catch (IOException e) { throw new UncheckedIOException(e); } }; }
.contains(dl.getTerminal().getVoltageLevel().getSubstation().getCountry().toString())) { continue; .contains(g.getTerminal().getVoltageLevel().getSubstation().getCountry().toString())) { continue; .contains(l.getTerminal().getVoltageLevel().getSubstation().getCountry().toString())) { continue; .contains(sc.getTerminal().getVoltageLevel().getSubstation().getCountry().toString())) { continue; .contains(wt2.getTerminal1().getVoltageLevel().getSubstation().getCountry().toString()) && !countries .contains(wt2.getTerminal2().getVoltageLevel().getSubstation().getCountry().toString())) { continue; wt3.getLeg1().getTerminal().getVoltageLevel().getSubstation().getCountry().toString()) && !countries.contains( wt3.getLeg2().getTerminal().getVoltageLevel().getSubstation().getCountry().toString()) && !countries.contains( wt3.getLeg3().getTerminal().getVoltageLevel().getSubstation().getCountry().toString())) { continue; l.getTerminal1().getVoltageLevel().getSubstation().getGeographicalTags())) && (countries == null || countries.contains( l.getTerminal1().getVoltageLevel().getSubstation().getCountry().toString()))) { String terminalId = l.getId() + "__TO__" + l.getTerminal1().getVoltageLevel().getId(); if (measureTypes == null || measureTypes.contains("P")) {
} else { try { country = Country.valueOf(gr.getName()); } catch (IllegalArgumentException ignored) {
private static Consumer<? super LimitViolation> writeLineLimitsViolations(Network network, TableFormatter formatter, boolean writeName) { return violation -> { try { formatter.writeCell(writeName ? violation.getSubjectName() : violation.getSubjectId()) .writeCell(LimitViolationHelper.getVoltageLevelId(violation, network, writeName)) .writeCell(LimitViolationHelper.getCountry(violation, network).name()) .writeCell((int) LimitViolationHelper.getNominalVoltage(violation, network)) .writeCell(violation.getLimitType().name()) .writeCell(getViolationName(violation)) .writeCell(violation.getValue()) .writeCell(getViolationLimit(violation)) .writeCell(getAbsValueLimit(violation)) .writeCell(getViolationRate(violation)); } catch (IOException e) { throw new UncheckedIOException(e); } }; }
private void createAreas(EsgNetwork esgNetwork) { esgNetwork.addArea(new EsgArea(new Esg2charName(EchUtil.FAKE_AREA), EsgArea.Type.AC)); for (Country c : network.getCountries()) { esgNetwork.addArea(new EsgArea(new Esg2charName(c.toString()), EsgArea.Type.AC)); } if (network.getHvdcLineCount() > 0) { esgNetwork.addArea(new EsgArea(new Esg2charName("DC"), EsgArea.Type.DC)); } }
Country defaultCountry = Country.valueOf((String) Importers.readParameter(FORMAT, parameters, DEFAULT_COUNTRY_PARAMETER)); boolean usePsseNamingStrategy = (Boolean) Importers.readParameter(FORMAT, parameters, USE_PSSE_NAMING_STRATEGY_PARAMETER); List<String> substationIdExcludedFromMapping = (List<String>) Importers.readParameter(FORMAT, parameters, SUBSTATION_ID_EXCLUDED_FROM_MAPPING);