diffmultipathuncorr_sim.cpp
上传用户:jtjnyq9001
上传日期:2014-11-21
资源大小:3974k
文件大小:6k
源码类别:

3G开发

开发平台:

Visual C++

  1. //
  2. //  File = diffmultipathuncorr_sim.cpp
  3. //
  4. #define SIM_NAME "DiffMultipathUncorr"
  5. #define SIM_TITLE "Diffuse Multipath Channel Uncorrelated Tap Gains"
  6. #include "global_stuff.h"
  7. //=====================
  8. // model includes
  9. #include "bitgen.h"
  10. #include "bitwav.h"
  11. #include "siganchr.h"
  12. #include "quadmod.h"
  13. #include "phase_genie.h"
  14. #include "quaddem.h"
  15. #include "integ_dump_slice.h"
  16. #include "qpskoptbitdem.h"
  17. #include "ber_ctr.h"
  18. #include "qpsk_err_ctr.h"
  19. #include "chan_diff_mp_uncorr.h"
  20. #include "cpxtophs.h"
  21. //=========================================================
  22. main()
  23. {
  24.    #include "sim_preamble.cpp"
  25.   //=========================================================================
  26.   //  Misc special processing
  27.    //CorrTapTest( "R_matrix.txt");
  28.   //=========================================================================
  29.   //  Allocate signals
  30.   BIT_SIGNAL(i_bits);
  31.   BIT_SIGNAL(q_bits);
  32.   FLOAT_SIGNAL(i_baseband_wave);
  33.   FLOAT_SIGNAL(q_baseband_wave);
  34.   COMPLEX_SIGNAL(modulated_signal);
  35.   COMPLEX_SIGNAL(distorted_signal);
  36.   COMPLEX_SIGNAL(recov_carrier_sig);
  37.   BIT_SIGNAL(symb_clock);
  38.   BIT_SIGNAL(delayed_clock);
  39.   BIT_SIGNAL(q_symb_clock);
  40.   FLOAT_SIGNAL(i_demod_wave);
  41.   FLOAT_SIGNAL(q_demod_wave);
  42.   FLOAT_SIGNAL(i_samp_wave);
  43.   FLOAT_SIGNAL(q_samp_wave);
  44.   BIT_SIGNAL(i_bit_decis);
  45.   BIT_SIGNAL(q_bit_decis);
  46.   FLOAT_SIGNAL(phase_sig_1);
  47.   FLOAT_SIGNAL(mag_sig_1);
  48.   FLOAT_SIGNAL(phase_sig_2);
  49.   FLOAT_SIGNAL(mag_sig_2);
  50.   //============================================================
  51.   //  Construct, initialize and connect models
  52.   BitGener* i_bit_gen = new BitGener( "i_bit_gen",
  53.                                       CommSystem,
  54.                                       i_bits );
  55.   BitGener* q_bit_gen = new BitGener( "q_bit_gen",
  56.                                       CommSystem,
  57.                                       q_bits );
  58.   
  59.   BitsToWave* i_wave_gen = new BitsToWave( "i_wave_gen",
  60.                                            CommSystem,
  61.                                            i_bits,
  62.                                            i_baseband_wave,
  63.                                            symb_clock );
  64.   BitsToWave* q_wave_gen = new BitsToWave( "q_wave_gen",
  65.                                            CommSystem,
  66.                                            q_bits,
  67.                                            q_baseband_wave,
  68.                                            q_symb_clock );
  69.   SignalAnchor* temp_anchor_1 = new SignalAnchor( "temp_anchor_1",
  70.                                                 CommSystem,
  71.                                                 i_baseband_wave,
  72.                                                 q_baseband_wave,
  73.                                                 0.0625, //samp_intvl
  74.                                                 4096 ); //block_size
  75.   QuadratureModulator* qpsk_mod = new QuadratureModulator( "qpsk_mod",
  76.                                                 CommSystem,
  77.                                                 i_baseband_wave,
  78.                                                 q_baseband_wave,
  79.                                                 modulated_signal);
  80.    CmpxToPhase* phase_det_1 = new CmpxToPhase( "phase_det_1",
  81.                                                 CommSystem,
  82.                                                 modulated_signal,
  83.                                                 phase_sig_1,
  84.                                                 mag_sig_1);
  85.    ChanDiffuseMultipathUncorr* channel = new ChanDiffuseMultipathUncorr( 
  86.                                                 "channel",
  87.                                                 CommSystem,
  88.                                                 modulated_signal,
  89.                                                 distorted_signal);
  90.    CmpxToPhase* phase_det_2 = new CmpxToPhase( "phase_det_2",
  91.                                                 CommSystem,
  92.                                                 distorted_signal,
  93.                                                 phase_sig_2,
  94.                                                 mag_sig_2);
  95.   PhaseRecoveryGenie* carrier_recovery = new PhaseRecoveryGenie( "carrier_recovery",
  96.                                                                    CommSystem,
  97.                                                                    recov_carrier_sig);
  98.   QuadratureDemod* quad_dem = new QuadratureDemod( "quad_dem",
  99.                                                    CommSystem,
  100.                                                    distorted_signal,
  101.                                                    recov_carrier_sig,
  102.                                                    i_demod_wave,
  103.                                                    q_demod_wave );
  104.   IntegrateDumpAndSlice* i_bit_slicer = new IntegrateDumpAndSlice( "i_bit_slicer",
  105.                                            CommSystem,
  106.                                            i_demod_wave,
  107.                                            symb_clock,
  108.                                            i_samp_wave,
  109.                                            i_bit_decis);
  110.   IntegrateDumpAndSlice* q_bit_slicer = new IntegrateDumpAndSlice( "q_bit_slicer",
  111.                                            CommSystem,
  112.                                            q_demod_wave,
  113.                                            q_symb_clock,
  114.                                            q_samp_wave,
  115.                                            q_bit_decis);
  116.   BerCounter* i_ber_ctr = new BerCounter( "i_ber_ctr",
  117.                                           CommSystem,
  118.                                           i_bits,
  119.                                           i_bit_decis );
  120.   BerCounter* q_ber_ctr = new BerCounter( "q_ber_ctr",
  121.                                           CommSystem,
  122.                                           q_bits,
  123.                                           q_bit_decis );
  124.   QpskErrorCounter* ser_ctr = new QpskErrorCounter( "ser_ctr",
  125.                                                     CommSystem,
  126.                                                     i_bits,
  127.                                                     q_bits,
  128.                                                     i_bit_decis,
  129.                                                     q_bit_decis );
  130.   //=============================================================
  131.   #include "sim_postamble.cpp"
  132.   return 0;
  133. }