Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to powsybl-core 5.1.0-RC1 #670

Merged
merged 9 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<junit-jupiter.version>5.8.2</junit-jupiter.version>
<slf4jtoys.version>1.6.3</slf4jtoys.version>

<powsybl-core.version>5.0.0</powsybl-core.version>
<powsybl-core.version>5.1.0-RC1</powsybl-core.version>
</properties>

<build>
Expand Down Expand Up @@ -176,8 +176,7 @@

<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-commons</artifactId>
<type>test-jar</type>
<artifactId>powsybl-commons-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ public static void logAc(LoadFlowParameters parameters, OpenLoadFlowParameters p
LOGGER.info("Voltage initialization mode override: {}", parametersExt.getVoltageInitModeOverride());
LOGGER.info("Distributed slack: {}", parameters.isDistributedSlack());
LOGGER.info("Balance type: {}", parameters.getBalanceType());
LOGGER.info("Reactive limits: {}", !parameters.isNoGeneratorReactiveLimits());
LOGGER.info("Reactive limits: {}", parameters.isUseReactiveLimits());
LOGGER.info("Voltage remote control: {}", parametersExt.hasVoltageRemoteControl());
LOGGER.info("Phase control: {}", parameters.isPhaseShifterRegulationOn());
LOGGER.info("Split shunt admittance: {}", parameters.isTwtSplitShuntAdmittance());
Expand Down Expand Up @@ -710,7 +710,7 @@ static LfNetworkParameters getNetworkParameters(LoadFlowParameters parameters, O
.setReactivePowerRemoteControl(parametersExt.hasReactivePowerRemoteControl())
.setDc(parameters.isDc())
.setShuntVoltageControl(parameters.isShuntCompensatorVoltageControlOn())
.setReactiveLimits(!parameters.isNoGeneratorReactiveLimits())
.setReactiveLimits(parameters.isUseReactiveLimits())
.setHvdcAcEmulation(parameters.isHvdcAcEmulation())
.setMinPlausibleTargetVoltage(parametersExt.getMinPlausibleTargetVoltage())
.setMaxPlausibleTargetVoltage(parametersExt.getMaxPlausibleTargetVoltage())
Expand Down Expand Up @@ -822,7 +822,7 @@ public static boolean equals(LoadFlowParameters parameters1, LoadFlowParameters
Objects.requireNonNull(parameters2);
boolean equals = parameters1.getVoltageInitMode() == parameters2.getVoltageInitMode() &&
parameters1.isTransformerVoltageControlOn() == parameters2.isTransformerVoltageControlOn() &&
parameters1.isNoGeneratorReactiveLimits() == parameters2.isNoGeneratorReactiveLimits() &&
parameters1.isUseReactiveLimits() == parameters2.isUseReactiveLimits() &&
parameters1.isPhaseShifterRegulationOn() == parameters2.isPhaseShifterRegulationOn() &&
parameters1.isTwtSplitShuntAdmittance() == parameters2.isTwtSplitShuntAdmittance() &&
parameters1.isShuntCompensatorVoltageControlOn() == parameters2.isShuntCompensatorVoltageControlOn() &&
Expand Down Expand Up @@ -882,7 +882,7 @@ public static LoadFlowParameters clone(LoadFlowParameters parameters) {
Objects.requireNonNull(parameters);
LoadFlowParameters parameters2 = new LoadFlowParameters(parameters.getVoltageInitMode(),
parameters.isTransformerVoltageControlOn(),
parameters.isNoGeneratorReactiveLimits(),
parameters.isUseReactiveLimits(),
parameters.isPhaseShifterRegulationOn(),
parameters.isTwtSplitShuntAdmittance(),
parameters.isShuntCompensatorVoltageControlOn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private static Optional<LfAction> create(PhaseTapChangerTapPositionAction action
if (branch.getPiModel() instanceof SimplePiModel) {
throw new UnsupportedOperationException("Phase tap changer tap connection action: only one tap in the branch {" + action.getTransformerId() + "}");
} else {
var tapPositionChange = new TapPositionChange(branch, action.getValue(), action.isRelativeValue());
var tapPositionChange = new TapPositionChange(branch, action.getTapPosition(), action.isRelativeValue());
return Optional.of(new LfAction(action.getId(), null, null, tapPositionChange, null));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected static Map<String, List<OperatorStrategy>> indexOperatorStrategiesByCo
Set<String> contingencyIds = propagatedContingencies.stream().map(propagatedContingency -> propagatedContingency.getContingency().getId()).collect(Collectors.toSet());
Map<String, List<OperatorStrategy>> operatorStrategiesByContingencyId = new HashMap<>();
for (OperatorStrategy operatorStrategy : operatorStrategies) {
if (contingencyIds.contains(operatorStrategy.getContingencyId())) {
if (contingencyIds.contains(operatorStrategy.getContingencyContext().getContingencyId())) {
// check actions IDs exists
for (String actionId : operatorStrategy.getActionIds()) {
Action action = actionsById.get(actionId);
Expand All @@ -200,11 +200,11 @@ protected static Map<String, List<OperatorStrategy>> indexOperatorStrategiesByCo
}
neededActions.add(action);
}
operatorStrategiesByContingencyId.computeIfAbsent(operatorStrategy.getContingencyId(), key -> new ArrayList<>())
operatorStrategiesByContingencyId.computeIfAbsent(operatorStrategy.getContingencyContext().getContingencyId(), key -> new ArrayList<>())
.add(operatorStrategy);
} else {
throw new PowsyblException("Operator strategy '" + operatorStrategy.getId() + "' is associated to contingency '"
+ operatorStrategy.getContingencyId() + "' but this contingency is not present in the list");
+ operatorStrategy.getContingencyContext().getContingencyId() + "' but this contingency is not present in the list");
}
}
return operatorStrategiesByContingencyId;
Expand Down Expand Up @@ -260,7 +260,7 @@ protected OperatorStrategyResult runActionSimulation(LfNetwork network, C contex
Map<String, LfAction> lfActionById, boolean createResultExtension, LfContingency contingency,
LoadFlowParameters.BalanceType balanceType) {
LOGGER.info("Start operator strategy {} after contingency '{}' simulation on network {}", operatorStrategy.getId(),
operatorStrategy.getContingencyId(), network);
operatorStrategy.getContingencyContext().getContingencyId(), network);

// get LF action for this operator strategy, as all actions have been previously checked against IIDM
// network, an empty LF action means it is for another component (so another LF network) so we can
Expand Down Expand Up @@ -290,7 +290,7 @@ protected OperatorStrategyResult runActionSimulation(LfNetwork network, C contex
stopwatch.stop();

LOGGER.info("Operator strategy {} after contingency '{}' simulation done on network {} in {} ms", operatorStrategy.getId(),
operatorStrategy.getContingencyId(), network, stopwatch.elapsed(TimeUnit.MILLISECONDS));
operatorStrategy.getContingencyContext().getContingencyId(), network, stopwatch.elapsed(TimeUnit.MILLISECONDS));

return new OperatorStrategyResult(operatorStrategy, status,
new LimitViolationsResult(postActionsViolationManager.getLimitViolations()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.powsybl.security.*;
import com.powsybl.security.action.Action;
import com.powsybl.security.monitor.StateMonitor;
import com.powsybl.security.results.ConnectivityResult;
import com.powsybl.security.results.OperatorStrategyResult;
import com.powsybl.security.results.PostContingencyResult;
import com.powsybl.security.results.PreContingencyResult;
Expand Down Expand Up @@ -250,7 +251,8 @@ private PostContingencyResult runPostContingencySimulation(LfNetwork network, Ac
new LimitViolationsResult(postContingencyLimitViolationManager.getLimitViolations()),
postContingencyNetworkResult.getBranchResults(),
postContingencyNetworkResult.getBusResults(),
postContingencyNetworkResult.getThreeWindingsTransformerResults());
postContingencyNetworkResult.getThreeWindingsTransformerResults(),
new ConnectivityResult(0, 0, 0, 0, Collections.emptySet()));
}

private Optional<OperatorStrategyResult> runActionSimulation(LfNetwork network, AcLoadFlowContext context, OperatorStrategy operatorStrategy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@
import com.powsybl.security.detectors.DefaultLimitViolationDetector;
import com.powsybl.security.detectors.LoadingLimitType;
import com.powsybl.security.monitor.StateMonitor;
import com.powsybl.security.results.BranchResult;
import com.powsybl.security.results.OperatorStrategyResult;
import com.powsybl.security.results.PostContingencyResult;
import com.powsybl.security.results.PreContingencyResult;
import com.powsybl.security.results.*;
import com.powsybl.security.strategy.OperatorStrategy;
import com.powsybl.sensitivity.*;
import org.apache.commons.lang3.tuple.Pair;
Expand Down Expand Up @@ -202,7 +199,7 @@ private List<PostContingencyResult> createPostContingencyResults(DcSecurityAnaly
});

PostContingencyResult pcResult = new PostContingencyResult(contingency, PostContingencyComputationStatus.CONVERGED, new ArrayList<>(violations.values()),
new ArrayList<>(postContingencyBranchResults.values()), Collections.emptyList(), Collections.emptyList());
new ArrayList<>(postContingencyBranchResults.values()), Collections.emptyList(), Collections.emptyList(), new ConnectivityResult(0, 0, 0, 0, Collections.emptySet()));
context.getPostContingencyResultPerContingencyId().put(contingency.getId(), pcResult);
postContingencyResults.add(pcResult);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/
package com.powsybl.openloadflow.network;

import com.powsybl.commons.AbstractConverterTest;
import com.powsybl.commons.ComparisonUtils;
import com.powsybl.commons.test.AbstractConverterTest;
import com.powsybl.commons.test.ComparisonUtils;
import com.powsybl.iidm.network.ComponentConstants;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.PhaseTapChanger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/
package com.powsybl.openloadflow.sa;

import com.powsybl.commons.AbstractConverterTest;
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.commons.test.AbstractConverterTest;
import com.powsybl.contingency.Contingency;
import com.powsybl.contingency.LoadContingency;
import com.powsybl.iidm.network.Network;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*/
package com.powsybl.openloadflow.sa;

import com.powsybl.commons.AbstractConverterTest;
import com.powsybl.commons.ComparisonUtils;
import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.commons.test.AbstractConverterTest;
import com.powsybl.commons.test.ComparisonUtils;
import com.powsybl.contingency.BranchContingency;
import com.powsybl.contingency.Contingency;
import com.powsybl.contingency.GeneratorContingency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/
package com.powsybl.openloadflow.sa;

import com.powsybl.commons.AbstractConverterTest;
import com.powsybl.commons.config.InMemoryPlatformConfig;
import com.powsybl.commons.config.MapModuleConfig;
import com.powsybl.commons.test.AbstractConverterTest;
import com.powsybl.openloadflow.util.PowsyblOpenLoadFlowVersion;
import com.powsybl.openloadflow.util.ProviderConstants;
import com.powsybl.security.SecurityAnalysisParameters;
Expand Down
Loading