Tweaked costas parameters
Dropped agc in costas loop for smoother outputs Added destructors
This commit is contained in:
parent
5fccd98d90
commit
7e899d01e0
|
@ -11,7 +11,7 @@ LDFLAGS=-lliquid
|
||||||
$(CXX) $(CFLAGS) -c $< -o $@
|
$(CXX) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
test: test.o costas-beacon-sync.o fft-beacon-finder.o
|
test: test.o costas-beacon-sync.o fft-beacon-finder.o
|
||||||
$(CXX) $(LDFLAGS) -o $@ $?
|
$(CXX) $(LDFLAGS) -o $@ $+
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm *.o
|
rm *.o
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "costas-beacon-sync.h"
|
#include "costas-beacon-sync.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
const size_t banpass_len = 47;
|
const size_t banpass_len = 47;
|
||||||
|
|
||||||
// 512000 ksps, pass end 10kHz, stop start 25khz, 40dB
|
// 512000 ksps, pass end 10kHz, stop start 25khz, 40dB
|
||||||
|
@ -21,8 +23,7 @@ float bandpass_taps[banpass_len] = {
|
||||||
0.004904961679130793, 0.0038352811243385077, 0.003062514355406165,
|
0.004904961679130793, 0.0038352811243385077, 0.003062514355406165,
|
||||||
0.002578944666311145, 0.0023692550603300333};
|
0.002578944666311145, 0.0023692550603300333};
|
||||||
|
|
||||||
CostasBeaconSync::CostasBeaconSync(float agc_bw,
|
CostasBeaconSync::CostasBeaconSync(float loop_bw,
|
||||||
float loop_bw,
|
|
||||||
float min_freq,
|
float min_freq,
|
||||||
float max_freq) {
|
float max_freq) {
|
||||||
this->min_freq = min_freq;
|
this->min_freq = min_freq;
|
||||||
|
@ -33,13 +34,15 @@ CostasBeaconSync::CostasBeaconSync(float agc_bw,
|
||||||
alpha = (4 * damping * loop_bw) / denom;
|
alpha = (4 * damping * loop_bw) / denom;
|
||||||
beta = (4 * loop_bw * loop_bw) / denom;
|
beta = (4 * loop_bw * loop_bw) / denom;
|
||||||
|
|
||||||
|
std::cout << "Alpha: " << alpha << std::endl;
|
||||||
|
std::cout << "Beta: " << beta << std::endl;
|
||||||
|
std::cout << "Min f: " << min_freq << std::endl;
|
||||||
|
std::cout << "Max f: " << max_freq << std::endl;
|
||||||
|
|
||||||
loop_freq = 0.0;
|
loop_freq = 0.0;
|
||||||
loop_phase = 0.0;
|
loop_phase = 0.0;
|
||||||
|
|
||||||
bandpass = firfilt_crcf_create(bandpass_taps, banpass_len);
|
bandpass = firfilt_crcf_create(bandpass_taps, banpass_len);
|
||||||
|
|
||||||
agc = agc_crcf_create();
|
|
||||||
agc_crcf_set_bandwidth(agc, agc_bw);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::complex<float> CostasBeaconSync::work(std::complex<float> in) {
|
std::complex<float> CostasBeaconSync::work(std::complex<float> in) {
|
||||||
|
@ -50,8 +53,6 @@ std::complex<float> CostasBeaconSync::work(std::complex<float> in) {
|
||||||
std::complex<float> out =
|
std::complex<float> out =
|
||||||
std::complex<float>(cos(-loop_phase), sin(-loop_phase));
|
std::complex<float>(cos(-loop_phase), sin(-loop_phase));
|
||||||
|
|
||||||
agc_crcf_execute(agc, filtered, &filtered);
|
|
||||||
|
|
||||||
std::complex<float> costas_sample = filtered * out;
|
std::complex<float> costas_sample = filtered * out;
|
||||||
|
|
||||||
float error = costas_sample.imag() * costas_sample.real();
|
float error = costas_sample.imag() * costas_sample.real();
|
||||||
|
@ -71,3 +72,8 @@ std::complex<float> CostasBeaconSync::work(std::complex<float> in) {
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CostasBeaconSync::~CostasBeaconSync() {
|
||||||
|
firfilt_crcf_destroy(bandpass);
|
||||||
|
}
|
||||||
|
|
|
@ -18,10 +18,9 @@ class CostasBeaconSync {
|
||||||
|
|
||||||
firfilt_crcf bandpass;
|
firfilt_crcf bandpass;
|
||||||
|
|
||||||
agc_crcf agc;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CostasBeaconSync(float, float, float, float);
|
CostasBeaconSync(float, float, float);
|
||||||
|
~CostasBeaconSync();
|
||||||
|
|
||||||
std::complex<float> work(liquid_float_complex);
|
std::complex<float> work(liquid_float_complex);
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,3 +77,9 @@ int FFTBeaconFinder::spectral_bin_to_fft_idx(int bin) {
|
||||||
return bin + FFT_LEN;
|
return bin + FFT_LEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FFTBeaconFinder::~FFTBeaconFinder() {
|
||||||
|
nco_crcf_destroy(coarse_correction);
|
||||||
|
fft_destroy_plan(fft);
|
||||||
|
}
|
||||||
|
|
|
@ -24,7 +24,8 @@ class FFTBeaconFinder {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FFTBeaconFinder(int);
|
FFTBeaconFinder(int);
|
||||||
|
~FFTBeaconFinder();
|
||||||
|
|
||||||
std::complex<float> work(std::complex<float>);
|
std::complex<float> work(std::complex<float>);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,524 @@
|
||||||
|
options:
|
||||||
|
parameters:
|
||||||
|
author: ''
|
||||||
|
catch_exceptions: 'True'
|
||||||
|
category: '[GRC Hier Blocks]'
|
||||||
|
cmake_opt: ''
|
||||||
|
comment: ''
|
||||||
|
copyright: ''
|
||||||
|
description: ''
|
||||||
|
gen_cmake: 'On'
|
||||||
|
gen_linking: dynamic
|
||||||
|
generate_options: qt_gui
|
||||||
|
hier_block_src_path: '.:'
|
||||||
|
id: generate_testdata
|
||||||
|
max_nouts: '0'
|
||||||
|
output_language: python
|
||||||
|
placement: (0,0)
|
||||||
|
qt_qss_theme: ''
|
||||||
|
realtime_scheduling: ''
|
||||||
|
run: 'True'
|
||||||
|
run_command: '{python} -u {filename}'
|
||||||
|
run_options: prompt
|
||||||
|
sizing_mode: fixed
|
||||||
|
thread_safe_setters: ''
|
||||||
|
title: Not titled yet
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [8, 8]
|
||||||
|
rotation: 0
|
||||||
|
state: enabled
|
||||||
|
|
||||||
|
blocks:
|
||||||
|
- name: samp_rate
|
||||||
|
id: variable
|
||||||
|
parameters:
|
||||||
|
comment: ''
|
||||||
|
value: '1000000'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [184, 12]
|
||||||
|
rotation: 0
|
||||||
|
state: enabled
|
||||||
|
- name: analog_noise_source_x_0
|
||||||
|
id: analog_noise_source_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
amp: '0.001'
|
||||||
|
comment: ''
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
noise_type: analog.GR_GAUSSIAN
|
||||||
|
seed: '0'
|
||||||
|
type: complex
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [1152, 148.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: analog_sig_source_x_0
|
||||||
|
id: analog_sig_source_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
amp: '1'
|
||||||
|
comment: ''
|
||||||
|
freq: '0.1'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
offset: '0'
|
||||||
|
phase: '0'
|
||||||
|
samp_rate: samp_rate
|
||||||
|
type: float
|
||||||
|
waveform: analog.GR_COS_WAVE
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [648, 324.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: analog_sig_source_x_1
|
||||||
|
id: analog_sig_source_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
amp: '1'
|
||||||
|
comment: ''
|
||||||
|
freq: '-250000'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
offset: '0'
|
||||||
|
phase: '0'
|
||||||
|
samp_rate: samp_rate
|
||||||
|
type: complex
|
||||||
|
waveform: analog.GR_COS_WAVE
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [208, 132.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: analog_sig_source_x_1_0
|
||||||
|
id: analog_sig_source_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
amp: '1'
|
||||||
|
comment: ''
|
||||||
|
freq: '250000'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
offset: '0'
|
||||||
|
phase: '0'
|
||||||
|
samp_rate: samp_rate
|
||||||
|
type: complex
|
||||||
|
waveform: analog.GR_COS_WAVE
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [208, 260.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: analog_sig_source_x_1_0_0
|
||||||
|
id: analog_sig_source_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
amp: '1'
|
||||||
|
comment: ''
|
||||||
|
freq: '0'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
offset: '0'
|
||||||
|
phase: '0'
|
||||||
|
samp_rate: samp_rate
|
||||||
|
type: complex
|
||||||
|
waveform: analog.GR_COS_WAVE
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [208, 404.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: analog_sig_source_x_1_0_0_0
|
||||||
|
id: analog_sig_source_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
amp: '1'
|
||||||
|
comment: ''
|
||||||
|
freq: '35000'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
offset: '0'
|
||||||
|
phase: '0'
|
||||||
|
samp_rate: samp_rate
|
||||||
|
type: complex
|
||||||
|
waveform: analog.GR_COS_WAVE
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [952, 476.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: blocks_add_xx_0
|
||||||
|
id: blocks_add_xx
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
comment: ''
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
num_inputs: '2'
|
||||||
|
type: complex
|
||||||
|
vlen: '1'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [1360, 240.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: blocks_add_xx_1
|
||||||
|
id: blocks_add_xx
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
comment: ''
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
num_inputs: '3'
|
||||||
|
type: complex
|
||||||
|
vlen: '1'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [576, 224.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: blocks_file_sink_0
|
||||||
|
id: blocks_file_sink
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
append: 'False'
|
||||||
|
comment: ''
|
||||||
|
file: input.raw
|
||||||
|
type: complex
|
||||||
|
unbuffered: 'False'
|
||||||
|
vlen: '1'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [1520, 236.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: blocks_multiply_xx_0
|
||||||
|
id: blocks_multiply_xx
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
comment: ''
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
num_inputs: '2'
|
||||||
|
type: complex
|
||||||
|
vlen: '1'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [1048, 256.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: blocks_multiply_xx_0_0
|
||||||
|
id: blocks_multiply_xx
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
comment: ''
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
num_inputs: '2'
|
||||||
|
type: complex
|
||||||
|
vlen: '1'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [1192, 272.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: blocks_multiply_xx_1
|
||||||
|
id: blocks_multiply_xx
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
comment: ''
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
num_inputs: '2'
|
||||||
|
type: complex
|
||||||
|
vlen: '1'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [448, 448.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: blocks_throttle_0
|
||||||
|
id: blocks_throttle
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
comment: ''
|
||||||
|
ignoretag: 'True'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
samples_per_second: samp_rate
|
||||||
|
type: complex
|
||||||
|
vlen: '1'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [432, 172.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: blocks_vco_c_0
|
||||||
|
id: blocks_vco_c
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
amplitude: '1.0'
|
||||||
|
comment: ''
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
samp_rate: samp_rate
|
||||||
|
sensitivity: '40000'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [864, 348.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: blocks_vector_source_x_0
|
||||||
|
id: blocks_vector_source_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
comment: ''
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
repeat: 'True'
|
||||||
|
tags: '[]'
|
||||||
|
type: float
|
||||||
|
vector: (1, 1, -1, -1, 1, -1, 1, -1)
|
||||||
|
vlen: '1'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [32, 572.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: qtgui_freq_sink_x_0
|
||||||
|
id: qtgui_freq_sink_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
alpha1: '1.0'
|
||||||
|
alpha10: '1.0'
|
||||||
|
alpha2: '1.0'
|
||||||
|
alpha3: '1.0'
|
||||||
|
alpha4: '1.0'
|
||||||
|
alpha5: '1.0'
|
||||||
|
alpha6: '1.0'
|
||||||
|
alpha7: '1.0'
|
||||||
|
alpha8: '1.0'
|
||||||
|
alpha9: '1.0'
|
||||||
|
autoscale: 'False'
|
||||||
|
average: '1.0'
|
||||||
|
axislabels: 'True'
|
||||||
|
bw: samp_rate
|
||||||
|
color1: '"blue"'
|
||||||
|
color10: '"dark blue"'
|
||||||
|
color2: '"red"'
|
||||||
|
color3: '"green"'
|
||||||
|
color4: '"black"'
|
||||||
|
color5: '"cyan"'
|
||||||
|
color6: '"magenta"'
|
||||||
|
color7: '"yellow"'
|
||||||
|
color8: '"dark red"'
|
||||||
|
color9: '"dark green"'
|
||||||
|
comment: ''
|
||||||
|
ctrlpanel: 'False'
|
||||||
|
fc: '0'
|
||||||
|
fftsize: '4096'
|
||||||
|
freqhalf: 'True'
|
||||||
|
grid: 'False'
|
||||||
|
gui_hint: ''
|
||||||
|
label: Relative Gain
|
||||||
|
label1: ''
|
||||||
|
label10: ''''''
|
||||||
|
label2: ''''''
|
||||||
|
label3: ''''''
|
||||||
|
label4: ''''''
|
||||||
|
label5: ''''''
|
||||||
|
label6: ''''''
|
||||||
|
label7: ''''''
|
||||||
|
label8: ''''''
|
||||||
|
label9: ''''''
|
||||||
|
legend: 'True'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
name: '""'
|
||||||
|
nconnections: '1'
|
||||||
|
norm_window: 'False'
|
||||||
|
showports: 'False'
|
||||||
|
tr_chan: '0'
|
||||||
|
tr_level: '0.0'
|
||||||
|
tr_mode: qtgui.TRIG_MODE_FREE
|
||||||
|
tr_tag: '""'
|
||||||
|
type: complex
|
||||||
|
units: dB
|
||||||
|
update_time: '0.10'
|
||||||
|
width1: '1'
|
||||||
|
width10: '1'
|
||||||
|
width2: '1'
|
||||||
|
width3: '1'
|
||||||
|
width4: '1'
|
||||||
|
width5: '1'
|
||||||
|
width6: '1'
|
||||||
|
width7: '1'
|
||||||
|
width8: '1'
|
||||||
|
width9: '1'
|
||||||
|
wintype: window.WIN_BLACKMAN_hARRIS
|
||||||
|
ymax: '10'
|
||||||
|
ymin: '-140'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [1520, 44.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: qtgui_waterfall_sink_x_0
|
||||||
|
id: qtgui_waterfall_sink_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
alpha1: '1.0'
|
||||||
|
alpha10: '1.0'
|
||||||
|
alpha2: '1.0'
|
||||||
|
alpha3: '1.0'
|
||||||
|
alpha4: '1.0'
|
||||||
|
alpha5: '1.0'
|
||||||
|
alpha6: '1.0'
|
||||||
|
alpha7: '1.0'
|
||||||
|
alpha8: '1.0'
|
||||||
|
alpha9: '1.0'
|
||||||
|
axislabels: 'True'
|
||||||
|
bw: samp_rate
|
||||||
|
color1: '0'
|
||||||
|
color10: '0'
|
||||||
|
color2: '0'
|
||||||
|
color3: '0'
|
||||||
|
color4: '0'
|
||||||
|
color5: '0'
|
||||||
|
color6: '0'
|
||||||
|
color7: '0'
|
||||||
|
color8: '0'
|
||||||
|
color9: '0'
|
||||||
|
comment: ''
|
||||||
|
fc: '0'
|
||||||
|
fftsize: '4096'
|
||||||
|
freqhalf: 'True'
|
||||||
|
grid: 'False'
|
||||||
|
gui_hint: ''
|
||||||
|
int_max: '10'
|
||||||
|
int_min: '-140'
|
||||||
|
label1: ''
|
||||||
|
label10: ''
|
||||||
|
label2: ''
|
||||||
|
label3: ''
|
||||||
|
label4: ''
|
||||||
|
label5: ''
|
||||||
|
label6: ''
|
||||||
|
label7: ''
|
||||||
|
label8: ''
|
||||||
|
label9: ''
|
||||||
|
legend: 'True'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
name: '""'
|
||||||
|
nconnections: '1'
|
||||||
|
showports: 'False'
|
||||||
|
type: complex
|
||||||
|
update_time: '0.10'
|
||||||
|
wintype: window.WIN_BLACKMAN_hARRIS
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [1520, 132.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: rational_resampler_xxx_0
|
||||||
|
id: rational_resampler_xxx
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
comment: ''
|
||||||
|
decim: '800'
|
||||||
|
fbw: '0'
|
||||||
|
interp: samp_rate
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
taps: '[]'
|
||||||
|
type: fcc
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [232, 564.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
|
||||||
|
connections:
|
||||||
|
- [analog_noise_source_x_0, '0', blocks_add_xx_0, '0']
|
||||||
|
- [analog_sig_source_x_0, '0', blocks_vco_c_0, '0']
|
||||||
|
- [analog_sig_source_x_1, '0', blocks_throttle_0, '0']
|
||||||
|
- [analog_sig_source_x_1_0, '0', blocks_add_xx_1, '1']
|
||||||
|
- [analog_sig_source_x_1_0_0, '0', blocks_multiply_xx_1, '0']
|
||||||
|
- [analog_sig_source_x_1_0_0_0, '0', blocks_multiply_xx_0_0, '1']
|
||||||
|
- [blocks_add_xx_0, '0', blocks_file_sink_0, '0']
|
||||||
|
- [blocks_add_xx_0, '0', qtgui_freq_sink_x_0, '0']
|
||||||
|
- [blocks_add_xx_0, '0', qtgui_waterfall_sink_x_0, '0']
|
||||||
|
- [blocks_add_xx_1, '0', blocks_multiply_xx_0, '0']
|
||||||
|
- [blocks_multiply_xx_0, '0', blocks_multiply_xx_0_0, '0']
|
||||||
|
- [blocks_multiply_xx_0_0, '0', blocks_add_xx_0, '1']
|
||||||
|
- [blocks_multiply_xx_1, '0', blocks_add_xx_1, '2']
|
||||||
|
- [blocks_throttle_0, '0', blocks_add_xx_1, '0']
|
||||||
|
- [blocks_vco_c_0, '0', blocks_multiply_xx_0, '1']
|
||||||
|
- [blocks_vector_source_x_0, '0', rational_resampler_xxx_0, '0']
|
||||||
|
- [rational_resampler_xxx_0, '0', blocks_multiply_xx_1, '1']
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
file_format: 1
|
|
@ -1,27 +1,38 @@
|
||||||
#include<cstdio>
|
#include <cstdio>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include<complex>
|
#include <complex>
|
||||||
|
|
||||||
#include "fft-beacon-finder.h"
|
|
||||||
#include "costas-beacon-sync.h"
|
#include "costas-beacon-sync.h"
|
||||||
|
#include "fft-beacon-finder.h"
|
||||||
|
|
||||||
int main(int argc, char const *argv[]) {
|
int main(int argc, char const* argv[]) {
|
||||||
|
|
||||||
FILE* output = fopen("output.raw", "w");
|
FILE* output = fopen("output.raw", "w");
|
||||||
FILE* input = fopen("input.raw", "r");
|
FILE* input = fopen("input.raw", "r");
|
||||||
|
|
||||||
FFTBeaconFinder finder(1000000);
|
FFTBeaconFinder finder(1000000);
|
||||||
CostasBeaconSync sync(1e-3f, 0.3, -1.0, 1.0);
|
CostasBeaconSync sync(0.03, -0.1, 0.1);
|
||||||
|
|
||||||
|
int sample_count = 0;
|
||||||
|
clock_t start_time = clock();
|
||||||
|
|
||||||
std::complex<float> in;
|
std::complex<float> in;
|
||||||
while(fread(&in, sizeof(std::complex<float>), 1, input) == 1) {
|
while (fread(&in, sizeof(std::complex<float>), 1, input) == 1) {
|
||||||
std::complex<float> coarse_synced = finder.work(in);
|
std::complex<float> coarse_synced = finder.work(in);
|
||||||
std::complex<float> sync_correction = sync.work(coarse_synced);
|
std::complex<float> sync_correction = sync.work(coarse_synced);
|
||||||
std::complex<float> out = coarse_synced * sync_correction;
|
std::complex<float> out = coarse_synced * sync_correction;
|
||||||
|
|
||||||
fwrite(&out, sizeof(std::complex<float>), 1, output);
|
fwrite(&out, sizeof(std::complex<float>), 1, output);
|
||||||
|
sample_count++;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
clock_t end_time = clock();
|
||||||
|
clock_t result = end_time - start_time;
|
||||||
|
|
||||||
|
std::cout << "Processed " << sample_count << " samples ("
|
||||||
|
<< sample_count / 1000000.0 << "s) "
|
||||||
|
<< "in " << result / CLOCKS_PER_SEC << " s" << std::endl;
|
||||||
|
|
||||||
fclose(input);
|
fclose(input);
|
||||||
fclose(output);
|
fclose(output);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,439 @@
|
||||||
|
options:
|
||||||
|
parameters:
|
||||||
|
author: ''
|
||||||
|
catch_exceptions: 'True'
|
||||||
|
category: '[GRC Hier Blocks]'
|
||||||
|
cmake_opt: ''
|
||||||
|
comment: ''
|
||||||
|
copyright: ''
|
||||||
|
description: ''
|
||||||
|
gen_cmake: 'On'
|
||||||
|
gen_linking: dynamic
|
||||||
|
generate_options: qt_gui
|
||||||
|
hier_block_src_path: '.:'
|
||||||
|
id: view_waterfall
|
||||||
|
max_nouts: '0'
|
||||||
|
output_language: python
|
||||||
|
placement: (0,0)
|
||||||
|
qt_qss_theme: ''
|
||||||
|
realtime_scheduling: ''
|
||||||
|
run: 'True'
|
||||||
|
run_command: '{python} -u {filename}'
|
||||||
|
run_options: prompt
|
||||||
|
sizing_mode: fixed
|
||||||
|
thread_safe_setters: ''
|
||||||
|
title: Not titled yet
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [8, 8]
|
||||||
|
rotation: 0
|
||||||
|
state: enabled
|
||||||
|
|
||||||
|
blocks:
|
||||||
|
- name: samp_rate
|
||||||
|
id: variable
|
||||||
|
parameters:
|
||||||
|
comment: ''
|
||||||
|
value: '1000000'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [184, 12]
|
||||||
|
rotation: 0
|
||||||
|
state: enabled
|
||||||
|
- name: blocks_file_source_0
|
||||||
|
id: blocks_file_source
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
begin_tag: pmt.PMT_NIL
|
||||||
|
comment: ''
|
||||||
|
file: output.raw
|
||||||
|
length: '0'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
offset: '0'
|
||||||
|
repeat: 'False'
|
||||||
|
type: complex
|
||||||
|
vlen: '1'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [184, 212.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: blocks_file_source_0_0
|
||||||
|
id: blocks_file_source
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
begin_tag: pmt.PMT_NIL
|
||||||
|
comment: ''
|
||||||
|
file: input.raw
|
||||||
|
length: '0'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
offset: '0'
|
||||||
|
repeat: 'False'
|
||||||
|
type: complex
|
||||||
|
vlen: '1'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [176, 92.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: blocks_throttle_0
|
||||||
|
id: blocks_throttle
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
comment: ''
|
||||||
|
ignoretag: 'True'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
samples_per_second: samp_rate
|
||||||
|
type: complex
|
||||||
|
vlen: '1'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [496, 244.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: blocks_throttle_1
|
||||||
|
id: blocks_throttle
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
comment: ''
|
||||||
|
ignoretag: 'True'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
samples_per_second: samp_rate
|
||||||
|
type: complex
|
||||||
|
vlen: '1'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [400, 124.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: qtgui_freq_sink_x_0
|
||||||
|
id: qtgui_freq_sink_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
alpha1: '1.0'
|
||||||
|
alpha10: '1.0'
|
||||||
|
alpha2: '1.0'
|
||||||
|
alpha3: '1.0'
|
||||||
|
alpha4: '1.0'
|
||||||
|
alpha5: '1.0'
|
||||||
|
alpha6: '1.0'
|
||||||
|
alpha7: '1.0'
|
||||||
|
alpha8: '1.0'
|
||||||
|
alpha9: '1.0'
|
||||||
|
autoscale: 'False'
|
||||||
|
average: '1.0'
|
||||||
|
axislabels: 'True'
|
||||||
|
bw: samp_rate
|
||||||
|
color1: '"blue"'
|
||||||
|
color10: '"dark blue"'
|
||||||
|
color2: '"red"'
|
||||||
|
color3: '"green"'
|
||||||
|
color4: '"black"'
|
||||||
|
color5: '"cyan"'
|
||||||
|
color6: '"magenta"'
|
||||||
|
color7: '"yellow"'
|
||||||
|
color8: '"dark red"'
|
||||||
|
color9: '"dark green"'
|
||||||
|
comment: ''
|
||||||
|
ctrlpanel: 'False'
|
||||||
|
fc: '0'
|
||||||
|
fftsize: '4096'
|
||||||
|
freqhalf: 'True'
|
||||||
|
grid: 'True'
|
||||||
|
gui_hint: ''
|
||||||
|
label: Relative Gain
|
||||||
|
label1: ''
|
||||||
|
label10: ''''''
|
||||||
|
label2: ''''''
|
||||||
|
label3: ''''''
|
||||||
|
label4: ''''''
|
||||||
|
label5: ''''''
|
||||||
|
label6: ''''''
|
||||||
|
label7: ''''''
|
||||||
|
label8: ''''''
|
||||||
|
label9: ''''''
|
||||||
|
legend: 'True'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
name: '""'
|
||||||
|
nconnections: '1'
|
||||||
|
norm_window: 'False'
|
||||||
|
showports: 'False'
|
||||||
|
tr_chan: '0'
|
||||||
|
tr_level: '0.0'
|
||||||
|
tr_mode: qtgui.TRIG_MODE_FREE
|
||||||
|
tr_tag: '""'
|
||||||
|
type: complex
|
||||||
|
units: dB
|
||||||
|
update_time: '0.10'
|
||||||
|
width1: '1'
|
||||||
|
width10: '1'
|
||||||
|
width2: '1'
|
||||||
|
width3: '1'
|
||||||
|
width4: '1'
|
||||||
|
width5: '1'
|
||||||
|
width6: '1'
|
||||||
|
width7: '1'
|
||||||
|
width8: '1'
|
||||||
|
width9: '1'
|
||||||
|
wintype: window.WIN_BLACKMAN_hARRIS
|
||||||
|
ymax: '10'
|
||||||
|
ymin: '-140'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [712, 156.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: qtgui_time_sink_x_0
|
||||||
|
id: qtgui_time_sink_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
alpha1: '1.0'
|
||||||
|
alpha10: '1.0'
|
||||||
|
alpha2: '1.0'
|
||||||
|
alpha3: '1.0'
|
||||||
|
alpha4: '1.0'
|
||||||
|
alpha5: '1.0'
|
||||||
|
alpha6: '1.0'
|
||||||
|
alpha7: '1.0'
|
||||||
|
alpha8: '1.0'
|
||||||
|
alpha9: '1.0'
|
||||||
|
autoscale: 'False'
|
||||||
|
axislabels: 'True'
|
||||||
|
color1: blue
|
||||||
|
color10: dark blue
|
||||||
|
color2: red
|
||||||
|
color3: green
|
||||||
|
color4: black
|
||||||
|
color5: cyan
|
||||||
|
color6: magenta
|
||||||
|
color7: yellow
|
||||||
|
color8: dark red
|
||||||
|
color9: dark green
|
||||||
|
comment: ''
|
||||||
|
ctrlpanel: 'False'
|
||||||
|
entags: 'True'
|
||||||
|
grid: 'False'
|
||||||
|
gui_hint: ''
|
||||||
|
label1: Signal 1
|
||||||
|
label10: Signal 10
|
||||||
|
label2: Signal 2
|
||||||
|
label3: Signal 3
|
||||||
|
label4: Signal 4
|
||||||
|
label5: Signal 5
|
||||||
|
label6: Signal 6
|
||||||
|
label7: Signal 7
|
||||||
|
label8: Signal 8
|
||||||
|
label9: Signal 9
|
||||||
|
legend: 'True'
|
||||||
|
marker1: '-1'
|
||||||
|
marker10: '-1'
|
||||||
|
marker2: '-1'
|
||||||
|
marker3: '-1'
|
||||||
|
marker4: '-1'
|
||||||
|
marker5: '-1'
|
||||||
|
marker6: '-1'
|
||||||
|
marker7: '-1'
|
||||||
|
marker8: '-1'
|
||||||
|
marker9: '-1'
|
||||||
|
name: '""'
|
||||||
|
nconnections: '1'
|
||||||
|
size: '1024'
|
||||||
|
srate: samp_rate
|
||||||
|
stemplot: 'False'
|
||||||
|
style1: '1'
|
||||||
|
style10: '1'
|
||||||
|
style2: '1'
|
||||||
|
style3: '1'
|
||||||
|
style4: '1'
|
||||||
|
style5: '1'
|
||||||
|
style6: '1'
|
||||||
|
style7: '1'
|
||||||
|
style8: '1'
|
||||||
|
style9: '1'
|
||||||
|
tr_chan: '0'
|
||||||
|
tr_delay: '0'
|
||||||
|
tr_level: '0.0'
|
||||||
|
tr_mode: qtgui.TRIG_MODE_FREE
|
||||||
|
tr_slope: qtgui.TRIG_SLOPE_POS
|
||||||
|
tr_tag: '""'
|
||||||
|
type: complex
|
||||||
|
update_time: '0.10'
|
||||||
|
width1: '1'
|
||||||
|
width10: '1'
|
||||||
|
width2: '1'
|
||||||
|
width3: '1'
|
||||||
|
width4: '1'
|
||||||
|
width5: '1'
|
||||||
|
width6: '1'
|
||||||
|
width7: '1'
|
||||||
|
width8: '1'
|
||||||
|
width9: '1'
|
||||||
|
ylabel: Amplitude
|
||||||
|
ymax: '1.5'
|
||||||
|
ymin: '-1.5'
|
||||||
|
yunit: '""'
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [704, 252.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: qtgui_waterfall_sink_x_0
|
||||||
|
id: qtgui_waterfall_sink_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
alpha1: '1.0'
|
||||||
|
alpha10: '1.0'
|
||||||
|
alpha2: '1.0'
|
||||||
|
alpha3: '1.0'
|
||||||
|
alpha4: '1.0'
|
||||||
|
alpha5: '1.0'
|
||||||
|
alpha6: '1.0'
|
||||||
|
alpha7: '1.0'
|
||||||
|
alpha8: '1.0'
|
||||||
|
alpha9: '1.0'
|
||||||
|
axislabels: 'True'
|
||||||
|
bw: samp_rate
|
||||||
|
color1: '0'
|
||||||
|
color10: '0'
|
||||||
|
color2: '0'
|
||||||
|
color3: '0'
|
||||||
|
color4: '0'
|
||||||
|
color5: '0'
|
||||||
|
color6: '0'
|
||||||
|
color7: '0'
|
||||||
|
color8: '0'
|
||||||
|
color9: '0'
|
||||||
|
comment: ''
|
||||||
|
fc: '0'
|
||||||
|
fftsize: '4096'
|
||||||
|
freqhalf: 'True'
|
||||||
|
grid: 'True'
|
||||||
|
gui_hint: ''
|
||||||
|
int_max: '10'
|
||||||
|
int_min: '-80'
|
||||||
|
label1: ''
|
||||||
|
label10: ''
|
||||||
|
label2: ''
|
||||||
|
label3: ''
|
||||||
|
label4: ''
|
||||||
|
label5: ''
|
||||||
|
label6: ''
|
||||||
|
label7: ''
|
||||||
|
label8: ''
|
||||||
|
label9: ''
|
||||||
|
legend: 'True'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
name: '""'
|
||||||
|
nconnections: '1'
|
||||||
|
showports: 'False'
|
||||||
|
type: complex
|
||||||
|
update_time: '0.10'
|
||||||
|
wintype: window.WIN_BLACKMAN_hARRIS
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [704, 348.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
- name: qtgui_waterfall_sink_x_0_0
|
||||||
|
id: qtgui_waterfall_sink_x
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
alpha1: '1.0'
|
||||||
|
alpha10: '1.0'
|
||||||
|
alpha2: '1.0'
|
||||||
|
alpha3: '1.0'
|
||||||
|
alpha4: '1.0'
|
||||||
|
alpha5: '1.0'
|
||||||
|
alpha6: '1.0'
|
||||||
|
alpha7: '1.0'
|
||||||
|
alpha8: '1.0'
|
||||||
|
alpha9: '1.0'
|
||||||
|
axislabels: 'True'
|
||||||
|
bw: samp_rate
|
||||||
|
color1: '0'
|
||||||
|
color10: '0'
|
||||||
|
color2: '0'
|
||||||
|
color3: '0'
|
||||||
|
color4: '0'
|
||||||
|
color5: '0'
|
||||||
|
color6: '0'
|
||||||
|
color7: '0'
|
||||||
|
color8: '0'
|
||||||
|
color9: '0'
|
||||||
|
comment: ''
|
||||||
|
fc: '0'
|
||||||
|
fftsize: '4096'
|
||||||
|
freqhalf: 'True'
|
||||||
|
grid: 'True'
|
||||||
|
gui_hint: ''
|
||||||
|
int_max: '10'
|
||||||
|
int_min: '-80'
|
||||||
|
label1: ''
|
||||||
|
label10: ''
|
||||||
|
label2: ''
|
||||||
|
label3: ''
|
||||||
|
label4: ''
|
||||||
|
label5: ''
|
||||||
|
label6: ''
|
||||||
|
label7: ''
|
||||||
|
label8: ''
|
||||||
|
label9: ''
|
||||||
|
legend: 'True'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
name: '""'
|
||||||
|
nconnections: '1'
|
||||||
|
showports: 'False'
|
||||||
|
type: complex
|
||||||
|
update_time: '0.10'
|
||||||
|
wintype: window.WIN_BLACKMAN_hARRIS
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [696, 60.0]
|
||||||
|
rotation: 0
|
||||||
|
state: true
|
||||||
|
|
||||||
|
connections:
|
||||||
|
- [blocks_file_source_0, '0', blocks_throttle_0, '0']
|
||||||
|
- [blocks_file_source_0_0, '0', blocks_throttle_1, '0']
|
||||||
|
- [blocks_throttle_0, '0', qtgui_freq_sink_x_0, '0']
|
||||||
|
- [blocks_throttle_0, '0', qtgui_time_sink_x_0, '0']
|
||||||
|
- [blocks_throttle_0, '0', qtgui_waterfall_sink_x_0, '0']
|
||||||
|
- [blocks_throttle_1, '0', qtgui_waterfall_sink_x_0_0, '0']
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
file_format: 1
|
Loading…
Reference in New Issue