Skip to content

[BUG] Voltage phasor measurement get masked by a voltage magnitude measurement #1158

@TonyXiang8787

Description

@TonyXiang8787

Describe the bug

If a node has both voltage phasor measurement and voltage magnitude measurement. The phasor measurement will be treated as magnitude only. This means the phase angle information is dropped which is not correct. In some cases, the grid can become not observable. In other cases, the grid is still observable, but phase angle of that voltage phasor is not taken into account.

It concerns the following code segment:

// check if there is nan
if (auto const start = input.measured_voltage.cbegin() + *sensors.begin();
std::any_of(start, start + sensors.size(), [](auto const& x) { return is_nan(imag(x.value)); })) {
// only keep magnitude
aggregated = combine_measurements<true>(input.measured_voltage, sensors);
} else {
// keep complex number
aggregated = combine_measurements(input.measured_voltage, sensors);
angle_measured = true;
}

// combine multiple measurements of one quantity
// using Kalman filter
// if only_magnitude = true, combine the abs value of the individual data
// set imag part to nan, to signal this is a magnitude only measurement
template <bool only_magnitude = false>
static VoltageSensorCalcParam<sym> combine_measurements(std::vector<VoltageSensorCalcParam<sym>> const& data,
IdxRange const& sensors) {
auto complex_measurements = sensors | std::views::transform([&data](Idx pos) -> auto& { return data[pos]; });
if constexpr (only_magnitude) {
return statistics::combine_magnitude(complex_measurements);
} else {
return statistics::combine(complex_measurements);
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    Status

    Q4 2025

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions