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,Float lowerThreshold = -1,Float upperThreshold = 1,Float hysteresisThreshold = 0,UINT searchWindowSize = 20,UINT searchTimeoutDuration = 1000,UINT offsetFilterSize = 10);
79 bool update(
const Float x );
93 bool triggerSearchTimeout();
100 bool getThresholdCrossingDetected()
const;
105 bool getEnableSearch()
const;
110 UINT getAnalysisMode()
const;
115 UINT getThresholdCrossingMode()
const;
120 UINT getSearchWindowSize()
const;
125 UINT getOffsetFilterSize()
const;
130 UINT getSearchWindowIndex()
const;
135 UINT getSearchTimeoutCounter();
140 UINT getSearchTimeoutDuration()
const;
145 Float getAnalysisValue()
const;
150 Float getUpperThreshold()
const;
155 Float getLowerThreshold()
const;
160 Float getHysteresisThreshold()
const;
169 bool setEnableSearch(
const bool enableSearch);
177 bool setAnalysisMode(
const UINT analysisMode);
185 bool setThresholdCrossingMode(
const UINT thresholdCrossingMode);
194 bool setSearchWindowSize(
const UINT searchWindowSize);
202 bool setOffsetFilterSize(
const UINT offsetFilterSize);
210 bool setSearchTimeoutDuration(
const UINT searchTimeoutDuration);
221 bool setDetectionTimeoutMode(
const UINT detectionTimeoutMode);
229 bool setLowerThreshold(
const Float lowerThreshold);
237 bool setUpperThreshold(
const Float upperThreshold);
245 bool setHysteresisThreshold(
const Float hysteresisThreshold);
249 Float lowerThreshold;
250 Float upperThreshold;
251 Float 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
The MovingAverageFilter implements a low pass moving average filter.
The Derivative class computes either the first or second order derivative of the input signal...