29 #ifndef GRT_THRESHOLD_CROSSING_DETECTOR_HEADER
30 #define GRT_THRESHOLD_CROSSING_DETECTOR_HEADER
32 #include "../PreProcessingModules/MovingAverageFilter.h"
33 #include "../PreProcessingModules/Derivative.h"
51 ThresholdCrossingDetector(UINT analysisMode = RAW_DATA_ANALYSIS_MODE,UINT thresholdCrossingMode = UPPER_THRESHOLD_CROSSING,UINT detectionTimeoutMode = TIMEOUT_COUNTER,
double lowerThreshold = -1,
double upperThreshold = 1,
double hysteresisThreshold = 0,UINT searchWindowSize = 20,UINT searchTimeoutDuration = 1000,UINT offsetFilterSize = 10);
79 bool update(
const double x );
248 double analysisValue;
249 double lowerThreshold;
250 double upperThreshold;
251 double hysteresisThreshold;
253 bool thresholdCrossingDetected;
254 unsigned int analysisMode;
255 unsigned int thresholdCrossingMode;
256 unsigned int detectionTimeoutMode;
257 unsigned int searchTimeoutDuration;
258 unsigned int searchWindowSize;
259 unsigned int searchWindowIndex;
260 unsigned int offsetFilterSize;
261 unsigned int currentSearchState;
262 Timer searchTimeoutCounter;
267 enum SearchStates{SEARCHING_FOR_FIRST_THRESHOLD_CROSSING=0,SEARCHING_FOR_SECOND_THRESHOLD_CROSSING,NO_SEARCH_GATE_TIME_OUT};
269 enum ThresholdCrossingModes{UPPER_THRESHOLD_CROSSING=0,
270 LOWER_THRESHOLD_CROSSING,
271 UPPER_OR_LOWER_THRESHOLD_CROSSING,
272 UPPER_THEN_LOWER_THRESHOLD_CROSSING,
273 LOWER_THEN_UPPER_THRESHOLD_CROSSING};
275 enum AnalysisModes{RAW_DATA_ANALYSIS_MODE=0,MOVING_OFFSET_ANALYSIS_MODE,DERIVATIVE_ANALYSIS_MODE};
277 enum DetectionTimeoutMode{TIMEOUT_COUNTER=0,HYSTERESIS_THRESHOLD};
283 #endif //GRT_THRESHOLD_CROSSING_DETECTOR_HEADER
bool setSearchTimeoutDuration(const UINT searchTimeoutDuration)
UINT getSearchTimeoutDuration() const
bool setThresholdCrossingMode(const UINT thresholdCrossingMode)
The CircularBuffer class provides a data structure for creating a dynamic circular buffer (also known...
bool setDetectionTimeoutMode(const UINT detectionTimeoutMode)
bool getThresholdCrossingDetected() const
ThresholdCrossingDetector(UINT analysisMode=RAW_DATA_ANALYSIS_MODE, UINT thresholdCrossingMode=UPPER_THRESHOLD_CROSSING, UINT detectionTimeoutMode=TIMEOUT_COUNTER, double lowerThreshold=-1, double upperThreshold=1, double hysteresisThreshold=0, UINT searchWindowSize=20, UINT searchTimeoutDuration=1000, UINT offsetFilterSize=10)
UINT getSearchWindowSize() const
bool triggerSearchTimeout()
bool setOffsetFilterSize(const UINT offsetFilterSize)
UINT getOffsetFilterSize() const
bool setAnalysisMode(const UINT analysisMode)
bool setLowerThreshold(const double lowerThreshold)
bool setEnableSearch(const bool enableSearch)
double getLowerThreshold() const
bool update(const double x)
UINT getThresholdCrossingMode() const
bool setUpperThreshold(const double upperThreshold)
~ThresholdCrossingDetector()
bool getEnableSearch() const
double getHysteresisThreshold() const
double getUpperThreshold() const
UINT getAnalysisMode() const
bool setHysteresisThreshold(const double hysteresisThreshold)
UINT getSearchTimeoutCounter() const
double getAnalysisValue() const
ThresholdCrossingDetector & operator=(const ThresholdCrossingDetector &rhs)
UINT getSearchWindowIndex() const
bool setSearchWindowSize(const UINT searchWindowSize)