GNU Radio 3.7.3 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  * There are some basic checks in place during initialization which check that the
60  * carrier allocation table is valid. However, it is possible to overwrite data symbols
61  * with pilot symbols, or provide a carrier allocation that has mismatching pilot symbol
62  * positions and -values.
63  *
64  * Tags are propagated such that a tag on an incoming complex symbol is mapped to the
65  * corresponding OFDM symbol. There is one exception: If a tag is on the first OFDM
66  * symbol, it is assumed that this tag should stay there, so it is moved to the front
67  * even if a sync word is included (any other tags will never be attached to the
68  * sync word). This allows tags to control the transmit timing to pass through in the
69  * correct position.
70  */
72  {
73  public:
75 
76  virtual std::string len_tag_key() = 0;
77  virtual const int fft_len() = 0;
78  virtual std::vector<std::vector<int> > occupied_carriers() = 0;
79 
80  /*
81  * \param fft_len FFT length, is also the maximum width of the OFDM symbols, the
82  * output vector size and maximum value for elements in
83  * \p occupied_carriers and \p pilot_carriers.
84  * \param occupied_carriers A vector of vectors of indexes. Example: if
85  * occupied_carriers = ((1, 2, 3), (1, 2, 4)), the first
86  * three input symbols will be mapped to carriers 1, 2
87  * and 3. After that, a new OFDM symbol is started. The next
88  * three input symbols will be placed onto carriers 1, 2
89  * and 4 of the second OFDM symbol. The allocation then
90  * starts from the beginning.
91  * Order matters! The first input symbol is always mapped
92  * onto occupied_carriers[0][0].
93  * \param pilot_carriers The position of the pilot symbols. Same as occupied_carriers,
94  * but the actual symbols are taken from pilot_symbols instead
95  * of the input stream.
96  * \param pilot_symbols The pilot symbols which are placed onto the pilot carriers.
97  * pilot_symbols[0][0] is placed onto the first OFDM symbol, on
98  * carrier index pilot_carriers[0][0] etc.
99  * \param sync_words OFDM symbols that are prepended to the OFDM frame (usually for
100  * synchronisation purposes, e.g. OFDM symbols with every second
101  * sub-carrier being idle). Is a vector of complex vectors of length
102  * \p fft_len
103  * \param len_tag_key The key of the tag identifying the length of the input packet.
104  */
105  static sptr make(
106  int fft_len,
107  const std::vector<std::vector<int> > &occupied_carriers,
108  const std::vector<std::vector<int> > &pilot_carriers,
109  const std::vector<std::vector<gr_complex> > &pilot_symbols,
110  const std::vector<std::vector<gr_complex> > &sync_words,
111  const std::string &len_tag_key = "packet_len",
112  const bool output_is_shifted=true);
113  };
114 
115  } // namespace digital
116 } // namespace gr
117 
118 #endif /* INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H */
119 
Block that operates on PDUs in form of tagged streamsOverride work to provide the signal processing i...
Definition: tagged_stream_block.h:37
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:30
boost::shared_ptr< ofdm_carrier_allocator_cvc > sptr
Definition: ofdm_carrier_allocator_cvc.h:74
shared_ptr documentation stub
Definition: shared_ptr_docstub.h:15
Create frequency domain OFDM symbols from complex values, add pilots.
Definition: ofdm_carrier_allocator_cvc.h:71