40 #include <visp3/core/vpStatisticalTestShewhart.h>
44 #include <visp3/core/vpMath.h>
54 name =
"3-sigma alarm";
57 name =
"2-sigma alarm";
60 name =
"1-sigma alarm";
63 name =
"Same-side alarm";
69 name =
"Unknown WECO alarm";
100 unsigned int nbAboveMean = 0;
101 unsigned int nbAbove2SigmaLimit = 0;
102 unsigned int nbAbove1SigmaLimit = 0;
105 nbAbove2SigmaLimit = 0;
106 nbAbove1SigmaLimit = 0;
115 ++nbAbove2SigmaLimit;
119 ++nbAbove2SigmaLimit;
121 if (nbAbove2SigmaLimit >= 2) {
129 ++nbAbove1SigmaLimit;
133 ++nbAbove1SigmaLimit;
135 if (nbAbove1SigmaLimit >= 4) {
146 else if (nbAbove2SigmaLimit >= 2) {
150 else if (nbAbove1SigmaLimit >= 4) {
172 unsigned int nbAboveMean = 0;
173 unsigned int nbAbove2SigmaLimit = 0;
174 unsigned int nbAbove1SigmaLimit = 0;
177 nbAbove2SigmaLimit = 0;
178 nbAbove1SigmaLimit = 0;
187 ++nbAbove2SigmaLimit;
191 ++nbAbove2SigmaLimit;
193 if (nbAbove2SigmaLimit >= 2) {
201 ++nbAbove1SigmaLimit;
205 ++nbAbove1SigmaLimit;
207 if (nbAbove1SigmaLimit >= 4) {
218 else if (nbAbove2SigmaLimit >= 2) {
222 else if (nbAbove1SigmaLimit >= 4) {
233 if (areStatsAvailable) {
236 return areStatsAvailable;
250 , m_nbDataInBuffer(0)
251 , m_activateWECOrules(activateWECOrules)
254 , m_oneSigmaNegLim(0.f)
255 , m_oneSigmaPosLim(0.f)
256 , m_twoSigmaNegLim(0.f)
257 , m_twoSigmaPosLim(0.f)
259 init(activateWECOrules, activatedRules, nbSamplesForStats);
264 , m_nbDataInBuffer(0)
265 , m_activateWECOrules(activateWECOrules)
268 , m_oneSigmaNegLim(0.f)
269 , m_oneSigmaPosLim(0.f)
270 , m_twoSigmaNegLim(0.f)
271 , m_twoSigmaPosLim(0.f)
273 init(activateWECOrules, activatedRules, mean, stdev);
278 std::vector<float> signals;
static float modulo(const float &value, const float &modulo)
Gives the rest of value divided by modulo when the quotient can only be an integer.
vpMeanDriftType
Enum that indicates if a drift of the mean occurred.
void init()
(Re)Initialize the algorithm.
virtual bool updateStatistics(const float &signal)
Update m_s and if enough values are available, compute the mean, the standard deviation and the limit...
bool m_areStatisticsComputed
bool m_activatedWECOrules[COUNT_WECO - 1]
vpStatisticalTestShewhart(const bool &activateWECOrules=true, const bool activatedRules[COUNT_WECO - 1]=CONST_ALL_WECO_ACTIVATED, const unsigned int &nbSamplesForStats=30)
Construct a new vpStatisticalTestShewhart object.
virtual void computeLimits() override
Compute the upper and lower limits of the test signal.
virtual vpMeanDriftType detectUpwardMeanDrift() override
Detects if an upward mean drift occured on the mean.
std::vector< float > getSignals() const
Get the NB_DATA_SIGNAL last signal values, sorted from the latest [0] to the newest [NB_DATA_SIGNAL -...
virtual vpMeanDriftType detectDownwardMeanDrift() override
Detects if a downward mean drift occured.
virtual void updateTestSignals(const float &signal) override
Update the test signals.
virtual bool updateStatistics(const float &signal) override
Update m_s and if enough values are available, compute the mean, the standard deviation and the limit...
unsigned int m_nbDataInBuffer
float m_signal[NB_DATA_SIGNAL]
static const bool CONST_ALL_WECO_ACTIVATED[COUNT_WECO - 1]
static const int NB_DATA_SIGNAL
static std::string vpWecoRulesAlarmToString(const vpWecoRulesAlarm &alarm)
Class that permits a simple test comparing the current value to the standard deviation of the signal.