@@ -16,6 +16,7 @@ struct ObservabilitySensorsResult {
1616 std::vector<int8_t > flow_sensors; // power sensor and current sensor
1717 std::vector<int8_t > voltage_phasor_sensors; // voltage phasor sensors
1818 std::vector<int8_t > bus_injections; // bus injections, zero injection and power sensors at buses
19+ int8_t total_injections{0 }; // total number of injections at buses
1920 bool is_possibly_ill_conditioned{false };
2021};
2122enum class ConnectivityStatus : std::int8_t {
@@ -75,7 +76,7 @@ ObservabilitySensorsResult scan_network_sensors(MeasuredValues<sym> const& measu
7576 // diagonal for bus injection measurement
7677 if (measured_values.has_bus_injection (bus)) {
7778 result.bus_injections [bus] = 1 ;
78- result.bus_injections . back () += 1 ;
79+ result.total_injections += 1 ;
7980 result.flow_sensors [current_bus_entry] = 1 ;
8081 has_at_least_one_sensor = true ;
8182 bus_neighbourhood_info[bus].status = ConnectivityStatus::node_measured; // only treat power/0 injection
@@ -498,10 +499,7 @@ inline bool find_spanning_tree_from_node(Idx start_bus, Idx n_bus,
498499}
499500
500501inline bool
501- sufficient_condition_meshed_without_voltage_phasor (std::vector<detail::BusNeighbourhoodInfo> const & _neighbour_list) {
502- // make a copy of the neighbour list
503- std::vector<detail::BusNeighbourhoodInfo> const neighbour_list = _neighbour_list;
504-
502+ sufficient_condition_meshed_without_voltage_phasor (std::vector<detail::BusNeighbourhoodInfo> const & neighbour_list) {
505503 auto const n_bus = static_cast <Idx>(neighbour_list.size ());
506504 std::vector<Idx> starting_candidates;
507505 prepare_starting_nodes (neighbour_list, n_bus, starting_candidates);
@@ -552,7 +550,7 @@ inline ObservabilityResult observability_check(MeasuredValues<sym> const& measur
552550 }
553551
554552 // Sufficient early out, enough nodal measurement equals observable
555- if (observability_sensors.bus_injections . back () > n_bus - 2 ) {
553+ if (observability_sensors.total_injections > n_bus - 2 ) {
556554 return ObservabilityResult{.is_observable = true ,
557555 .is_possibly_ill_conditioned = observability_sensors.is_possibly_ill_conditioned };
558556 }
0 commit comments