com.powsybl.python.flow_decomposition.XnecWithDecompositionContext Maven / Gradle / Ivy
/*
* 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.python.flow_decomposition;
import com.powsybl.flow_decomposition.DecomposedFlow;
import com.powsybl.flow_decomposition.DecomposedFlowBuilder;
import com.powsybl.flow_decomposition.NetworkUtil;
import com.powsybl.iidm.network.Country;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.function.ToDoubleFunction;
/**
* @author Hugo Schindler {@literal }
*/
public class XnecWithDecompositionContext extends DecomposedFlow {
public XnecWithDecompositionContext(DecomposedFlow decomposedFlow) {
super(new DecomposedFlowBuilder().withBranchId(decomposedFlow.getBranchId())
.withContingencyId(decomposedFlow.getContingencyId())
.withCountry1(decomposedFlow.getCountry1())
.withCountry2(decomposedFlow.getCountry2())
.withAcTerminal1ReferenceFlow(decomposedFlow.getAcTerminal1ReferenceFlow())
.withAcTerminal2ReferenceFlow(decomposedFlow.getAcTerminal2ReferenceFlow())
.withDcReferenceFlow(decomposedFlow.getDcReferenceFlow())
.withAllocatedFlow(decomposedFlow.getAllocatedFlow())
.withXNodeFlow(decomposedFlow.getXNodeFlow())
.withPstFlow(decomposedFlow.getPstFlow())
.withInternalFlow(decomposedFlow.getInternalFlow())
.withLoopFlowsMap(decomposedFlow.getLoopFlows()));
}
public String getCountry1String() {
return getCountry1().toString();
}
public String getCountry2String() {
return getCountry2().toString();
}
public static Map> getLoopFlowsFunctionMap(Set zoneSet) {
TreeMap> loopFlows = new TreeMap<>();
zoneSet.forEach(country -> loopFlows.put(getColumnPep8Name(country), decomposedFlow -> decomposedFlow.getLoopFlow(country)));
return loopFlows;
}
private static String getColumnPep8Name(Country country) {
return NetworkUtil.getLoopFlowIdFromCountry(country).replace(" ", "_").toLowerCase();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy