Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
3 changes: 2 additions & 1 deletion docs/security/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ The default value is 1.

**dcFastMode**
The `dcFastMode` property allows to use fast DC security analysis, based on Woodbury's formula for calculating post-contingency states,
when DC mode is activated.
when DC mode is activated. Setting the log level of the `com.powsybl.openloadflow` logger to DEBUG displays the details of post-contingency
and post-operator strategy simulations. It is recommended to avoid enabling these logs for better performance.

Please note that fast mode has a few limitations:
- Contingencies applied on branches opened on one side are ignored. Also, if a contingency causes the loss of one side of a branch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import com.powsybl.security.strategy.OperatorStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;

import java.util.*;
import java.util.concurrent.*;
Expand Down Expand Up @@ -77,6 +78,8 @@ public abstract class AbstractSecurityAnalysis<V extends Enum<V> & Quantity, E e

private static final String NOT_FOUND = "' not found in the network";

protected Level logLevel = Level.INFO; // level of the post contingency and action logs

protected AbstractSecurityAnalysis(Network network, MatrixFactory matrixFactory, GraphConnectivityFactory<LfBus, LfBranch> connectivityFactory,
List<StateMonitor> stateMonitors, ReportNode reportNode) {
this.network = Objects.requireNonNull(network);
Expand Down Expand Up @@ -924,15 +927,15 @@ protected PostContingencyResult runPostContingencySimulation(LfNetwork network,
connectivityResult);
}

protected static void logPostContingencyStart(LfNetwork network, LfContingency lfContingency) {
LOGGER.info("Start post contingency '{}' simulation on network {}", lfContingency.getId(), network);
protected void logPostContingencyStart(LfNetwork network, LfContingency lfContingency) {
LOGGER.atLevel(logLevel).log("Start post contingency '{}' simulation on network {}", lfContingency.getId(), network);
LOGGER.debug("Contingency '{}' impact on network {}: remove {} buses, remove {} branches, remove {} generators, shift {} shunts, shift {} loads",
lfContingency.getId(), network, lfContingency.getDisabledNetwork().getBuses(), lfContingency.getDisabledNetwork().getBranchesStatus(),
lfContingency.getLostGenerators(), lfContingency.getShuntsShift(), lfContingency.getLostLoads());
}

protected static void logPostContingencyEnd(LfNetwork network, LfContingency lfContingency, Stopwatch stopwatch) {
LOGGER.info("Post contingency '{}' simulation done on network {} in {} ms", lfContingency.getId(),
protected void logPostContingencyEnd(LfNetwork network, LfContingency lfContingency, Stopwatch stopwatch) {
LOGGER.atLevel(logLevel).log("Post contingency '{}' simulation done on network {} in {} ms", lfContingency.getId(),
network, stopwatch.elapsed(TimeUnit.MILLISECONDS));
}

Expand Down Expand Up @@ -980,13 +983,13 @@ protected OperatorStrategyResult runActionSimulation(LfNetwork network, C contex
postActionsNetworkResult.getThreeWindingsTransformerResults()));
}

protected static void logActionStart(LfNetwork network, OperatorStrategy operatorStrategy) {
LOGGER.info("Start operator strategy {} after contingency '{}' simulation on network {}", operatorStrategy.getId(),
protected void logActionStart(LfNetwork network, OperatorStrategy operatorStrategy) {
LOGGER.atLevel(logLevel).log("Start operator strategy {} after contingency '{}' simulation on network {}", operatorStrategy.getId(),
operatorStrategy.getContingencyContext().getContingencyId(), network);
}

protected static void logActionEnd(LfNetwork network, OperatorStrategy operatorStrategy, Stopwatch stopwatch) {
LOGGER.info("Operator strategy {} after contingency '{}' simulation done on network {} in {} ms", operatorStrategy.getId(),
protected void logActionEnd(LfNetwork network, OperatorStrategy operatorStrategy, Stopwatch stopwatch) {
LOGGER.atLevel(logLevel).log("Operator strategy {} after contingency '{}' simulation done on network {} in {} ms", operatorStrategy.getId(),
operatorStrategy.getContingencyContext().getContingencyId(), network, stopwatch.elapsed(TimeUnit.MILLISECONDS));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.powsybl.security.monitor.StateMonitor;
import com.powsybl.security.results.*;
import com.powsybl.security.strategy.OperatorStrategy;
import org.slf4j.event.Level;

import java.util.*;
import java.util.function.BiFunction;
Expand Down Expand Up @@ -73,6 +74,7 @@ private record SecurityAnalysisSimulationResults(PreContingencyNetworkResult pre
protected WoodburyDcSecurityAnalysis(Network network, MatrixFactory matrixFactory, GraphConnectivityFactory<LfBus, LfBranch> connectivityFactory,
List<StateMonitor> stateMonitors, ReportNode reportNode) {
super(network, matrixFactory, connectivityFactory, stateMonitors, reportNode);
this.logLevel = Level.DEBUG;
}

@Override
Expand Down