Commit c5dadb3f authored by Alessio Netti's avatar Alessio Netti
Browse files

Analytics: various fixes

- Fixed a bug in UnitGenerator when generating units in relaxed mode
- Added the latest reading as feature in the Regressor plugin
- Added a small delay in the scheduling of analyzers to give higher
priority to standard monitoring plugins
parent 1a968c70
......@@ -212,6 +212,7 @@ void RegressorAnalyzer::computeFeatureVector(U_Ptr unit) {
_currentfVector->at<float>(fIdx+2) = (float)_diffsum;
_currentfVector->at<float>(fIdx+3) = (float)_qtl25;
_currentfVector->at<float>(fIdx+4) = (float)_qtl75;
_currentfVector->at<float>(fIdx+5) = (float)_buffer->at(_buffer->size()-1).value;
}
//LOG(error) << "Target: " << _currentTarget;
//LOG(error) << "Vector: ";
......@@ -248,6 +249,9 @@ std::string RegressorAnalyzer::getImportances() {
case 4:
pair.name += " - qtl75";
break;
case 5:
pair.name += " - latest";
break;
default:
break;
}
......
......@@ -36,7 +36,7 @@
#include "opencv4/opencv2/ml.hpp"
#include <math.h>
#define REG_NUMFEATURES 5
#define REG_NUMFEATURES 6
/**
* @brief Regressor analyzer plugin.
......
......@@ -398,9 +398,9 @@ protected:
uint64_t now_ms = now / 1000 / 1000;
uint64_t waitToStart = interval64 - (now_ms%interval64); //synchronize all measurements with other sensors
if(!waitToStart ){ // less than 1 ms seconds is too small, so we wait the entire interval for the next measurement
return (now_ms + interval64)*1000*1000;
return (now_ms + interval64 + 10)*1000*1000;
}
return (now_ms + waitToStart)*1000*1000;
return (now_ms + waitToStart + 10)*1000*1000;
} else {
return now + MS_TO_NS(_interval);
}
......
......@@ -396,7 +396,7 @@ protected:
for (const auto &s : *sensors) {
if (!addedSensors.count(s)) {
SBase uIn(*in);
uIn.setMqtt(_navi->getNodeTopic(s));
uIn.setMqtt(s);
uIn.setName(s);
if (!(_navi->sensorExists(uIn.getName()) || relaxed)) {
delete sensors;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment