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

Fix getting measurements for a branch or a 3wt on side other than 1, when there are measurements on multiple sides #234

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
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public static List<TapChangerStepData> toMapDataRatioStep(Map<Integer, RatioTapC
}

public static void mapThreeWindingsTransformerPermanentLimits(
ThreeWindingsTransformerTabInfos.ThreeWindingsTransformerTabInfosBuilder builder,
ThreeWindingsTransformerTabInfos.ThreeWindingsTransformerTabInfosBuilder<?, ?> builder,
ThreeWindingsTransformer transformer) {
CurrentLimits limits1 = transformer.getLeg1().getCurrentLimits().orElse(null);
CurrentLimits limits2 = transformer.getLeg2().getCurrentLimits().orElse(null);
Expand All @@ -290,7 +290,7 @@ public static void mapThreeWindingsTransformerPermanentLimits(
}

public static void mapThreeWindingsTransformerRatioTapChangers(
ThreeWindingsTransformerTabInfos.ThreeWindingsTransformerTabInfosBuilder builder,
ThreeWindingsTransformerTabInfos.ThreeWindingsTransformerTabInfosBuilder<?, ?> builder,
ThreeWindingsTransformer transformer) {
ThreeWindingsTransformer.Leg leg1 = transformer.getLeg1();
ThreeWindingsTransformer.Leg leg2 = transformer.getLeg2();
Expand Down Expand Up @@ -395,7 +395,7 @@ public static Optional<MeasurementsInfos> toMeasurement(Connectable<?> connectab
if (measurements == null) {
return Optional.empty();
} else {
return measurements.getMeasurements(type).stream().findFirst().filter(m -> ((Measurement) m).getSide() == null || ((Measurement) m).getSide().getNum() - 1 == index)
return measurements.getMeasurements(type).stream().filter(m -> ((Measurement) m).getSide() == null || ((Measurement) m).getSide().getNum() - 1 == index).findFirst()
.map(m -> MeasurementsInfos.builder().value(((Measurement) m).getValue()).validity(((Measurement) m).isValid()).build());
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/test/resources/2-windings-transformers-tab-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@
"value": 13.0,
"validity": true
},
"measurementP2": {
"value": 68.0,
"validity": false
},
"measurementQ2": {
"value": 53.0,
"validity": false
},
"measurementRatioTap": {
"value": 11,
"validity": true
Expand All @@ -218,7 +226,7 @@
"value": 7,
"validity": false
},
"branchObservability":{
"branchObservability": {
"qualityP1": {
"standardDeviation": 23.31,
"isRedundant": true
Expand Down
48 changes: 48 additions & 0 deletions src/test/resources/3-windings-transformers-tab-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@
"value": 13.0,
"validity": true
},
"measurementP2": {
"value": 23.0,
"validity": false
},
"measurementQ2": {
"value": 33.0,
"validity": false
},
"measurementP3": {
"value": 43.0,
"validity": true
},
"measurementQ3": {
"value": 53.0,
"validity": true
},
"measurementRatioTap1": {
"value": 14,
"validity": true
Expand Down Expand Up @@ -244,6 +260,22 @@
"value": 13.0,
"validity": true
},
"measurementP2": {
"value": 23.0,
"validity": false
},
"measurementQ2": {
"value": 33.0,
"validity": false
},
"measurementP3": {
"value": 43.0,
"validity": true
},
"measurementQ3": {
"value": 53.0,
"validity": true
},
"measurementRatioTap1": {
"value": 14,
"validity": true
Expand Down Expand Up @@ -375,6 +407,22 @@
"value": 13.0,
"validity": true
},
"measurementP2": {
"value": 23.0,
"validity": false
},
"measurementQ2": {
"value": 33.0,
"validity": false
},
"measurementP3": {
"value": 43.0,
"validity": true
},
"measurementQ3": {
"value": 53.0,
"validity": true
},
"measurementRatioTap1": {
"value": 14,
"validity": true
Expand Down
108 changes: 84 additions & 24 deletions src/test/resources/all-data-in-variant.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
},
{
"id": "VLGEN",
"name": "VLGEN_Name",
"properties": {
"Country": "FR"
},
"substationId": "P1",
"nominalV": 24.0,
"country": "FR",
"name": "VLGEN_Name",
"lowVoltageLimit": 200.0,
"highVoltageLimit": 400.0,
"identifiableShortCircuit": {
"ipMin": 10.0,
"ipMax": 120.0
},
"properties": {
"Country": "FR"
}
},
{
Expand Down Expand Up @@ -119,18 +119,18 @@
"voltageLevels": [
{
"id": "VLGEN",
"name": "VLGEN_Name",
"properties": {
"Country": "FR"
},
"substationId": "P1",
"nominalV": 24.0,
"country": "FR",
"name": "VLGEN_Name",
"lowVoltageLimit": 200.0,
"highVoltageLimit": 400.0,
"identifiableShortCircuit": {
"ipMin": 10.0,
"ipMax": 120.0
},
"properties": {
"Country": "FR"
}
},
{
Expand Down Expand Up @@ -280,7 +280,11 @@
"value": 24.0,
"validity": false
},
"branchObservability":{
"measurementQ2": {
"value": 45.0,
"validity": true
},
"branchObservability": {
"qualityP1": {
"standardDeviation": 23.31,
"isRedundant": true
Expand Down Expand Up @@ -688,6 +692,14 @@
"value": 13.0,
"validity": true
},
"measurementP2": {
"value": 68.0,
"validity": false
},
"measurementQ2": {
"value": 53.0,
"validity": false
},
"measurementRatioTap": {
"value": 11,
"validity": true
Expand All @@ -696,7 +708,7 @@
"value": 7,
"validity": false
},
"branchObservability":{
"branchObservability": {
"qualityP1": {
"standardDeviation": 23.31,
"isRedundant": true
Expand Down Expand Up @@ -832,6 +844,22 @@
"value": 13.0,
"validity": true
},
"measurementP2": {
"value": 23.0,
"validity": false
},
"measurementQ2": {
"value": 33.0,
"validity": false
},
"measurementP3": {
"value": 43.0,
"validity": true
},
"measurementQ3": {
"value": 53.0,
"validity": true
},
"measurementRatioTap1": {
"value": 14,
"validity": true
Expand Down Expand Up @@ -963,6 +991,22 @@
"value": 13.0,
"validity": true
},
"measurementP2": {
"value": 23.0,
"validity": false
},
"measurementQ2": {
"value": 33.0,
"validity": false
},
"measurementP3": {
"value": 43.0,
"validity": true
},
"measurementQ3": {
"value": 53.0,
"validity": true
},
"measurementRatioTap1": {
"value": 14,
"validity": true
Expand Down Expand Up @@ -1094,6 +1138,22 @@
"value": 13.0,
"validity": true
},
"measurementP2": {
"value": 23.0,
"validity": false
},
"measurementQ2": {
"value": 33.0,
"validity": false
},
"measurementP3": {
"value": 43.0,
"validity": true
},
"measurementQ3": {
"value": 53.0,
"validity": true
},
"measurementRatioTap1": {
"value": 14,
"validity": true
Expand Down Expand Up @@ -1162,22 +1222,22 @@
"value": 5.0,
"validity": true
},
"highVoltageLimit": 400.0,
"lowVoltageLimit": 200.0,
"isCondenser": false,
"substationId": "P1",
"substationName": "P1_Name",
"substationProperties": {
"Country": "FR"
},
"voltageLevelName": "VLGEN_Name",
"lowVoltageLimit": 200.0,
"highVoltageLimit": 400.0,
"voltageLevelShortCircuit": {
"ipMin": 10.0,
"ipMax": 120.0
},
"voltageLevelProperties": {
"Country": "FR"
},
"voltageLevelShortCircuit": {
"ipMin": 10,
"ipMax": 120
},
"injectionObservability": {
"qualityP": {
"standardDeviation": 19.65,
Expand Down Expand Up @@ -1240,21 +1300,21 @@
"value": 80.0,
"validity": false
},
"highVoltageLimit": 400.0,
"lowVoltageLimit": 200.0,
"isCondenser": false,
"substationId": "P1",
"substationName": "P1_Name",
"substationProperties": {
"Country": "FR"
},
"voltageLevelName": "VLGEN_Name",
"lowVoltageLimit": 200.0,
"highVoltageLimit": 400.0,
"voltageLevelShortCircuit": {
"ipMin": 10.0,
"ipMax": 120.0
},
"voltageLevelProperties": {
"Country": "FR"
},
"voltageLevelShortCircuit": {
"ipMin": 10,
"ipMax": 120
}
}
],
Expand Down Expand Up @@ -1395,8 +1455,8 @@
"country": "FR",
"terminalConnected": true,
"pairingKey": "xnode1",
"p": 45,
"q": 75,
"p": 45.0,
"q": 75.0,
"p0": 50.0,
"q0": 30.0
}
Expand Down
Loading
Loading