本文整理了Java中com.powsybl.iidm.network.Network.getStateManager()
方法的一些代码示例,展示了Network.getStateManager()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Network.getStateManager()
方法的具体详情如下:
包路径:com.powsybl.iidm.network.Network
类名称:Network
方法名:getStateManager
暂无
代码示例来源:origin: itesla/ipst
@Override
public List<CommandExecution> before(Path workingDir) throws IOException {
network.getStateManager().setWorkingState(workingStateId);
context = EurostagStabilization.this.before(workingDir);
return Collections.singletonList(createCommandExecution());
}
代码示例来源:origin: itesla/ipst
private void checkMultiThreadAccess() {
if (!network.getStateManager().isStateMultiThreadAccessAllowed()) {
throw new IllegalStateException("Multi thread access has to be allowed in the network");
}
}
代码示例来源:origin: itesla/ipst
public Network getNetwork() {
network.getStateManager().setWorkingState(stateId);
return network;
}
代码示例来源:origin: itesla/ipst
private void removePostContingencyState(String contingencyStateId, Map<String, String> metrics) {
network.getStateManager().setWorkingState(contingencyStateId);
network.getStateManager().removeState(contingencyStateId);
}
代码示例来源: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: itesla/ipst
@Override
public CompletableFuture<StabilizationResult> runAsync(String workingStateId) {
return CompletableFuture.supplyAsync(() -> {
network.getStateManager().setWorkingState(workingStateId);
return run();
});
}
代码示例来源:origin: itesla/ipst
@Override
public WCAResult run(WCAParameters parameters) throws Exception {
WCAAsyncResult asyncResult = runAsync(network.getStateManager().getWorkingStateId(), parameters)
.join();
List<WCACluster> clusters = new ArrayList<>();
for (CompletableFuture<WCACluster> cluster : asyncResult.getClusters()) {
clusters.add(cluster.join());
}
return () -> clusters;
}
代码示例来源:origin: itesla/ipst
@Override
public CompletableFuture<StabilizationResult> runAsync(String workingStateId) {
return CompletableFuture.supplyAsync(() -> {
network.getStateManager().setWorkingState(workingStateId);
return run();
});
}
代码示例来源:origin: itesla/ipst
private RulesFacadeResults getMockResults(Contingency contingency, Network network) {
Map<SecurityIndexType, StateStatus> indexesResults = new EnumMap<>(SecurityIndexType.class);
for (SecurityIndexType indexType : securityIndexTypes) {
StateStatus ruleResults = (rulesResults == StateStatus.SAFE) ? StateStatus.SAFE : StateStatus.UNSAFE;
indexesResults.put(indexType, ruleResults);
}
return new RulesFacadeResults(network.getStateManager().getWorkingStateId(), contingency.getId(), rulesResults, indexesResults,
new ArrayList<>(), true);
}
代码示例来源:origin: itesla/ipst
@Override
public StabilizationResult run() throws Exception {
return runAsync(network.getStateManager().getWorkingStateId()).join();
}
代码示例来源:origin: itesla/ipst
private void createPostContingencyState(Contingency contingency, String baseStateId, String contingencyStateId) {
network.getStateManager().cloneState(baseStateId, contingencyStateId);
network.getStateManager().setWorkingState(contingencyStateId);
contingency.toTask().modify(network, computationManager);
}
代码示例来源:origin: itesla/ipst
@Override
public StabilizationResult after(Path workingDir, ExecutionReport report) throws IOException {
network.getStateManager().setWorkingState(workingStateId);
return EurostagStabilization.this.after(workingDir, context, report);
}
});
代码示例来源:origin: itesla/ipst
@Override
public void process(Network network, ComputationManager computationManager) throws Exception {
LoadFlowFactory loadFlowFactory = defaultConfigSupplier.get().newFactoryImpl(LoadFlowFactory.class);
LoadFlow loadFlow = loadFlowFactory.create(network, computationManager, 0);
CaseProjectorUtils.project(computationManager, network, loadFlow, network.getStateManager().getWorkingStateId(), caseProjectorConfigSupplier.get()).join();
}
代码示例来源:origin: itesla/ipst
@Override
public void sample() throws Exception {
String stateId = network.getStateManager().getWorkingStateId();
LOGGER.info("Getting new sample for network " + network + ", working state id: " + stateId);
SampleData sample = nextSample();
putSampleDataIntoNetwork(sample);
}
代码示例来源:origin: itesla/ipst
@Override
public StabilizationResult run() {
LOGGER.info("Running Dymola stabilization");
String baseStateId = network.getStateManager().getWorkingStateId();
DymolaState state = new DymolaState(baseStateId);
return new DymolaStabilizationResult(state);
}
代码示例来源:origin: itesla/ipst
public static void dumpStateId(Path workingDir, Network network) throws IOException {
dumpStateId(workingDir, network.getStateManager().getWorkingStateId());
}
代码示例来源:origin: itesla/ipst
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);
}
}
代码示例来源: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
@Override
public StabilizationResult run() {
String baseStateId = network.getStateManager().getWorkingStateId();
List<LimitViolation> violations = baseVoltageFilter.apply(Security.checkLimits(network, config.getCurrentLimitType(),
config.getLimitReduction()), network);
String report = Security.printLimitsViolations(violations, network, CURRENT_FILTER);
if (report != null) {
LOGGER.warn("Constraints after stabilization for {}:\n{}", baseStateId, report);
}
PostContLoadFlowSimState state = new PostContLoadFlowSimState(baseStateId, violations);
return new PostContLoadFlowSimStabilizationResult(state);
}
内容来源于网络,如有侵权,请联系作者删除!