Skip to content

Resolving issue #378- Check ValidationUtils for negative Susceptance #499

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

Merged
merged 14 commits into from
Jan 19, 2022
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Create JavaDoc with java 17 instead of java 8
- Let JavDoc pass, if there are warnings **ATTENTION:** Should be removed, when JavaDoc is fixed! (cf. Issue [#494](https://github.com/ie3-institute/PowerSystemDataModel/issues/494))

### Changed
- BREAKING: Transformer's no load susceptance needs to be zero or negative to pass model validation [#378](https://github.com/ie3-institute/PowerSystemDataModel/issues/378)
- All input data sets for version < 3.0.0 need to be altered!

## [2.1.0] - 2022-01-05

### Added
Expand Down
6 changes: 5 additions & 1 deletion gradle/scripts/tests.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
test {
useJUnitPlatform()
testLogging {
events "skipped", "failed", "passed"
events "skipped", "failed"
}

testLogging {
exceptionFormat "Full"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private static void checkTransformer2W(Transformer2WInput transformer2W) {
* - rSc is greater 0 (short circuit resistance) <br>
* - xSc is greater 0 (short circuit impedance) <br>
* - gM is greater/equal to 0 (no load conductance) <br>
* - bM is greater/equal to 0 (no load susceptance) <br>
* - bM is less/equal to 0 (no load susceptance)<br>
* - sRated is greater 0 (rated apparent power) <br>
* - vRatedA is greater 0 (rated voltage at higher voltage terminal) <br>
* - vRatedB is greater 0 (rated voltage at lower voltage terminal) <br>
Expand All @@ -139,10 +139,7 @@ protected static void checkTransformer2WType(Transformer2WTypeInput transformer2
checkNonNull(transformer2WType, "a two winding transformer type");
detectNegativeQuantities(
new Quantity<?>[] {
transformer2WType.getgM(),
transformer2WType.getbM(),
transformer2WType.getdPhi(),
transformer2WType.getrSc()
transformer2WType.getgM(), transformer2WType.getdPhi(), transformer2WType.getrSc()
},
transformer2WType);
detectZeroOrNegativeQuantities(
Expand All @@ -153,6 +150,7 @@ protected static void checkTransformer2WType(Transformer2WTypeInput transformer2
transformer2WType.getxSc()
},
transformer2WType);
detectPositiveQuantities(new Quantity<?>[] {transformer2WType.getbM()}, transformer2WType);
checkVoltageMagnitudeChangePerTapPosition(transformer2WType);
checkMinimumTapPositionIsLowerThanMaximumTapPosition(transformer2WType);
checkNeutralTapPositionLiesBetweenMinAndMaxTapPosition(transformer2WType);
Expand Down Expand Up @@ -193,7 +191,7 @@ private static void checkTransformer3W(Transformer3WInput transformer3W) {
* - rScA, rScB, rScC are greater 0 (short circuit resistance in branches A,B,C) <br>
* - xScA, xScB, xScC are greater 0 (short circuit impedance in branches A,B,C) <br>
* - gM is greater/equal to 0 (no load conductance) <br>
* - bM is greater/equal to 0 (no load susceptance) <br>
* - bM is less/equal to 0 (no load susceptance) <br>
* - sRatedA, sRatedB, sRatedC are greater 0 (rated apparent power in branches A,B,C) <br>
* - vRatedA, vRatedB, vRatedC are greater 0 (rated voltage at higher node A,B,C) <br>
* - dV is between 0% and 100% (voltage magnitude increase per tap position <br>
Expand All @@ -206,9 +204,7 @@ private static void checkTransformer3W(Transformer3WInput transformer3W) {
protected static void checkTransformer3WType(Transformer3WTypeInput transformer3WType) {
checkNonNull(transformer3WType, "a three winding transformer type");
detectNegativeQuantities(
new Quantity<?>[] {
transformer3WType.getgM(), transformer3WType.getbM(), transformer3WType.getdPhi()
},
new Quantity<?>[] {transformer3WType.getgM(), transformer3WType.getdPhi()},
transformer3WType);
detectZeroOrNegativeQuantities(
new Quantity<?>[] {
Expand All @@ -220,6 +216,7 @@ protected static void checkTransformer3WType(Transformer3WTypeInput transformer3
transformer3WType.getxScA(), transformer3WType.getxScB(), transformer3WType.getxScC()
},
transformer3WType);
detectPositiveQuantities(new Quantity<?>[] {transformer3WType.getbM()}, transformer3WType);
checkVoltageMagnitudeChangePerTapPosition(transformer3WType);
checkMinimumTapPositionIsLowerThanMaximumTapPosition(transformer3WType);
checkNeutralTapPositionLiesBetweenMinAndMaxTapPosition(transformer3WType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,17 @@ protected static void detectZeroOrNegativeQuantities(
detectMalformedQuantities(
quantities, entity, predicate, "The following quantities have to be positive");
}
/**
* Goes through the provided quantities and reports those, that have positive value via
*
* @param quantities Array of quantities to check
* @param entity Unique entity holding the malformed quantities
*/
protected static void detectPositiveQuantities(Quantity<?>[] quantities, UniqueEntity entity) {
Predicate<Quantity<?>> predicate = quantity -> quantity.getValue().doubleValue() > 0d;
detectMalformedQuantities(
quantities, entity, predicate, "The following quantities have to be negative");
}

/**
* Goes through the provided quantities and reports those, that do fulfill the given predicate via
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ class InputEntityProcessorTest extends Specification {
"xScB" : "0.08",
"xScC" : "0.003",
"gM" : "40000.0",
"bM" : "1000.0",
"bM" : "-1000.0",
"dV" : "1.5",
"dPhi" : "0.0",
"tapNeutr": "0",
Expand Down
2 changes: 1 addition & 1 deletion src/test/groovy/edu/ie3/test/common/GridTestData.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class GridTestData {
Quantities.getQuantity(0.08d, IMPEDANCE),
Quantities.getQuantity(0.003d, IMPEDANCE),
Quantities.getQuantity(40000d, ADMITTANCE),
Quantities.getQuantity(1000d, ADMITTANCE),
Quantities.getQuantity(-1000d, ADMITTANCE),
Quantities.getQuantity(1.5d, DV_TAP),
Quantities.getQuantity(0d, DPHI_TAP),
0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
uuid,b_m,d_phi,d_v,g_m,id,r_sc_a,r_sc_b,r_sc_c,s_rated_a,s_rated_b,s_rated_c,tap_max,tap_min,tap_neutr,v_rated_a,v_rated_b,v_rated_c,x_sc_a,x_sc_b,x_sc_c
5b0ee546-21fb-4a7f-a801-5dbd3d7bb356,1000.0,0.0,1.5,40000.0,HöS-HS-MS_1,0.3,0.025,8.0E-4,120000.0,60000.0,40000.0,10,-10,0,380.0,110.0,20.0,1.0,0.08,0.003
5b0ee546-21fb-4a7f-a801-5dbd3d7bb356,-1000.0,0.0,1.5,40000.0,HöS-HS-MS_1,0.3,0.025,8.0E-4,120000.0,60000.0,40000.0,10,-10,0,380.0,110.0,20.0,1.0,0.08,0.003