23 #define M_PI 3.14159265358979323846 55 double p1 =
exp(-1.146 * bandwidth * 2.0 *
M_PI);
56 double p2 =
exp(-5.331 * bandwidth * 2.0 * M_PI);
62 double q1 =
exp(-0.1153 * bandwidth * 2.0 * M_PI);
89 qDebug(
"PhaseLock::configure: freq: %f bandwidth: %f minsignal: %f", freq, bandwidth, minsignal);
115 double p1 =
exp(-1.146 * bandwidth * 2.0 *
M_PI);
116 double p2 =
exp(-5.331 * bandwidth * 2.0 * M_PI);
122 double q1 =
exp(-0.1153 * bandwidth * 2.0 * M_PI);
150 unsigned int n = samples_in.size();
152 samples_out.resize(n);
160 for (
unsigned int i = 0;
i < n;
i++) {
168 samples_out[
i] = 2 * psin * pcos;
171 Real x = samples_in[
i];
172 Real phasor_i = psin * x;
173 Real phasor_q = pcos * x;
189 if (phasor_i >
std::abs(phasor_q)) {
192 phase_err = phasor_q / phasor_i;
193 }
else if (phasor_q > 0) {
207 m_loopfilter_x1 = phase_err;
308 if (phasor_i >
std::abs(phasor_q)) {
311 phase_err = phasor_q / phasor_i;
312 }
else if (phasor_q > 0) {
327 m_loopfilter_x1 = phase_err;
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
std::vector< PpsEvent > m_pps_events
void configure(Real freq, Real bandwidth, Real minsignal)
static const int pilot_frequency
Fixed< IntType, IntBits > abs(Fixed< IntType, IntBits > const &x)
Fixed< IntType, IntBits > exp(Fixed< IntType, IntBits > const &x)
virtual void processPhase(Real *samples_out) const
void process(const std::vector< Real > &samples_in, std::vector< Real > &samples_out)
Fixed< IntType, IntBits > sin(Fixed< IntType, IntBits > const &x)
void process_phasor(Real &phasor_i, Real &phasor_q)
T max(const T &x, const T &y)
PhaseLock(Real freq, Real bandwidth, Real minsignal)
T min(const T &x, const T &y)