I try to implement the algorithm you described
CNiMath::ACDCEstimator( m_WaveArray, _ac_rms, _dc);
For DC_Estimate
//it applies a Hanning Window to your signal,
// makes a mean calculation and divides this result by half to find the DC estimate.
CNiReal64Vector WaveArray(m_WaveArray);
CNiMath::WindowConstants wc;
CNiMath::ScaledWindow(WaveArray, wc, static_cast<CNiMath::WindowType>(3));
double DC_Estimate;
CNiMath::Mean(WaveArray,DC_Estimate);
---> without divided by 2, DC_Estimate will be equal to _dc, is that your description wrong or something wrong in my implementation?
For AC estimate
//The function then subtracts that DC estimate from the original signal,
// applies another Hanning Window to the resultant signal,
// calculates the variance of this, divides the variance result by 0.375,
// and takes the square root of the division to obtain the AC estimate.
for (i=0; i<m_WaveArray.GetSize(); i++)
{
WaveArray[i] = (m_WaveArray[i] - DC_Estimate);
}
CNiMath::ScaledWindow(WaveArray, wc, static_cast<CNiMath::WindowType>(3));
double v_ac;
CNiMath::Variance(WaveArray, v_ac);
v_ac = sqrt(v_ac/0.375)/2;
---> it needs to divide by2, then v_ac will be almost equal to _ac_rms, is that your description wrong or something wrong in my implementation?