Skip to content

Commit

Permalink
fix checkstyle
Browse files Browse the repository at this point in the history
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
  • Loading branch information
Djazouli committed Dec 3, 2020
1 parent a628029 commit 76dc05f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,4 @@ public List<Variable> getVariables() {
public boolean hasRhs() {
return true;
}

public double getPower() {
return power;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.powsybl.openloadflow.OpenLoadFlowParameters;
import com.powsybl.openloadflow.ac.AbstractDistributedSlackOuterLoop;
import com.powsybl.openloadflow.ac.DistributedSlackOnGenerationOuterLoop;
import com.powsybl.openloadflow.ac.DistributedSlackOnLoadOuterLoop;
import com.powsybl.openloadflow.dc.equations.ClosedBranchSide1DcFlowEquationTerm;
import com.powsybl.openloadflow.dc.equations.DcEquationSystem;
import com.powsybl.openloadflow.dc.equations.DcEquationSystemCreationParameters;
Expand All @@ -29,8 +28,6 @@
import org.apache.commons.lang3.tuple.Pair;

import java.util.*;
import java.util.stream.Collectors;


/**
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>
Expand Down Expand Up @@ -202,14 +199,15 @@ private Map<SensitivityVariableConfiguration, SensitivityFactorGroup> indexFacto
* @param oldFactors
* @return
*/
private List<SensitivityFactor> getDistributedFactors(Network network, LfNetwork lfNetwork, List<SensitivityFactor> oldFactors) {
private List<SensitivityFactor> getDistributedFactors(Network network, LfNetwork lfNetwork,
List<SensitivityFactor> oldFactors) {
// todo: load ?
// todo: use only lfnetwork ?

List<SensitivityFactor> factors = new ArrayList<>();

Set<String> monitoredLines = new HashSet<>();
for (SensitivityFactor oldFactor: oldFactors) {
for (SensitivityFactor oldFactor : oldFactors) {
// if the factor if an injection then we will compute it with distribution, otherwise we just keep it as it is
if (oldFactor instanceof BranchFlowPerInjectionIncrease) {
BranchFlowPerInjectionIncrease branchFactor = (BranchFlowPerInjectionIncrease) oldFactor;
Expand All @@ -220,19 +218,24 @@ private List<SensitivityFactor> getDistributedFactors(Network network, LfNetwork
}

monitoredLines.forEach(
lineId -> {
// todo: check that the line is still in the connected component ?
BranchFlow branchFlow = new BranchFlow(lineId, lineId, lineId);
network.getGenerators().forEach( // todo: not all generators, only those who have an impact in compensation
generator -> {
if (generator.getTerminal().getBusView().getBus() == null) return;
if (lfNetwork.getBusById(generator.getTerminal().getBusView().getBus().getId()) == null) return; // check connected component
String genId = generator.getId();
factors.add(new BranchFlowPerInjectionIncrease(branchFlow,
new InjectionIncrease(genId, genId, genId)));
}
);
}
lineId -> {
// todo: check that the line is still in the connected component ?
BranchFlow branchFlow = new BranchFlow(lineId, lineId, lineId);
network.getGenerators().forEach(// todo: not all generators, only those who have an impact in compensation
generator -> {
if (generator.getTerminal().getBusView().getBus() == null) {
return;
}
// check connected component
if (lfNetwork.getBusById(generator.getTerminal().getBusView().getBus().getId()) == null) {
return;
}
String genId = generator.getId();
factors.add(new BranchFlowPerInjectionIncrease(branchFlow,
new InjectionIncrease(genId, genId, genId)));
}
);
}
);
return factors;
}
Expand Down Expand Up @@ -299,7 +302,7 @@ public List<SensitivityValue> analyse(Network network, List<SensitivityFactor> f
// index factors by variable configuration to compute minimal number of DC state
Map<SensitivityVariableConfiguration, SensitivityFactorGroup> factorsByVarConfig = lfParameters.isDistributedSlack()
? indexFactorsByVariableConfig(network, getDistributedFactors(network, lfNetwork, factors)) // if the slack is distributed we need to compute sensi for all generators
: indexFactorsByVariableConfig(network, factors);;
: indexFactorsByVariableConfig(network, factors);

if (factorsByVarConfig.isEmpty()) {
return Collections.emptyList();
Expand Down

0 comments on commit 76dc05f

Please sign in to comment.