Fix SF 11 and SF 12

pull/61/head
Pieter Robyns 2017-08-29 12:57:17 +02:00
rodzic d7c73883ad
commit 25aa382bad
3 zmienionych plików z 89 dodań i 83 usunięć

Wyświetl plik

@ -1,114 +1,114 @@
-------- Test Results on 2017-08-23 17:51:40 ---------
-------- Test Results on 2017-08-29 11:56:30 ---------
Test serie 0: [u'01 23 45 67 89 ab cd ef'] * 10
Test 1 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 2 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 8 out of 10 ( 80.00%)
Test 3 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 4 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 5 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 9 out of 10 ( 90.00%)
Test 6 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 7 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 8 out of 10 ( 80.00%)
=> Total passed: 35 out of 70 (50.00%)
Test 2 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 3 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 4 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 5 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 6 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 8 out of 10 ( 80.00%)
Test 7 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 9 out of 10 ( 90.00%)
=> Total passed: 67 out of 70 (95.71%)
Test serie 1: [u'11 11 11'] * 1
Test 8 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 9 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 10 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 1 ( 0.00%)
Test 10 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 11 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 12 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 13 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 1 ( 0.00%)
Test 13 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 14 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 1 out of 1 (100.00%)
=> Total passed: 5 out of 7 (71.43%)
=> Total passed: 7 out of 7 (100.00%)
Test serie 2: [u'11 11 11'] * 5
Test 15 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 5 out of 5 (100.00%)
Test 16 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 5 out of 5 (100.00%)
Test 17 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 1 out of 5 ( 20.00%)
Test 18 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 4 out of 5 ( 80.00%)
Test 17 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 5 out of 5 (100.00%)
Test 18 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 5 out of 5 (100.00%)
Test 19 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 5 out of 5 (100.00%)
Test 20 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 2 out of 5 ( 40.00%)
Test 20 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 5 out of 5 (100.00%)
Test 21 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 5 out of 5 (100.00%)
=> Total passed: 27 out of 35 (77.14%)
=> Total passed: 35 out of 35 (100.00%)
Test serie 3: [u'aa aa aa aa'] * 3
Test 22 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 3 out of 3 (100.00%)
Test 23 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 3 out of 3 (100.00%)
Test 24 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 3 ( 0.00%)
Test 25 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 1 out of 3 ( 33.33%)
Test 24 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 2 out of 3 ( 66.67%)
Test 25 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 3 out of 3 (100.00%)
Test 26 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 3 out of 3 (100.00%)
Test 27 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 3 ( 0.00%)
Test 27 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 3 out of 3 (100.00%)
Test 28 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 3 out of 3 (100.00%)
=> Total passed: 13 out of 21 (61.90%)
=> Total passed: 20 out of 21 (95.24%)
Test serie 4: [u'ff ff ff ff'] * 1
Test 29 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 30 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 31 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 1 ( 0.00%)
Test 32 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 1 ( 0.00%)
Test 31 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 32 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 33 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 34 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 1 ( 0.00%)
Test 34 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 35 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 0 out of 1 ( 0.00%)
=> Total passed: 3 out of 7 (42.86%)
=> Total passed: 6 out of 7 (85.71%)
Test serie 5: [u'ff ff ff ff'] * 10
Test 36 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 9 out of 10 ( 90.00%)
Test 37 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 8 out of 10 ( 80.00%)
Test 38 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 39 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 36 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 37 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 5 out of 10 ( 50.00%)
Test 38 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 9 out of 10 ( 90.00%)
Test 39 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 40 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 41 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 42 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 10 out of 10 (100.00%)
=> Total passed: 37 out of 70 (52.86%)
Test 41 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 42 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 9 out of 10 ( 90.00%)
=> Total passed: 53 out of 70 (75.71%)
Test serie 6: [u'55 55 55 55'] * 3
Test 43 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 3 out of 3 (100.00%)
Test 44 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 3 out of 3 (100.00%)
Test 45 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 3 ( 0.00%)
Test 46 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 3 ( 0.00%)
Test 47 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 2 out of 3 ( 66.67%)
Test 48 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 3 ( 0.00%)
Test 45 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 3 out of 3 (100.00%)
Test 46 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 3 out of 3 (100.00%)
Test 47 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 3 out of 3 (100.00%)
Test 48 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 3 out of 3 (100.00%)
Test 49 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 3 out of 3 (100.00%)
=> Total passed: 11 out of 21 (52.38%)
=> Total passed: 21 out of 21 (100.00%)
Test serie 7: [u'55 55 55 55'] * 10
Test 50 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 51 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 52 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 53 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 52 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 53 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 54 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 55 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 55 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 56 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 10 out of 10 (100.00%)
=> Total passed: 40 out of 70 (57.14%)
=> Total passed: 70 out of 70 (100.00%)
Test serie 8: [u'88 88 88 88'] * 1
Test 57 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 57 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 0 out of 1 ( 0.00%)
Test 58 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 59 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 1 ( 0.00%)
Test 60 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 1 ( 0.00%)
Test 61 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 62 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 1 ( 0.00%)
Test 63 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 59 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 60 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 61 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 0 out of 1 ( 0.00%)
Test 62 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 1 out of 1 (100.00%)
Test 63 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 0 out of 1 ( 0.00%)
=> Total passed: 4 out of 7 (57.14%)
Test serie 9: [u'88 88 88 88'] * 5
Test 64 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 4 out of 5 ( 80.00%)
Test 65 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 4 out of 5 ( 80.00%)
Test 66 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 5 ( 0.00%)
Test 67 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 2 out of 5 ( 40.00%)
Test 68 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 5 out of 5 (100.00%)
Test 69 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 1 out of 5 ( 20.00%)
Test 70 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 5 out of 5 (100.00%)
=> Total passed: 21 out of 35 (60.00%)
Test 64 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 0 out of 5 ( 0.00%)
Test 65 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 5 out of 5 (100.00%)
Test 66 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 5 out of 5 (100.00%)
Test 67 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 5 out of 5 (100.00%)
Test 68 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 0 out of 5 ( 0.00%)
Test 69 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 4 out of 5 ( 80.00%)
Test 70 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 0 out of 5 ( 0.00%)
=> Total passed: 19 out of 35 (54.29%)
Test serie 10: [u'88 88 88 88'] * 10
Test 71 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 71 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 72 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 73 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 74 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 5 out of 10 ( 50.00%)
Test 75 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 9 out of 10 ( 90.00%)
Test 76 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 77 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 10 out of 10 (100.00%)
=> Total passed: 44 out of 70 (62.86%)
Test 73 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 9 out of 10 ( 90.00%)
Test 74 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 10 out of 10 (100.00%)
Test 75 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
Test 76 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 7 out of 10 ( 70.00%)
Test 77 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 0 out of 10 ( 0.00%)
=> Total passed: 36 out of 70 (51.43%)
====== Total passed: 240 out of 413 (58.11%) ======
====== Total passed: 338 out of 413 (81.84%) ======

