kopia lustrzana https://github.com/rpp0/gr-lora
- Fixed decoding bug
- Allow for pausing upon encountering test suite error - Round header bin index instead of floorpull/61/head
rodzic
ea6d08e9cb
commit
b65f34c0aa
|
@ -196,4 +196,4 @@ if __name__ == '__main__':
|
||||||
Test(payload="88", times=1),
|
Test(payload="88", times=1),
|
||||||
Test(payload="ffff", times=10),
|
Test(payload="ffff", times=10),
|
||||||
]
|
]
|
||||||
#TestSuite(name='short', args=args, config_set=short_config_set, test_set=short_test_set).run()
|
TestSuite(name='short', args=args, config_set=short_config_set, test_set=short_test_set).run()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Test suite: 'decode_long_usrp'
|
# Test suite: 'decode_long_usrp'
|
||||||
|
|
||||||
*Results on 2017-09-06 14:44:23.827805*
|
*Results on 2017-09-07 08:34:10.155002*
|
||||||
|
|
||||||
### 868.1 MHz, SF 7, CR 4/8, BW 125 kHz, prlen 8, crc on, implicit off
|
### 868.1 MHz, SF 7, CR 4/8, BW 125 kHz, prlen 8, crc on, implicit off
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
# Test suite: 'short_usrp'
|
# Test suite: 'short_usrp'
|
||||||
|
|
||||||
*Results on 2017-09-06 14:45:03.172136*
|
*Results on 2017-09-07 08:34:49.501821*
|
||||||
|
|
||||||
### 868.1 MHz, SF 7, CR 4/8, BW 125 kHz, prlen 8, crc on, implicit off
|
### 868.1 MHz, SF 7, CR 4/8, BW 125 kHz, prlen 8, crc on, implicit off
|
||||||
|
|
||||||
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
`deadbeef ` | 0 | 5 | 0.00%
|
`deadbeef ` | 5 | 5 | 100.00%
|
||||||
`88 ` | 1 | 1 | 100.00%
|
`88 ` | 1 | 1 | 100.00%
|
||||||
`ffff ` | 10 | 10 | 100.00%
|
`ffff ` | 10 | 10 | 100.00%
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
||||||
|
|
||||||
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
`deadbeef ` | 0 | 5 | 0.00%
|
`deadbeef ` | 5 | 5 | 100.00%
|
||||||
`88 ` | 1 | 1 | 100.00%
|
`88 ` | 1 | 1 | 100.00%
|
||||||
`ffff ` | 10 | 10 | 100.00%
|
`ffff ` | 10 | 10 | 100.00%
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
||||||
|
|
||||||
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
`deadbeef ` | 0 | 5 | 0.00%
|
`deadbeef ` | 5 | 5 | 100.00%
|
||||||
`88 ` | 1 | 1 | 100.00%
|
`88 ` | 1 | 1 | 100.00%
|
||||||
`ffff ` | 10 | 10 | 100.00%
|
`ffff ` | 10 | 10 | 100.00%
|
||||||
|
|
||||||
|
@ -166,15 +166,15 @@ Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
||||||
|
|
||||||
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
`deadbeef ` | 2 | 5 | 40.00%
|
`deadbeef ` | 5 | 5 | 100.00%
|
||||||
`88 ` | 0 | 1 | 0.00%
|
`88 ` | 1 | 1 | 100.00%
|
||||||
`ffff ` | 9 | 10 | 90.00%
|
`ffff ` | 10 | 10 | 100.00%
|
||||||
|
|
||||||
### 868.1 MHz, SF 12, CR 4/7, BW 125 kHz, prlen 8, crc on, implicit off
|
### 868.1 MHz, SF 12, CR 4/7, BW 125 kHz, prlen 8, crc on, implicit off
|
||||||
|
|
||||||
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
`deadbeef ` | 2 | 5 | 40.00%
|
`deadbeef ` | 5 | 5 | 100.00%
|
||||||
`88 ` | 1 | 1 | 100.00%
|
`88 ` | 1 | 1 | 100.00%
|
||||||
`ffff ` | 10 | 10 | 100.00%
|
`ffff ` | 10 | 10 | 100.00%
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
||||||
|
|
||||||
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
`deadbeef ` | 4 | 5 | 80.00%
|
`deadbeef ` | 5 | 5 | 100.00%
|
||||||
`88 ` | 1 | 1 | 100.00%
|
`88 ` | 1 | 1 | 100.00%
|
||||||
`ffff ` | 10 | 10 | 100.00%
|
`ffff ` | 10 | 10 | 100.00%
|
||||||
|
|
||||||
|
@ -190,11 +190,11 @@ Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
||||||
|
|
||||||
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
Transmitted payload | :heavy_check_mark: | :hash: | :heavy_division_sign:
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
`deadbeef ` | 4 | 5 | 80.00%
|
`deadbeef ` | 5 | 5 | 100.00%
|
||||||
`88 ` | 0 | 1 | 0.00%
|
`88 ` | 1 | 1 | 100.00%
|
||||||
`ffff ` | 8 | 10 | 80.00%
|
`ffff ` | 10 | 10 | 100.00%
|
||||||
|
|
||||||
### Summary for suite 'short_usrp'
|
### Summary for suite 'short_usrp'
|
||||||
|
|
||||||
Total payloads passed: 356 out of 384 (92.71%)
|
Total payloads passed: 384 out of 384 (100.00%)
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ namespace gr {
|
||||||
d_samples_per_symbol = (uint32_t)(d_samples_per_second / d_symbols_per_second);
|
d_samples_per_symbol = (uint32_t)(d_samples_per_second / d_symbols_per_second);
|
||||||
d_delay_after_sync = d_samples_per_symbol / 4u;
|
d_delay_after_sync = d_samples_per_symbol / 4u;
|
||||||
d_number_of_bins = (uint32_t)(1u << d_sf);
|
d_number_of_bins = (uint32_t)(1u << d_sf);
|
||||||
|
d_number_of_bins_hdr = (uint32_t)(1u << (d_sf-2));
|
||||||
d_decim_factor = d_samples_per_symbol / d_number_of_bins;
|
d_decim_factor = d_samples_per_symbol / d_number_of_bins;
|
||||||
d_energy_threshold = 0.01f;
|
d_energy_threshold = 0.01f;
|
||||||
d_whitening_sequence = gr::lora::prng_payload;
|
d_whitening_sequence = gr::lora::prng_payload;
|
||||||
|
@ -431,12 +432,10 @@ namespace gr {
|
||||||
gradient = samples_ifreq_avg[i - 1] - samples_ifreq_avg[i];
|
gradient = samples_ifreq_avg[i - 1] - samples_ifreq_avg[i];
|
||||||
if (gradient > max_gradient) {
|
if (gradient > max_gradient) {
|
||||||
max_gradient = gradient;
|
max_gradient = gradient;
|
||||||
max_index = i;
|
max_index = i+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
max_index += 1;
|
|
||||||
|
|
||||||
return (d_number_of_bins - max_index) % d_number_of_bins;
|
return (d_number_of_bins - max_index) % d_number_of_bins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +452,7 @@ namespace gr {
|
||||||
|
|
||||||
// Header has additional redundancy
|
// Header has additional redundancy
|
||||||
if (is_header || d_sf > 10) {
|
if (is_header || d_sf > 10) {
|
||||||
bin_idx /= 4u;
|
bin_idx = std::lround(bin_idx / 4.0f) % d_number_of_bins_hdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode (actually gray encode) the bin to get the symbol value
|
// Decode (actually gray encode) the bin to get the symbol value
|
||||||
|
|
|
@ -35,7 +35,8 @@ def trunc(target, max_len=30):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
class TestSummary():
|
class TestSummary():
|
||||||
def __init__(self, suite):
|
def __init__(self, suite, pause=False):
|
||||||
|
self.pause = pause
|
||||||
self.suite = suite
|
self.suite = suite
|
||||||
self._summary = []
|
self._summary = []
|
||||||
self._summary_text = "-------- Test suite '{:s}' results on {:s} ---------\n".format(suite, str(datetime.datetime.utcnow()))
|
self._summary_text = "-------- Test suite '{:s}' results on {:s} ---------\n".format(suite, str(datetime.datetime.utcnow()))
|
||||||
|
@ -117,6 +118,9 @@ class TestSummary():
|
||||||
if decoded == expected:
|
if decoded == expected:
|
||||||
num_correct_payloads += 1
|
num_correct_payloads += 1
|
||||||
self._num_total_correct_payloads += 1
|
self._num_total_correct_payloads += 1
|
||||||
|
else:
|
||||||
|
if self.pause:
|
||||||
|
dummy = input("Expected %s but got %s for %s. Press enter to continue..." % (expected, decoded, lora_config.string_repr()))
|
||||||
|
|
||||||
# Append to text report
|
# Append to text report
|
||||||
evaluation_text += "\tTest {:>3n}: {:<30s} * {:<3n} :: passed {:>3n} out of {:<3n} ({:.2%})\n".format(
|
evaluation_text += "\tTest {:>3n}: {:<30s} * {:<3n} :: passed {:>3n} out of {:<3n} ({:.2%})\n".format(
|
||||||
|
@ -191,14 +195,14 @@ class qa_testsuite():
|
||||||
|
|
||||||
return total_data
|
return total_data
|
||||||
|
|
||||||
def run(self, suites_to_run):
|
def run(self, suites_to_run, pause=False):
|
||||||
for test_suite in self.test_suites:
|
for test_suite in self.test_suites:
|
||||||
# Skip test suites that we don't want to run
|
# Skip test suites that we don't want to run
|
||||||
if suites_to_run != [] and (not test_suite in suites_to_run):
|
if suites_to_run != [] and (not test_suite in suites_to_run):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print("[+] Testing suite: '%s'" % test_suite)
|
print("[+] Testing suite: '%s'" % test_suite)
|
||||||
summary = TestSummary(suite=test_suite)
|
summary = TestSummary(suite=test_suite, pause=pause)
|
||||||
|
|
||||||
# Get all metadata files associated with the suite
|
# Get all metadata files associated with the suite
|
||||||
get_mtime = lambda f: os.stat(os.path.join(self.test_suites_directory, test_suite, f)).st_mtime
|
get_mtime = lambda f: os.stat(os.path.join(self.test_suites_directory, test_suite, f)).st_mtime
|
||||||
|
@ -264,10 +268,11 @@ if __name__ == '__main__':
|
||||||
# Parse args
|
# Parse args
|
||||||
parser = argparse.ArgumentParser(description="Tool to evaluate decoding test suites for gr-lora.")
|
parser = argparse.ArgumentParser(description="Tool to evaluate decoding test suites for gr-lora.")
|
||||||
parser.add_argument('suites', type=str, nargs="*", help='Names of the test suites to execute.')
|
parser.add_argument('suites', type=str, nargs="*", help='Names of the test suites to execute.')
|
||||||
|
parser.add_argument('--pause', action="store_true", default=False, help='Pause upon encountering an error.')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Make sure CTRL+C exits the whole test suite instead of only the current GNU Radio top block
|
# Make sure CTRL+C exits the whole test suite instead of only the current GNU Radio top block
|
||||||
signal.signal(signal.SIGINT, signal_handler)
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
|
||||||
suite = qa_testsuite()
|
suite = qa_testsuite()
|
||||||
suite.run(args.suites)
|
suite.run(args.suites, args.pause)
|
||||||
|
|
Ładowanie…
Reference in New Issue