2022-06-01 12:32:04 +02:00
|
|
|
#include "power.h"
|
|
|
|
#include "getArray.h"
|
2022-06-02 14:29:21 +02:00
|
|
|
#include "fileGestion.h"
|
2022-06-01 18:02:32 +02:00
|
|
|
#include "initialParameters.h"
|
2022-06-01 12:32:04 +02:00
|
|
|
|
2022-06-02 14:29:21 +02:00
|
|
|
void power(int **p, double a[]){
|
2022-06-02 12:12:41 +02:00
|
|
|
|
|
|
|
double periode = 1.0/freqEch;
|
|
|
|
double temps = 1/(nRow * periode);
|
2022-06-02 14:29:21 +02:00
|
|
|
/*printf("periode : %f\n",periode);
|
|
|
|
printf("temps : %f\n",temps);*/
|
2022-06-02 12:12:41 +02:00
|
|
|
|
|
|
|
//Fill array with the power of the signal for each captor
|
2022-06-02 15:07:04 +02:00
|
|
|
for(int i = 0; i < nCol-1; i++){
|
2022-06-01 12:32:04 +02:00
|
|
|
int j = 0;
|
2022-06-02 12:12:41 +02:00
|
|
|
a[i] = 0;
|
|
|
|
while(j < nRow-1){
|
2022-06-02 15:07:04 +02:00
|
|
|
double aire = ( pow(p[j][i+1],2) + pow(p[j+1][i+1],2) ) / 2 * periode;
|
2022-06-02 12:12:41 +02:00
|
|
|
//printf("aire [%d,%d] : %f\n",j,i,aire);
|
|
|
|
a[i] += aire;
|
2022-06-01 12:32:04 +02:00
|
|
|
j++;
|
|
|
|
}
|
2022-06-02 12:12:41 +02:00
|
|
|
a[i] *= temps;
|
2022-06-02 15:07:04 +02:00
|
|
|
//printf("%f\n", a[i]);
|
2022-06-01 12:32:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
int main(int argc , char** argv){
|
2022-06-01 18:02:32 +02:00
|
|
|
int **p = getRawDataArray(nRow, nCol);
|
2022-06-02 18:10:42 +02:00
|
|
|
printArray(p,nRow,nCol);
|
2022-06-02 12:12:41 +02:00
|
|
|
double pw[8];
|
|
|
|
power(p,pw);
|
2022-06-02 14:29:21 +02:00
|
|
|
writePowerData(pw,8);
|
2022-06-01 12:32:04 +02:00
|
|
|
}
|