Skip to content

Commit

Permalink
multipath channel test
Browse files Browse the repository at this point in the history
  • Loading branch information
drowe67 committed Nov 29, 2024
1 parent 09e9547 commit 1ca79a6
Showing 4 changed files with 31 additions and 8 deletions.
18 changes: 17 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -554,14 +554,15 @@ add_test(NAME c_decoder_aux_mpp

# EOO data -------------------------------------------------------------------------------------------

# Pythion Tx & Rx, no noise
add_test(NAME radae_eoo_data_py
COMMAND sh -c "cd ${CMAKE_SOURCE_DIR}; \
${CMAKE_CURRENT_BINARY_DIR}/src/lpcnet_demo -features wav/brian_g8sez.wav features_in.f32; \
cat features_in.f32 | python3 radae_txe.py --eoo_data_test > rx.f32; \
cat rx.f32 | python3 radae_rxe.py -v 2 --eoo_data_test > /dev/null")
set_tests_properties(radae_eoo_data_py PROPERTIES PASS_REGULAR_EXPRESSION "PASS")

# C tx. C rx. Note Python radae_txe.py just generates eoo_tx.f32 for C radae_tx
# C tx & rx, no noise. Note Python radae_txe.py just generates eoo_tx.f32 for C radae_tx
add_test(NAME radae_eoo_data_c
COMMAND sh -c "cd ${CMAKE_SOURCE_DIR}; \
${CMAKE_CURRENT_BINARY_DIR}/src/lpcnet_demo -features wav/brian_g8sez.wav features_in.f32; \
@@ -571,6 +572,21 @@ add_test(NAME radae_eoo_data_c
python3 eoo_ber.py eoo_tx.f32 eoo_rx.f32")
set_tests_properties(radae_eoo_data_c PROPERTIES PASS_REGULAR_EXPRESSION "PASS")

# C tx & rx, over a multipath channel, we set up 5 "overs", each with an EOO chunk of data. Just one of them needs
# to have a BER < 5% for a PASS. About 6dB SNR
add_test(NAME radae_eoo_data_mpp
COMMAND sh -c "cd ${CMAKE_SOURCE_DIR}; test/make_g.sh; \
${CMAKE_CURRENT_BINARY_DIR}/src/lpcnet_demo -features wav/brian_g8sez.wav features_in.f32; \
cat features_in.f32 | python3 radae_txe.py --eoo_data_test > /dev/null; \
cat features_in.f32 | PYTHONPATH='.' ${CMAKE_CURRENT_BINARY_DIR}/src/radae_tx > tx.f32; \
cat tx.f32 tx.f32 tx.f32 tx.f32 tx.f32 > tx_2.f32;
cat tx_2.f32 | python3 f32toint16.py --real --scale 8192 > tx.raw; \
${CODEC2_DEV_BUILD_DIR}/src/ch tx.raw rx.raw --No -24 --mpp --fading_dir .; \
cat rx.raw | python3 int16tof32.py --zeropad > rx.f32; \
cat rx.f32 | PYTHONPATH='.' ${CMAKE_CURRENT_BINARY_DIR}/src/radae_rx > /dev/null; \
python3 eoo_ber.py eoo_tx.f32 eoo_rx.f32")
set_tests_properties(radae_eoo_data_mpp PROPERTIES PASS_REGULAR_EXPRESSION "PASS")

# BBFM -----------------------------------------------------------------------------------------------

# single carrier modem internal (inside single_carrier class) tests
16 changes: 11 additions & 5 deletions eoo_ber.py
Original file line number Diff line number Diff line change
@@ -4,9 +4,15 @@
# bits are in float form, e.g. +/-1 or +/-1000
tx_bits = np.fromfile(sys.argv[1], dtype=np.float32)
rx_bits = np.fromfile(sys.argv[2], dtype=np.float32)
n_bits = len(tx_bits)
n_errors = sum(rx_bits*tx_bits < 0)
ber = n_errors/n_bits
print(f"EOO data n_bits: {n_bits} n_errors: {n_errors} BER: {ber:5.2f}", file=sys.stderr)
if ber < 0.05:
bits_per_frame = len(tx_bits)
n_frames = len(rx_bits)//bits_per_frame
n_ok_frames = 0
for f in range(n_frames):
n_errors = sum(rx_bits[f*bits_per_frame:(f+1)*bits_per_frame]*tx_bits < 0)
ber = n_errors/bits_per_frame
print(f"frame received! BER: {ber:5.2f}")
if ber < 0.05:
n_ok_frames += 1
print(f"EOO frames received: {n_frames} n_ok_frames: {n_ok_frames}", file=sys.stderr)
if n_ok_frames:
print("PASS", file=sys.stderr)
2 changes: 1 addition & 1 deletion src/radae_rx.c
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
int main(int argc, char *argv[])
{
rade_initialize();
int flags = RADE_USE_C_DECODER; // | RADE_VERBOSE_0;
int flags = RADE_USE_C_DECODER | RADE_VERBOSE_0;
/* special test mode that induces a frequency offset error to test UW false sync detection */
if (argc == 2) {
if (atoi(argv[1]) == 1) {
3 changes: 2 additions & 1 deletion src/rade_api.h
Original file line number Diff line number Diff line change
@@ -102,7 +102,8 @@ RADE_EXPORT int rade_n_eoo_bits(struct rade *r);
// returns number of RADE_COMP samples written to tx_out[]
RADE_EXPORT int rade_tx(struct rade *r, RADE_COMP tx_out[], float features_in[]);

// Set the rade_n_eoo_bits() bits to be sent in the EOO frame
// Set the rade_n_eoo_bits() bits to be sent in the EOO frame, which are
// in +/- 1 float form (note NOT 1 or 0)
RADE_EXPORT void rade_tx_set_eoo_bits(struct rade *r, float eoo_bits[]);

// call this for the final frame at the end of over

0 comments on commit 1ca79a6

Please sign in to comment.