On Sun, Mar 11, 2012 at 4:25 PM, Arturo R. [email protected]
wrote:
On Thu, Dec 8, 2011 at 5:33 PM, Arturo R.[email protected]
Coding for instance). Which blocks do i need to put together to get
The 2nd, 3rd and 4th arguments to the constellation constructor while
differential coding etc.) because i need only gray coding. and the
modified by me. please help me. thx in advance
i.e. for a qpsk modulation ----->
argument a “constellation” object and not a “constellation_bpsk”,
http://imageshack.us/photo/my-images/838/bersimulationgrchomeart.png/
http://pastebin.com/i3nxY6u0
Regards, Arturo
Hi Arturo,
To generate a generic constellation use:
constellation = digital.constellation_calcdist(complex_points, [], 1,
1).base()
In my earlier email I forgot about the ‘_calcdist’ and the ‘.base()’.
Hopefully the above will work better for you.
I’m also including an simple example that works for me, in case that
doesn’t fix your problem.
Cheers,
Ben
import random
from gnuradio import gr, digital
def get_BER(constellation, noise_level, data_length=1000):
data = tuple(
[random.randint(0,1) for i in range(0, data_length)])
tb = gr.top_block()
src = gr.vector_source_b(data)
pack = gr.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
bytes2chunks =
gr.packed_to_unpacked_bb(constellation.bits_per_symbol(),
gr.GR_MSB_FIRST)
chunks2symbols = gr.chunks_to_symbols_bc(constellation.points())
noise = gr.noise_source_c(gr.GR_GAUSSIAN, noise_level)
adder = gr.add_cc()
decoder = digital.constellation_decoder_cb(constellation)
unpack = gr.unpack_k_bits_bb(constellation.bits_per_symbol())
snk = gr.vector_sink_b()
tb.connect(src, pack, bytes2chunks, chunks2symbols)
tb.connect(noise, (adder, 0))
tb.connect(chunks2symbols, (adder, 1))
tb.connect(adder, decoder, unpack, snk)
tb.run()
errors = 0
for i, j in zip(data, snk.data()):
if i != j:
errors += 1
return 1.0*errors/data_length
if name == “main”:
points = [1+3j, 4, 5, 6-8j]
constellation = digital.constellation_calcdist(points, [], 1,
1).base()
BER = get_BER(constellation, 1)
print(“BER = {0}”.format(BER))