Skip to content

Commit b398458

Browse files
authored
Merge pull request #943 from PowerGridModel/feature/rename-angle-measurement-type-values
Resolve AngleMeasurementType enum value name conflict
2 parents c42532d + e278b41 commit b398458

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

power_grid_model_c/power_grid_model/include/power_grid_model/common/enum.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ enum class SearchMethod : IntS { // Which type of tap search method for finite e
127127
};
128128

129129
enum class AngleMeasurementType : IntS { // The type of the angle measurement for current sensors
130-
local = 0, // local = 0, the angle is relative to the local voltage angle
131-
global = 1, // global = 1, the angle is relative to the global voltage angle
130+
local_angle = 0, // local_angle = 0, the angle is relative to the local voltage angle
131+
global_angle = 1, // global_angle = 1, the angle is relative to the global voltage angle
132132
};
133133

134134
} // namespace power_grid_model

tests/cpp_unit_tests/test_current_sensor.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ TEST_CASE("Test current sensor") {
3838
sym_current_sensor_input.id = 0;
3939
sym_current_sensor_input.measured_object = 1;
4040
sym_current_sensor_input.measured_terminal_type = terminal_type;
41-
sym_current_sensor_input.angle_measurement_type = AngleMeasurementType::local;
41+
sym_current_sensor_input.angle_measurement_type = AngleMeasurementType::local_angle;
4242
sym_current_sensor_input.i_sigma = 1.0;
4343
sym_current_sensor_input.i_measured = 1.0 * 1e3;
4444
sym_current_sensor_input.i_angle_measured = 0.0;
@@ -65,7 +65,7 @@ TEST_CASE("Test current sensor") {
6565
sym_current_sensor.get_output<asymmetric_t>(i_asym);
6666

6767
// Check symmetric sensor output for symmetric parameters
68-
CHECK(sym_sensor_param.angle_measurement_type == AngleMeasurementType::local);
68+
CHECK(sym_sensor_param.angle_measurement_type == AngleMeasurementType::local_angle);
6969
CHECK(sym_sensor_param.measurement.real_component.variance == doctest::Approx(i_variance_pu));
7070
CHECK(sym_sensor_param.measurement.imag_component.variance ==
7171
doctest::Approx(i_angle_variance_pu * i_pu * i_pu));
@@ -92,14 +92,14 @@ TEST_CASE("Test current sensor") {
9292

9393
CHECK(sym_current_sensor.get_terminal_type() == terminal_type);
9494

95-
CHECK(sym_current_sensor.get_angle_measurement_type() == AngleMeasurementType::local);
95+
CHECK(sym_current_sensor.get_angle_measurement_type() == AngleMeasurementType::local_angle);
9696
}
9797
SUBCASE("Wrong measured terminal type") {
9898
for (auto const terminal_type :
9999
{MeasuredTerminalType::source, MeasuredTerminalType::shunt, MeasuredTerminalType::load,
100100
MeasuredTerminalType::generator, MeasuredTerminalType::node}) {
101101
CHECK_THROWS_AS((CurrentSensor<symmetric_t>{
102-
{1, 1, terminal_type, AngleMeasurementType::local, 1.0, 1.0, 1.0, 1.0}, 1.0}),
102+
{1, 1, terminal_type, AngleMeasurementType::local_angle, 1.0, 1.0, 1.0, 1.0}, 1.0}),
103103
InvalidMeasuredTerminalType);
104104
}
105105
}
@@ -110,15 +110,15 @@ TEST_CASE("Test current sensor") {
110110
CurrentSensor<symmetric_t> sym_current_sensor{{.id = 1,
111111
.measured_object = 1,
112112
.measured_terminal_type = MeasuredTerminalType::branch3_1,
113-
.angle_measurement_type = AngleMeasurementType::local},
113+
.angle_measurement_type = AngleMeasurementType::local_angle},
114114
u_rated};
115115

116116
SUBCASE("No phase shift") {
117117
sym_current_sensor.update(
118118
{.id = 1, .i_sigma = 1.0, .i_angle_sigma = 0.2, .i_measured = 1.0, .i_angle_measured = 0.0});
119119
auto const sym_param = sym_current_sensor.calc_param<symmetric_t>();
120120

121-
CHECK(sym_param.angle_measurement_type == AngleMeasurementType::local);
121+
CHECK(sym_param.angle_measurement_type == AngleMeasurementType::local_angle);
122122
CHECK(sym_param.measurement.real_component.variance == doctest::Approx(pow(1.0 / base_current, 2)));
123123
CHECK(sym_param.measurement.imag_component.variance == doctest::Approx(pow(0.2 / base_current, 2)));
124124
CHECK(real(sym_param.measurement.value()) == doctest::Approx(1.0 / base_current));
@@ -130,7 +130,7 @@ TEST_CASE("Test current sensor") {
130130
{.id = 1, .i_sigma = 1.0, .i_angle_sigma = 0.2, .i_measured = 1.0, .i_angle_measured = pi / 2});
131131
auto const sym_param = sym_current_sensor.calc_param<symmetric_t>();
132132

133-
CHECK(sym_param.angle_measurement_type == AngleMeasurementType::local);
133+
CHECK(sym_param.angle_measurement_type == AngleMeasurementType::local_angle);
134134
CHECK(sym_param.measurement.real_component.variance == doctest::Approx(pow(0.2 / base_current, 2)));
135135
CHECK(sym_param.measurement.imag_component.variance == doctest::Approx(pow(1.0 / base_current, 2)));
136136
CHECK(real(sym_param.measurement.value()) == doctest::Approx(0.0 / base_current));
@@ -145,7 +145,7 @@ TEST_CASE("Test current sensor") {
145145
{.id = 1, .i_sigma = 1.0, .i_angle_sigma = 0.2, .i_measured = 1.0, .i_angle_measured = pi / 4});
146146
auto const sym_param = sym_current_sensor.calc_param<symmetric_t>();
147147

148-
CHECK(sym_param.angle_measurement_type == AngleMeasurementType::local);
148+
CHECK(sym_param.angle_measurement_type == AngleMeasurementType::local_angle);
149149
CHECK(sym_param.measurement.real_component.variance ==
150150
doctest::Approx(1.04 / 2.0 / (base_current * base_current)));
151151
CHECK(sym_param.measurement.imag_component.variance ==
@@ -164,7 +164,7 @@ TEST_CASE("Test current sensor") {
164164
CurrentSensor<symmetric_t> const current_sensor{{.id = 1,
165165
.measured_object = 1,
166166
.measured_terminal_type = MeasuredTerminalType::branch3_1,
167-
.angle_measurement_type = AngleMeasurementType::local,
167+
.angle_measurement_type = AngleMeasurementType::local_angle,
168168
.i_sigma = i_sigma,
169169
.i_angle_sigma = i_angle_sigma,
170170
.i_measured = i_measured,
@@ -289,7 +289,7 @@ TEST_CASE("Test current sensor") {
289289
CurrentSensor<asymmetric_t> const current_sensor{{.id = 1,
290290
.measured_object = 1,
291291
.measured_terminal_type = measured_terminal_type,
292-
.angle_measurement_type = AngleMeasurementType::local,
292+
.angle_measurement_type = AngleMeasurementType::local_angle,
293293
.i_sigma = i_sigma,
294294
.i_angle_sigma = i_angle_sigma,
295295
.i_measured = i_measured,

0 commit comments

Comments
 (0)