From e23d744cdc5b66a309b20167742b132efb00e4be Mon Sep 17 00:00:00 2001 From: "quentin.perret" Date: Thu, 16 Jun 2022 14:35:02 +0200 Subject: [PATCH] beginning change power --- Code-C/getArray.c | 15 +++++++++++++-- Code-C/getArray.h | 3 ++- Code-C/growthRate.c | 15 ++++++++------- Code-C/growthRate.h | 2 +- Code-C/main | Bin 0 -> 41872 bytes Code-C/main.c | 23 +++++++++++------------ Code-C/power.c | 15 ++++++++++----- Code-C/power.h | 2 +- Code-C/simulateFlux.c | 4 ++-- 9 files changed, 48 insertions(+), 31 deletions(-) create mode 100755 Code-C/main diff --git a/Code-C/getArray.c b/Code-C/getArray.c index eeaac8e..7284378 100644 --- a/Code-C/getArray.c +++ b/Code-C/getArray.c @@ -3,7 +3,7 @@ #include "initialParameters.h" //#include -long **get(int N, int M) /* Allocate the array */ +long **getlongArray(int N, int M) /* Allocate the array */ { /* Check if allocation succeeded. (check for NULL pointer) */ int i; @@ -14,6 +14,17 @@ long **get(int N, int M) /* Allocate the array */ return array; } +double **getDoubleArray(int N, int M) /* Allocate the array */ +{ + /* Check if allocation succeeded. (check for NULL pointer) */ + int i; + double **array; + array = (double **) malloc(N*sizeof(double *)); + for(i = 0 ; i < N ; i++) + array[i] = (double *) malloc( M*sizeof(double)); + return array; +} + void fillArrayWithRawData(char *rawDataFileName,long** p, int N, int M) { int i, j; char *buffer; @@ -86,7 +97,7 @@ void freeArray(long **p, int N) { */ long **getRawDataArray(char* rawDataFileName){ long **p; - p = get(nRow, nCol); + p = getlongArray(nRow, nCol); fillArrayWithRawData(rawDataFileName,p ,nRow, nCol); //if(checkArrayFullyFill(p,nRow)){ //clearRawData(N); diff --git a/Code-C/getArray.h b/Code-C/getArray.h index 02810a9..a53bd0c 100644 --- a/Code-C/getArray.h +++ b/Code-C/getArray.h @@ -8,4 +8,5 @@ long **getRawDataArray(char *rawDataFileName); void printArrayData(long** p, int N, int M); void freeArray(long **p, int N); -bool checkArrayFullyFill(long **p, int N ); \ No newline at end of file +bool checkArrayFullyFill(long **p, int N ); +double **getDoubleArray(int N, int M); \ No newline at end of file diff --git a/Code-C/growthRate.c b/Code-C/growthRate.c index c381864..8fcca10 100644 --- a/Code-C/growthRate.c +++ b/Code-C/growthRate.c @@ -9,16 +9,17 @@ * @param gRateArray array that contaigns results of the growth ratecalculation */ void growthRateCalculation(double **dataArray , double *gRateArray){ - double gRate = 0; for(int i = 0 ; i < nCol-1 ; i++){ - gRate = (dataArray[1][i] - dataArray[2][i]) / period; + gRateArray[i] = (dataArray[0][i] - dataArray[1][i]) / period; } } - -void growthRateFunction(double *dataLign){ - double **dataArray; - //initialization + fill +/** + * @brief calcul then print differentiate in csv + * + * @param dataLign + */ +void growthRateFunction(double **dataLign){ double gRateArray[nCol-1]; - growthRateCalculation(dataArray , gRateArray); + growthRateCalculation(dataLign , gRateArray); appendDataInFile("growthRate.csv",gRateArray , nCol-1); } \ No newline at end of file diff --git a/Code-C/growthRate.h b/Code-C/growthRate.h index 1e0b201..7979f21 100644 --- a/Code-C/growthRate.h +++ b/Code-C/growthRate.h @@ -1,4 +1,4 @@ #include #include -void growthRateFunction(double *dataLign); \ No newline at end of file +void growthRateFunction(double **dataLign); \ No newline at end of file diff --git a/Code-C/main b/Code-C/main new file mode 100755 index 0000000000000000000000000000000000000000..640008a6248823e31c5af521edcfbba984debc5d GIT binary patch literal 41872 zcmeHwdwf*Ywf{LY*^`rGUP%ZLp2JHXLI_VmK@%V_LBOCOpy)6plZWJGGQ&er(13Mr zj3)hA#gzX>8+T|LDas;MG5>9?macEkRHc!jK?>KF& z<^nnm|3#8)Ppch*pi)EfIgwJigOYAfM@T-EDh(;6a;c7Lx1gw0^9z{DG0IBVp0*KFzfOo3OawH(>z#6m$ou`)5;NCv=hQl_dLnS;umlI2dxaw^rNy;Q2~ zNj9PX=Oo>pE&+`Wl@c!G^37W%jFOeW~m+PwKBy zS-m#Bwr2C(+0$z)rq$Ne$F@(~K5y={xw8wJ8wzIfb`OFgWXff$)@m2;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vmEdt~d8MGT0asfGnjWLTa$SaZl)R|Z z6roS&B$P;cB_$kfs7c@=`{HXs2{>{b;Y4fMFMm|>>6TC`6oU6rewo~oT9Ff+k{Zow z2&KF*!x^cy>Z>^9dPN^6yI{#L!iGZS+r#9u!?n2LnV=mPC+9i;D3G{Tlfc7AJgAX%1ETCQ7fo#zz3CZlX$`ASWRukw3-TuDqd8ItLs%7 zr&WiWtF?lP9rchWQrr!|DcB_N>s(eK1X@$1HcSO%uCX?%74Y$0fNVik1HdRnS98Q<`p{~=YbcDpKM4s*` zP#cFFwzy__bv;L=<4sPHQTtqlrYBOZ<<)f`l?D`}Ozq{D0RIu*Ew1!e*N0RpPlIuV zNE~W^EJ1A*GKeag`p-jrhYpo)k}yt-xSdpaoRRb6TKp1=s$X4iQmJ}*f#4Q0RGw0L z{{_7}U6ohYrBoV}%u0X7r_wE;)4SLetlr12(neXH^d~)){t~U-f(+SIl~>ofRN5;U zRsE{GYX2Ttev#x;*TYnLKnkYvi0Yd4tMc~(M`McgpuUyF|DL!L8l-(5W1!U-&hMZ>R zb;lD61&5tq!78QeL_SM-b$#;Wr!4;~lvQ(sYE;)TPs#FXVyI@QdX*jbp$wTw>94ML zp1Ojh;ax={F@IHgmA(gxwY+&;yQVt_8BZ-F`cF zhyt(E;%GTk{nper#X0x-J4B&QnjARB;J*a_syWL4l7CTskF0qN?GV|URRKv+^(w|} SWRjJSKO{Jo*$UV|?f(I4zMJO& literal 0 HcmV?d00001 diff --git a/Code-C/main.c b/Code-C/main.c index 1bacd00..1a42c18 100644 --- a/Code-C/main.c +++ b/Code-C/main.c @@ -6,14 +6,15 @@ #include "queue.h" #include "average.h" #include "growthRate.h" +#include "getArray.h" bool rawDataWriteFlag; -int nRow = 500; +int nRow = 4; int nCol = 1; double freqEch = 250; Pqueue firstRawDataQueue; - +//Captor 1 2 3 4 5 6 7 8 bool selectionCaptors[] = {true,false,true,false,false,false,true,false}; int cptData = 0; @@ -66,31 +67,29 @@ void *threadCalculGrowthRate(void * vargp){ Pqueue rawDataQueue = firstRawDataQueue; char* fileName; //double pw[nCol-1]; - double *dataLign[2][nCol-1]; + double **dataLign = getDoubleArray(2,nCol); + int i = 0; while(rawDataWriteFlag){ - //add case first file traitement - //(possibility 1: call twice powerfunction , following while strat after 2 file encountered) - //(posibilty 2 : initialiaze with a 0-fill array, move ligns for first encounter then let the following whil e do the job) while(queueGetNextE(rawDataQueue) != NULL){ rawDataQueue = queueGetNextE(rawDataQueue); fileName = queueGetTabChar(rawDataQueue); if(i < 2){ if(i == 1){ - powerFunction(fileName, dataLign[1]); - growthRateFunction(**dataLign); + powerFunction(fileName, dataLign); + growthRateFunction(dataLign); }else{ - powerFunction(fileName, dataLign[0]); + powerFunction(fileName, dataLign); } i++; }else{ for(int y = 0; y < (nCol-1); y++){ dataLign[0][y] = dataLign[1][y]; } - powerFunction(fileName, dataLign[1]); - growthRateFunction(**dataLign); + powerFunction(fileName, dataLign); + growthRateFunction(dataLign); } - remove(fileName); + //remove(fileName); } } } diff --git a/Code-C/power.c b/Code-C/power.c index 8f80d43..836bf0c 100644 --- a/Code-C/power.c +++ b/Code-C/power.c @@ -11,16 +11,21 @@ * @param powerArray array where results are stocked */ void powerCalculation(long **p, double powerArray[]){ + printArrayData(p,nRow,nCol); + printf("data in pw : \n"); for(int i = 1; i < nCol; i++){ int j = 0; powerArray[i] = 0; - while(j < nRow-1){ - double aire = ( pow(p[j][i],2) + pow(p[j+1][i],2) ) / 2 * period; - powerArray[i] += aire; + + while(j < nRow){ + + printf("%d , %d , %d , %d\n" , p[j][i], p[j+1][i] , i ,j); + powerArray[i] + pow(p[j][i],2); j++; } powerArray[i] *= invTimeBandWidth; } + } /** @@ -30,7 +35,7 @@ void powerCalculation(long **p, double powerArray[]){ * @param N number of rows in the file * @param M number of columns in the file */ -void powerFunction(char* rawDataFileName, double **pw){ +void powerFunction(char* rawDataFileName, double *pw[]){ long **p = getRawDataArray(rawDataFileName); double pww[nCol-1]; if(p !=NULL){ @@ -38,7 +43,7 @@ void powerFunction(char* rawDataFileName, double **pw){ powerCalculation(p,pww); appendDataInFile("powerData.csv",pww,nCol-1); }else{ - powerCalculation(p,*pw); + powerCalculation(p,pw[1]); appendDataInFile("powerData.csv",*pw,nCol-1); } freeArray(p,nRow); diff --git a/Code-C/power.h b/Code-C/power.h index 043857c..e75d948 100644 --- a/Code-C/power.h +++ b/Code-C/power.h @@ -1,4 +1,4 @@ #include #include -void powerFunction(char* rawDataFileName, double **pw); \ No newline at end of file +void powerFunction(char* rawDataFileName, double *pw[]); \ No newline at end of file diff --git a/Code-C/simulateFlux.c b/Code-C/simulateFlux.c index 0016a69..9c0fbd9 100644 --- a/Code-C/simulateFlux.c +++ b/Code-C/simulateFlux.c @@ -119,7 +119,7 @@ bool writeOneRawData(FILE *rawDataFile){ } int lastIndex = lastIndexCaptor(); for (int i = 1; i < 9; i++){ - if(selectionCaptors[i]){ + if(selectionCaptors[i-1]){ value.octet1 = buff[3*i+1]; value.octet2 = buff[3*i+2]; value.octet3 = buff[3*i+3]; @@ -128,7 +128,7 @@ bool writeOneRawData(FILE *rawDataFile){ 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)); - if(i==lastIndex){ + if(i-1==lastIndex){ fprintf(rawDataFile, "%d\n", values[i]/256); } else{