com.powsybl.openloadflow.sa.PreContingencyNetworkResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powsybl-open-loadflow Show documentation
Show all versions of powsybl-open-loadflow Show documentation
An open source loadflow based on PowSyBl
The newest version!
/**
* Copyright (c) 2022, 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.openloadflow.sa;
import com.powsybl.openloadflow.network.LfNetwork;
import com.powsybl.security.monitor.StateMonitor;
import com.powsybl.security.monitor.StateMonitorIndex;
import com.powsybl.security.results.BranchResult;
import java.util.*;
/**
* @author Geoffroy Jamgotchian {@literal }
*/
public class PreContingencyNetworkResult extends AbstractNetworkResult {
private final Map branchResults = new HashMap<>();
public PreContingencyNetworkResult(LfNetwork network, StateMonitorIndex monitorIndex, boolean createResultExtension) {
super(network, monitorIndex, createResultExtension);
}
@Override
protected void clear() {
super.clear();
branchResults.clear();
}
private void addResults(StateMonitor monitor) {
addResults(monitor, branch -> {
branch.createBranchResult(Double.NaN, Double.NaN, createResultExtension)
.forEach(branchResult -> branchResults.put(branchResult.getBranchId(), branchResult));
});
}
@Override
public void update() {
clear();
addResults(monitorIndex.getNoneStateMonitor());
addResults(monitorIndex.getAllStateMonitor());
}
public BranchResult getBranchResult(String branchId) {
Objects.requireNonNull(branchId);
return branchResults.get(branchId);
}
@Override
public List getBranchResults() {
return new ArrayList<>(branchResults.values());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy