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

[Shortcircuit] Add new parameters #2638

Merged
merged 50 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
ce59859
Add subTransientCoefficient to ShortCircuitParameters and FaultParame…
colinepiloquet Jul 6, 2023
771079b
Add test
colinepiloquet Jul 6, 2023
16a8f9a
Add new parameters in ShortCircuitParameters
colinepiloquet Jul 28, 2023
9fdd8c6
Add new parameters in FaultParameters
colinepiloquet Jul 28, 2023
5169780
Merge branch 'main' into add_subtransient_coefficient
colinepiloquet Jul 28, 2023
191ad94
Add tests
colinepiloquet Jul 31, 2023
d2fe45d
Add some javadoc
colinepiloquet Jul 31, 2023
89bbf40
Fix version in ShortCircuitAnalysisResult
colinepiloquet Aug 1, 2023
6435505
Add initial voltage profile and coefficients in parameters
colinepiloquet Aug 2, 2023
6417e3c
Merge branch 'main' into add_subtransient_coefficient
colinepiloquet Aug 2, 2023
b675539
Increase test coverage
colinepiloquet Aug 2, 2023
c9c3a37
change switch/case and casting
colinepiloquet Aug 7, 2023
3a03eec
Some fixes
colinepiloquet Aug 7, 2023
cd35a17
fix
colinepiloquet Aug 7, 2023
3c9f6c7
Merge branch 'main' into add_subtransient_coefficient
colinepiloquet Aug 10, 2023
9dbcce7
Merge branch 'main' into add_subtransient_coefficient
olperr1 Aug 11, 2023
53d375c
Renaming
colinepiloquet Aug 21, 2023
cc5898b
Add checks
colinepiloquet Aug 21, 2023
56bab08
review
colinepiloquet Aug 21, 2023
44a02af
Merge branch 'main' into add_subtransient_coefficient
colinepiloquet Aug 22, 2023
ac1dc80
Fix code smells
colinepiloquet Aug 22, 2023
f439d6c
Merge branch 'main' into add_subtransient_coefficient
annetill Aug 23, 2023
2f59365
review
colinepiloquet Aug 24, 2023
024cd51
fix
colinepiloquet Aug 24, 2023
702a9ce
Proposal for a builder
colinepiloquet Aug 24, 2023
81cbc9e
Make withNeutralTapChanger false by default.
colinepiloquet Aug 24, 2023
6f6a621
Make withNeutralTapChanger false by default - test fix
colinepiloquet Aug 24, 2023
0c4093c
Revert "Proposal for a builder"
colinepiloquet Aug 29, 2023
d2f09a9
Add check on parameters in runAsync
colinepiloquet Aug 29, 2023
6e94823
Merge branch 'main' into add_subtransient_coefficient
colinepiloquet Aug 30, 2023
7e7b2b9
Add checks
colinepiloquet Aug 30, 2023
9db0275
Fix code smells + one test
colinepiloquet Aug 30, 2023
6efbc9d
Fixes
colinepiloquet Aug 30, 2023
902c764
Add test, fix check
colinepiloquet Aug 31, 2023
294d671
Remove default in switch
colinepiloquet Aug 31, 2023
e0019eb
Fix wording
colinepiloquet Sep 4, 2023
e49a914
Add voltage range data file in config + add test with multiple feeders
colinepiloquet Sep 7, 2023
6e41236
Return empty collection instead of null
colinepiloquet Sep 7, 2023
bb3c529
Renaming + one test
colinepiloquet Sep 11, 2023
3a79cee
Enhance getVoltageRangeDataFromConfig method
colinepiloquet Sep 11, 2023
d71f5df
Merge branch 'main' into add_subtransient_coefficient
colinepiloquet Sep 11, 2023
da85b8c
Merge branch 'main' into add_subtransient_coefficient
annetill Sep 12, 2023
b21ba27
Merge branch 'main' into add_subtransient_coefficient
annetill Sep 13, 2023
e4caccb
Renaming
colinepiloquet Sep 14, 2023
7be6608
Merge branch 'main' into add_subtransient_coefficient
colinepiloquet Sep 14, 2023
7649a3b
Merge branch 'main' into add_subtransient_coefficient
colinepiloquet Sep 18, 2023
95a83d5
Voltage range path is now absolute
colinepiloquet Sep 18, 2023
9f5b94e
Clean
geofjamg Sep 18, 2023
c8a60c7
Merge branch 'main' into add_subtransient_coefficient
colinepiloquet Sep 18, 2023
077cd9a
Clean
geofjamg Sep 18, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,36 @@
package com.powsybl.shortcircuit;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.json.JsonUtil;
import com.powsybl.shortcircuit.json.ShortCircuitAnalysisJsonModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import static com.powsybl.shortcircuit.VoltageRangeData.checkVoltageRangeData;

