[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9568 - in gnuradio/branches/developers/jcorgan/bert:
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r9568 - in gnuradio/branches/developers/jcorgan/bert: gnuradio-core/src/lib/general gnuradio-examples/python/digital-bert |
Date: |
Sat, 13 Sep 2008 17:30:40 -0600 (MDT) |
Author: jcorgan
Date: 2008-09-13 17:30:39 -0600 (Sat, 13 Sep 2008)
New Revision: 9568
Added:
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/README
Modified:
gnuradio/branches/developers/jcorgan/bert/gnuradio-core/src/lib/general/gr_probe_density_b.h
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/benchmark_rx.py
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/benchmark_tx.py
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/receive_path.py
Log:
docs, cleanup, more parameters
Modified:
gnuradio/branches/developers/jcorgan/bert/gnuradio-core/src/lib/general/gr_probe_density_b.h
===================================================================
---
gnuradio/branches/developers/jcorgan/bert/gnuradio-core/src/lib/general/gr_probe_density_b.h
2008-09-13 21:21:49 UTC (rev 9567)
+++
gnuradio/branches/developers/jcorgan/bert/gnuradio-core/src/lib/general/gr_probe_density_b.h
2008-09-13 23:30:39 UTC (rev 9568)
@@ -28,6 +28,18 @@
gr_probe_density_b_sptr gr_make_probe_density_b(double alpha);
+/*!
+ * This block maintains a running average of the input stream and
+ * makes it available as an accessor function. The input stream
+ * is type unsigned char.
+ *
+ * If you send this block a stream of unpacked bytes, it will tell
+ * you what the bit density is.
+ *
+ * \param alpha Average filter constant
+ *
+ */
+
class gr_probe_density_b : public gr_sync_block
{
private:
@@ -42,8 +54,14 @@
public:
~gr_probe_density_b();
+ /*!
+ * \brief Returns the current density value
+ */
double density() const { return d_density; }
+ /*!
+ * \brief Set the average filter constant
+ */
void set_alpha(double alpha);
int work(int noutput_items,
Added:
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/README
===================================================================
---
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/README
(rev 0)
+++
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/README
2008-09-13 23:30:39 UTC (rev 9568)
@@ -0,0 +1,62 @@
+BERT testing example scripts
+
+
+benchmark_tx.py
+
+This sets up a BPSK transmitter that is modulated with a pseudorandom
+sequence of bits. The PN code is generated by sending an all 1s
+sequence through a 7-bit scrambler. The transmitter performs the BPSK
+modulation, then passes the complex baseband waveform through a
+root-raised-cosine filter and onto the USRP.
+
+The --sps parameter controls how many baseband samples per symbol
+are created and passed through the RRC filter, prior to going to the
+USRP over the USB for interpolation to the final DAC rate.
+
+The baseband bit rate is controlled by -r or --rate. This value, when
+multiplied by the --sps parameter, must result in valid interpolation
+rate for the USRP. For example, if the baseband rate is 250k bits/sec,
+and the samples per symbol is 4, then the final rate is 1M samples/sec,
+which results in an interpolation rate of 128. The valid interpolation
+rates for the USRP are multiples of 4 between 16 and 512.
+
+Finally, the RRC excess bandwidth may be specified by --excess-bw.
+(See ./benchmark_tx.py -h for additional parameters.)
+
+
+benchmark_rx.py
+
+This sets up a BPSK receiver to demodulate the received waveform. It
+accepts a similar set of parameters as the transmitter, except that one
+specifies the USRP decimation rate desired. The resulting sample stream
+rate must be an integral number of baseband symbols. For example, the
+parameters corresponding to the above transmitter would be to use a
+decimation rate of 8 (32 sps), 16 (16 sps), 32 (8 sps), 64, (4 sps), or
+128 (2 sps). The lower the USRP decimation, the more CPU is required to
+demodulate the signal, so not all valid decimation rates will work.
+
+The baseband signal from the USRP is first passed through an AGC to
+establish an average power of 1.0. It is then passed through a matched
+filter (another RRC), a Costas phase-locked loop, and an M&M bit timing
+recovery loop. The resulting constellation has an SNR estimation probe
+attached, and is then sliced into a bit stream.
+
+The recovered bits are then passed through a 7-bit descrambler. If
+there are no channel errors, the all 1s sequence is recovered. In the
+event of a channel error, there will be a 0 in the bit stream for each
+feedback tap in the descrambler. In this case, the CCSDS descrambler is
+using 3 feedback taps.
+
+Finally, the signal is passed into a bit density measurement probe. The
+channel BER is measured by dividing the 0s density by three. This
+measurement is inaccurate at high BER rates (>10%) as the error 0s
+begin to overlap.
+
+The benchmark script will, once per second, output the mean symbol power,
+the average noise variance, the estimated SNR, and the average BER.
+
+NOTE: The particular SNR estimator used is inaccurate below about 7dB,
+and will report erroneously high values even for random noise.
+
+There are a variety of Costas and M&M loop parameters one can adjust.
+See ./benchmark_rx.py -h for the full set.
Modified:
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/benchmark_rx.py
===================================================================
---
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/benchmark_rx.py
2008-09-13 21:21:49 UTC (rev 9567)
+++
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/benchmark_rx.py
2008-09-13 23:30:39 UTC (rev 9568)
@@ -64,7 +64,13 @@
if_rate = self._usrp.adc_rate()/options.decim_rate
self._receiver = receive_path(if_rate,
options.rate,
- options.excess_bw)
+ options.excess_bw,
+ options.costas_alpha,
+ options.costas_beta,
+ options.costas_max,
+ options.mm_gain_mu,
+ options.mm_gain_omega,
+ options.mm_omega_limit)
self.connect(self._usrp, self._receiver)
@@ -102,7 +108,7 @@
def get_options():
parser = OptionParser(option_class=eng_option)
parser.add_option("-w", "--which", type="int", default=0,
- help="select which USRP (0, 1, ...) default is %default",
+ help="select which USRP (0, 1, ...) (default is
%default)",
metavar="NUM")
parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None,
help="select USRP Rx side A or B (default=first one with
a daughterboard)")
@@ -116,6 +122,19 @@
help="Select USRP decimation rate (default=%default)")
parser.add_option("", "--excess-bw", type="eng_float", default=0.35,
help="Select RRC excess bandwidth (default=%default)")
+ parser.add_option("", "--costas-alpha", type="eng_float", default=0.2,
+ help="set Costas loop 1st order gain,
(default=%default)")
+ parser.add_option("", "--costas-beta", type="eng_float", default=0.01,
+ help="set Costas loop 2nd order gain,
(default=%default)")
+ parser.add_option("", "--costas-max", type="eng_float", default=0.005,
+ help="set Costas loop max freq (rad/sample)
(default=%default)")
+ parser.add_option("", "--mm-gain-mu", type="eng_float", default=0.2,
+ help="set M&M loop 1st order gain, (default=%default)")
+ parser.add_option("", "--mm-gain-omega", type="eng_float", default=0.01,
+ help="set M&M loop 2nd order gain, (default=%default)")
+ parser.add_option("", "--mm-omega-limit", type="eng_float", default=0.005,
+ help="set M&M max timing error, (default=%default)")
+
(options, args) = parser.parse_args()
if len(args) != 0:
@@ -134,8 +153,8 @@
tb = rx_bpsk_block(options)
- print "\nSNR estimator is inaccurate below about 7dB"
-
+ print "\n*** SNR estimator is inaccurate below about 7dB"
+ print "*** BER estimator is inaccurate above about 10%\n"
updater = status_thread(tb)
try:
Modified:
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/benchmark_tx.py
===================================================================
---
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/benchmark_tx.py
2008-09-13 21:21:49 UTC (rev 9567)
+++
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/benchmark_tx.py
2008-09-13 23:30:39 UTC (rev 9568)
@@ -24,6 +24,7 @@
from gnuradio.eng_option import eng_option
from optparse import OptionParser
from transmit_path import transmit_path
+import sys
_dac_rate = 128e6
@@ -93,6 +94,10 @@
parser.print_help()
sys.exit(1)
+ if options.freq == None:
+ print "Must supply frequency as -f or --freq"
+ sys.exit(1)
+
return (options, args)
if __name__ == "__main__":
Modified:
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/receive_path.py
===================================================================
---
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/receive_path.py
2008-09-13 21:21:49 UTC (rev 9567)
+++
gnuradio/branches/developers/jcorgan/bert/gnuradio-examples/python/digital-bert/receive_path.py
2008-09-13 23:30:39 UTC (rev 9568)
@@ -26,9 +26,15 @@
class receive_path(gr.hier_block2):
def __init__(self,
- if_rate, # Incoming sample rate
- symbol_rate, # Original symbol rate
- excess_bw # RRC excess bandwidth, typically 0.35-0.5
+ if_rate, # Incoming sample rate
+ symbol_rate, # Original symbol rate
+ excess_bw, # RRC excess bandwidth, typically 0.35-0.5
+ costas_alpha, # Costas loop 1st order gain, typically
0.01-0.2
+ costas_beta, # Costas loop 2nd order gain, typically
alpha^2/4.0
+ costas_max, # Costas loop max frequency offset in
radians/sample
+ mm_gain_mu, # M&M loop 1st order gain, typically 0.001-0.2
+ mm_gain_omega, # M&M loop 2nd order gain, typically
alpha^2/4.0
+ mm_omega_limit, # M&M loop max timing error
):
gr.hier_block2.__init__(self, "receive_path",
@@ -54,9 +60,6 @@
self._rrc = gr.fir_filter_ccf(1, taps)
# Create a Costas loop frequency/phase recovery block
- costas_alpha=0.2
- costas_beta=costas_alpha*costas_alpha/4.0;
- costas_max = 0.005
print "Costas alpha:", costas_alpha
print "Costas beta:", costas_beta
@@ -71,12 +74,8 @@
# Create a M&M bit synchronization retiming block
mm_mu = 0.5
mm_omega = sps
- mm_gain_mu=0.2
- mm_gain_omega = mm_gain_mu*mm_gain_mu/0.4
- mm_omega_limit=0.005
print "MM gain mu:", mm_gain_mu
- print "MM omega:", mm_omega
print "MM gain omega:", mm_gain_omega
print "MM omega limit:", mm_omega_limit
@@ -87,7 +86,7 @@
mm_omega_limit) # Maximum timing
offset
# Add an SNR probe on the demodulated constellation
- self._snr_probe = gr.probe_mpsk_snr_c(1.0/symbol_rate)
+ self._snr_probe = gr.probe_mpsk_snr_c(10.0/symbol_rate)
self.connect(self._mm, self._snr_probe)
# Slice the resulting constellation into bits.
@@ -98,8 +97,8 @@
# Descramble BERT sequence. A channel error will create 3 incorrect
bits
self._descrambler = gr.descrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit
descrambler
- # This will be replaced with the density measurement block
- self._ber = gr.probe_density_b(1/symbol_rate)
+ # Measure BER by the density of 0s in the stream
+ self._ber = gr.probe_density_b(1.0/symbol_rate)
self.connect(self, self._agc, self._rrc, self._costas, self._mm,
self._c2r, self._slicer, self._descrambler, self._ber)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9568 - in gnuradio/branches/developers/jcorgan/bert: gnuradio-core/src/lib/general gnuradio-examples/python/digital-bert,
jcorgan <=