40 lines
837 B
C
40 lines
837 B
C
|
|
|
||
|
|
#include <stdbool.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);
|
||
|
|
|