Skip to content

Commit e02333d

Browse files
committed
resolve comments
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
1 parent 6f69349 commit e02333d

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

power_grid_model_c/power_grid_model/include/power_grid_model/math_solver/iterative_linear_se_solver.hpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,16 @@ template <symmetry_tag sym_type> class IterativeLinearSESolver {
211211
}
212212
// branch
213213
else {
214-
auto const add_branch_measurement =
215-
[&block, &param, obj, type](IntS measured_side, RealValue<sym> const& current_variance) {
216-
// branch from- and to-side index at 0, and 1 position
217-
IntS const b0 = static_cast<IntS>(type) / 2;
218-
IntS const b1 = static_cast<IntS>(type) % 2;
219-
block.g() +=
220-
dot(hermitian_transpose(param.branch_param[obj].value[measured_side * 2 + b0]),
221-
diagonal_inverse(current_variance),
222-
param.branch_param[obj].value[measured_side * 2 + b1]);
223-
};
214+
auto const add_branch_measurement = [&block, &param, obj,
215+
type](IntS measured_side,
216+
RealValue<sym> const& branch_current_variance) {
217+
// branch from- and to-side index at 0, and 1 position
218+
IntS const b0 = static_cast<IntS>(type) / 2;
219+
IntS const b1 = static_cast<IntS>(type) % 2;
220+
block.g() += dot(hermitian_transpose(param.branch_param[obj].value[measured_side * 2 + b0]),
221+
diagonal_inverse(branch_current_variance),
222+
param.branch_param[obj].value[measured_side * 2 + b1]);
223+
};
224224
// measured at from-side: 0, to-side: 1
225225
for (IntS const measured_side : std::array<IntS, 2>{0, 1}) {
226226
// has measurement
@@ -329,7 +329,7 @@ template <symmetry_tag sym_type> class IterativeLinearSESolver {
329329
// measured at from-side: 0, to-side: 1
330330
for (IntS const measured_side : std::array<IntS, 2>{0, 1}) {
331331
// the current needs to be calculated with the voltage of the measured bus side
332-
// NOTE: not the current bus!
332+
// NOTE: not the bus that is currently being processed!
333333
Idx const measured_bus = branch_bus_idx[obj][measured_side];
334334

335335
// has measurement
@@ -345,12 +345,12 @@ template <symmetry_tag sym_type> class IterativeLinearSESolver {
345345
CurrentSensorCalcParam<sym> const m =
346346
std::invoke(branch_current_[measured_side], measured_value, obj);
347347
// for local angle current sensors, the current needs to be offset with the phase offset
348-
// of the measured bus side. NOTE: not the current bus!
349-
auto global_current = static_cast<IndependentComplexRandVar<sym>>(m.measurement);
348+
// of the measured bus side. NOTE: not the bus that is currently being processed!
349+
auto measured_current = static_cast<IndependentComplexRandVar<sym>>(m.measurement);
350350
if (m.angle_measurement_type == AngleMeasurementType::local_angle) {
351-
global_current.value *= phase_shift(u[measured_bus]); // offset with the phase shift
351+
measured_current.value *= phase_shift(u[measured_bus]); // offset with the phase shift
352352
}
353-
add_branch_measurement(measured_side, global_current);
353+
add_branch_measurement(measured_side, measured_current);
354354
}
355355
}
356356
}

tests/cpp_unit_tests/test_math_solver_se.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ TEST_CASE_TEMPLATE_DEFINE("Test math solver - SE, measurements", SolverType, tes
346346

347347
SUBCASE("Source and branch current") {
348348
/*
349-
network, v means voltage measured, p means power measured
349+
network, v means voltage measured, c means current measured
350350
351351
bus_0(v) -(c)-branch_0-- bus_1
352352
| |

0 commit comments

Comments
 (0)