GNU Radio Manual and C++ API Reference 3.10.5.1
The Free & Open Software Radio Ecosystem
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 * SPDX-License-Identifier: GPL-3.0-or-later
8 *
9 */
10
11
12#ifndef INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H
13#define INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H
14
17
18namespace gr {
19namespace digital {
20
21/*!
22 * \brief Create frequency domain OFDM symbols from complex values, add pilots.
23 * \ingroup ofdm_blk
24 *
25 * \details
26 * This block turns a stream of complex, scalar modulation symbols into vectors
27 * which are the input for an IFFT in an OFDM transmitter. It also supports the
28 * possibility of placing pilot symbols onto the carriers.
29 *
30 * The carriers can be allocated freely, if a carrier is not allocated, it is set
31 * to zero. This allows doing OFDMA-style carrier allocations.
32 *
33 * Input: A tagged stream of complex scalars. The first item must have a tag
34 * containing the number of complex symbols in this frame.
35 * Output: A tagged stream of complex vectors of length fft_len. This can directly
36 * be connected to an FFT block. Make sure to set this block to 'reverse'
37 * for the IFFT. If \p output_is_shifted is true, the FFT block must activate
38 * FFT shifting, otherwise, set shifting to false. If given, sync words are
39 * prepended to the output. Note that sync words are prepended verbatim,
40 * make sure they are shifted (or not).
41 *
42 * Carrier indexes are always such that index 0 is the DC carrier (note: you should
43 * not allocate this carrier). The carriers below the DC carrier are either indexed
44 * with negative numbers, or with indexes larger than \p fft_len/2. Index -1 and index
45 * \p fft_len-1 both identify the carrier below the DC carrier.
46 *
47 * There are some basic checks in place during initialization which check that the
48 * carrier allocation table is valid. However, it is possible to overwrite data symbols
49 * with pilot symbols, or provide a carrier allocation that has mismatching pilot symbol
50 * positions and -values.
51 *
52 * Tags are propagated such that a tag on an incoming complex symbol is mapped to the
53 * corresponding OFDM symbol. There is one exception: If a tag is on the first OFDM
54 * symbol, it is assumed that this tag should stay there, so it is moved to the front
55 * even if a sync word is included (any other tags will never be attached to the
56 * sync word). This allows tags to control the transmit timing to pass through in the
57 * correct position.
58 */
60{
61public:
62 typedef std::shared_ptr<ofdm_carrier_allocator_cvc> sptr;
63
64 virtual std::string len_tag_key() = 0;
65 virtual const int fft_len() = 0;
66 virtual std::vector<std::vector<int>> occupied_carriers() = 0;
67
68 /*
69 * \param fft_len FFT length, is also the maximum width of the OFDM symbols, the
70 * output vector size and maximum value for elements in
71 * \p occupied_carriers and \p pilot_carriers.
72 * \param occupied_carriers A vector of vectors of indexes. Example: if
73 * occupied_carriers = ((1, 2, 3), (1, 2, 4)), the first
74 * three input symbols will be mapped to carriers 1, 2
75 * and 3. After that, a new OFDM symbol is started. The next
76 * three input symbols will be placed onto carriers 1, 2
77 * and 4 of the second OFDM symbol. The allocation then
78 * starts from the beginning.
79 * Order matters! The first input symbol is always mapped
80 * onto occupied_carriers[0][0].
81 * \param pilot_carriers The position of the pilot symbols. Same as occupied_carriers,
82 * but the actual symbols are taken from pilot_symbols instead
83 * of the input stream.
84 * \param pilot_symbols The pilot symbols which are placed onto the pilot carriers.
85 * pilot_symbols[0][0] is placed onto the first OFDM symbol, on
86 * carrier index pilot_carriers[0][0] etc.
87 * \param sync_words OFDM symbols that are prepended to the OFDM frame (usually for
88 * synchronisation purposes, e.g. OFDM symbols with every second
89 * sub-carrier being idle). Is a vector of complex vectors of length
90 * \p fft_len
91 * \param len_tag_key The key of the tag identifying the length of the input packet.
92 * \param output_is_shifted whether to 'fftshift' the output OFDM symbols. If used,
93 * the followup FFT should be instantaited such that it knows that the input is
94 * shifted. Default is true.
95 */
96 static sptr make(int fft_len,
97 const std::vector<std::vector<int>>& occupied_carriers,
98 const std::vector<std::vector<int>>& pilot_carriers,
99 const std::vector<std::vector<gr_complex>>& pilot_symbols,
100 const std::vector<std::vector<gr_complex>>& sync_words,
101 const std::string& len_tag_key = "packet_len",
102 const bool output_is_shifted = true);
103};
104
105} // namespace digital
106} // namespace gr
107
108#endif /* INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H */
Create frequency domain OFDM symbols from complex values, add pilots.
Definition: ofdm_carrier_allocator_cvc.h:60
virtual std::vector< std::vector< int > > occupied_carriers()=0
std::shared_ptr< ofdm_carrier_allocator_cvc > sptr
Definition: ofdm_carrier_allocator_cvc.h:62
virtual std::string len_tag_key()=0
static sptr make(int fft_len, const std::vector< std::vector< int > > &occupied_carriers, const std::vector< std::vector< int > > &pilot_carriers, const std::vector< std::vector< gr_complex > > &pilot_symbols, const std::vector< std::vector< gr_complex > > &sync_words, const std::string &len_tag_key="packet_len", const bool output_is_shifted=true)
Block that operates on PDUs in form of tagged streams.
Definition: tagged_stream_block.h:26
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29