discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] need help for digital.constellation_decoder_cb in


From: Arturo Rinaldi
Subject: Re: [Discuss-gnuradio] need help for digital.constellation_decoder_cb in release 3.5.0
Date: Mon, 12 Mar 2012 17:11:19 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

Nella citazione in data Mon Mar 12 03:36:20 2012, Ben Reynwar ha scritto:
On Sun, Mar 11, 2012 at 4:25 PM, Arturo Rinaldi<address@hidden>  wrote:
Nella citazione in data Sun Mar 11 02:30:43 2012, Arturo Rinaldi ha scritto:

Nella citazione in data Fri Mar 9 19:50:05 2012, Ben Reynwar ha scritto:

On Thu, Mar 8, 2012 at 8:19 PM, Arturo Rinaldi<address@hidden>
wrote:

Nella citazione in data ven 09 dic 2011 05:55:57 CET, Ben Reynwar ha
scritto:

On Thu, Dec 8, 2011 at 5:33 PM, Arturo Rinaldi<address@hidden>
wrote:


I noticed dramatic changes in the 3.5.0 release in the generation of
the
constellation points of digital modulations. So, if the easy part is
to
again modify the source code to match my needs, i need some help in
using
the new block :

digital.constellation_decoder_cb(arg1)

instead of

gr.constellation_decoder(arg1,arg2)

I usually used the last one where arg1 is a list containing the
complex
values of a generic digital modulation and arg2 is the symbol mapping
(Gray
Coding for instance). Which blocks do i need to put together to get
the
same
result ?

Regards, Arturo

_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Simplest solution is probably:

constell = digital.digital_constellation(list_of_complex_points, [], 1,
1)
decoder = digital.constellation_decoder_cb(constell)

To get the symbol mapping you want, just choose the appropriate order
of the complex points in the list.

The 2nd, 3rd and 4th arguments to the constellation constructor while
not relevant to this example are:
- a mapping to be applied before differential encoding.
- the rotational-symmetry of the constellation
- the dimensionality of the constellation (i.e. number of complex
points that together map to one symbol)

Functions to simplify the creation of commonly used constellations can
be found in digital.bpsk, digital.qpsk, digital.psk, and digital.qam.

Ben


i made some progress in simplyfing the creation of the constellations
but i
still need help in the decoding part.

I'm trying to calculate the modulation BER by using this flow graph :

http://imageshack.us/photo/my-images/819/bersimgrchomeartynetscr.png/

i removed all the unnecessary parameters to my study (excess bw ,
differential coding etc.) because i need only gray coding. and the
decoding
part is this one

http://pastebin.com/wADRx7Hj

could you please help me ? the grc blocks are made by invoking only the
psk_new.py source

http://pastebin.com/kawSfuPg

modified by me. please help me. thx in advance

Regards, Arturo.


I'd be happy to help but I'm not quite sure what exactly your
problem/question is.

Maybe you could post the python generated by grc, along with the issue
you're having?


here it is

http://pastebin.com/hQsPXbjJ

my goal is to perform a baseband simulation for a simple BER estimation
(modulator-channel-demodulator). when i posted the issue some time ago i
used the block

decoder = gr.constellation_decoder_cb($constellation_points,$symbol_value)

i.e. for a qpsk modulation ----->
constellation_points=[1+1j,-1+1j,-1-1j,1-1j] , symbol_value=[0,1,2,3]

after that i "un-grayed" the symbols by connecting the map block

gr.map_bb([0,1,3,2])

Since i'm usign the 3.5.2 tarball, the new block

digital_swig.constellation_decoder_cb($constellation)
(and not digital.constellation_decoder_cb) that you suggested me takes as
argument a "constellation" object and not a "constellation_bpsk",
"constellation_qpsk" object and so on. So i think i'm unable to assign the
right symbols to the decoded constellation and perform a correct BER
estimation. I tried to use also with the object

digital.constellation($constellation_points)

as you suggested to build my own constellation but the log file says that
it is an "abstract class" so it can't be used. I hope I explained myself
well this time. Please help me because i need to update my work to the 3.5.x
gnuradio version.

PS : I also thought that I could take the old block
gr.constellation_decoder_cb from the 3.4.2 tarball (.h , .i and .cc files)
and build it with gr-how-to-make-a-block-3.5.2...would it be possible ?

Best Regards, Arturo


i forgot to mention that i deleted any block for RRC filtering and recovery.
my goal is a simple baseband simulation. I attach again my new version (v2)
of the source file "generic_mod_demod" and the grc image of the flow graph :

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))


ok perfect, it worked. I'm using your code to fix my project and it is working very well. I'll need only few tweaks in the deconding part of the digital modulations.

thank you very much again Ben ;)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]