add timeFile + ignore last values
This commit is contained in:
parent
8ecdd37619
commit
e06c7602e0
|
@ -1,5 +1,5 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
|
||||||
all:
|
all:
|
||||||
$(CC) -g fileGestion.c getArray.c average.c growthRate.c power.c queue.c simulateFlux.c main.c -lm -lpthread -o main
|
$(CC) -g -Wall fileGestion.c getArray.c average.c growthRate.c power.c queue.c simulateFlux.c main.c -lm -lpthread -o main
|
||||||
./main < ../02400031.TXT
|
./main < ../02400031.TXT
|
|
@ -17,6 +17,7 @@ void averageCalculation(long **p, double averageArray[]){
|
||||||
averageArray[i] += p[i][j];
|
averageArray[i] += p[i][j];
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
//printf("%f , %f\n", averageArray[i] , averageArray[i] / nRowRawData);
|
||||||
averageArray[i] /= nRowRawData;
|
averageArray[i] /= nRowRawData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ void printArrayData(long** p, int N, int M) {
|
||||||
for(i = 0 ; i < N ; i++){
|
for(i = 0 ; i < N ; i++){
|
||||||
printf("line n°%d : " , i);
|
printf("line n°%d : " , i);
|
||||||
for(int j = 0 ; j < M ; j++){
|
for(int j = 0 ; j < M ; j++){
|
||||||
printf("%d , " , p[i][j]);
|
printf("%ld , " , p[i][j]);
|
||||||
if(j==(M-1)) printf("\n");
|
if(j==(M-1)) printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,11 @@ extern int nRowRawData;
|
||||||
extern int nRowGR;
|
extern int nRowGR;
|
||||||
extern int nCol;
|
extern int nCol;
|
||||||
extern double freqEch;
|
extern double freqEch;
|
||||||
|
extern int nbRowBinFile;
|
||||||
|
extern int nbRowIgnore;
|
||||||
|
|
||||||
extern int cptFile;
|
extern int cptFile;
|
||||||
|
extern int cptValue;
|
||||||
extern double period;
|
extern double period;
|
||||||
extern double invTimeBandWidth;
|
extern double invTimeBandWidth;
|
||||||
|
|
||||||
|
|
BIN
Code-C/main
BIN
Code-C/main
Binary file not shown.
|
@ -14,12 +14,16 @@ int nRowGR = 150;
|
||||||
int nCol = 1;
|
int nCol = 1;
|
||||||
double freqEch = 250;
|
double freqEch = 250;
|
||||||
|
|
||||||
|
int nbRowBinFile = 900011;
|
||||||
|
int nbRowIgnore = 19;
|
||||||
|
|
||||||
Pqueue firstRawDataQueue;
|
Pqueue firstRawDataQueue;
|
||||||
//Captor 1 2 3 4 5 6 7 8
|
//Captor 1 2 3 4 5 6 7 8
|
||||||
bool selectionCaptors[] = {true,false,true,false,false,false,true,false};
|
bool selectionCaptors[] = {true,false,true,false,false,false,true,false};
|
||||||
|
|
||||||
int cptData = 0;
|
int cptData = 0;
|
||||||
int cptFile = 1;
|
int cptFile = 1;
|
||||||
|
int cptValue = 0;
|
||||||
|
|
||||||
double period = 0;
|
double period = 0;
|
||||||
double invTimeBandWidth = 0;
|
double invTimeBandWidth = 0;
|
||||||
|
@ -97,7 +101,7 @@ void *threadCalculGrowthRate(void * vargp){
|
||||||
growthRateFunction(dataLignPw,"growthRatePw.csv");
|
growthRateFunction(dataLignPw,"growthRatePw.csv");
|
||||||
growthRateFunction(dataLignPw,"growthRateAv.csv");
|
growthRateFunction(dataLignPw,"growthRateAv.csv");
|
||||||
}
|
}
|
||||||
//remove(fileName);
|
remove(fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,7 @@ int lastIndexCaptor(){
|
||||||
}
|
}
|
||||||
return lastIndex;
|
return lastIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief write one lign of rawData in the file @param rawDataFile (simulate of freq of the Vegetal Signals Captor)
|
* @brief write one lign of rawData in the file @param rawDataFile (simulate of freq of the Vegetal Signals Captor)
|
||||||
*
|
*
|
||||||
|
@ -108,7 +109,12 @@ bool writeOneRawData(FILE *rawDataFile){
|
||||||
quartet value;
|
quartet value;
|
||||||
|
|
||||||
if(fread(&buff, 26, 1, stdin)) {
|
if(fread(&buff, 26, 1, stdin)) {
|
||||||
fprintf(rawDataFile , "%d,", millis());
|
//printf("%d\n",cptValue);
|
||||||
|
if(cptValue < nbRowBinFile - nbRowIgnore){
|
||||||
|
FILE *timeFile = fopen("timeFile.csv" , "a+");
|
||||||
|
fprintf(timeFile , "%ld\n", millis());
|
||||||
|
fclose(timeFile);
|
||||||
|
fprintf(rawDataFile , "%ld,", millis());
|
||||||
if (strncmp(buff, "#################\n", (size_t)18) == 0) {
|
if (strncmp(buff, "#################\n", (size_t)18) == 0) {
|
||||||
if (!(fread(&buff2, 18, 1, stdin))) {
|
if (!(fread(&buff2, 18, 1, stdin))) {
|
||||||
fprintf(stderr, "Erreur lecture après ###...#");
|
fprintf(stderr, "Erreur lecture après ###...#");
|
||||||
|
@ -127,22 +133,28 @@ bool writeOneRawData(FILE *rawDataFile){
|
||||||
|
|
||||||
valbin[i] = buff[3*i+1]*256*256*256 + buff[3*i+2]*256*256 + buff[3*i+3]*256;
|
valbin[i] = buff[3*i+1]*256*256*256 + buff[3*i+2]*256*256 + buff[3*i+3]*256;
|
||||||
memcpy(&values[i], &valbin[i], sizeof(uint32_t));
|
memcpy(&values[i], &valbin[i], sizeof(uint32_t));
|
||||||
|
FILE* allRawDataFile = fopen("AllRawData.csv" , "a+");
|
||||||
if(i-1==lastIndex){
|
if(i-1==lastIndex){
|
||||||
fprintf(rawDataFile, "%d\n", values[i]/256);
|
fprintf(rawDataFile, "%d\n", values[i]/256);
|
||||||
|
fprintf(allRawDataFile, "%d\n", values[i]/256);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
fprintf(rawDataFile, "%d,", values[i]/256);
|
fprintf(rawDataFile, "%d,", values[i]/256);
|
||||||
|
fprintf(allRawDataFile, "%d,", values[i]/256);
|
||||||
}
|
}
|
||||||
|
fclose(allRawDataFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cptData++;
|
cptData++;
|
||||||
//sleep(0.004); //simul freq here
|
//sleep(0.004); //simul freq here
|
||||||
|
|
||||||
|
cptValue++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *threadSimulateFlux(void *vargp){
|
void *threadSimulateFlux(void *vargp){
|
||||||
|
|
Loading…
Reference in a new issue