1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

New PLL: experimental lock condition algorithm based on phi hat averaging

This commit is contained in:
f4exb 2018-05-16 08:42:08 +02:00
parent 660d8d22ae
commit 10c56fc47a
2 changed files with 19 additions and 1 deletions

View File

@ -51,7 +51,8 @@ PhaseLockComplex::PhaseLockComplex() :
m_lockTime1(480),
m_lockTime(2400),
m_lockTimef(2400.0f),
m_lockThreshold(4.8f)
m_lockThreshold(4.8f),
m_avgPhi(240)
{
}
@ -97,6 +98,7 @@ void PhaseLockComplex::setSampleRate(unsigned int sampleRate)
m_lockTime = sampleRate / 20; // 50ms for order > 1
m_lockTimef = (float) m_lockTime;
m_lockThreshold = m_lockTime * 0.002f; // threshold of 0.002 taking division by lock time into account
m_avgPhi.resize(sampleRate / 200);
reset();
}
@ -167,6 +169,20 @@ void PhaseLockComplex::feed(float re, float im)
// lock estimation
if (m_pskOrder > 1)
{
// m_avgPhi(m_phiHat);
// float vPhi = normalizeAngle(m_phiHat - m_avgPhi.asFloat());
//
// if ((vPhi > -0.2) && (vPhi < 0.2)) // locked condition
// {
// if (m_lockCount < 20) { // [0..20]
// m_lockCount++;
// }
// }
// else // unlocked condition
// {
// m_lockCount = 0;
// }
float dPhi = normalizeAngle(m_phiHat - m_phiHatPrev);
if (m_phiHatCount < (m_lockTime-1))

View File

@ -24,6 +24,7 @@
#define SDRBASE_DSP_PHASELOCKCOMPLEX_H_
#include "dsp/dsptypes.h"
#include "util/movingaverage.h"
#include "export.h"
/** General purpose Phase-locked loop using complex analytic signal input. */
@ -84,6 +85,7 @@ private:
int m_lockTime;
float m_lockTimef;
float m_lockThreshold;
MovingAverageUtilVar<float, float> m_avgPhi;
};