This commit is contained in:
Vincenzo Pio Florio 2024-12-03 13:25:10 +01:00
parent a9ba49505e
commit 034c7231ef
4 changed files with 4 additions and 50 deletions

View File

@ -1,44 +0,0 @@
#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);
bool anomalyDetect(float average, float standardDeviation);
int getOutlierCount();
Metrics getMetrics(float **readings, int sensorNumber, int slidingWindow);
#endif // DATA_ACQUISITION_H

Binary file not shown.

View File

@ -35,7 +35,7 @@ float getOverallStandardDeviation();
float getLastReading(int sensorIndex);
bool anomalyDetect(float average, float standardDeviation);
void anomalyDetect(float average, float standardDeviation);
int getOutlierCount();

View File

@ -3,6 +3,8 @@
#include <stdbool.h>
#include <math.h>
#include <dataAcquisition.h>
int outlierCount;
// Variable definition
@ -10,11 +12,7 @@ static float **readings;
static int sensorsNumber;
static int slidingWindowSize;
typedef struct {
float mean;
float standardDeviation;
int possibleFaultySensor;
} Metrics;
/**