GNU Radio's LTE Package
channel_estimator_vcvc_impl.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2014 Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT)
4 *
5 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3, or (at your option)
8 * any later version.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this software; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifndef INCLUDED_LTE_CHANNEL_ESTIMATOR_VCVC_IMPL_H
22#define INCLUDED_LTE_CHANNEL_ESTIMATOR_VCVC_IMPL_H
23
25
26namespace gr {
27 namespace lte {
28
30 {
31 private:
32 static const gr_complex d_C_I;
33 int d_subcarriers;
34 int d_n_frame_syms;
35 int d_last_calced_sym;
36 int d_rxant;
37 pmt::pmt_t d_key;
38 pmt::pmt_t d_msg_buf;
39
40 inline void
41 handle_msg(pmt::pmt_t msg);
42 inline void
43 msg_extract_poss(std::vector<std::vector<int> > &pilot_carriers,
44 pmt::pmt_t poss);
45 inline void
46 msg_extract_vals(std::vector<std::vector<gr_complex> > &pilot_symbols,
47 pmt::pmt_t vals);
48
49 std::vector<std::vector<int> > d_pilot_carriers;
50 std::vector<gr_complex*> d_pilot_symbols;
51
52 // These methods do all the setup stuff.
53 inline void
54 init_pilot_symbol_arrays(
55 const std::vector<std::vector<gr_complex> > &pilot_symbols,
56 int n_frame_syms, int max_pilots);
57 inline void
58 initialize_volk_vectors(int max_pilots, int subcarriers,
59 int n_frame_syms);
60 inline void
61 init_pilot_dependend_volk_vectors(int max_pilots);
62 inline void
63 init_subcarrier_dependend_volk_vectors(int subcarriers);
64 inline void
65 init_estimates_store_volk_vectors(int subcarriers, int n_frame_syms);
66
67 std::vector<std::vector<gr_complex*> > d_estimates;
68 std::vector<std::vector<float*> > d_mag_estimates;
69 std::vector<std::vector<float*> > d_phase_estimates;
70
71 inline int
72 get_max_pilot_number(
73 const std::vector<std::vector<int> > &pilot_carriers);
74 inline int
75 get_nsyms_in_frame(const std::vector<std::vector<int> > &pilot_carriers);
76
77 // These methods are resposnible for control and data moves
78 inline int
79 get_sym_num_from_tags(std::vector<gr::tag_t> &v_b);
80 inline void
81 copy_estimates_to_out_buf(gr_complex* out, int sym_num,
82 int processed_items);
83
84 // This method does all the estimation work
85 int
86 calculate_channel_estimates(const gr_complex* in_rx, int sym_num,
87 int nitems);
88 inline void
89 calculate_ofdm_symbols_with_pilots(const gr_complex* in_rx, int first_sym,
90 int processable_items, int rx);
91 gr_complex* d_rx_vec;
92 inline void
93 calculate_interpolated_ofdm_symbols(int first_sym, int processable_items,
94 int rx);
95 inline void
96 processed_items_to_complex(int first_sym, int processed_items, int rx);
97 inline int
98 get_processable_items(int sym_num, int nitems);
99 inline int
100 get_last_processable_sym(int first_sym, int nitems);
101
102 // Calculate phase and magnitude distortion for OFDM symbol with
103 void
104 estimate_ofdm_symbol(float* mag_est_vec, float* phase_est_vec,
105 gr_complex* symbol_vec, std::vector<int> pilot_pos,
106 gr_complex* pilot_sym);
107 gr_complex* d_rx_rs;
108 float* d_diff_mag;
109 float* d_diff_phase;
110
111 inline void
112 calculate_mag_phase_diff(float* diff_mag, float* diff_phase,
113 gr_complex* rx_rs, gr_complex* pilot_sym,
114 int num_pilots);
115 gr_complex* d_diff_rx_rs;
116
117 inline void
118 extract_pilots(gr_complex* b_vec, gr_complex* a_vec,
119 std::vector<int> pilot_pos);
120
121 void inline
122 phase_bound_diff(float* phase_vec, int len);
123 void inline
124 phase_bound_abs(float* phase_vec, int len);
125 void inline
126 phase_bound_between_pilot_vectors(int first_sym, int processable_items,
127 int rx);
128 void inline
129 phase_bound_between_vectors(float* first, float* last);
130 float* d_phase_bound_vector;
131
132 void inline
133 interpolate_between_vectors(std::vector<float*> &estimates,
134 int previous_sym, int current_sym);
135 float* d_diff_vector;
136 float* d_div_vector;
137
138 void inline
139 interpolate_ofdm_symbol(float* b_vec, float* a_vec,
140 std::vector<int> pilot_pos);
141 void inline
142 interpolate(float* interp_vals, float first_val, float last_val,
143 int steps);
144
145 void inline
146 vector_mag_phase_to_complex(gr_complex* c_vec, float* m_vec, float* p_vec,
147 int len);
148 gr_complex inline
149 mag_phase_to_complex(float mag, float phase);
150
151 public:
153 int rxant, int subcarriers, std::string tag_key,
154 std::string msg_buf_name,
155 const std::vector<std::vector<int> > &pilot_carriers,
156 const std::vector<std::vector<gr_complex> > &pilot_symbols,
157 std::string name);
159
160 // Where all the action really happens
161 int
162 work(int noutput_items, gr_vector_const_void_star &input_items,
163 gr_vector_void_star &output_items);
164
165 void
166 set_pilot_map(const std::vector<std::vector<int> > &pilot_carriers,
167 const std::vector<std::vector<gr_complex> > &pilot_symbols);
168
169 std::vector<std::vector<int> >
171 {
172 return d_pilot_carriers;
173 }
174
175 };
176
177 } // namespace lte
178} // namespace gr
179
180#endif /* INCLUDED_LTE_CHANNEL_ESTIMATOR_VCVC_IMPL_H */
181
Definition channel_estimator_vcvc_impl.h:30
channel_estimator_vcvc_impl(int rxant, int subcarriers, std::string tag_key, std::string msg_buf_name, const std::vector< std::vector< int > > &pilot_carriers, const std::vector< std::vector< gr_complex > > &pilot_symbols, std::string name)
std::vector< std::vector< int > > get_pilot_carriers()
Definition channel_estimator_vcvc_impl.h:170
void set_pilot_map(const std::vector< std::vector< int > > &pilot_carriers, const std::vector< std::vector< gr_complex > > &pilot_symbols)
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
Channel Estimator for OFDM.
Definition channel_estimator_vcvc.h:44
Definition bch_crc_check_ant_chooser_bb.h:28