1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

adapt code style

This commit is contained in:
Manuel Pitz 2021-02-16 09:47:06 +01:00
parent 007e415b87
commit 7f2b713714

View file

@ -140,7 +140,7 @@ public:
{
signal_list_clear(&signals);
/*init sample memory*/
smp_memory = new double*[signalCnt];
for (uint i = 0; i < signalCnt; i++) {
@ -175,9 +175,6 @@ public:
freq_count = ceil((end_freqency - start_freqency) / frequency_resolution) + 1;
//init sample memory
/*init matrix of dft coeffients*/
dftMatrix = new std::complex<double>*[freq_count];
if (!dftMatrix)
@ -306,7 +303,6 @@ public:
ret = 1;
}
if (ret)
throw ConfigError(cfg, err, "node-config-hook-dft");
}
@ -333,7 +329,6 @@ public:
double maxA = 0;
int maxPos = 0;
for (uint i = 0; i<freq_count; i++) {
absDftResults[i] = abs(dftResults[i]) * 2 / (window_size * window_corretion_factor * ((padding_type == paddingType::ZERO)?1:window_multiplier));
if (maxA < absDftResults[i]) {
@ -343,12 +338,7 @@ public:
}
}
//info("sec=%ld, nsec=%ld freq: %f \t phase: %f \t amplitude: %f",last_dft_cal.tv_sec, smp->ts.origin.tv_nsec, maxF, atan2(dftResults[maxPos].imag(), dftResults[maxPos].real()), (maxA / pow(2,1./2)));
if (dftCalcCnt > 1) {
//double tmpMaxA = maxA / pow(2,1./2);
//phasorAmpitude->writeData(1,&tmpMaxA);
phasorFreq->writeData(1,&maxF);
smp->data[i * 4].f = maxF;//frequency
@ -363,7 +353,6 @@ public:
smp->length = signalCnt * 4;
}
if ((smp->sequence - last_sequence) > 1)
warning("Calculation is not Realtime. %li sampled missed",smp->sequence - last_sequence);
@ -381,7 +370,6 @@ public:
omega = exp((-2 * M_PI * M_I) / (double)(window_size * window_multiplier));
uint startBin = floor(start_freqency / frequency_resolution);
for (uint i = 0; i < freq_count ; i++) {
for (uint j=0 ; j < window_size * window_multiplier ; j++) {
dftMatrix[i][j] = pow(omega, (i + startBin) * j);
@ -417,7 +405,7 @@ public:
else
dftResults[i] += 0;
}
else if (padding == paddingType::SIG_REPEAT)//repeate samples
else if (padding == paddingType::SIG_REPEAT) //repeate samples
dftResults[i] += tmp_smp_window[j % window_size] * dftMatrix[i][j];
}