IT++ Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
channel.h
Go to the documentation of this file.
1 
29 #ifndef CHANNEL_H
30 #define CHANNEL_H
31 
33 #include <itpp/base/mat.h>
34 #include <itpp/base/array.h>
35 #include <itpp/base/random.h>
36 #include <itpp/signal/filter.h>
37 
184 namespace itpp
185 {
186 
188 
189 
192  ITU_Vehicular_A, ITU_Vehicular_B, ITU_Pedestrian_A, ITU_Pedestrian_B,
193  COST207_RA, COST207_RA6,
194  COST207_TU, COST207_TU6alt, COST207_TU12, COST207_TU12alt,
195  COST207_BU, COST207_BU6alt, COST207_BU12, COST207_BU12alt,
196  COST207_HT, COST207_HT6alt, COST207_HT12, COST207_HT12alt,
197  COST259_TUx, COST259_RAx, COST259_HTx
198 };
199 
201 enum FADING_TYPE { Independent, Static, Correlated };
202 
204 enum CORRELATED_METHOD { Rice_MEDS, IFFT, FIR };
205 
207 enum RICE_METHOD { MEDS };
208 
211  Jakes = 0, J = 0, Classic = 0, C = 0,
212  GaussI = 1, Gauss1 = 1, GI = 1, G1 = 1,
213  GaussII = 2, Gauss2 = 2, GII = 2, G2 = 2
214 };
215 
216 
227 {
228 public:
232  virtual ~Fading_Generator() {}
233 
235  void set_LOS_power(double relative_power);
237  virtual void set_LOS_doppler(double relative_doppler);
239  virtual void set_time_offset(int offset);
241  virtual void set_filter_length(int filter_length);
243  virtual void set_norm_doppler(double norm_doppler);
247  virtual void set_no_frequencies(int no_freq);
249  virtual void set_rice_method(RICE_METHOD method);
250 
252  double get_LOS_power() const { return los_power; }
254  virtual double get_LOS_doppler() const;
256  virtual double get_time_offset() const;
258  virtual int get_filter_length() const;
260  virtual double get_norm_doppler() const;
262  virtual DOPPLER_SPECTRUM get_doppler_spectrum() const;
264  virtual int get_no_frequencies() const;
266  virtual RICE_METHOD get_rice_method() const;
267 
269  virtual void shift_time_offset(int no_samples);
270 
272  virtual void init() = 0;
273 
275  virtual void generate(int no_samples, cvec &output) = 0;
277  cvec generate(int no_samples);
278 
279 protected:
280  bool init_flag;
281  double los_power;
282  double los_diffuse;
283  double los_direct;
284 };
285 
286 
296 {
297 public:
302 
304  virtual void init() { init_flag = true; }
305 
307 
309  virtual void generate(int no_samples, cvec& output);
310 };
311 
312 
323 {
324 public:
329 
331  virtual void init();
332 
334 
336  virtual void generate(int no_samples, cvec& output);
337 
338 protected:
340  std::complex<double> static_sample;
341 };
342 
343 
357 {
358 public:
360  Correlated_Fading_Generator(double norm_doppler);
363 
365  virtual void set_norm_doppler(double norm_doppler);
367  virtual void set_LOS_doppler(double relative_doppler);
369  virtual void set_time_offset(int offset);
370 
372  virtual double get_norm_doppler() const { return n_dopp; }
374  virtual double get_LOS_doppler() const { return los_dopp; }
376  virtual double get_time_offset() const { return time_offset; }
377 
379  virtual void shift_time_offset(int no_samples);
380 
382  virtual void init() = 0;
383 
385 
387  virtual void generate(int no_samples, cvec& output) = 0;
388 
389 protected:
390  double n_dopp;
391  double los_dopp;
392  double time_offset;
393 
395  void add_LOS(int idx, std::complex<double>& sample);
396 };
397 
398 
434 {
435 public:
437  Rice_Fading_Generator(double norm_doppler, DOPPLER_SPECTRUM spectrum = Jakes,
438  int no_freq = 16, RICE_METHOD method = MEDS);
441 
445  virtual void set_no_frequencies(int no_freq);
447  virtual void set_rice_method(RICE_METHOD method);
448 
452  virtual int get_no_frequencies() const { return Ni; }
454  virtual RICE_METHOD get_rice_method() const { return rice_method; }
455 
457  virtual void init();
458 
460 
462  virtual void generate(int no_samples, cvec &output);
463 
464 protected:
466 
467  int Ni;
472  vec f1, f2, c1, c2, th1, th2;
476  double f01, f02;
479 
480  void init_MEDS();
481 };
482 
483 
503 {
504 public:
506  FIR_Fading_Generator(double norm_doppler, int filter_length = 500);
509 
511  virtual void set_filter_length(int filter_length);
513  virtual int get_filter_length() const { return fir_length; }
514 
516  virtual void init();
517 
519 
521  virtual void generate(int no_samples, cvec &output);
522 
523 protected:
526 
527  MA_Filter<std::complex<double>, double, std::complex<double> > fir_filter;
528  cvec left_overs;
529 
540  vec Jakes_filter(double norm_dopp, int order = 100);
541 };
542 
543 
569 {
570 public:
572  IFFT_Fading_Generator(double norm_doppler) :
573  Correlated_Fading_Generator(norm_doppler) {}
576 
578  virtual void init() { init_flag = true; }
579 
581 
583  virtual void generate(int no_samples, cvec &output);
584 
585 protected:
587  void generate_Jakes(int no_samples, cvec &output);
588 };
589 
590 
663 {
664 public:
666  Channel_Specification(const vec &avg_power_dB = "0", const vec &delay_prof = "0");
668  Channel_Specification(const CHANNEL_PROFILE profile);
671 
673  void set_channel_profile(const vec &avg_power_dB, const vec &delay_prof);
675  void set_channel_profile(const CHANNEL_PROFILE profile);
676 
678  void set_doppler_spectrum(DOPPLER_SPECTRUM *tap_spectrum);
680  void set_doppler_spectrum(int tap_number, DOPPLER_SPECTRUM tap_spectrum);
681 
683  void set_LOS(int tap_number, double relative_power, double relative_doppler = 0.7);
685  void set_LOS(const vec& relative_power, const vec& relative_doppler = "");
686 
688  void get_channel_profile(vec &avg_power_dB, vec &delay_prof) const;
690  vec get_avg_power_dB() const { return a_prof_dB; }
692  vec get_delay_prof() const { return d_prof; }
696  DOPPLER_SPECTRUM get_doppler_spectrum(int index) const;
698  vec get_LOS_power() const { return los_power; }
700  vec get_LOS_doppler() const { return los_dopp; }
702  double get_LOS_power(int tap_number) const { return los_power(tap_number); }
704  double get_LOS_doppler(int tap_number) const { return los_dopp(tap_number); }
705 
707  int taps() const { return N_taps; }
708 
710  double calc_mean_excess_delay() const;
712  double calc_rms_delay_spread() const;
713 
714 protected:
715  vec a_prof_dB;
716  vec d_prof;
718  int N_taps;
719  vec los_power;
720  vec los_dopp;
721 };
722 
723 
824 {
825 public:
827  TDL_Channel(const vec &avg_power_dB = "0", const ivec &delay_prof = "0");
829  TDL_Channel(const Channel_Specification &channel_spec, double sampling_time);
831  virtual ~TDL_Channel();
832 
834  void set_channel_profile(const vec &avg_power_dB, const ivec &delay_prof);
836  void set_channel_profile_uniform(int no_taps);
838  void set_channel_profile_exponential(int no_taps);
840  void set_channel_profile(const Channel_Specification &channel_spec, double sampling_time);
841 
846 
848  void set_norm_doppler(double norm_doppler);
849 
851  void set_LOS(const vec& relative_power, const vec& relative_doppler = "");
853  void set_LOS_power(const vec& relative_power);
855  void set_LOS_doppler(const vec& relative_doppler);
856 
858  void set_doppler_spectrum(const DOPPLER_SPECTRUM *tap_spectrum);
860  void set_doppler_spectrum(int tap_number, DOPPLER_SPECTRUM tap_spectrum);
862  void set_no_frequencies(int no_freq);
863 
865  void set_time_offset(int offset);
867  void shift_time_offset(int no_samples);
868 
871 
872 
874  int taps() const { return N_taps; }
875 
877  void get_channel_profile(vec &avg_power_dB, ivec &delay_prof) const;
879  vec get_avg_power_dB() const;
881  ivec get_delay_prof() const { return d_prof; }
882 
887 
889  double get_norm_doppler() const { return n_dopp; }
890 
892  vec get_LOS_power() const { return los_power; }
894  vec get_LOS_doppler() const { return los_dopp; }
896  double get_LOS_power(int tap_number) const { return los_power(tap_number); }
898  double get_LOS_doppler(int tap_number) const { return los_dopp(tap_number); }
899 
901  int get_no_frequencies() const { return nrof_freq; }
902 
904  double get_time_offset() const;
905 
907  double calc_mean_excess_delay() const;
909  double calc_rms_delay_spread() const;
910 
912  void init();
913 
915  void generate(int no_samples, Array<cvec> &channel_coeff);
917  void generate(int no_samples, cmat &channel_coeff);
918 
920  void filter_known_channel(const cvec &input, cvec &output, const Array<cvec> &channel_coeff);
922  void filter_known_channel(const cvec &input, cvec &output, const cmat &channel_coeff);
923 
925  void filter(const cvec &input, cvec &output, Array<cvec> &channel_coeff);
927  void filter(const cvec &input, cvec &output, cmat &channel_coeff);
929  cvec filter(const cvec &input, Array<cvec> &channel_coeff);
931  cvec filter(const cvec &input, cmat &channel_coeff);
933  void filter(const cvec &input, cvec &output);
935  cvec filter(const cvec &input);
936 
938  void operator()(const cvec &input, cvec &output, Array<cvec> &channel_coeff);
940  void operator()(const cvec &input, cvec &output, cmat &channel_coeff);
942  cvec operator()(const cvec &input, Array<cvec> &channel_coeff);
944  cvec operator()(const cvec &input, cmat &channel_coeff);
946  cvec operator()(const cvec &input);
947 
949  void calc_impulse_response(const Array<cvec> &channel_coeff, Array<cvec> &impulse_response);
950 
952  void calc_frequency_response(const Array<cvec> &channel_coeff, Array<cvec> &frequency_response, const int fft_size);
954  void calc_frequency_response(const cmat &channel_coeff, cmat &frequency_response, const int fft_size);
956  double get_sampling_time() const { return discrete_Ts; }
957 
958 protected:
959  bool init_flag;
960  vec a_prof;
961  ivec d_prof;
962  vec los_power;
963  vec los_dopp;
964  int N_taps;
965  double n_dopp;
971  int nrof_freq;
972  double discrete_Ts;
973 
980  void discretize(const vec &delay_profile);
981 };
982 
983 
984 
1003 class BSC
1004 {
1005 public:
1007  BSC(double in_p = 0.0) : u(0.0, 1.0) { p = in_p; };
1009  void set_prob(double in_p) { p = in_p; };
1011  double get_prob() const { return p; };
1013  bvec operator()(const bvec &input);
1014 private:
1015  Uniform_RNG u;
1016  double p;
1017 };
1018 
1019 
1020 
1055 {
1056 public:
1058  AWGN_Channel(double noisevar = 0.0): sigma(std::sqrt(noisevar)) {}
1060  void set_noise(double noisevar) { sigma = std::sqrt(noisevar); }
1062  double get_noise() const { return sqr(sigma); }
1064  cvec operator()(const cvec &input);
1066  vec operator()(const vec &input);
1067 private:
1068  Complex_Normal_RNG rng_cn;
1069  Normal_RNG rng_n;
1070  double sigma;
1071 };
1072 
1074 
1075 } // namespace itpp
1076 
1077 #endif // #ifndef CHANNEL_H
SourceForge Logo

Generated on Fri Mar 21 2014 17:14:13 for IT++ by Doxygen 1.8.1.2