![JAR search and dependency download from the Maven repository](/logo.png)
com.powsybl.shortcircuit.ShortCircuitAnalysisResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powsybl-shortcircuit-api Show documentation
Show all versions of powsybl-shortcircuit-api Show documentation
An API to run three-phase short-circuit analysis
/**
* Copyright (c) 2021, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*/
package com.powsybl.shortcircuit;
import com.powsybl.commons.extensions.AbstractExtendable;
import java.util.*;
/**
* Results of localized short-circuit computations.
* Will contain fault results, with optional feeder results.
*
* @author Boubakeur Brahimi
*/
public class ShortCircuitAnalysisResult extends AbstractExtendable {
// VERSION = 1.0 faultResults
// VERSION = 1.1 status in faultResult
// VERSION = 1.2 side in FeederResult
public static final String VERSION = "1.3";
private final Map resultByFaultId = new TreeMap<>();
private final Map> resultByElementId = new TreeMap<>();
public ShortCircuitAnalysisResult(List faultResults) {
Objects.requireNonNull(faultResults);
faultResults.forEach(r -> {
this.resultByFaultId.put(r.getFault().getId(), r);
this.resultByElementId.computeIfAbsent(r.getFault().getElementId(), k -> new ArrayList<>()).add(r);
});
}
/**
* The associated fault results.
*/
public List getFaultResults() {
return new ArrayList<>(resultByFaultId.values());
}
/**
* Get a computation result associated to a given fault ID
*
* @param id the ID of the considered fault.
* @return the computation result associated to a given fault ID.
*/
public FaultResult getFaultResult(String id) {
return resultByFaultId.get(id);
}
/**
* Get a list of computation result associated to a given fault element ID
*
* @param elementId the ID of the considered element.
* @return the computation result associated to a given element ID.
*/
public List getFaultResults(String elementId) {
return resultByElementId.getOrDefault(elementId, Collections.emptyList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy