private void runLoadFlow(ComputationManager computationManager) throws Exception { int priority = 1; LoadFlow loadflow = loadFlowFactory.create(_network, computationManager, priority); //((HELMLoadFlow) loadflow).setSlack(this._slackId); LoadFlowResult lfResults = loadflow.run(_network.getStateManager().getWorkingStateId(), LoadFlowParameters.load()).join(); if (!lfResults.isOk()) { System.out.println("LF has not been successfuly completed."); LOGGER.info("Loadflow finished. isOk == false"); System.exit(-1); } }
LOGGER.info("Loadflow module: {} {}", context.loadFlow.getName(), Objects.toString(context.loadFlow.getVersion(), "")); LOGGER.info("Stabilization module: {} {}", context.stabilization.getName(), Objects.toString(context.stabilization.getVersion(), "")); LOGGER.info("Impact analysis module: {} {}", context.impactAnalysis.getName(), Objects.toString(context.impactAnalysis.getVersion(), "")); .thenComposeAsync(aVoid -> { LOGGER.debug("Workflow {}, case {}: loadflow started", id, caseNum); return context.loadFlow.run(getCaseId(caseNum), loadFlowParameters); }, executorService) .thenAcceptAsync(loadFlowResult -> {
LOGGER.info("Load flow module: {} {}", loadFlow.getName(), Objects.toString(loadFlow.getVersion(), "")); LOGGER.info("Stabilization module: {} {}", stabilization.getName(), Objects.toString(stabilization.getVersion(), "")); LOGGER.info("Impact analysis module: {} {}", impactAnalysis.getName(), Objects.toString(impactAnalysis.getVersion(), ""));
private void runLoadFlow(LoadFlow loadFlow, String workingStateId) { try { LoadFlowResult result = loadFlow.run(workingStateId, LoadFlowParameters.load()).join(); if (!result.isOk()) { throw new PowsyblException("Load flow diverged during phase shifter optimization"); } } catch (Exception e) { throw new PowsyblException(e); } }
createPostContingencyState(contingency, baseStateId, contingencyStateId); LoadFlowResult loadFlowResult = loadFlow.run(network.getStateManager().getWorkingStateId(), loadFlowParameters).join();
LoadFlowResult result = loadFlow.run(n.getStateManager().getWorkingStateId(), new LoadFlowParameters(LoadFlowParameters.VoltageInitMode.UNIFORM_VALUES)).join(); removeStepUpTransformersAlreadyPresents(n, statorVoltageLevels, config); result = loadFlow.run(n.getStateManager().getWorkingStateId(), new LoadFlowParameters(LoadFlowParameters.VoltageInitMode.UNIFORM_VALUES)).join(); result = loadFlow.run(n.getStateManager().getWorkingStateId(), new LoadFlowParameters(LoadFlowParameters.VoltageInitMode.UNIFORM_VALUES)).join();
.thenComposeAsync(aVoid -> loadFlow.run(contingencyStateId, loadFlowParameters), computationManager.getExecutor()) .thenAcceptAsync(loadFlowResult -> analyseLoadFlowResult(baseStateId, index, contingency, contingencyStateId, loadFlowResult, baseViolationsByType,
for (Network network : networks) { LoadFlow loadFlow = loadFlowFactory.create(network, computationManager, loadFlowPriority); LoadFlowResult result = loadFlow.run(network.getStateManager().getWorkingStateId(), loadFlowParameters).join(); if (!result.isOk()) { LOGGER.error("LF divergence on network " + network.getId()); LoadFlowResult result = loadFlow.run(merge.getStateManager().getWorkingStateId(), loadFlowParameters).join(); if (!result.isOk()) { throw new RuntimeException("Merge LF divergence");
LoadFlowResult result = loadFlow.run(network.getVariantManager().getWorkingVariantId(), params).join();
LoadFlowParameters loadFlowParameters2 = LoadFlowParameters.load().setNoGeneratorReactiveLimits(true); return loadFlow.run(workingStateId, loadFlowParameters) .thenComposeAsync(loadFlowResult -> { LOGGER.debug("Pre-projector load flow metrics: {}", loadFlowResult.getMetrics()); throw new StopException("Projector failed"); return loadFlow.run(workingStateId, loadFlowParameters2); }, computationManager.getExecutor()) .thenApplyAsync(loadFlowResult -> {
LoadFlowResult result = loadFlow.run(network.getStateManager().getWorkingStateId(), loadFlowParameters).join(); if (!alreadyProcessed) {
context.getOutputStream().println("running loadflow..."); LoadFlowResult result2 = loadFlow.run(network.getStateManager().getWorkingStateId(), LoadFlowParameters.load()).join();
LoadFlowResult loadFlowResult = loadFlow.run(network.getStateManager().getWorkingStateId(), loadFlowParameters).join();
protected boolean runLoadFlow(WorkflowContext context, WorkflowStartContext startContext, Sample sample) { LOGGER.debug("Workflow {}, sample {}: load flow started", id, sample.getId()); try { LoadFlowResult result = context.getLoadflow().run(context.getNetwork().getStateManager().getWorkingStateId(), context.getLoadFlowParameters()).join(); LOGGER.debug("Workflow {}, sample {}: load flow terminated (ok={})", id, sample.getId(), result.isOk()); changeTaskStatus(startContext, sample.getId(), LOAD_FLOW, result.isOk() ? SUCCEED : FAILED, null); metricsDb.store(id, "sample-" + sample.getId(), LOAD_FLOW.name(), result.getMetrics()); // consistency check on sampled variables SampleCharacteritics characteritics = SampleCharacteritics.fromNetwork(context.getNetwork(), creationParameters.isGenerationSampled(), creationParameters.isBoundariesSampled()); if (!characteritics.equals(sample.getCharacteritics())) { LOGGER.warn("Sampled variables inconsistency for {}: {} != {}", sample.getId(), characteritics, sample.getCharacteritics()); } return result.isOk(); } catch (Exception e) { LOGGER.error(e.toString(), e); return false; } }
.thenCompose(aVoid -> loadFlow.run(contingencyStateId[0], LOAD_FLOW_PARAMETERS)) .thenCompose(loadFlowResult -> { if (!loadFlowResult.isOk()) { loadFlowResult1 = loadFlow.run(network.getStateManager().getWorkingStateId(), LOAD_FLOW_PARAMETERS).join(); if (loadFlowResult1.isOk()) { boolean violationsRemoved = false; LOGGER.info("Network {}, contingency {}: running loadflow on post contingency state with 'clusters' uncertainties", network.getId(), contingency.getId()); loadFlow.run(clustersUncertaintiesState, LOAD_FLOW_PARAMETERS) .thenAccept(loadFlowResult2 -> { if (!loadFlowResult2.isOk()) {
.run(baseStateId, LOAD_FLOW_PARAMETERS) .thenApply(loadFlowInBaseStateResult -> { WCAUtils.applyInjections(network, domainsUncertaintiesState, domainsResult.getInjections()); LOGGER.info("Network {}: running loadflow on state with 'domains' uncertainties", network.getId()); return loadFlow.run(domainsUncertaintiesState, LOAD_FLOW_PARAMETERS) .thenApply(loadFlowResult -> { if (!loadFlowResult.isOk()) { loadFlowResult1 = loadFlow.run(network.getStateManager().getWorkingStateId(), LOAD_FLOW_PARAMETERS).join(); if (loadFlowResult1.isOk()) { List<LimitViolation> preventiveStateLimitViolations = violationsFilter.apply(Security.checkLimits(network), network); .thenCompose(ignored -> loadFlow.run(baseStateId, LOAD_FLOW_PARAMETERS)) .thenAccept(ignored -> {
stateListener.onUpdate(stateId, status, context.timeHorizon); logger.info(this.logHeader + "{}: loadflow started", stateId); LoadFlowResult result = loadFlow.run(context.getNetwork().getStateManager().getWorkingStateId(), loadFlowParameters).join(); status.put(currentStatus, result.isOk() ? OnlineTaskStatus.SUCCESS : OnlineTaskStatus.FAILED); stateListener.onUpdate(stateId, status, context.timeHorizon);
return loadFlow.run(workingStateId, loadFlowParameters) // run base load flow .thenComposeAsync(loadFlowResult -> { network.getVariantManager().setWorkingVariant(workingStateId); .thenComposeAsync(aVoid -> loadFlow.run(postContStateId, postContParameters), computationManager.getExecutor()) .handleAsync((lfResult, throwable) -> { network.getVariantManager().setWorkingVariant(postContStateId);