51 for (
unsigned i = 0; i < siblings; i++) {
99 while (next !=
nullptr) {
112 while (next !=
nullptr) {
125 while (next !=
nullptr) {
127 next->
put(timestamp, val, error_count, priority);
143 float pre_check_confidence = 1.0f;
144 int pre_check_prio = -1;
145 float max_confidence = -1.0f;
146 int max_priority = -1000;
152 while (next !=
nullptr) {
153 float confidence = next->
confidence(timestamp);
155 if (i == pre_check_best) {
157 pre_check_confidence = confidence;
166 (confidence > max_confidence && (next->
priority() >= max_priority)) ||
167 (fabsf(confidence - max_confidence) < 0.01f && (next->
priority() > max_priority))
168 ) && (confidence > 0.0
f)) {
171 max_confidence = confidence;
184 bool true_failsafe =
true;
187 if (pre_check_prio != -1 && pre_check_prio < max_priority &&
188 fabsf(pre_check_confidence - max_confidence) < 0.1
f) {
191 true_failsafe =
false;
194 if (best !=
nullptr) {
222 return (best) ? best->
value() :
nullptr;
233 while (next !=
nullptr) {
236 float *rms = next->
rms();
238 for (
unsigned j = 0; j < 3; j++) {
259 while (next !=
nullptr) {
264 if (vibe < 0.0
f || vibration_offset[axis] < vibe) {
265 vibe = vibration_offset[axis];
279 ECL_INFO(
"validator: best: %d, prev best: %d, failsafe: %s (%u events)",
286 while (next !=
nullptr) {
288 uint32_t flags = next->
state();
312 while (next !=
nullptr) {
330 while (next !=
nullptr) {
332 return next->
state();
int priority() const
Get the priority of this validator.
uint32_t get_timeout() const
Get the timeout value.
static constexpr uint32_t ERROR_FLAG_NO_ERROR
Data validator error states.
Adapter / shim layer for system calls needed by ECL.
bool used() const
Get the used status of this validator.
void put(unsigned index, uint64_t timestamp, const float val[3], uint64_t error_count, int priority)
Put an item into the validator group.
void set_timeout(uint32_t timeout_interval_us)
Set the timeout value for the whole group.
void reset_state()
Reset the error state of this validator.
DataValidator * _first
first node in the group
static constexpr uint32_t ERROR_FLAG_TIMEOUT
int failover_index()
Get the index of the failed sensor in the group.
DataValidator * _last
last node in the group
void print()
Print the validator value.
uint32_t failover_state()
Get the error state of the failed sensor in the group.
static constexpr uint32_t ERROR_FLAG_STALE_DATA
float * get_best(uint64_t timestamp, int *index)
Get the best data triplet of the group.
static constexpr float MIN_REGULAR_CONFIDENCE
static constexpr uint32_t ERROR_FLAG_HIGH_ERRCOUNT
float get_vibration_offset(uint64_t timestamp, int axis)
Get the vibration offset in the sensor unit.
float get_vibration_factor(uint64_t timestamp)
Get the RMS / vibration factor.
void print()
Print the validator value.
void set_timeout(uint32_t timeout_interval_us)
Set the timeout value.
void setSibling(DataValidator *new_sibling)
Set the sibling to the next node in the group.
void set_equal_value_threshold(uint32_t threshold)
Set the equal count threshold for the whole group.
DataValidator * add_new_validator()
Create a new Validator (with index equal to the number of currently existing validators) ...
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
A data validation group to identify anomalies in data streams.
uint32_t state() const
Get the error state of this validator.
float * rms()
Get the RMS values of this validator.
static constexpr uint32_t ERROR_FLAG_NO_DATA
float * value()
Get the values of this validator.
DataValidator * sibling()
Get the next sibling in the group.
static constexpr uint32_t ERROR_FLAG_HIGH_ERRDENSITY
void set_equal_value_threshold(uint32_t threshold)
Set the equal count threshold.
uint32_t _timeout_interval_us
currently set timeout
float * vibration_offset()
Get the vibration offset.
void put(uint64_t timestamp, float val, uint64_t error_count, int priority)
Put an item into the validator.
float confidence(uint64_t timestamp)
Get the confidence of this validator.
int _prev_best
the previous best index
int _curr_best
currently best index
unsigned _toggle_count
number of back and forth switches between two sensors
DataValidatorGroup(unsigned siblings)
uint64_t _first_failover_time
timestamp where the first failover occured or zero if none occured