File: ofdm_check

package info (click to toggle)
codec2 1.2.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 76,376 kB
  • sloc: ansic: 436,819; cpp: 2,091; objc: 1,736; sh: 1,510; python: 1,405; asm: 683; makefile: 605
file content (68 lines) | stat: -rwxr-xr-x 2,095 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#! /bin/bash

# ofdm_check
#
# A series of checks of the ofdm functions, mostly decode.
# 
# This uses ofdm_mod to supply test data to ofdm_demod and mostly
# assumes that the encode function is correct.

# Define macros to (later) allow testing alternate versions.
alias OFDM_MOD=ofdm_mod
alias OFDM_DEMOD=ofdm_demod
shopt -s expand_aliases

# PATH
PATH=$PATH:../src

PASS=1

###############################
echo
echo "Simple test, plain, ideal"
OFDM_MOD --in /dev/zero --testframes 100 |
    OFDM_DEMOD --out /dev/null --testframes --verbose 1 2> tmp
cat tmp
p1=$(grep '^BER\.*: 0.000' tmp | wc -l)
p2=$(grep '^BER2\.*: 0.000' tmp | wc -l)
if [[ $p1 -eq 1 && $p2 -eq 1 ]]; then echo "OK"; else echo "BAD"; PASS=0; fi

###############################
echo
echo "Simple test, plain, AWGN"
OFDM_MOD --in /dev/zero --testframes 100 |
    cohpsk_ch - - -20 -Fs 8000 -f -5  |
    OFDM_DEMOD --out /dev/null --testframes --verbose 1 2>tmp
cat tmp
n=$(grep '^BER\.*:' tmp | cut -d ' ' -f 2)
p1=$(echo $n '<=' 0.10 | bc)
n=$(grep '^BER2\.*:' tmp | cut -d ' ' -f 2)
p2=$(echo $n '<=' 0.10 | bc)
if [[ $p1 -eq 1 && $p2 -eq 1 ]]; then echo "OK"; else echo "BAD"; PASS=0; fi

###############################
echo
echo "Simple test, LDPC, ideal"
OFDM_MOD --in /dev/zero --ldpc --testframes 100 |
    OFDM_DEMOD --out /dev/null --ldpc --testframes --verbose 1 2>tmp
cat tmp
p1=$(grep '^BER\.*: 0.000' tmp | wc -l)
p2=$(grep '^Coded BER: 0.000' tmp | wc -l)
if [[ $p1 -eq 1 && $p2 -eq 1 ]]; then echo "OK"; else echo "BAD"; PASS=0; fi

###############################
echo
echo "Simple test, LDPC, AWGN"
OFDM_MOD --in /dev/zero --ldpc --testframes 100 |
    cohpsk_ch - - -20 -Fs 8000 -f -5 --fading_dir ../../build_linux/unittest |
    OFDM_DEMOD --out /dev/null --ldpc --testframes --verbose 1 2>tmp
cat tmp
n=$(grep '^BER\.*:' tmp | cut -d ' ' -f 2)
p1=$(echo $n '<=' 0.10 | bc)
n=$(grep '^Coded.*BER\.*:' tmp | cut -d ' ' -f 3)
p2=$(echo $n '<=' 0.01 | bc)
if [[ $p1 -eq 1 && $p2 -eq 1 ]]; then echo "OK"; else echo "BAD"; PASS=0; fi


echo
if [[ $PASS == 1 ]]; then echo "PASSED"; else echo "FAILED"; fi