com.powsybl.iidm.network.Network.getId()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中com.powsybl.iidm.network.Network.getId()方法的一些代码示例,展示了Network.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Network.getId()方法的具体详情如下:
包路径:com.powsybl.iidm.network.Network
类名称:Network
方法名:getId

Network.getId介绍

[英]Get a equipment.
[中]找一台设备。

代码示例

代码示例来源:origin: itesla/ipst

@Override
public synchronized List<Contingency> getContingencies() {
  LOGGER.info("Network {}: getting contingencies", network.getId());
  return contingenciesActionsDbClient.getContingencies(network);
}

代码示例来源:origin: itesla/ipst

public MontecarloSamplerImpl(Network network, ComputationManager computationManager, ForecastErrorsDataStorage forecastErrorsDataStorage, MontecarloSamplerConfig config) {
  Objects.requireNonNull(network, "network is null");
  Objects.requireNonNull(computationManager, "computationManager is null");
  Objects.requireNonNull(forecastErrorsDataStorage, "forecast errors data storage is null");
  Objects.requireNonNull(config, "config is null");
  LOGGER.info("Network {}: {}", network.getId(), config.toString());
  this.network = network;
  this.computationManager = computationManager;
  this.forecastErrorsDataStorage = forecastErrorsDataStorage;
  this.config = config;
  currentSampleIndex = -1;
}

代码示例来源:origin: itesla/ipst

@Override
public List<CommandExecution> before(Path workingDir) throws IOException {
  // put mat files in working dir
  Path localForecastErrorsDataFile = Paths.get(workingDir.toString(), MCSINPUTFILEPREFIX + "forecast_errors_" + timeHorizon.getLabel() + ".mat");
  forecastErrorsDataStorage.getForecastErrorsFile(feAnalysisId, timeHorizon, localForecastErrorsDataFile);
  Path localNetworkDataMatFile = Paths.get(workingDir.toString(), MCSINPUTFILEPREFIX + network.getId() + ".mat");
  Files.copy(networkDataMatFile, localNetworkDataMatFile);
  LOGGER.info("Preparing FPF input data for {} network", network.getId());
  Command cmd = createFPFCommand(localForecastErrorsDataFile, localNetworkDataMatFile);
  return Collections.singletonList(new CommandExecution(cmd, 1));
}

代码示例来源:origin: itesla/ipst

public SamplingNetworkData createSamplingNetworkData() {
  HashMap<String, Integer> busMapping = new HashMap<String, Integer>();
  LOGGER.debug("Getting buses data from {} network", network.getId());
  ArrayList<BusData> busesData = getBusData(busMapping);
  LOGGER.debug("Getting generators data from {} network", network.getId());
  ArrayList<GeneratorData> generatorsData = getGeneratorData(busMapping);
  LOGGER.debug("Getting loads data from {} network", network.getId());
  ArrayList<LoadData> loadsData = getLoadData(busMapping);
  samplingData = new SamplingNetworkData(busesData, generatorsData, loadsData);
  return samplingData;
}

代码示例来源:origin: itesla/ipst

public static void exportState(Network network, Path folder, int faultNum, int actionNum) {
  Objects.requireNonNull(network);
  Objects.requireNonNull(folder);
  Properties parameters = new Properties();
  parameters.setProperty("iidm.export.xml.indent", "true");
  parameters.setProperty("iidm.export.xml.with-branch-state-variables", "true");
  DataSource dataSource = new GzFileDataSource(folder, network.getId() + "_" + faultNum + "_" + actionNum);
  Exporters.export("XIIDM", network, parameters, dataSource);
}

代码示例来源:origin: itesla/ipst

@Override
public CompletableFuture<WCAAsyncResult> runAsync(String baseStateId, WCAParameters parameters) throws Exception {
  LOGGER.info(parameters.toString());
  LOGGER.info("Network {}: starting WCA...", network.getId());
  return createWcaTask(baseStateId, parameters)
      .thenApply(clusters -> () -> clusters);
}

代码示例来源:origin: itesla/ipst

public ForecastErrorsHistoricalData createForecastErrorsHistoricalData(Path historicalDataCsvFile) throws IOException {
  LOGGER.debug("Getting stochastic variables from {} network", network.getId());
  ArrayList<StochasticVariable> stochasticVariables = FEANetworkUtils.getStochasticVariables(network, generatorsIds, loadsIds);
  LOGGER.debug("Reading historical data from cvs file {}", historicalDataCsvFile.toString());
  forecastErrorsHistoricalData = loadHistoricalDataFromCsvFile(historicalDataCsvFile, generatorsIds, loadsIds, stochasticVariables);
  //LOGGER.debug("Forecast errors historical data:\n" + forecastErrorsHistoricalData.toString());
  return forecastErrorsHistoricalData;
}

代码示例来源:origin: itesla/ipst

@Override
public void process(Network network, ComputationManager cm) throws Exception {
  Objects.requireNonNull(network);
  LOGGER.info("Execute {} post processor on network {}", getName(), network.getId());
  removeBreakers(network);
}

代码示例来源:origin: itesla/ipst

