mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-07-03 09:25:23 -04:00
ChannelAnalyzerNG: implemented FLL
This commit is contained in:
parent
e723764376
commit
47f214fdf0
@ -51,6 +51,7 @@ ChannelAnalyzerNG::ChannelAnalyzerNG(DeviceSourceAPI *deviceAPI) :
|
|||||||
DSBFilter = new fftfilt(m_config.m_Bandwidth / m_config.m_inputSampleRate, 2*ssbFftLen);
|
DSBFilter = new fftfilt(m_config.m_Bandwidth / m_config.m_inputSampleRate, 2*ssbFftLen);
|
||||||
//m_pll.computeCoefficients(0.05f, 0.707f, 1000.0f); // bandwidth, damping factor, loop gain
|
//m_pll.computeCoefficients(0.05f, 0.707f, 1000.0f); // bandwidth, damping factor, loop gain
|
||||||
m_pll.computeCoefficients(0.002f, 0.5f, 10.0f); // bandwidth, damping factor, loop gain
|
m_pll.computeCoefficients(0.002f, 0.5f, 10.0f); // bandwidth, damping factor, loop gain
|
||||||
|
m_fll.computeCoefficients(0.004f); // ~100Hz @ 48 kHz
|
||||||
|
|
||||||
apply(true);
|
apply(true);
|
||||||
|
|
||||||
@ -77,9 +78,10 @@ void ChannelAnalyzerNG::configure(MessageQueue* messageQueue,
|
|||||||
int spanLog2,
|
int spanLog2,
|
||||||
bool ssb,
|
bool ssb,
|
||||||
bool pll,
|
bool pll,
|
||||||
|
bool fll,
|
||||||
unsigned int pllPskOrder)
|
unsigned int pllPskOrder)
|
||||||
{
|
{
|
||||||
Message* cmd = MsgConfigureChannelAnalyzer::create(channelSampleRate, Bandwidth, LowCutoff, spanLog2, ssb, pll, pllPskOrder);
|
Message* cmd = MsgConfigureChannelAnalyzer::create(channelSampleRate, Bandwidth, LowCutoff, spanLog2, ssb, pll, fll, pllPskOrder);
|
||||||
messageQueue->push(cmd);
|
messageQueue->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,6 +172,7 @@ bool ChannelAnalyzerNG::handleMessage(const Message& cmd)
|
|||||||
m_config.m_spanLog2 = cfg.getSpanLog2();
|
m_config.m_spanLog2 = cfg.getSpanLog2();
|
||||||
m_config.m_ssb = cfg.getSSB();
|
m_config.m_ssb = cfg.getSSB();
|
||||||
m_config.m_pll = cfg.getPLL();
|
m_config.m_pll = cfg.getPLL();
|
||||||
|
m_config.m_fll = cfg.getFLL();
|
||||||
m_config.m_pllPskOrder = cfg.getPLLPSKOrder();
|
m_config.m_pllPskOrder = cfg.getPLLPSKOrder();
|
||||||
|
|
||||||
qDebug() << "ChannelAnalyzerNG::handleMessage: MsgConfigureChannelAnalyzer:"
|
qDebug() << "ChannelAnalyzerNG::handleMessage: MsgConfigureChannelAnalyzer:"
|
||||||
@ -179,6 +182,7 @@ bool ChannelAnalyzerNG::handleMessage(const Message& cmd)
|
|||||||
<< " m_spanLog2: " << m_config.m_spanLog2
|
<< " m_spanLog2: " << m_config.m_spanLog2
|
||||||
<< " m_ssb: " << m_config.m_ssb
|
<< " m_ssb: " << m_config.m_ssb
|
||||||
<< " m_pll: " << m_config.m_pll
|
<< " m_pll: " << m_config.m_pll
|
||||||
|
<< " m_fll: " << m_config.m_fll
|
||||||
<< " m_pllPskOrder: " << m_config.m_pllPskOrder;
|
<< " m_pllPskOrder: " << m_config.m_pllPskOrder;
|
||||||
|
|
||||||
apply();
|
apply();
|
||||||
@ -254,7 +258,9 @@ void ChannelAnalyzerNG::apply(bool force)
|
|||||||
if ((m_running.m_channelSampleRate != m_config.m_channelSampleRate) ||
|
if ((m_running.m_channelSampleRate != m_config.m_channelSampleRate) ||
|
||||||
(m_running.m_spanLog2 != m_config.m_spanLog2) || force)
|
(m_running.m_spanLog2 != m_config.m_spanLog2) || force)
|
||||||
{
|
{
|
||||||
m_pll.setSampleRate(m_running.m_channelSampleRate / (1<<m_running.m_spanLog2));
|
int sampleRate = m_running.m_channelSampleRate / (1<<m_running.m_spanLog2);
|
||||||
|
m_pll.setSampleRate(sampleRate);
|
||||||
|
m_fll.computeCoefficients(200.0f/sampleRate); // 100 Hz
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_running.m_pll != m_config.m_pll || force)
|
if (m_running.m_pll != m_config.m_pll || force)
|
||||||
@ -264,9 +270,18 @@ void ChannelAnalyzerNG::apply(bool force)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_running.m_pll != m_config.m_pll || force)
|
if (m_running.m_fll != m_config.m_fll || force)
|
||||||
{
|
{
|
||||||
m_pll.setPskOrder(m_config.m_pllPskOrder);
|
if (m_config.m_fll) {
|
||||||
|
m_fll.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_running.m_pllPskOrder != m_config.m_pllPskOrder || force)
|
||||||
|
{
|
||||||
|
if (m_config.m_pllPskOrder < 5) {
|
||||||
|
m_pll.setPskOrder(m_config.m_pllPskOrder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_running.m_frequency = m_config.m_frequency;
|
m_running.m_frequency = m_config.m_frequency;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "dsp/ncof.h"
|
#include "dsp/ncof.h"
|
||||||
#include "dsp/fftfilt.h"
|
#include "dsp/fftfilt.h"
|
||||||
#include "dsp/phaselockcomplex.h"
|
#include "dsp/phaselockcomplex.h"
|
||||||
|
#include "dsp/freqlockcomplex.h"
|
||||||
#include "audio/audiofifo.h"
|
#include "audio/audiofifo.h"
|
||||||
#include "util/message.h"
|
#include "util/message.h"
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ public:
|
|||||||
int getSpanLog2() const { return m_spanLog2; }
|
int getSpanLog2() const { return m_spanLog2; }
|
||||||
bool getSSB() const { return m_ssb; }
|
bool getSSB() const { return m_ssb; }
|
||||||
bool getPLL() const { return m_pll; }
|
bool getPLL() const { return m_pll; }
|
||||||
|
bool getFLL() const { return m_fll; }
|
||||||
unsigned int getPLLPSKOrder() const { return m_pllPskOrder; }
|
unsigned int getPLLPSKOrder() const { return m_pllPskOrder; }
|
||||||
|
|
||||||
static MsgConfigureChannelAnalyzer* create(
|
static MsgConfigureChannelAnalyzer* create(
|
||||||
@ -56,6 +58,7 @@ public:
|
|||||||
int spanLog2,
|
int spanLog2,
|
||||||
bool ssb,
|
bool ssb,
|
||||||
bool pll,
|
bool pll,
|
||||||
|
bool fll,
|
||||||
unsigned int pllPskOrder)
|
unsigned int pllPskOrder)
|
||||||
{
|
{
|
||||||
return new MsgConfigureChannelAnalyzer(
|
return new MsgConfigureChannelAnalyzer(
|
||||||
@ -65,6 +68,7 @@ public:
|
|||||||
spanLog2,
|
spanLog2,
|
||||||
ssb,
|
ssb,
|
||||||
pll,
|
pll,
|
||||||
|
fll,
|
||||||
pllPskOrder);
|
pllPskOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,6 +79,7 @@ public:
|
|||||||
int m_spanLog2;
|
int m_spanLog2;
|
||||||
bool m_ssb;
|
bool m_ssb;
|
||||||
bool m_pll;
|
bool m_pll;
|
||||||
|
bool m_fll;
|
||||||
unsigned int m_pllPskOrder;
|
unsigned int m_pllPskOrder;
|
||||||
|
|
||||||
MsgConfigureChannelAnalyzer(
|
MsgConfigureChannelAnalyzer(
|
||||||
@ -84,6 +89,7 @@ public:
|
|||||||
int spanLog2,
|
int spanLog2,
|
||||||
bool ssb,
|
bool ssb,
|
||||||
bool pll,
|
bool pll,
|
||||||
|
bool fll,
|
||||||
unsigned int pllPskOrder) :
|
unsigned int pllPskOrder) :
|
||||||
Message(),
|
Message(),
|
||||||
m_channelSampleRate(channelSampleRate),
|
m_channelSampleRate(channelSampleRate),
|
||||||
@ -92,6 +98,7 @@ public:
|
|||||||
m_spanLog2(spanLog2),
|
m_spanLog2(spanLog2),
|
||||||
m_ssb(ssb),
|
m_ssb(ssb),
|
||||||
m_pll(pll),
|
m_pll(pll),
|
||||||
|
m_fll(fll),
|
||||||
m_pllPskOrder(pllPskOrder)
|
m_pllPskOrder(pllPskOrder)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
@ -148,6 +155,7 @@ public:
|
|||||||
int spanLog2,
|
int spanLog2,
|
||||||
bool ssb,
|
bool ssb,
|
||||||
bool pll,
|
bool pll,
|
||||||
|
bool fll,
|
||||||
unsigned int pllPskOrder);
|
unsigned int pllPskOrder);
|
||||||
|
|
||||||
DownChannelizer *getChannelizer() { return m_channelizer; }
|
DownChannelizer *getChannelizer() { return m_channelizer; }
|
||||||
@ -185,6 +193,7 @@ private:
|
|||||||
int m_spanLog2;
|
int m_spanLog2;
|
||||||
bool m_ssb;
|
bool m_ssb;
|
||||||
bool m_pll;
|
bool m_pll;
|
||||||
|
bool m_fll;
|
||||||
unsigned int m_pllPskOrder;
|
unsigned int m_pllPskOrder;
|
||||||
|
|
||||||
Config() :
|
Config() :
|
||||||
@ -196,6 +205,7 @@ private:
|
|||||||
m_spanLog2(3),
|
m_spanLog2(3),
|
||||||
m_ssb(false),
|
m_ssb(false),
|
||||||
m_pll(false),
|
m_pll(false),
|
||||||
|
m_fll(false),
|
||||||
m_pllPskOrder(1)
|
m_pllPskOrder(1)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
@ -215,6 +225,7 @@ private:
|
|||||||
|
|
||||||
NCOF m_nco;
|
NCOF m_nco;
|
||||||
PhaseLockComplex m_pll;
|
PhaseLockComplex m_pll;
|
||||||
|
FreqLockComplex m_fll;
|
||||||
Interpolator m_interpolator;
|
Interpolator m_interpolator;
|
||||||
Real m_interpolatorDistance;
|
Real m_interpolatorDistance;
|
||||||
Real m_interpolatorDistanceRemain;
|
Real m_interpolatorDistanceRemain;
|
||||||
@ -258,7 +269,11 @@ private:
|
|||||||
|
|
||||||
if (m_running.m_pll)
|
if (m_running.m_pll)
|
||||||
{
|
{
|
||||||
m_pll.feed(re, im);
|
if (m_running.m_fll) {
|
||||||
|
m_fll.feed(re, im);
|
||||||
|
} else {
|
||||||
|
m_pll.feed(re, im);
|
||||||
|
}
|
||||||
|
|
||||||
// Use -fPLL to mix (exchange PLL real and image in the complex multiplication)
|
// Use -fPLL to mix (exchange PLL real and image in the complex multiplication)
|
||||||
Real mixI = m_sum.real() * m_pll.getImag() - m_sum.imag() * m_pll.getReal();
|
Real mixI = m_sum.real() * m_pll.getImag() - m_sum.imag() * m_pll.getReal();
|
||||||
|
@ -251,9 +251,8 @@ void ChannelAnalyzerNGGUI::on_channelSampleRate_changed(quint64 value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelAnalyzerNGGUI::on_pll_toggled(bool checked)
|
void ChannelAnalyzerNGGUI::on_pll_toggled(bool checked __attribute__((unused)))
|
||||||
{
|
{
|
||||||
m_usePll = checked;
|
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,8 +398,7 @@ ChannelAnalyzerNGGUI::ChannelAnalyzerNGGUI(PluginAPI* pluginAPI, DeviceUISet *de
|
|||||||
m_channelMarker(this),
|
m_channelMarker(this),
|
||||||
m_doApplySettings(true),
|
m_doApplySettings(true),
|
||||||
m_rate(6000),
|
m_rate(6000),
|
||||||
m_spanLog2(0),
|
m_spanLog2(0)
|
||||||
m_usePll(false)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
@ -592,6 +590,7 @@ void ChannelAnalyzerNGGUI::applySettings()
|
|||||||
m_spanLog2,
|
m_spanLog2,
|
||||||
ui->ssb->isChecked(),
|
ui->ssb->isChecked(),
|
||||||
ui->pll->isChecked(),
|
ui->pll->isChecked(),
|
||||||
|
ui->pllPskOrder->currentIndex() == 5,
|
||||||
1<<ui->pllPskOrder->currentIndex());
|
1<<ui->pllPskOrder->currentIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,6 @@ private:
|
|||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
int m_rate; //!< sample rate after final in-channel decimation (spanlog2)
|
int m_rate; //!< sample rate after final in-channel decimation (spanlog2)
|
||||||
int m_spanLog2;
|
int m_spanLog2;
|
||||||
bool m_usePll;
|
|
||||||
MovingAverageUtil<Real, double, 40> m_channelPowerDbAvg;
|
MovingAverageUtil<Real, double, 40> m_channelPowerDbAvg;
|
||||||
|
|
||||||
ChannelAnalyzerNG* m_channelAnalyzer;
|
ChannelAnalyzerNG* m_channelAnalyzer;
|
||||||
|
@ -233,6 +233,11 @@
|
|||||||
<string>16</string>
|
<string>16</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>F</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user