#include <DataPeak.h>

Public Member Functions

 DataPeak (unsigned int samples, double epsilon)
 
void Reset ()
 
double LastTopPeak ()
 
double LastBottomPeak ()
 
bool Peaked (double value)
 

Protected Attributes

bool m_PositiveTrend
 
bool m_FindMax
 
bool m_FindMin
 
unsigned int m_Samples
 
unsigned int m_PeakCount
 
double m_Epsilon
 
double m_SamplePeak
 
double m_LastTopPeak
 
double m_LastBottomPeak
 

Detailed Description

Utility class that looks for a peak in data looking at the data one point at a time.

Note: I wrote this for finding peaks on well behaved sinusoidal data. I have some Ideas in the comments if the data is not as well behaved.

Constructor & Destructor Documentation

◆ DataPeak()

DataPeak::DataPeak ( unsigned int  samples,
double  epsilon 
)

– Number of Samples - This is how many values the peak is compared too, that the current peak must be greater than. When the this many samples are smaller than the peak, we have found a peak. – epsilon - The window (below the peak if trending up, above the peak if trending down) that a new value must be below/above in order to be considered treding away from the peak If data is inside the window, we are in a plataue and don't do anything. If we are going away from the peak (opposite direction) we need #samples away from the window to signal a peak. If we find a point that is a new peak, we move our window and start our counting all over.

By default this class will look for max peak only By default this class assumes data coming in is trening in the positive/up direction

Member Function Documentation

◆ LastBottomPeak()

double DataPeak::LastBottomPeak ( )

Get the last bottom peak value

◆ LastTopPeak()

double DataPeak::LastTopPeak ( )

Get the last top peak value

◆ Peaked()

bool DataPeak::Peaked ( double  value)

Check to see if we have peaked value is the next point of data we will check against.

◆ Reset()

void DataPeak::Reset ( )

Reset Counter info

Member Data Documentation

◆ m_Epsilon

double DataPeak::m_Epsilon
protected

◆ m_FindMax

bool DataPeak::m_FindMax
protected

◆ m_FindMin

bool DataPeak::m_FindMin
protected

◆ m_LastBottomPeak

double DataPeak::m_LastBottomPeak
protected

◆ m_LastTopPeak

double DataPeak::m_LastTopPeak
protected

◆ m_PeakCount

unsigned int DataPeak::m_PeakCount
protected

◆ m_PositiveTrend

bool DataPeak::m_PositiveTrend
protected

◆ m_SamplePeak

double DataPeak::m_SamplePeak
protected

◆ m_Samples

unsigned int DataPeak::m_Samples
protected