Skip to content

Commit 49bb1bf

Browse files
committed
test difference between global and local angle current sensors
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
1 parent 4511e4b commit 49bb1bf

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/cpp_unit_tests/test_math_solver_se.hpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,12 @@ TEST_CASE_TEMPLATE_DEFINE("Test math solver - SE, measurements", SolverType, tes
353353
source_0(p) load_0
354354
355355
*/
356+
// to make the distinction between global and local angle current measurement
357+
auto const global_shift = phase_shift(1.0 + 1.0i);
358+
356359
topo.power_sensors_per_source = {from_sparse, {0, 1}};
357360
topo.current_sensors_per_branch_from = {from_sparse, {0, 1}};
361+
se_input.measured_voltage = {{.value = 1.0 * global_shift, .variance = 0.1}};
358362

359363
auto param_ptr = std::make_shared<MathModelParam<symmetric_t> const>(param);
360364
auto topo_ptr = std::make_shared<MathModelTopology const>(topo);
@@ -377,19 +381,23 @@ TEST_CASE_TEMPLATE_DEFINE("Test math solver - SE, measurements", SolverType, tes
377381
CHECK(real(output.bus_injection[0]) == doctest::Approx(1.95));
378382
CHECK(real(output.source[0].s) == doctest::Approx(1.95));
379383
CHECK(real(output.branch[0].s_f) == doctest::Approx(1.95));
384+
CHECK(real(output.branch[0].i_f) == doctest::Approx(real(1.95 * global_shift)));
385+
CHECK(imag(output.branch[0].i_f) == doctest::Approx(imag(1.95 * global_shift)));
380386
} else {
381387
CHECK_FALSE(real(output.bus_injection[0]) == doctest::Approx(1.95));
382388
CHECK_FALSE(real(output.source[0].s) == doctest::Approx(1.95));
383389
CHECK_FALSE(real(output.branch[0].s_f) == doctest::Approx(1.95));
390+
CHECK_FALSE(real(output.branch[0].i_f) == doctest::Approx(real(1.95 * global_shift)));
391+
CHECK_FALSE(imag(output.branch[0].i_f) == doctest::Approx(imag(1.95 * global_shift)));
384392
}
385393
}
386394
SUBCASE("Global angle current sensor") {
387395
se_input.measured_source_power = {{.real_component = {.value = 1.93, .variance = 0.05},
388396
.imag_component = {.value = 0.0, .variance = 0.05}}};
389397
se_input.measured_branch_from_current = {
390398
{.angle_measurement_type = AngleMeasurementType::global_angle,
391-
.measurement = {.real_component = {.value = 1.97, .variance = 0.05},
392-
.imag_component = {.value = 0.0, .variance = 0.05}}}};
399+
.measurement = {.real_component = {.value = real(1.97 * global_shift), .variance = 0.05},
400+
.imag_component = {.value = imag(1.97 * global_shift), .variance = 0.05}}}};
393401

394402
output = run_state_estimation(solver, y_bus_sym, se_input, error_tolerance, num_iter, info);
395403

@@ -398,10 +406,14 @@ TEST_CASE_TEMPLATE_DEFINE("Test math solver - SE, measurements", SolverType, tes
398406
CHECK(real(output.bus_injection[0]) == doctest::Approx(1.95));
399407
CHECK(real(output.source[0].s) == doctest::Approx(1.95));
400408
CHECK(real(output.branch[0].s_f) == doctest::Approx(1.95));
409+
CHECK(real(output.branch[0].i_f) == doctest::Approx(real(1.95 * global_shift)));
410+
CHECK(imag(output.branch[0].i_f) == doctest::Approx(imag(1.95 * global_shift)));
401411
} else {
402412
CHECK_FALSE(real(output.bus_injection[0]) == doctest::Approx(1.95));
403413
CHECK_FALSE(real(output.source[0].s) == doctest::Approx(1.95));
404414
CHECK_FALSE(real(output.branch[0].s_f) == doctest::Approx(1.95));
415+
CHECK_FALSE(real(output.branch[0].i_f) == doctest::Approx(real(1.95 * global_shift)));
416+
CHECK_FALSE(imag(output.branch[0].i_f) == doctest::Approx(imag(1.95 * global_shift)));
405417
}
406418
}
407419
}

0 commit comments

Comments
 (0)