Wyświetl plik

@ -369,7 +369,9 @@ namespace gr {
}
}
d_debug << "FINE: " << -lag << std::endl;
#ifndef NDEBUG
d_debug << "FINE: " << -lag << std::endl;
#endif
d_fine_sync = -lag;
@ -396,6 +398,9 @@ namespace gr {
autocorr = abs(dot_product / gr_complex(sqrt(energy_chirp1 * energy_chirp2), 0));
if(energy_chirp1 < 0.05f)
autocorr = 0; // TODO: fixme
return autocorr;
}
@ -524,7 +529,7 @@ namespace gr {
samples_ifreq_avg[i] /= d_decim_factor;
}
float max_gradient = 0.2f;
float max_gradient = 0.1f;
float gradient = 0.0f;
uint32_t max_index = 0;
for (uint32_t i = 1u; i < this->d_number_of_bins; i++) {
@ -547,12 +552,12 @@ namespace gr {
uint32_t bin_idx = this->max_frequency_gradient_idx(samples, is_header);
//uint32_t bin_idx = this->get_shift_fft(samples);
fine_sync(samples, bin_idx, 2);
fine_sync(samples, bin_idx, std::max(d_decim_factor / 4u, 2u));
// DBGR_INTERMEDIATE_TIME_MEASUREMENT();
// Header has additional redundancy
if (is_header) {
if (is_header || d_sf > 10) {
bin_idx /= 4u;
//bin_idx = std::max(bin_idx - 2u, 0u) / 4u;
}
@ -568,7 +573,7 @@ namespace gr {
// Look for 4+cr symbols and stop
if (this->d_words.size() == (4u + this->d_cr)) {
// Deinterleave
this->deinterleave(is_header ? this->d_sf - 2u : this->d_sf);
this->deinterleave((is_header || d_sf > 10) ? this->d_sf - 2u : this->d_sf);
return true; // Signal that a block is ready for decoding
}
@ -601,6 +606,7 @@ namespace gr {
#ifndef NDEBUG
print_vector(this->d_debug, words_deinterleaved, "D", sizeof(uint8_t) * 8u);
//print_interleave_matrix(this->d_debug, this->d_words, ppm);
#endif
// Add to demodulated data
@ -840,6 +846,7 @@ namespace gr {
const gr_complex *input = (gr_complex *) input_items[0];
const gr_complex *raw_input = (gr_complex *) input_items[1];
d_fine_sync = 0;
// float *out = (float *)output_items[0];
// DBGR_TIME_MEASUREMENT_TO_FILE("SF7_fft_idx");
@ -850,8 +857,10 @@ namespace gr {
case gr::lora::DecoderState::DETECT: {
float correlation = detect_preamble_autocorr(input, d_samples_per_symbol);
if (correlation >= 0.80f) {
//this->samples_to_file("/tmp/detect", &input[0], this->d_samples_per_symbol, sizeof(gr_complex));
if (correlation >= 0.90f) {
#ifndef NDEBUG
this->d_debug << "Ca: " << correlation << std::endl;
#endif
this->d_corr_fails = 0u;
this->d_state = gr::lora::DecoderState::SYNC;
break;
@ -866,13 +875,9 @@ namespace gr {
int i = 0;
float correlation = detect_upchirp(input, d_samples_per_symbol, &i);
#ifndef NDEBUG
this->d_debug << "Cu: " << correlation << std::endl;
#endif
float cfo = experimental_determine_cfo(&input[i], d_samples_per_symbol);
pmt::pmt_t kv = pmt::cons(pmt::intern(std::string("cfo")), pmt::from_double(cfo));
this->message_port_pub(pmt::mp("control"), kv);
//float cfo = experimental_determine_cfo(&input[i], d_samples_per_symbol);
//pmt::pmt_t kv = pmt::cons(pmt::intern(std::string("cfo")), pmt::from_double(cfo));
//this->message_port_pub(pmt::mp("control"), kv);
this->samples_to_file("/tmp/detect", &input[i], this->d_samples_per_symbol, sizeof(gr_complex));
memcpy(&d_upchirp_stored[0], input+i, sizeof(gr_complex) * this->d_samples_per_symbol);
@ -891,8 +896,7 @@ namespace gr {
this->d_debug << "Cd: " << c << std::endl;
#endif
if (c > 0.99f) {
d_dbg.store_samples(input, this->d_samples_per_symbol);
if (c > 0.96f) {
memcpy(&d_downchirp_stored[0], input, sizeof(gr_complex) * this->d_samples_per_symbol);
#ifndef NDEBUG
this->d_debug << "SYNC: " << c << std::endl;
@ -905,13 +909,13 @@ namespace gr {
this->d_state = gr::lora::DecoderState::PAUSE;
} else {
if(c < -0.98) {
fine_sync(input, d_number_of_bins-1, 64);
if(c < -0.97) {
fine_sync(input, d_number_of_bins-1, d_decim_factor * 4);
} else {
this->d_corr_fails++;
}
if (this->d_corr_fails > 8u) {
if (this->d_corr_fails > 4u) {
this->d_state = gr::lora::DecoderState::DETECT;
#ifndef NDEBUG
this->d_debug << "Lost sync" << std::endl;
@ -944,9 +948,11 @@ namespace gr {
this->d_payload_length = decoded[0];
this->d_cr = this->lookup_cr(decoded[1]);
uint8_t redundancy = (d_sf > 10 ? 2 : 0);
const int symbols_per_block = this->d_cr + 4u;
const float bits_needed = float(this->d_payload_length) * 8.0f + 16.0f;
const float symbols_needed = bits_needed * (symbols_per_block / 4.0f) / float(this->d_sf);
const float symbols_needed = bits_needed * (symbols_per_block / 4.0f) / float(this->d_sf - redundancy);
const int blocks_needed = (int)std::ceil(symbols_needed / symbols_per_block);
this->d_payload_symbols = blocks_needed * symbols_per_block;

Wyświetl plik

@ -86,7 +86,7 @@ class qa_BasicTest_XML (gr_unittest.TestCase):
# For FFT, determine Center Frequency Offset first, then set here.
# For RN2483, usually -14.1e3
self.center_offset = 0
self.center_offset = 40000
self.inputFile = "./"
@ -221,7 +221,7 @@ class qa_BasicTest_XML (gr_unittest.TestCase):
self.lora_lora_receiver_0 = lora.lora_receiver(self.samp_rate, self.capture_freq, [868100000], self.sf, self.samp_rate, self.threshold)
self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, self.samp_rate, True)
self.blocks_message_socket_sink_0 = lora.message_socket_sink()
self.freq_xlating_fir_filter_0 = filter.freq_xlating_fir_filter_ccc(1, (firdes.low_pass(1, self.samp_rate, 500000, 100000, firdes.WIN_HAMMING, 6.67)), self.center_offset, self.samp_rate)
self.freq_xlating_fir_filter_0 = filter.freq_xlating_fir_filter_ccc(1, (firdes.low_pass(1, self.samp_rate, 100000, 100000, firdes.WIN_HAMMING, 6.67)), self.center_offset, self.samp_rate)
self.tb.connect( (self.file_source, 0), (self.blocks_throttle_0, 0))
self.tb.connect( (self.blocks_throttle_0, 0), (self.freq_xlating_fir_filter_0, 0))