[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnuradio-discuss
Subject:    [Discuss-gnuradio] Does OFDM Carrier Allocator add input tags to sync word?
From:       Jeon <sjeon87+gnuradio () gmail ! com>
Date:       2016-12-19 8:33:26
Message-ID: CACfn7v5DAYrV5H5ws3+Gdh7GtJk0U28uBcTaRaRndAYHEb_Fng () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I am modifying OFDM Carrier Allocator block for my project.

I put the source code below and also in the link: https://gist.github.com/
gsongsong/c78dfe2de979aa9a7f61e36f0eee5ba6#file-gistfile1-txt-L26-L37

    int
    ofdm_carrier_allocator_cvc_impl::work (int noutput_items,
                       gr_vector_int &ninput_items,
                       gr_vector_const_void_star &input_items,
                       gr_vector_void_star &output_items)
    {
      const gr_complex *in = (const gr_complex *) input_items[0];
      gr_complex *out = (gr_complex *) output_items[0];
      std::vector<tag_t> tags;

      memset((void *) out, 0x00, sizeof(gr_complex) * d_fft_len *
noutput_items);
      // Copy Sync word
      for (unsigned i = 0; i < d_sync_words.size(); i++) {
    memcpy((void *) out, (void *) &d_sync_words[i][0], sizeof(gr_complex) *
d_fft_len);
    out += d_fft_len;
      }

      // Copy data symbols
      long n_ofdm_symbols = 0; // Number of output items
      int curr_set = 0;
      int symbols_to_allocate = d_occupied_carriers[0].size();
      int symbols_allocated = 0;
      for (int i = 0; i < ninput_items[0]; i++) {
    if (symbols_allocated == 0) {
      // Copy all tags associated with these input symbols onto this OFDM
symbol
      get_tags_in_range(tags, 0,
          nitems_read(0)+i,
          nitems_read(0)+std::min(i+symbols_to_allocate, (int)
ninput_items[0])
      );
      for (unsigned t = 0; t < tags.size(); t++) {
        add_item_tag(
        0,
        nitems_written(0) + n_ofdm_symbols + (n_ofdm_symbols == 0 ? 0 :
d_sync_words.size()),
        tags[t].key,
        tags[t].value
        );
      }
      n_ofdm_symbols++;
}

In short: input tags are put into the position `k = nitems_written(0) +
n_ofdm_symbols + (n_ofdm_symbols == 0 ? 0 : d_sync_words.size())`

As I understand, at first run (n_ofdm_symbols = 0), it reads `n =
symbols_to_allocate` tags from input and puts it into `k =
nitems_written(0)`, which is the starting position of sync word. At second
run (n_ofdm_symbols = 1), it reads tags again, and puts it into `k =
nitems_written(0) + 1 + d_sync_words.size()`. Hence, the first group and
the second group of tags are apart by offset `d_sync_words.size()`

Is it my understanding of source code correct? If so, I wonder whether
there is a reason for placing the first group of tags onto sync word, not
onto the first data ofdm symbol. If I miss something in interpreting the
code, please let me know it.

Regards,
Jeon.

[Attachment #5 (text/html)]

<div dir="ltr"><div><div><div><div><div>I am modifying OFDM Carrier Allocator block \
for my project.<br></div><div><br>I put the source code below and also in the link: \
<a href="https://gist.github.com/gsongsong/c78dfe2de979aa9a7f61e36f0eee5ba6#file-gistfile1-txt-L26-L37" \
target="_blank">https://gist.github.com/<wbr>gsongsong/<wbr>c78dfe2de979aa9a7f61e36f0eee5b<wbr>a6#file-gistfile1-txt-L26-L37</a><br><br> \
int<br>       ofdm_carrier_allocator_cvc_<wbr>impl::work (int noutput_items,<br>      \
gr_vector_int &amp;ninput_items,<br>                                             \
gr_vector_const_void_star &amp;input_items,<br>                                       \
gr_vector_void_star &amp;output_items)<br>       {<br>           const gr_complex *in \
= (const gr_complex *) input_items[0];<br>           gr_complex *out = (gr_complex *) \
output_items[0];<br>           std::vector&lt;tag_t&gt; tags;<br><br>           \
memset((void *) out, 0x00, sizeof(gr_complex) * d_fft_len * noutput_items);<br>       \
// Copy Sync word<br>           for (unsigned i = 0; i &lt; d_sync_words.size(); i++) \
{<br>       memcpy((void *) out, (void *) &amp;d_sync_words[i][0], sizeof(gr_complex) \
* d_fft_len);<br>       out += d_fft_len;<br>           }<br><br>           // Copy \
data symbols<br>           long n_ofdm_symbols = 0; // Number of output items<br>     \
int curr_set = 0;<br>           int symbols_to_allocate = \
d_occupied_carriers[0].size();<br>           int symbols_allocated = 0;<br>           \
for (int i = 0; i &lt; ninput_items[0]; i++) {<br>       if (symbols_allocated == 0) \
{<br>          // Copy all tags associated with these input symbols onto this OFDM \
symbol<br>          get_tags_in_range(tags, 0,<br>                  \
nitems_read(0)+i,<br>                  \
nitems_read(0)+std::min(i+<wbr>symbols_to_allocate, (int) ninput_items[0])<br>        \
);<br>          for (unsigned t = 0; t &lt; tags.size(); t++) {<br>              \
add_item_tag(<br>              0,<br>              nitems_written(0) + n_ofdm_symbols \
+ (n_ofdm_symbols == 0 ? 0 : d_sync_words.size()),<br>              tags[t].key,<br>  \
tags[t].value<br>              );<br>          }<br>          \
n_ofdm_symbols++;<br>}<br><br></div><div>In short: input tags are put into the \
position `k = nitems_written(0) + n_ofdm_symbols + (n_ofdm_symbols == 0 ? 0 : \
d_sync_words.size())`</div><div><br></div>As I understand, at first run \
(n_ofdm_symbols = 0), it reads `n = symbols_to_allocate` tags from input and puts it \
into `k = nitems_written(0)`, which is the starting position of sync word. At second \
run (n_ofdm_symbols = 1), it reads tags again, and puts it into `k = \
nitems_written(0) + 1 + d_sync_words.size()`. Hence, the first group and the second \
group of tags are apart by offset `d_sync_words.size()`<br></div><br></div>Is it my \
understanding of source code correct? If so, I wonder whether there is a reason for \
placing the first group of tags onto sync word, not onto the first data ofdm symbol. \
If I miss something in interpreting the code, please let me know \
it.<br></div><div><br></div>Regards,<br></div>Jeon.<br></div>



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic