Skip to content

Commit 81e0334

Browse files
authored
Merge pull request #968 from PowerGridModel/current-sensor-validation-tests
Current sensor validation tests
2 parents 4040fbd + 0c38dd7 commit 81e0334

27 files changed

+307
-10
lines changed

tests/data/state_estimation/basic-current-sensor/sym_output.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/data/state_estimation/basic-current-sensor/input.json renamed to tests/data/state_estimation/current-sensor/global-current-sensor/input.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{"id": 2, "u_rated": 10000}
1010
],
1111
"line": [
12-
{"id": 3, "from_node": 1, "to_node": 2, "from_status": 1, "to_status": 1, "r1": 0.000416, "x1": 0.000136, "c1": 1e-09, "tan1": 0}
12+
{"id": 3, "from_node": 1, "to_node": 2, "from_status": 1, "to_status": 1, "r1": 3, "x1": 2, "c1": 1.0e-06, "tan1": 0}
1313
],
1414
"source": [
1515
{"id": 4, "node": 1, "status": 1, "u_ref": 1}
@@ -18,10 +18,10 @@
1818
{"id": 5, "node": 2, "status": 1, "type": 0}
1919
],
2020
"sym_voltage_sensor": [
21-
{"id": 6, "measured_object": 1, "u_sigma": 200, "u_measured": 10000, "u_angle_measured": 0.0}
21+
{"id": 6, "measured_object": 1, "u_sigma": 200, "u_measured": 10000, "u_angle_measured": 0}
2222
],
2323
"sym_current_sensor": [
24-
{"id": 7, "measured_object": 3, "measured_terminal_type": 0, "angle_measurement_type": 1, "i_sigma": 1, "i_angle_sigma": 0.05, "i_measured": 10, "i_angle_measured": 0.3}
24+
{"id": 7, "measured_object": 3, "measured_terminal_type": 1, "angle_measurement_type": 1, "i_sigma": 5, "i_angle_sigma": 0.1, "i_measured": 10, "i_angle_measured": 0.5}
2525
]
2626
}
2727
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "1.0",
3+
"type": "sym_output",
4+
"is_batch": false,
5+
"attributes": {},
6+
"data": {
7+
"node": [
8+
{"id": 1, "energized": 1, "u_pu": 1, "u": 10000, "u_angle": 2.7755575615628914e-17, "p": -152081.2413973829, "q": 51572.482773851283},
9+
{"id": 2, "energized": 1, "u_pu": 1.0032295891835012, "u": 10032.295891835012, "u_angle": 0.0050437703573163505, "p": 152910.90226951908, "q": -82536.926436116293}
10+
],
11+
"line": [
12+
{"id": 3, "energized": 1, "p_from": -152081.2413973829, "q_from": 51572.482773851283, "i_from": 9.2715379818072332, "s_from": 160587.74848794736, "p_to": 152910.90226951908, "q_to": -82536.926436116293, "i_to": 10.0, "s_to": 173764.46201222876}
13+
],
14+
"source": [
15+
{"id": 4, "energized": 1, "p": -152081.2413973829, "q": 51572.482773851283, "i": 9.2715379818072332, "s": 160587.74848794736, "pf": -0.94702891614921103}
16+
],
17+
"sym_load": [
18+
{"id": 5, "energized": 1, "p": -152910.90226951908, "q": 82536.926436116293, "i": 10.0, "s": 173764.46201222876, "pf": -0.8799895012983604}
19+
],
20+
"sym_voltage_sensor": [
21+
{"id": 6, "energized": 1, "u_residual": 0, "u_angle_residual": 0}
22+
],
23+
"sym_current_sensor": [
24+
{"id": 7, "energized": 1, "i_residual": 0, "i_angle_residual": 0}
25+
]
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "1.0",
3+
"type": "input",
4+
"is_batch": false,
5+
"attributes": {},
6+
"data": {
7+
"node": [
8+
{"id": 1, "u_rated": 10000},
9+
{"id": 2, "u_rated": 10000}
10+
],
11+
"line": [
12+
{"id": 3, "from_node": 1, "to_node": 2, "from_status": 1, "to_status": 1, "r1": 3, "x1": 2, "c1": 1.0e-06, "tan1": 0}
13+
],
14+
"source": [
15+
{"id": 4, "node": 1, "status": 1, "u_ref": 1}
16+
],
17+
"sym_load": [
18+
{"id": 5, "node": 2, "status": 1, "type": 0}
19+
],
20+
"sym_voltage_sensor": [
21+
{"id": 6, "measured_object": 1, "u_sigma": 200, "u_measured": 10000, "u_angle_measured": 0}
22+
],
23+
"sym_current_sensor": [
24+
{"id": 7, "measured_object": 3, "measured_terminal_type": 1, "angle_measurement_type": 0, "i_sigma": 5, "i_angle_sigma": 0.1, "i_measured": 10, "i_angle_measured": 0.5}
25+
]
26+
}
27+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+
3+
SPDX-License-Identifier: MPL-2.0
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"calculation_method": [
3+
"iterative_linear",
4+
"newton_raphson"
5+
],
6+
"rtol": 1e-8,
7+
"atol": {
8+
"default": 1e-8,
9+
".+_residual": 5e-4
10+
},
11+
"extra_params": {
12+
"iterative_linear": {
13+
"experimental_features": "enabled"
14+
},
15+
"newton_raphson": {
16+
"experimental_features": "enabled",
17+
"fail": {
18+
"raises": "SparseMatrixError",
19+
"reason": "Current sensors are not yet implemented for this calculation method"
20+
}
21+
}
22+
}
23+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+
3+
SPDX-License-Identifier: MPL-2.0
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "1.0",
3+
"type": "sym_output",
4+
"is_batch": false,
5+
"attributes": {},
6+
"data": {
7+
"node": [
8+
{"id": 1, "energized": 1, "u_pu": 1, "u": 10000, "u_angle": 0, "p": -152009.12684220925, "q": -114546.21807138032},
9+
{"id": 2, "energized": 1, "u_pu": 1.0065370416981694, "u": 10065.370416981694, "u_angle": 7.4547572222640965e-05, "p": 152995.40009988801, "q": 83581.768571801134}
10+
],
11+
"line": [
12+
{"id": 3, "energized": 1, "p_from": -152009.12684220925, "q_from": -114546.21807138032, "i_from": 10.989026453358989, "s_from": 190335.52142936189, "p_to": 152995.40009988801, "q_to": 83581.768571801134, "i_to": 10.0, "s_to": 174337.32959212991}
13+
],
14+
"source": [
15+
{"id": 4, "energized": 1, "p": -152009.12684220925, "q": -114546.21807138032, "i": 10.989026453358989, "s": 190335.52142936189, "pf": -0.79863771985737042}
16+
],
17+
"sym_load": [
18+
{"id": 5, "energized": 1, "p": -152995.40009988801, "q": -83581.768571801134, "i": 10.0, "s": 174337.32959212991, "pf": -0.87758256053266204}
19+
],
20+
"sym_voltage_sensor": [
21+
{"id": 6, "energized": 1, "u_residual": 0, "u_angle_residual": 0}
22+
],
23+
"sym_current_sensor": [
24+
{"id": 7, "energized": 1, "i_residual": 0, "i_angle_residual": 0}
25+
]
26+
}
27+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+
3+
SPDX-License-Identifier: MPL-2.0
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!--
2+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
3+
4+
SPDX-License-Identifier: MPL-2.0
5+
-->
6+
7+
# Power sensor from Global Current Sensor test case
8+
9+
This test case is used to validate the output values from the global current sensor. To verify the correctness of the results, the input from the global current sensor is transformed into power sensor input. At the time of writing, the power sensor component has already been validated. However, keep in mind that for state estimation using the iterative linear method, there may be small discrepancies between the results obtained from the current sensor and those from the power sensor due to the approximate nature of the calculation method.
10+
11+
## Conversion from Global Current Sensor to Power Sensor
12+
13+
To convert the input of a global current sensor to a power sensor, use the following relations:
14+
15+
$$
16+
S = I_g^* V \sqrt(3), \quad
17+
p = \Re(S), \quad
18+
q = \Im(S),
19+
$$
20+
21+
where:
22+
23+
- $S$ is the complex power,
24+
- $I_g$ is the global complex current,
25+
- $V$ is the complex voltage at the adjacent node where the sensor is located,
26+
- $p$ and $q$ are the measured active and reactive powers, respectively,
27+
- $\sqrt(3)$ comes from the neutral-line change of frame of reference.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "1.0",
3+
"type": "input",
4+
"is_batch": false,
5+
"attributes": {},
6+
"data": {
7+
"node": [
8+
{"id": 1, "u_rated": 10000},
9+
{"id": 2, "u_rated": 10000}
10+
],
11+
"line": [
12+
{"id": 3, "from_node": 1, "to_node": 2, "from_status": 1, "to_status": 1, "r1": 3, "x1": 2, "c1": 1.0e-06, "tan1": 0}
13+
],
14+
"source": [
15+
{"id": 4, "node": 1, "status": 1, "u_ref": 1}
16+
],
17+
"sym_load": [
18+
{"id": 5, "node": 2, "status": 1, "type": 0}
19+
],
20+
"sym_voltage_sensor": [
21+
{"id": 6, "measured_object": 1, "u_sigma": 200, "u_measured": 10000, "u_angle_measured": 0}
22+
],
23+
"sym_power_sensor": [
24+
{"id": 7, "measured_object": 3, "measured_terminal_type": 1, "p_measured": 152910.90226951957, "q_measured": -82536.926436113092, "p_sigma": 20000, "q_sigma": 10000}
25+
]
26+
}
27+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+
3+
SPDX-License-Identifier: MPL-2.0
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"calculation_method": ["iterative_linear"],
3+
"rtol": 1e-8,
4+
"atol": 1e-8
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+
3+
SPDX-License-Identifier: MPL-2.0
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "1.0",
3+
"type": "sym_output",
4+
"is_batch": false,
5+
"attributes": {},
6+
"data": {
7+
"node": [
8+
{"id": 1, "energized": 1, "u_pu": 1.0, "u": 10000.0, "u_angle": 0, "p": -152081.2411685313, "q": 51572.482671218742},
9+
{"id": 2, "energized": 1, "u_pu": 1.0032295891786502, "u": 10032.295891786502, "u_angle": 0.0050437703497091899, "p": 152910.90203816551, "q": -82536.926334998439}
10+
],
11+
"line": [
12+
{"id": 3, "energized": 1, "p_from": -152081.2411685313, "q_from": 51572.482671218742, "i_from": 9.27153796739141, "s_from": 160587.74823825801, "p_to": 152910.90203816551, "q_to": -82536.926334998439, "i_to": 10.0, "s_to": 173764.46176060976}
13+
],
14+
"source": [
15+
{"id": 4, "energized": 1, "p": -152081.2411685313, "q": 51572.482671218742, "i": 9.27153796739141, "s": 160587.74823825801, "pf": -0.94702891619660845}
16+
],
17+
"sym_load": [
18+
{"id": 5, "energized": 1, "p": -152910.90203816551, "q": 82536.926334998439, "i": 10.0, "s": 173764.46176060976, "pf": -0.87998950124120556}
19+
],
20+
"sym_voltage_sensor": [
21+
{"id": 6, "energized": 1, "u_residual": 0, "u_angle_residual": 0}
22+
],
23+
"sym_power_sensor": [
24+
{"id": 7, "energized": 1, "p_residual": 0.00023135404703111817, "q_residual": -0.00010111464443518514}
25+
]
26+
}
27+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+
3+
SPDX-License-Identifier: MPL-2.0
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--
2+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
3+
4+
SPDX-License-Identifier: MPL-2.0
5+
-->
6+
7+
# Power sensor from Local Current Sensor test case
8+
9+
This test case is used to validate the output values from the local current sensor. To verify the correctness of the results, the input from the local current sensor is transformed into power sensor input. At the time of writing, the power sensor component has already been validated. However, keep in mind that for state estimation using the iterative linear method, there may be small discrepancies between the results obtained from the current sensor and those from the power sensor due to the approximate nature of the calculation method.
10+
11+
## Conversion from Local Current Sensor to Power Sensor
12+
13+
To convert the input of a local current sensor to a power sensor, use the following relations:
14+
15+
$$
16+
S = I_l e^{-i \theta} V \sqrt(3), \quad
17+
p = \Re(S), \quad
18+
q = \Im(S),
19+
$$
20+
21+
where:
22+
23+
- $S$ is the complex power,
24+
- $I_l$ is the local complex current,
25+
- $V$ is the complex voltage at the adjacent node where the sensor is located,
26+
- $e^{-i \theta}$ is the phase shift with respect to the voltage angle of the adjacent node,
27+
- $p$ and $q$ are the measured active and reactive powers, respectively,
28+
- $\sqrt(3)$ comes from the neutral-line change of frame of reference.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "1.0",
3+
"type": "input",
4+
"is_batch": false,
5+
"attributes": {},
6+
"data": {
7+
"node": [
8+
{"id": 1, "u_rated": 10000},
9+
{"id": 2, "u_rated": 10000}
10+
],
11+
"line": [
12+
{"id": 3, "from_node": 1, "to_node": 2, "from_status": 1, "to_status": 1, "r1": 3, "x1": 2, "c1": 1.0e-06, "tan1": 0}
13+
],
14+
"source": [
15+
{"id": 4, "node": 1, "status": 1, "u_ref": 1}
16+
],
17+
"sym_load": [
18+
{"id": 5, "node": 2, "status": 1, "type": 0}
19+
],
20+
"sym_voltage_sensor": [
21+
{"id": 6, "measured_object": 1, "u_sigma": 200, "u_measured": 10000, "u_angle_measured": 0}
22+
],
23+
"sym_power_sensor": [
24+
{"id": 7, "measured_object": 3, "measured_terminal_type": 1, "p_measured": 152995.40033658801, "q_measured": 83581.768138525527, "p_sigma": 20000, "q_sigma": 10000}
25+
]
26+
}
27+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+
3+
SPDX-License-Identifier: MPL-2.0
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"calculation_method": ["iterative_linear"],
3+
"rtol": 1e-8,
4+
"atol": 1e-8
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+
3+
SPDX-License-Identifier: MPL-2.0
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "1.0",
3+
"type": "sym_output",
4+
"is_batch": false,
5+
"attributes": {},
6+
"data": {
7+
"node": [
8+
{"id": 1, "energized": 1, "u_pu": 1.0, "u": 10000.0, "u_angle": -1.110223024625156e-16, "p": -152009.12685229909, "q": -114546.2174907462},
9+
{"id": 2, "energized": 1, "u_pu": 1.0065370416868618, "u": 10065.370416868618, "u_angle": 7.4547589729823558e-05, "p": 152995.40010662266, "q": 83581.767989290369}
10+
],
11+
"line": [
12+
{"id": 3, "energized": 1, "p_from": -152009.12685229909, "q_from": -114546.2174907462, "i_from": 10.989026433649713, "s_from": 190335.52108798738, "p_to": 152995.40010662266, "q_to": 83581.767989290369, "i_to": 9.9999999844323568, "s_to": 174337.32931876957}
13+
],
14+
"source": [
15+
{"id": 4, "energized": 1, "p": -152009.12685229909, "q": -114546.2174907462, "i": 10.989026433649711, "s": 190335.52108798738, "pf": -0.79863772134277056}
16+
],
17+
"sym_load": [
18+
{"id": 5, "energized": 1, "p": -152995.40010662266, "q": -83581.767989290369, "i": 9.999999984432355, "s": 174337.32931876957, "pf": -0.87758256194733864}
19+
],
20+
"sym_voltage_sensor": [
21+
{"id": 6, "energized": 1, "u_residual": 0, "u_angle_residual": 0}
22+
],
23+
"sym_power_sensor": [
24+
{"id": 7, "energized": 1, "p_residual": 0.00022996535231634141, "q_residual": 0.00014923515201381576}
25+
]
26+
}
27+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+
3+
SPDX-License-Identifier: MPL-2.0

0 commit comments

Comments
 (0)