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

3G开发

开发平台:

Visual C++

  1. //
  2. //  File = finedelayest_sim.cpp
  3. //
  4. #define SIM_NAME "FineDelayEst"
  5. #define SIM_TITLE "Fine Delay Estimation Testbed"
  6. #include "global_stuff.h"
  7. //=====================
  8. // model includes
  9. #include "sinc_wave.h"
  10. #include "bitgen.h"
  11. #include "basewav.h"
  12. #include "butt_filt_iir.h"
  13. //#include "bitwav.h"
  14. //#include "multi_sine_gen.h"
  15. #include "ramp_gen.h"
  16. //#include "sine_gen.h"
  17. #include "contin_delay_tester.h"
  18. #include "contin_delay2_T.h"
  19. #include "coarse_delay_est.h"
  20. #include "fine_delay_est.h"
  21. #include "discrete_delay_T.h"
  22. #include "dft_delay_T.h"
  23. #include "siganchr.h"
  24. //=========================================================
  25. main()
  26. {
  27.    #include "sim_preamble.cpp"
  28.   //=========================================================================
  29.   //  Misc special processing
  30.    SincWaveform(  4, //num_sidelobes
  31.                  50, //samps_per_hump
  32.                  "sinc_wave.txt");//out_filename
  33.   //=========================================================================
  34.   //  Allocate signals
  35.   BIT_SIGNAL(bit_seq);
  36.   BIT_SIGNAL(bit_clock);
  37.   FLOAT_SIGNAL(binary_wave);
  38.   FLOAT_SIGNAL(filt_wave);
  39.   FLOAT_SIGNAL(test_sig);
  40.   FLOAT_SIGNAL(test_sig_2);
  41.   FLOAT_SIGNAL(delayed_test_sig);
  42.   FLOAT_SIGNAL(delayed_ref_sig);
  43.   FLOAT_SIGNAL(coarse_dly_ref_sig);
  44.   FLOAT_SIGNAL(corr_out_sig);
  45.   FLOAT_SIGNAL(baseband_wave);
  46.   //============================================================
  47.   //  Construct, initialize and connect models
  48.    BitGener* bit_gen = new BitGener( "bit_gen",
  49.                                       CommSystem,
  50.                                       bit_seq );
  51.   
  52.    SignalAnchor* bit_seq_anchr = new SignalAnchor( "bit_seq_anchr",
  53.                                                    CommSystem,
  54.                                                    bit_seq );
  55.    BasebandWaveform* baseband_gen = new BasebandWaveform(   "baseband_gen",
  56.                                                 CommSystem,
  57.                                                 bit_seq,
  58.                                                 binary_wave,
  59.                                                 bit_clock );
  60.   ButterworthFilterByIir<float>* base_filt = new ButterworthFilterByIir<float>( "base_filt",
  61.                                                         CommSystem,
  62.                                                         binary_wave,
  63.                                                         filt_wave);
  64.   
  65.   ContinuousDelay2< float >* delay_2 = new ContinuousDelay2< float >( 
  66.                                                 "delay_2",
  67.                                                 CommSystem,
  68.                                                 filt_wave,
  69.                                                 delayed_test_sig);
  70.   Control<float>* coarse_delay_est_cntl = new Control<float>( "coarse_delay_est_cntl",
  71.                                                           CommSystem);
  72.    Control<int>* samps_delay_est_cntl = new Control<int>( "samps_delay_est_cntl",
  73.                                                             CommSystem);
  74.    Control<bool>* coarse_dly_is_valid_cntl = new Control<bool>( "coarse_dly_is_valid_cntl",
  75.                                                             CommSystem);
  76.    CoarseDelayEstimator* correlator = new CoarseDelayEstimator(  "correlator",
  77.                                                     CommSystem,
  78.                                                     delayed_test_sig,
  79.                                                     filt_wave,
  80.                                                     corr_out_sig,
  81.                                                     coarse_dly_is_valid_cntl,
  82.                                                     coarse_delay_est_cntl,
  83.                                                     samps_delay_est_cntl);
  84.    DiscreteDelay< float >* coarse_dly_adj = new DiscreteDelay<float>(  "coarse_dly_adj",
  85.                                                                CommSystem,
  86.                                                                filt_wave,
  87.                                                                coarse_dly_ref_sig,
  88.                                                                samps_delay_est_cntl,
  89.                                                                coarse_dly_is_valid_cntl);
  90.   Control<float>* fine_delay_est_cntl = new Control<float>( "fine_delay_est_cntl",
  91.                                                           CommSystem);
  92.    Control<bool>* fine_dly_is_valid_cntl = new Control<bool>( "fine_dly_is_valid_cntl",
  93.                                                             CommSystem);
  94.    FineDelayEstimator* phase_slope_est = new FineDelayEstimator(  "phase_slope_est",
  95.                                                     CommSystem,
  96.                                                     delayed_test_sig,
  97.                                                     coarse_dly_ref_sig,
  98.                                                     coarse_dly_is_valid_cntl,
  99.                                                     fine_dly_is_valid_cntl,
  100.                                                     fine_delay_est_cntl);
  101.    ContinuousDelay2<float>* fine_dly_adj = new ContinuousDelay2<float>( 
  102.                                                          "fine_dly_adj",
  103.                                                          CommSystem,
  104.                                                          coarse_dly_ref_sig,
  105.                                                          delayed_ref_sig,
  106.                                                          fine_delay_est_cntl,
  107.                                                          fine_dly_is_valid_cntl);
  108. //  SignalAnchor* temp_anchor = new SignalAnchor( "temp_anchor",
  109. //                                                CommSystem,
  110. //                                                filt_wave,
  111. //                                                0.0078125, //samp_intvl
  112. //                                                4096 ); //block_size
  113. //  SignalAnchor* temp_anchor_3 = new SignalAnchor( "temp_anchor_3",
  114. //                                                CommSystem,
  115. //                                                ref_seq,
  116. //                                                1.0, //samp_rate
  117. //                                                128 ); //block_size
  118.   //=============================================================
  119.   #include "sim_postamble.cpp"
  120.   return 0;
  121. }