private void createMat(Network network, Path outputFolder) throws IOException {
  System.out.println("creating mat file for network " + network.getId());
  ArrayList<String> generatorsIds = NetworkUtils.getGeneratorsIds(network);
  ArrayList<String> loadsIds = NetworkUtils.getLoadsIds(network);
  SamplingNetworkData samplingNetworkData = new SamplingDataCreator(network, generatorsIds, loadsIds).createSamplingNetworkData();
  Path networkDataMatFile = Files.createTempFile(outputFolder, "mcsamplerinput_" + network.getId() + "_", ".mat");
  System.out.println("saving data of network " + network.getId() + " in file " + networkDataMatFile.toString());
  new MCSMatFileWriter(networkDataMatFile).writeSamplingNetworkData(samplingNetworkData);
}

代码示例来源:origin: itesla/ipst

@Override
  public SampledData after(Path workingDir, ExecutionReport report) throws IOException {
    report.log();
    LOGGER.debug("Network {}: retrieving sampling results from file {}", network.getId(), MCSOUTPUTFILENAME);
    try {
      return new MCSMatFileReader(workingDir.resolve(MCSOUTPUTFILENAME)).getSampledData();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}).join();

代码示例来源:origin: com.powsybl/powsybl-loadflow-results-completion

@Override
public void process(Network network, ComputationManager computationManager) throws Exception {
  Objects.requireNonNull(network);
  LOGGER.info("Execute {} post processor on network {}", getName(), network.getId());
  new LoadFlowResultsCompletion(parameters, lfParameters).run(network, computationManager);
}

代码示例来源:origin: itesla/ipst

@Override
  public WCADomainsResult after(Path workingDir, ExecutionReport report) throws IOException {
    report.log();
    WCADomainsResult domainsResult = WCAUtils.readDomainsResult(DOMAINS_CMD_ID, workingDir, WCA_UNCERTAINTIES_FILE);
    LOGGER.info("Network {}, {}: 'domains' result = {}", network.getId(), contingency == null ? "pre-contingency" : "contingency " + contingency.getId(), domainsResult.toString());
    return domainsResult;
  }
});

代码示例来源:origin: com.powsybl/powsybl-afs-ext-base

public ImportedCaseBuilder withNetwork(Network network) {
  Objects.requireNonNull(network);
  if (name == null) {
    name = network.getId();
  }
  DataSource memDataSource = new MemDataSource();
  Exporters.export("XIIDM", network, null, memDataSource);
  return withDatasource(memDataSource);
}

代码示例来源:origin: com.powsybl/powsybl-security-analysis-api

public NetworkMetadata(Network network) {
  Objects.requireNonNull(network);
  this.id = network.getId();
  this.sourceFormat = network.getSourceFormat();
  this.caseDate = network.getCaseDate();
  this.forecastDistance = network.getForecastDistance();
}

代码示例来源:origin: itesla/ipst

public static NetworkData extract(Network network) {
  Objects.requireNonNull(network, "network is null");
  LOGGER.info("Extracting data of network {}", network.getId());
  NetworkData networkData = new NetworkData(network.getId());
  extractBusesData(network, networkData);
  extractLinesData(network, networkData);
  extractTfo2WData(network, networkData);
  extractTfo3WData(network, networkData);
  extractGeneratorsData(network, networkData);
  extractLoadsData(network, networkData);
  return networkData;
}

代码示例来源:origin: itesla/ipst

@Override
  public WCAClustersResult after(Path workingDir, ExecutionReport report) throws IOException {
    report.log();
    WCAClustersResult clustersResult = WCAUtils.readClustersResult(CLUSTERS_CMD_ID, workingDir, WCA_FLOWS_FILE, WCA_UNCERTAINTIES_FILE);
    LOGGER.info("Network {}, contingency {}: 'clusters' result = {}", network.getId(), contingency.getId(), clustersResult.toString());
    return clustersResult;
  }
});

代码示例来源:origin: itesla/ipst

private RulesFacadeResults evaluate(Network network, List<SecurityRule> rules, List<SecurityIndexType> bacecaseInvalidRulesIndexes) {
  Objects.requireNonNull(network, "network is null");
  HashMap<HistoDbAttributeId, Object> networkValues = IIDM2DB.extractCimValues(network, new IIDM2DB.Config(null, true)).getSingleValueMap();
  return evaluate(network.getId(), network.getStateManager().getWorkingStateId(), networkValues, rules, bacecaseInvalidRulesIndexes);
}

代码示例来源:origin: itesla/ipst

public void write(Writer writer, EsgGeneralParameters parameters, EsgSpecialParameters specialParameters) throws IOException {
  EsgNetwork esgNetwork = createNetwork(parameters);
  new EsgWriter(esgNetwork, parameters, specialParameters).write(writer, network.getId() + "/" + network.getStateManager().getWorkingStateId());
}

代码示例来源:origin: itesla/ipst

public void looseConstraints(String stateId, float margin, boolean applyToBaseCase) {
  if (network.getStateManager().getStateIds().contains(stateId)) {
    String workingStateId = network.getStateManager().getWorkingStateId();
    network.getStateManager().setWorkingState(stateId);
    List<LimitViolation> violations = Security.checkLimits(network);
    looseConstraints(stateId, violations, margin, applyToBaseCase);
    network.getStateManager().setWorkingState(workingStateId);
  } else {
    throw new RuntimeException("No " + stateId + " in network " + network.getId() + ": cannot loose constraints");
  }
}

代码示例来源:origin: com.powsybl/powsybl-security-analysis-api

private static void assertRunningContext(RunningContext context) {
  assertNotNull(context);
  assertNotNull(context.getNetwork());
  assertEquals("sim1", context.getNetwork().getId());
  assertEquals("test", context.getNetwork().getSourceFormat());
}

相关文章