@@ -45,17 +45,17 @@ Idx count_bus_injection_sensors(const Idx n_bus, const MeasuredValues<sym>& meas
45
45
46
46
template <symmetry_tag sym>
47
47
std::tuple<Idx, Idx> count_voltage_sensors (const Idx n_bus, const MeasuredValues<sym>& measured_values) {
48
- Idx n_voltage_magnitude {};
49
- Idx n_voltage_phasor {};
48
+ Idx n_voltage_sensor {};
49
+ Idx n_voltage_phasor_sensor {};
50
50
for (Idx bus = 0 ; bus != n_bus; ++bus) {
51
51
if (measured_values.has_voltage (bus)) {
52
- n_voltage_magnitude ++;
52
+ n_voltage_sensor ++;
53
53
if (measured_values.has_angle_measurement (bus)) {
54
- n_voltage_phasor ++;
54
+ n_voltage_phasor_sensor ++;
55
55
}
56
56
}
57
57
}
58
- return std::make_tuple (n_voltage_magnitude, n_voltage_phasor );
58
+ return std::make_tuple (n_voltage_sensor, n_voltage_phasor_sensor );
59
59
}
60
60
61
61
} // namespace detail
@@ -66,17 +66,19 @@ inline void necessary_observability_check(MeasuredValues<sym> const& measured_va
66
66
Idx const n_bus{topo->n_bus ()};
67
67
std::vector<BranchIdx> const & branch_bus_idx{topo->branch_bus_idx };
68
68
69
- auto const [n_voltage_magnitude, n_voltage_phasor ] = detail::count_voltage_sensors (n_bus, measured_values);
70
- if (n_voltage_magnitude + n_voltage_phasor < 1 ) {
69
+ auto const [n_voltage_sensor, n_voltage_phasor_sensor ] = detail::count_voltage_sensors (n_bus, measured_values);
70
+ if (n_voltage_sensor < 1 ) {
71
71
throw NotObservableError{};
72
72
}
73
+
73
74
Idx const n_injection_sensor = detail::count_bus_injection_sensors (n_bus, measured_values);
74
75
Idx const n_branch_sensor = detail::count_branch_sensors (branch_bus_idx, n_bus, measured_values);
76
+ Idx const n_power_sensor = n_injection_sensor + n_branch_sensor;
75
77
76
- if (n_voltage_phasor == 0 && n_branch_sensor + n_injection_sensor < n_bus - 1 ) {
78
+ if (n_voltage_phasor_sensor == 0 && n_power_sensor < n_bus - 1 ) {
77
79
throw NotObservableError{};
78
80
}
79
- if (n_voltage_phasor > 0 && n_branch_sensor + n_injection_sensor + n_voltage_phasor < n_bus) {
81
+ if (n_voltage_phasor_sensor > 0 && n_power_sensor + n_voltage_phasor_sensor < n_bus) {
80
82
throw NotObservableError{};
81
83
}
82
84
}
0 commit comments