44 lines
957 B
C
44 lines
957 B
C
#ifndef DATA_ACQUISITION_H
|
|
#define DATA_ACQUISITION_H
|
|
|
|
#include <stdbool.h>
|
|
#include <math.h>
|
|
#include <stdlib.h>
|
|
|
|
typedef struct {
|
|
float mean;
|
|
float standardDeviation;
|
|
int *possibleFaultySensor;
|
|
} Metrics;
|
|
|
|
typedef struct {
|
|
int sensorsNumber;
|
|
int slidingWindowSize;
|
|
} Matrix;
|
|
|
|
void initializeReadings(int numSensors, float deltaTime);
|
|
bool freeReadings();
|
|
|
|
int getSensorsNumber();
|
|
int getSlidingWindowSize();
|
|
bool isFull(int sensorIndex);
|
|
|
|
void addReading(float value);
|
|
|
|
float getAverageOnSensor(int sensorIndex);
|
|
float getAverageOnAllSensors();
|
|
float getOverallAverage();
|
|
|
|
float getStandardDeviationOnSensor(int sensorIndex);
|
|
float getStandardDeviationOnAllSensors();
|
|
float getOverallStandardDeviation();
|
|
|
|
float getLastReading(int sensorIndex);
|
|
|
|
void anomalyDetect(float average, float standardDeviation);
|
|
|
|
int getOutlierCount();
|
|
|
|
Metrics getMetrics(float **readings, int sensorNumber, int slidingWindow);
|
|
|
|
#endif // DATA_ACQUISITION_H
|