/**
* @author Thomas Adam <tadam at silicom.fr>
*/
public class FaultParameters {

private static final Logger LOGGER = LoggerFactory.getLogger(FaultParameters.class);

// VERSION = 1.0 withLimitViolations, withVoltageMap, withFeederResult, studyType and minVoltageDropProportionalThreshold
// VERSION = 1.1 withVoltageMap -> withFortescueResult and withVoltageResult
public static final String VERSION = "1.1";
// VERSION = 1.2 subTransientCoefficient, withLoads, withShuntCompensators, withVSCConverterStations, withNeutralPosition,
// initialVoltageProfile, configuredInitialVoltageProfileCoefficients
public static final String VERSION = "1.2";

private final String id;

Expand All @@ -42,6 +52,20 @@ public class FaultParameters {

private final double minVoltageDropProportionalThreshold;

private final double subTransientCoefficient;

private final boolean withLoads;

private final boolean withShuntCompensators;

private final boolean withVSCConverterStations;

private final boolean withNeutralPosition;

private final InitialVoltageProfile initialVoltageProfile;

private final List<VoltageRangeData> voltageRangeData;

/** Fault id */
public String getId() {
return id;
Expand Down Expand Up @@ -77,20 +101,82 @@ public double getMinVoltageDropProportionalThreshold() {
return minVoltageDropProportionalThreshold;
}

/** Override general parameter subTransientCoefficient from {@link ShortCircuitParameters} */
public double getSubTransientCoefficient() {
return subTransientCoefficient;
}

/** Override general parameter withLoads from {@link com.powsybl.shortcircuit.ShortCircuitParameters} */
public boolean isWithLoads() {
return withLoads;
}

/** Override general parameter withShuntCompensators from {@link com.powsybl.shortcircuit.ShortCircuitParameters} */
public boolean isWithShuntCompensators() {
return withShuntCompensators;
}

/** Override general parameter withVSCConverterStations from {@link com.powsybl.shortcircuit.ShortCircuitParameters} */
public boolean isWithVSCConverterStations() {
return withVSCConverterStations;
}

/** Override general parameter withNeutralPosition from {@link com.powsybl.shortcircuit.ShortCircuitParameters} */
public boolean isWithNeutralPosition() {
return withNeutralPosition;
}

/** Override general parameter initialVoltageProfile from {@link com.powsybl.shortcircuit.ShortCircuitParameters} */
public InitialVoltageProfile getInitialVoltageProfile() {
return initialVoltageProfile;
}

/** Override general parameter configuredInitialVoltageProfileCoefficients from {@link ShortCircuitParameters}*/
public List<VoltageRangeData> getConfiguredInitialVoltageProfileCoefficients() {
return voltageRangeData;
}

public FaultParameters(String id,
boolean withLimitViolations,
boolean withVoltageResult,
boolean withFeederResult,
StudyType studyType,
double minVoltageDropProportionalThreshold,
boolean withFortescueResult) {
boolean withFortescueResult,
double subTransientCoefficient,
boolean withLoads,
boolean withShuntCompensators,
boolean withVSCConverterStations,
boolean withNeutralPosition,
InitialVoltageProfile initialVoltageProfile,
List<VoltageRangeData> coefficients) {
this.id = Objects.requireNonNull(id);
this.withLimitViolations = withLimitViolations;
this.withVoltageResult = withVoltageResult;
this.withFeederResult = withFeederResult;
this.studyType = studyType;
this.minVoltageDropProportionalThreshold = minVoltageDropProportionalThreshold;
this.withFortescueResult = withFortescueResult;
this.subTransientCoefficient = subTransientCoefficient;
this.withLoads = withLoads;
this.withShuntCompensators = withShuntCompensators;
this.withVSCConverterStations = withVSCConverterStations;
this.withNeutralPosition = withNeutralPosition;
this.initialVoltageProfile = initialVoltageProfile;
this.voltageRangeData = new ArrayList<>();
if (coefficients != null) {
if (initialVoltageProfile == InitialVoltageProfile.CONFIGURED) {
checkVoltageRangeData(coefficients);
this.voltageRangeData.addAll(coefficients);
} else {
LOGGER.warn("Nominal voltage ranges and coefficient defined but InitialVoltageProfile is not CONFIGURED: they are ignored");
colinepiloquet marked this conversation as resolved.
Show resolved Hide resolved
}
} else {
if (initialVoltageProfile == InitialVoltageProfile.CONFIGURED) {
throw new PowsyblException("Configured initial voltage profile but coefficients are missing.");
colinepiloquet marked this conversation as resolved.
Show resolved Hide resolved
}
}

}

@Override
Expand All @@ -108,12 +194,22 @@ public boolean equals(Object o) {
Objects.equals(withFeederResult, that.withFeederResult) &&
Objects.equals(studyType, that.studyType) &&
Objects.equals(minVoltageDropProportionalThreshold, that.minVoltageDropProportionalThreshold) &&
Objects.equals(withFortescueResult, that.withFortescueResult);
Objects.equals(withFortescueResult, that.withFortescueResult) &&
Objects.equals(subTransientCoefficient, that.subTransientCoefficient) &&
Objects.equals(withLoads, that.withLoads) &&
Objects.equals(withShuntCompensators, that.withShuntCompensators) &&
Objects.equals(withVSCConverterStations, that.withVSCConverterStations) &&
Objects.equals(withNeutralPosition, that.withNeutralPosition) &&
Objects.equals(initialVoltageProfile, that.initialVoltageProfile) &&
Objects.equals(voltageRangeData, that.voltageRangeData);
colinepiloquet marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
public int hashCode() {
return Objects.hash(id, withLimitViolations, withVoltageResult, withFeederResult, studyType, minVoltageDropProportionalThreshold, withFortescueResult);
return Objects.hash(id, withLimitViolations, withVoltageResult, withFeederResult, studyType,
minVoltageDropProportionalThreshold, withFortescueResult, subTransientCoefficient,
withLoads, withShuntCompensators, withVSCConverterStations, withNeutralPosition,
initialVoltageProfile, voltageRangeData);
}

@Override
Expand All @@ -126,6 +222,13 @@ public String toString() {
", studyType=" + studyType +
", minVoltageDropProportionalThreshold=" + minVoltageDropProportionalThreshold +
", withFortescueResult=" + withFortescueResult +
", subTransientCoefficient=" + subTransientCoefficient +
", withLoads=" + withLoads +
", withShuntCompensators=" + withShuntCompensators +
", withVSCConverterStations=" + withVSCConverterStations +
", withNeutralPosition=" + withNeutralPosition +
", initialVoltageProfile=" + initialVoltageProfile +
", configuredInitialVoltageProfileCoefficients=" + voltageRangeData +
colinepiloquet marked this conversation as resolved.
Show resolved Hide resolved
'}';
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Copyright (c) 2023, 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.shortcircuit;

/**
* @author Coline Piloquet <coline.piloquet at rte-france.com>
*/
public enum InitialVoltageProfile {
colinepiloquet marked this conversation as resolved.
Show resolved Hide resolved
NOMINAL,
CONFIGURED, // Voltage profile given by the user
PREVIOUS_VALUE // Voltage profile from the loadflow

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class ShortCircuitAnalysisResult extends AbstractExtendable<ShortCircuitAnalysisResult> {

// VERSION = 1.0 faultResults
// VERSION = 1.0 status in faultResult
// VERSION = 1.1 status in faultResult
public static final String VERSION = "1.1";

private final Map<String, FaultResult> resultByFaultId = new TreeMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@ private ShortCircuitConstants() {
public static final boolean DEFAULT_WITH_FEEDER_RESULT = true;
public static final double DEFAULT_MIN_VOLTAGE_DROP_PROPORTIONAL_THRESHOLD = 0.0;
public static final boolean DEFAULT_WITH_FORTESCUE_RESULT = true;
public static final double DEFAULT_SUB_TRANSIENT_COEFFICIENT = 70.0;
public static final boolean DEFAULT_WITH_LOADS = true;
public static final boolean DEFAULT_WITH_SHUNT_COMPENSATORS = true;
public static final boolean DEFAULT_WITH_VSC_CONVERTER_STATIONS = true;
public static final boolean DEFAULT_WITH_NEUTRAL_POSITION = true;
public static final InitialVoltageProfile DEFAULT_INITIAL_VOLTAGE_PROFILE = InitialVoltageProfile.NOMINAL;
}
colinepiloquet marked this conversation as resolved.
Show resolved Hide resolved
Loading