mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 13:21:50 -05:00
New PLL: experimental lock condition algorithm based on phi hat averaging
This commit is contained in:
parent
660d8d22ae
commit
10c56fc47a
@ -51,7 +51,8 @@ PhaseLockComplex::PhaseLockComplex() :
|
|||||||
m_lockTime1(480),
|
m_lockTime1(480),
|
||||||
m_lockTime(2400),
|
m_lockTime(2400),
|
||||||
m_lockTimef(2400.0f),
|
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_lockTime = sampleRate / 20; // 50ms for order > 1
|
||||||
m_lockTimef = (float) m_lockTime;
|
m_lockTimef = (float) m_lockTime;
|
||||||
m_lockThreshold = m_lockTime * 0.002f; // threshold of 0.002 taking division by lock time into account
|
m_lockThreshold = m_lockTime * 0.002f; // threshold of 0.002 taking division by lock time into account
|
||||||
|
m_avgPhi.resize(sampleRate / 200);
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,6 +169,20 @@ void PhaseLockComplex::feed(float re, float im)
|
|||||||
// lock estimation
|
// lock estimation
|
||||||
if (m_pskOrder > 1)
|
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);
|
float dPhi = normalizeAngle(m_phiHat - m_phiHatPrev);
|
||||||
|
|
||||||
if (m_phiHatCount < (m_lockTime-1))
|
if (m_phiHatCount < (m_lockTime-1))
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#define SDRBASE_DSP_PHASELOCKCOMPLEX_H_
|
#define SDRBASE_DSP_PHASELOCKCOMPLEX_H_
|
||||||
|
|
||||||
#include "dsp/dsptypes.h"
|
#include "dsp/dsptypes.h"
|
||||||
|
#include "util/movingaverage.h"
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
|
|
||||||
/** General purpose Phase-locked loop using complex analytic signal input. */
|
/** General purpose Phase-locked loop using complex analytic signal input. */
|
||||||
@ -84,6 +85,7 @@ private:
|
|||||||
int m_lockTime;
|
int m_lockTime;
|
||||||
float m_lockTimef;
|
float m_lockTimef;
|
||||||
float m_lockThreshold;
|
float m_lockThreshold;
|
||||||
|
MovingAverageUtilVar<float, float> m_avgPhi;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user