Simulate channel with frequency offset
"""

import math, random, pylab
import dab_tb, ber

NUM_BYTES = 1000000

MODES=[1,2,3,4]
FREQ_OFFSET_RANGE = range(-300000,300000,10000)
FREQ_OFFSET_RANGE = range(0,1000,100)

PLOT_FORMAT=['-','-x','--x','-.x',':x']

# initialise test flowgraph
tb = dab_tb.dab_ofdm_testbench(ber_sink=True)
tb.gen_random_bytes(NUM_BYTES)

# prepeare plot	
#pylab.title("BER in channel with frequency shift") # add caption in LaTeX -> looks better
pylab.xlabel("Frequency shift [Hz]")
pylab.ylabel("BER")

# open logfile
logfile = open("freq_shift_ber_log.txt",'w')
logfile.write("number of bytes: " + str(NUM_BYTES) + "\nFrequency shift range: " + str(FREQ_OFFSET_RANGE) + "\n\n")

for mode in MODES:
	print "Mode: "+str(mode)+"\n-------\n"
	tb.setup_flowgraph(mode)
	ber_values = []
Exemple #2
0
"""
Simulate noise channel to evaluate BER vs SNR
"""

import math, random, pylab
import dab_tb, ber

NUM_BYTES = 1000000

MODES = [1, 2, 3, 4]
SNR_DB = range(-5, 21)

PLOT_FORMAT = ['-', '-x', '--x', '-.x', ':x']

# initialise test flowgraph
tb = dab_tb.dab_ofdm_testbench()
tb.gen_random_bytes(NUM_BYTES)

# prepeare plot
#pylab.title("BER in noisy channel") # add caption in LaTeX -> looks better
pylab.xlabel("SNR [dB]")
pylab.ylabel("BER")

# open logfile
logfile = open("snr_ber_log.txt", 'w')
logfile.write("number of bytes: " + str(NUM_BYTES) + "\nSNR range: " +
              str(SNR_DB) + "\n\n")

for mode in MODES:
    print "\nMode: " + str(mode) + "\n-------\n"
    tb.setup_flowgraph(mode)
Exemple #3
0
Simulate channel with frequency offset
"""

import math, random, pylab
import dab_tb, ber

NUM_BYTES = 1000000

MODES = [1, 2, 3, 4]
FREQ_OFFSET_RANGE = range(-300000, 300000, 10000)
FREQ_OFFSET_RANGE = range(0, 1000, 100)

PLOT_FORMAT = ['-', '-x', '--x', '-.x', ':x']

# initialise test flowgraph
tb = dab_tb.dab_ofdm_testbench(ber_sink=True)
tb.gen_random_bytes(NUM_BYTES)

# prepeare plot
#pylab.title("BER in channel with frequency shift") # add caption in LaTeX -> looks better
pylab.xlabel("Frequency shift [Hz]")
pylab.ylabel("BER")

# open logfile
logfile = open("freq_shift_ber_log.txt", 'w')
logfile.write("number of bytes: " + str(NUM_BYTES) +
              "\nFrequency shift range: " + str(FREQ_OFFSET_RANGE) + "\n\n")

for mode in MODES:
    print "Mode: " + str(mode) + "\n-------\n"
    tb.setup_flowgraph(mode)
Exemple #4
0
Simulate channel with sampling frequency offset
"""

import math, random, pylab
import dab_tb, ber

NUM_BYTES = 1000000

MODES = [1, 2, 3, 4]
MODES = [1]
SAMPLE_RATE_ERROR = pylab.linspace(0.99, 1.01, 50)

PLOT_FORMAT = ['-', '-x', '--x', '-.x', ':x']

# initialise test flowgraph
tb = dab_tb.dab_ofdm_testbench(autocorrect_sample_rate=True, ber_sink=True)
tb.gen_random_bytes(NUM_BYTES)

# prepeare plot
pylab.xlabel("Sampling frequency offset (ratio)")
pylab.ylabel("BER")

# open logfile
logfile = open("sampling_frequency_offset_ber_log.txt", 'w')
logfile.write("number of bytes: " + str(NUM_BYTES) +
              "\nRange of sampling rate ratios: " + str(SAMPLE_RATE_ERROR) +
              "\n\n")

for mode in MODES:
    print "Mode: " + str(mode) + "\n-------\n"
    tb.setup_flowgraph(mode, ber_skipbytes=5 * tb.dp.bytes_per_frame)
Simulate channel with sampling frequency offset
"""

import math, random, pylab
import dab_tb, ber

NUM_BYTES = 1000000

MODES=[1,2,3,4]
MODES=[1]
SAMPLE_RATE_ERROR = pylab.linspace(0.99, 1.01, 50)

PLOT_FORMAT=['-','-x','--x','-.x',':x']

# initialise test flowgraph
tb = dab_tb.dab_ofdm_testbench(autocorrect_sample_rate=True, ber_sink=True)
tb.gen_random_bytes(NUM_BYTES)

# prepeare plot	
pylab.xlabel("Sampling frequency offset (ratio)")
pylab.ylabel("BER")

# open logfile
logfile = open("sampling_frequency_offset_ber_log.txt",'w')
logfile.write("number of bytes: " + str(NUM_BYTES) + "\nRange of sampling rate ratios: " + str(SAMPLE_RATE_ERROR) + "\n\n")

for mode in MODES:
	print "Mode: "+str(mode)+"\n-------\n"
	tb.setup_flowgraph(mode, ber_skipbytes=5*tb.dp.bytes_per_frame)
	ber_values = []
	bytes_received = []
Exemple #6
0
"""
Simulate noise channel to evaluate BER vs SNR
"""

import math, random, pylab
import dab_tb, ber

NUM_BYTES = 1000000

MODES=[1,2,3,4]
SNR_DB = range(-5,21)

PLOT_FORMAT=['-','-x','--x','-.x',':x']

# initialise test flowgraph
tb = dab_tb.dab_ofdm_testbench()
tb.gen_random_bytes(NUM_BYTES)

# prepeare plot	
#pylab.title("BER in noisy channel") # add caption in LaTeX -> looks better
pylab.xlabel("SNR [dB]")
pylab.ylabel("BER")

# open logfile
logfile = open("snr_ber_log.txt",'w')
logfile.write("number of bytes: " + str(NUM_BYTES) + "\nSNR range: " + str(SNR_DB) + "\n\n")

for mode in MODES:
	print "\nMode: "+str(mode)+"\n-------\n"
	tb.setup_flowgraph(mode)
	ber_values = []