GNU Radio 3.7.0-50 C++ API
ofdm_carrier_allocator_cvc.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2013 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 
24 #ifndef INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H
25 #define INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H
26 
27 #include <gnuradio/digital/api.h>
29 
30 namespace gr {
31  namespace digital {
32 
33  /*!
34  * \brief Create frequency domain OFDM symbols from complex values, add pilots.
35  * \ingroup ofdm_blk
36  *
37  * \details
38  * This block turns a stream of complex, scalar modulation symbols into vectors
39  * which are the input for an IFFT in an OFDM transmitter. It also supports the
40  * possibility of placing pilot symbols onto the carriers.
41  *
42  * The carriers can be allocated freely, if a carrier is not allocated, it is set
43  * to zero. This allows doing OFDMA-style carrier allocations.
44  *
45  * Input: A tagged stream of complex scalars. The first item must have a tag
46  * containing the number of complex symbols in this frame.
47  * Output: A tagged stream of complex vectors of length fft_len. This can directly
48  * be connected to an FFT block. Make sure to set this block to 'reverse'
49  * for the IFFT. If \p output_is_shifted is true, the FFT block must activate
50  * FFT shifting, otherwise, set shifting to false. If given, sync words are
51  * prepended to the output. Note that sync words are prepended verbatim,
52  * make sure they are shifted (or not).
53  *
54  * Carrier indexes are always such that index 0 is the DC carrier (note: you should
55  * not allocate this carrier). The carriers below the DC carrier are either indexed
56  * with negative numbers, or with indexes larger than \p fft_len/2. Index -1 and index
57  * \p fft_len-1 both identify the carrier below the DC carrier.
58  *
59  */
61  {
62  public:
64 
65  virtual std::string len_tag_key() = 0;
66  virtual const int fft_len() = 0;
67  virtual std::vector<std::vector<int> > occupied_carriers() = 0;
68 
69  /*
70  * \param fft_len FFT length, is also the maximum width of the OFDM symbols, the
71  * output vector size and maximum value for elements in
72  * \p occupied_carriers and \p pilot_carriers.
73  * \param occupied_carriers A vector of vectors of indexes. Example: if
74  * occupied_carriers = ((1, 2, 3), (1, 2, 4)), the first
75  * three input symbols will be mapped to carriers 1, 2
76  * and 3. After that, a new OFDM symbol is started. The next
77  * three input symbols will be placed onto carriers 1, 2
78  * and 4 of the second OFDM symbol. The allocation then
79  * starts from the beginning.
80  * Order matters! The first input symbol is always mapped
81  * onto occupied_carriers[0][0].
82  * \param pilot_carriers The position of the pilot symbols. Same as occupied_carriers,
83  * but the actual symbols are taken from pilot_symbols instead
84  * of the input stream.
85  * \param pilot_symbols The pilot symbols which are placed onto the pilot carriers.
86  * pilot_symbols[0][0] is placed onto the first OFDM symbol, on
87  * carrier index pilot_carriers[0][0] etc.
88  * \param sync_words OFDM symbols that are prepended to the OFDM frame (usually for
89  * synchronisation purposes, e.g. OFDM symbols with every second
90  * sub-carrier being idle). Is a vector of complex vectors of length
91  * \p fft_len
92  * \param len_tag_key The key of the tag identifying the length of the input packet.
93  */
94  static sptr make(
95  int fft_len,
96  const std::vector<std::vector<int> > &occupied_carriers,
97  const std::vector<std::vector<int> > &pilot_carriers,
98  const std::vector<std::vector<gr_complex> > &pilot_symbols,
99  const std::vector<std::vector<gr_complex> > &sync_words,
100  const std::string &len_tag_key = "packet_len",
101  const bool output_is_shifted=true);
102  };
103 
104  } // namespace digital
105 } // namespace gr
106 
107 #endif /* INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H */
108