Skip to content

Commit 446a38d

Browse files
authored
Merge pull request drowe67#278 from drowe67/dr-channelsim
Channel simulator maintenance
2 parents 8e599d1 + 01010b7 commit 446a38d

28 files changed

+230
-174
lines changed

CMakeLists.txt

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,9 @@ if(UNITTEST)
394394
set_tests_properties(test_CML_ldpcut PROPERTIES PASS_REGULAR_EXPRESSION "Nerr: 0")
395395

396396
# check channel simulator measures correct Peak to Average Power Ratio (about 0dB) with a sine wave input signal
397-
add_test(NAME test_cohpsk_ch_papr
397+
add_test(NAME test_ch_papr
398398
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR};
399-
./misc/mksine - 1000 10 | ./src/cohpsk_ch - /dev/null -100 --Fs 8000 --ctest")
399+
./misc/mksine - 1000 10 | ./src/ch - /dev/null --ctest")
400400

401401
add_test(NAME test_codec2_700c_octave_port
402402
COMMAND sh -c "
@@ -418,11 +418,11 @@ if(UNITTEST)
418418
set_tests_properties(test_COHPSK_modem_octave_port PROPERTIES PASS_REGULAR_EXPRESSION "fails: 0")
419419

420420
add_test(NAME test_COHPSK_modem_AWGN_BER
421-
COMMAND sh -c "$<TARGET_FILE:cohpsk_get_test_bits> - 5600 | $<TARGET_FILE:cohpsk_mod> - - | $<TARGET_FILE:cohpsk_ch> - - -30 | $<TARGET_FILE:cohpsk_demod> - - | $<TARGET_FILE:cohpsk_put_test_bits> -"
421+
COMMAND sh -c "$<TARGET_FILE:cohpsk_get_test_bits> - 5600 | $<TARGET_FILE:cohpsk_mod> - - | $<TARGET_FILE:ch> - - --No -30 --Fs 7500 | $<TARGET_FILE:cohpsk_demod> - - | $<TARGET_FILE:cohpsk_put_test_bits> -"
422422
)
423423

424424
add_test(NAME test_COHPSK_modem_freq_offset
425-
COMMAND sh -c "set -x; $<TARGET_FILE:cohpsk_get_test_bits> - 5600 | $<TARGET_FILE:cohpsk_mod> - - | $<TARGET_FILE:cohpsk_ch> - - -40 -f -30 | $<TARGET_FILE:cohpsk_demod> -v - - 2>log.txt | $<TARGET_FILE:cohpsk_put_test_bits> - ; ! grep 'lost sync' log.txt"
425+
COMMAND sh -c "set -x; $<TARGET_FILE:cohpsk_get_test_bits> - 5600 | $<TARGET_FILE:cohpsk_mod> - - | $<TARGET_FILE:ch> - - --No -40 -f -30 --Fs 7500 | $<TARGET_FILE:cohpsk_demod> -v - - 2>log.txt | $<TARGET_FILE:cohpsk_put_test_bits> - ; ! grep 'lost sync' log.txt"
426426
)
427427

428428
# -------------------------------------------------------------------------
@@ -523,7 +523,7 @@ if(UNITTEST)
523523
./fsk_put_test_bits - -q")
524524

525525
add_test(NAME test_OFDM_modem_AWGN_BER
526-
COMMAND sh -c "$<TARGET_FILE:ofdm_mod> --in /dev/zero --ldpc --testframes 60 --txbpf | $<TARGET_FILE:cohpsk_ch> - - -20 --Fs 8000 -f -50 | $<TARGET_FILE:ofdm_demod> --out /dev/null --testframes --ldpc --verbose 1"
526+
COMMAND sh -c "$<TARGET_FILE:ofdm_mod> --in /dev/zero --ldpc --testframes 60 --txbpf | $<TARGET_FILE:ch> - - --No -20 -f -50 | $<TARGET_FILE:ofdm_demod> --out /dev/null --testframes --ldpc --verbose 1"
527527
)
528528

529529
add_test(NAME test_OFDM_modem_fading_BER
@@ -552,7 +552,7 @@ endif()
552552
add_test(NAME test_OFDM_modem_700E_AWGN
553553
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
554554
./ofdm_mod --in /dev/zero --testframes 10 --ldpc --mode 700E |
555-
./cohpsk_ch - - -22 --Fs 8000 |
555+
./ch - - --No -22 |
556556
./ofdm_demod --mode 700E --ldpc --testframes -v 2 > /dev/null")
557557

558558
# -------------------------------------------------------------------------
@@ -603,7 +603,7 @@ endif()
603603
add_test(NAME test_OFDM_modem_datac0_ldpc_burst
604604
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
605605
./ofdm_mod --mode datac0 --in /dev/zero --testframes 1 --verbose 1 --ldpc --bursts 3 |
606-
./cohpsk_ch - - -17 --Fs 8000 |
606+
./ch - - --No -17 |
607607
./ofdm_demod --mode datac0 --out /dev/null --testframes --ldpc --verbose 2 --packetsperburst 1")
608608

609609
# -------------------------------------------------------------------------
@@ -712,24 +712,24 @@ endif()
712712
add_test(NAME test_freedv_api_700D_speech
713713
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
714714
./freedv_tx 700D ../../raw/ve9qrp_10s.raw - |
715-
./cohpsk_ch - - -20 --Fs 8000 |
715+
./ch - - --No -20 |
716716
./freedv_rx 700D - /dev/null --squelch -2 -vv")
717717
set_tests_properties(test_freedv_api_700D_speech PROPERTIES PASS_REGULAR_EXPRESSION "frames decoded: 62 output speech samples: 7")
718718

719719
# no random speech output due to trial sync when listening to noise
720720
add_test(NAME test_freedv_api_700D_burble
721721
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
722722
./freedv_tx 700D ../../raw/ve9qrp.raw - |
723-
./cohpsk_ch - - -8 --Fs 8000 |
723+
./ch - - --No -8 |
724724
./freedv_rx 700D - /dev/null --squelch -2 -vv")
725725
set_tests_properties(test_freedv_api_700D_burble PROPERTIES PASS_REGULAR_EXPRESSION "output speech samples: 0")
726726

727727
add_test(NAME test_freedv_api_700D_AWGN_BER
728-
COMMAND sh -c "dd bs=2560 count=120 if=/dev/zero | $<TARGET_FILE:freedv_tx> 700D - - --testframes | $<TARGET_FILE:cohpsk_ch> - - -20 --Fs 8000 -f -10 | $<TARGET_FILE:freedv_rx> 700D - /dev/null --testframes --discard"
728+
COMMAND sh -c "dd bs=2560 count=120 if=/dev/zero | $<TARGET_FILE:freedv_tx> 700D - - --testframes | $<TARGET_FILE:ch> - - --No -20 -f -10 | $<TARGET_FILE:freedv_rx> 700D - /dev/null --testframes --discard"
729729
)
730730

731731
add_test(NAME test_freedv_api_700D_AWGN_BER_USECOMPLEX
732-
COMMAND sh -c "dd bs=2560 count=120 if=/dev/zero | $<TARGET_FILE:freedv_tx> 700D - - --testframes | $<TARGET_FILE:cohpsk_ch> - - -20 --Fs 8000 -f -10 | $<TARGET_FILE:freedv_rx> 700D - /dev/null --testframes --discard --usecomplex"
732+
COMMAND sh -c "dd bs=2560 count=120 if=/dev/zero | $<TARGET_FILE:freedv_tx> 700D - - --testframes | $<TARGET_FILE:ch> - - --No -20 -f -10 | $<TARGET_FILE:freedv_rx> 700D - /dev/null --testframes --discard --usecomplex"
733733
)
734734

735735
if(LPCNET)
@@ -750,7 +750,7 @@ if(LPCNET)
750750
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
751751
dd bs=32000 count=10 if=/dev/zero |
752752
./freedv_tx 2020 - - --testframes |
753-
./cohpsk_ch - - -24 --Fs 8000 |
753+
./ch - - --No -24 |
754754
./freedv_rx 2020 - /dev/null --testframes"
755755
)
756756
endif()
@@ -822,21 +822,21 @@ endif()
822822

823823
add_test(NAME test_freedv_reliable_text_awgn_1600
824824
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
825-
./freedv_tx 1600 ../../raw/ve9qrp.raw - --reliabletext AB1CDEF | ./cohpsk_ch - - -25 --Fs 8000 -f -5 > 1600_reliable.raw 2>/dev/null;
825+
./freedv_tx 1600 ../../raw/ve9qrp.raw - --reliabletext AB1CDEF | ./ch - - --No -25 -f -5 > 1600_reliable.raw 2>/dev/null;
826826
./freedv_rx 1600 1600_reliable.raw /dev/null --txtrx 1600_reliable.txt --reliabletext 2>/dev/null;
827827
if [ `cat 1600_reliable.txt | wc -l` -ge 10 ]; then echo 1; fi")
828828
set_tests_properties(test_freedv_reliable_text_awgn_1600 PROPERTIES PASS_REGULAR_EXPRESSION "1")
829829

830830
add_test(NAME test_freedv_reliable_text_awgn_700D
831831
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
832-
./freedv_tx 700D ../../raw/ve9qrp.raw - --reliabletext AB1CDEF --txbpf 1 --clip 1 | ./cohpsk_ch - - -12 --Fs 8000 -f -5 > 700D_reliable.raw 2>/dev/null;
832+
./freedv_tx 700D ../../raw/ve9qrp.raw - --reliabletext AB1CDEF --txbpf 1 --clip 1 | ./ch - - --No -12 -f -5 > 700D_reliable.raw 2>/dev/null;
833833
./freedv_rx 700D 700D_reliable.raw /dev/null --txtrx 700D_reliable.txt --reliabletext 2>/dev/null;
834834
if [ `cat 700D_reliable.txt | wc -l` -ge 10 ]; then echo 1; fi")
835835
set_tests_properties(test_freedv_reliable_text_awgn_700D PROPERTIES PASS_REGULAR_EXPRESSION "1")
836836

837837
add_test(NAME test_freedv_reliable_text_awgn_700E
838838
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
839-
./freedv_tx 700E ../../raw/ve9qrp.raw - --reliabletext AB1CDEF --txbpf 1 --clip 1 | ./cohpsk_ch - - -15 --Fs 8000 -f -5 > 700E_reliable.raw 2>/dev/null;
839+
./freedv_tx 700E ../../raw/ve9qrp.raw - --reliabletext AB1CDEF --txbpf 1 --clip 1 | ./ch - - --No -15 -f -5 > 700E_reliable.raw 2>/dev/null;
840840
./freedv_rx 700E 700E_reliable.raw /dev/null --txtrx 700E_reliable.txt --reliabletext 2>/dev/null;
841841
if [ `cat 700E_reliable.txt | wc -l` -ge 10 ]; then echo 1; fi")
842842
set_tests_properties(test_freedv_reliable_text_awgn_700E PROPERTIES PASS_REGULAR_EXPRESSION "1")
@@ -860,7 +860,7 @@ if(LPCNET)
860860

861861
add_test(NAME test_freedv_reliable_text_awgn_2020
862862
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
863-
./freedv_tx 2020 ../../raw/ve9qrp.raw - --reliabletext AB1CDEF | ./cohpsk_ch - - -22 --Fs 8000 -f -5 > 2020_reliable.raw 2>/dev/null;
863+
./freedv_tx 2020 ../../raw/ve9qrp.raw - --reliabletext AB1CDEF | ./ch - - --No -22 -f -5 > 2020_reliable.raw 2>/dev/null;
864864
./freedv_rx 2020 2020_reliable.raw /dev/null --txtrx 2020_reliable.txt --reliabletext 2>/dev/null;
865865
if [ `cat 2020_reliable.txt | wc -l` -ge 9 ]; then echo 1; fi")
866866
set_tests_properties(test_freedv_reliable_text_awgn_1600 PROPERTIES PASS_REGULAR_EXPRESSION "1")
@@ -1034,20 +1034,20 @@ endif(NOT APPLE)
10341034
add_test(NAME test_fsk_2fsk_ber
10351035
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
10361036
./fsk_get_test_bits - 10000 | ./fsk_mod 2 8000 100 1000 100 - - |
1037-
./cohpsk_ch - - -26 --Fs 8000 |
1037+
./ch - - --No -26 |
10381038
./fsk_demod 2 8000 100 - - | ./fsk_put_test_bits -b 0.015 -q - ")
10391039
# 4FSK modem at Eb/No = 6dB, SNR = Eb/No+10log10(Rb/B) = 6 + 10*log10(2*100/3000) = -5.7dB
10401040
# Ideal BER = 0.016, set thresh 50% higher
10411041
add_test(NAME test_fsk_4fsk_ber
10421042
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
10431043
./fsk_get_test_bits - 10000 | ./fsk_mod 4 8000 100 1000 100 - - |
1044-
./cohpsk_ch - - -26 --Fs 8000 |
1044+
./ch - - --No -26 |
10451045
./fsk_demod 4 8000 100 - - | ./fsk_put_test_bits -b 0.025 - ")
10461046
# shift FSK signal to -ve frequencies
10471047
add_test(NAME test_fsk_4fsk_ber_negative_freq
10481048
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
10491049
./fsk_get_test_bits - 10000 | ./fsk_mod 4 8000 100 1000 200 - - |
1050-
./cohpsk_ch - - -26 --Fs 8000 --ssbfilt 0 --complexout -f -3000 |
1050+
./ch - - --No -26 --ssbfilt 0 --complexout -f -3000 |
10511051
./fsk_demod -c -p 8 4 8000 100 - - |
10521052
./fsk_put_test_bits -b 0.025 -q - ")
10531053
# Low SNR 4FSK uncoded PER/BER test:
@@ -1059,7 +1059,7 @@ endif(NOT APPLE)
10591059
bits=512; tx_packets=20; rx_packets=18; tx_tone_sep=50; Rs=25;
10601060
./fsk_get_test_bits - $(($bits*$tx_packets)) $bits |
10611061
./fsk_mod 4 8000 $Rs 1000 $tx_tone_sep - - |
1062-
./cohpsk_ch - - -16 --Fs 8000 --ssbfilt 0 -f -3000 --complexout |
1062+
./ch - - --No -16 --ssbfilt 0 -f -3000 --complexout |
10631063
./fsk_demod -c -p 8 --mask $tx_tone_sep -t1 --nsym 100 4 8000 $Rs - - 2>stats.txt |
10641064
./fsk_put_test_bits -t 0.25 -b 0.20 -p $rx_packets -f $bits -q -")
10651065

@@ -1097,7 +1097,7 @@ endif(NOT APPLE)
10971097
./ldpc_enc /dev/zero - --code HRAb_396_504 --testframes 200 |
10981098
./framer - - 504 5186 |
10991099
./fsk_mod 4 8000 100 1000 100 - - |
1100-
./cohpsk_ch - - -25 --Fs 8000 |
1100+
./ch - - --No -25 |
11011101
./fsk_demod -s 4 8000 100 - - |
11021102
./deframer - - 504 5186 |
11031103
./ldpc_dec - /dev/null --code HRAb_396_504 --testframes")
@@ -1156,31 +1156,31 @@ endif(NOT APPLE)
11561156
add_test(NAME test_freedv_data_raw_fsk_ldpc_100
11571157
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
11581158
./freedv_data_raw_tx --testframes 10 --bursts 10 FSK_LDPC /dev/zero - |
1159-
./cohpsk_ch - - -5 --Fs 8000 --ssbfilt 0 |
1159+
./ch - - --No -5 --ssbfilt 0 |
11601160
./freedv_data_raw_rx --testframes -v FSK_LDPC - /dev/null")
11611161
set_tests_properties(test_freedv_data_raw_fsk_ldpc_100 PROPERTIES PASS_REGULAR_EXPRESSION "Frms.: 10")
11621162

11631163
# FSK LDPC 1000 bit/s 2FSK, Fs=40kHz, as different configs can upset acquisition
11641164
add_test(NAME test_freedv_data_raw_fsk_ldpc_1k
11651165
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
11661166
./freedv_data_raw_tx --Fs 40000 --Rs 1000 --tone1 1000 --shift 1000 --testframes 10 --bursts 10 FSK_LDPC /dev/zero - |
1167-
./cohpsk_ch - - -10 --Fs 8000 --ssbfilt 0 |
1167+
./ch - - --No -10 --ssbfilt 0 |
11681168
./freedv_data_raw_rx --testframes -v --Fs 40000 --Rs 1000 FSK_LDPC - /dev/null")
11691169
set_tests_properties(test_freedv_data_raw_fsk_ldpc_1k PROPERTIES PASS_REGULAR_EXPRESSION "Frms.: 10")
11701170

11711171
# FSK LDPC 10000 bit/s 2FSK, Fs=100kHz, each of the 10 bursts has 100 frames
11721172
add_test(NAME test_freedv_data_raw_fsk_ldpc_10k
11731173
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
11741174
./freedv_data_raw_tx --Fs 100000 --Rs 10000 --tone1 10000 --shift 10000 --framesperburst 100 --bursts 10 --testframes 1000 FSK_LDPC /dev/zero - |
1175-
./cohpsk_ch - - -15 --Fs 8000 --ssbfilt 0 |
1175+
./ch - - --No -15 --ssbfilt 0 |
11761176
./freedv_data_raw_rx --testframes -v --Fs 100000 --Rs 10000 FSK_LDPC - /dev/null")
11771177
set_tests_properties(test_freedv_data_raw_fsk_ldpc_10k PROPERTIES PASS_REGULAR_EXPRESSION "Frms.: 1000")
11781178

11791179
# FSK LDPC Rs=1000 bit/s (Rb=2000) 4FSK, Fs=40kHz, this needs --mask and 2Rs shift to work reliably
11801180
add_test(NAME test_freedv_data_raw_fsk_ldpc_2k
11811181
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
11821182
./freedv_data_raw_tx -a 8192 -m 4 --Fs 40000 --Rs 1000 --tone1 10000 --shift 2000 --testframes 10 --bursts 10 FSK_LDPC /dev/zero - |
1183-
./cohpsk_ch - - -22 --Fs 8000 --ssbfilt 0 |
1183+
./ch - - --No -22 --ssbfilt 0 |
11841184
./freedv_data_raw_rx -m 4 --testframes -v --Fs 40000 --Rs 1000 FSK_LDPC --mask 2000 - /dev/null")
11851185
set_tests_properties(test_freedv_data_raw_fsk_ldpc_2k PROPERTIES PASS_REGULAR_EXPRESSION "Frms.: 10")
11861186

@@ -1219,7 +1219,7 @@ endif(NOT APPLE)
12191219
add_test(NAME test_demo_datac0c1
12201220
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR};
12211221
./demo/freedv_datac0c1_tx |
1222-
./src/cohpsk_ch - - -24 -f 20 --Fs 8000 |
1222+
./src/ch - - --No -24 -f 20 |
12231223
sox -t .s16 -c 1 -r 8000 - -t .s16 -c 1 -r 8008 - |
12241224
./demo/freedv_datac0c1_rx")
12251225
set_tests_properties(test_demo_datac0c1 PROPERTIES PASS_REGULAR_EXPRESSION "DATAC0 Frames: 10 DATAC1 Frames: 10")

README_cohpsk.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
1. BER test in AWGN channel with just less that 2% average bit error rate:
88

99
```
10-
$ ./cohpsk_get_test_bits - 5600 | ./cohpsk_mod - - | ./cohpsk_ch - - -30 | ./cohpsk_demod - - | ./cohpsk_put_test_bits -
10+
$ ./cohpsk_get_test_bits - 5600 | ./cohpsk_mod - - | ./ch - - --No -30 --Fs 7500 | ./cohpsk_demod - - | ./cohpsk_put_test_bits -
1111
<snip>
1212
SNR3k(dB): 3.41 C/No: 38.2 PAPR: 8.1
1313
BER: 0.017 Nbits: 5264 Nerrors: 92
@@ -18,7 +18,7 @@
1818

1919
```
2020
$ cd build_linux/src
21-
$ ./cohpsk_get_test_bits - 5600 | ./cohpsk_mod - - | ./cohpsk_ch - - -40 -f -20 | ./cohpsk_demod -o cohpsk_demod.txt - - | ./cohpsk_put_test_bits -
21+
$ ./cohpsk_get_test_bits - 5600 | ./cohpsk_mod - - | ./ch - - --No -40 -f -20 --Fs 7500 | ./cohpsk_demod -o cohpsk_demod.txt - - | ./cohpsk_put_test_bits -
2222
$ cd ../../octave
2323
$ octave --no-gui
2424
$ cohpsk_demod_plot("../build_linux/src/cohpsk_demod.txt")

0 commit comments

Comments
 (0)