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

3G开发

开发平台:

Visual C++

  1. //
  2. //  File = contindelay_sim.cpp
  3. //
  4. #define SIM_NAME "CoarseDelayEst"
  5. #define SIM_TITLE "Coarse 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 "ramp_gen.h"
  15. #include "contin_delay_tester.h"
  16. #include "contin_delay2_T.h"
  17. #include "coarse_delay_est.h"
  18. #include "discrete_delay_T.h"
  19. #include "dft_delay_T.h"
  20. #include "siganchr.h"
  21. //=========================================================
  22. main()
  23. {
  24.    #include "sim_preamble.cpp"
  25.   //=========================================================================
  26.   //  Misc special processing
  27.    SincWaveform(  4, //num_sidelobes
  28.                  50, //samps_per_hump
  29.                  "sinc_wave.txt");//out_filename
  30.   //=========================================================================
  31.   //  Allocate signals
  32.   BIT_SIGNAL(bit_seq);
  33.   BIT_SIGNAL(bit_clock);
  34.   FLOAT_SIGNAL(binary_wave);
  35.   FLOAT_SIGNAL(filt_wave);
  36.   FLOAT_SIGNAL(test_sig);
  37.   FLOAT_SIGNAL(test_sig_2);
  38.   FLOAT_SIGNAL(delayed_test_sig);
  39.   FLOAT_SIGNAL(coarse_dly_ref_sig);
  40.   FLOAT_SIGNAL(corr_out_sig);
  41.   FLOAT_SIGNAL(baseband_wave);
  42.   //============================================================
  43.   //  Construct, initialize and connect models
  44.    BitGener* bit_gen = new BitGener( "bit_gen",
  45.                                       CommSystem,
  46.                                       bit_seq );
  47.   
  48.    SignalAnchor* bit_seq_anchr = new SignalAnchor( "bit_seq_anchr",
  49.                                                    CommSystem,
  50.                                                    bit_seq );
  51.    BasebandWaveform* baseband_gen = new BasebandWaveform(   "baseband_gen",
  52.                                                 CommSystem,
  53.                                                 bit_seq,
  54.                                                 binary_wave,
  55.                                                 bit_clock );
  56.   ButterworthFilterByIir<float>* base_filt = new ButterworthFilterByIir<float>( "base_filt",
  57.                                                         CommSystem,
  58.                                                         binary_wave,
  59.                                                         filt_wave);
  60.   //Control<bool>* delay_chg_enab = new Control<bool>( "delay_chg_enab",
  61.   //                                                 CommSystem );
  62.   //Control<float>* dynam_float_dly = new Control<float>( "dynam_float_dly",
  63.   //                                                 CommSystem );
  64.   //ContinuousDelayTester< float >* dyn_delay_knob = 
  65.   //                          new ContinuousDelayTester< float >( 
  66.   //                                                "dyn_delay_knob",
  67.   //                                                CommSystem,
  68.   //                                                filt_wave,
  69.   //                                                test_sig_2,
  70.   //                                                dynam_float_dly,
  71.   //                                                delay_chg_enab );
  72.   
  73.   ContinuousDelay2< float >* delay_2 = new ContinuousDelay2< float >( 
  74.                                                 "delay_2",
  75.                                                 CommSystem,
  76.                                                 filt_wave,
  77.                                                 delayed_test_sig);
  78.   Control<float>* delay_at_max_corr = new Control<float>( "delay_at_max_corr",
  79.                                                           CommSystem);
  80.    Control<int>* samps_delay_est_cntl = new Control<int>( "samps_delay_est_cntl",
  81.                                                             CommSystem);
  82.    Control<bool>* dly_est_is_valid_cntl = new Control<bool>( "dly_est_is_valid_cntl",
  83.                                                             CommSystem);
  84.    CoarseDelayEstimator* correlator = new CoarseDelayEstimator(  "correlator",
  85.                                                     CommSystem,
  86.                                                     delayed_test_sig,
  87.                                                     filt_wave,
  88.                                                     corr_out_sig,
  89.                                                     dly_est_is_valid_cntl,
  90.                                                     delay_at_max_corr,
  91.                                                     samps_delay_est_cntl);
  92.    DiscreteDelay< float >* coarse_dly_adj = new DiscreteDelay<float>(  "coarse_dly_adj",
  93.                                                                CommSystem,
  94.                                                                filt_wave,
  95.                                                                coarse_dly_ref_sig,
  96.                                                                samps_delay_est_cntl,
  97.                                                                dly_est_is_valid_cntl);
  98. //  SignalAnchor* temp_anchor = new SignalAnchor( "temp_anchor",
  99. //                                                CommSystem,
  100. //                                                filt_wave,
  101. //                                                0.0078125, //samp_intvl
  102. //                                                4096 ); //block_size
  103. //  SignalAnchor* temp_anchor_3 = new SignalAnchor( "temp_anchor_3",
  104. //                                                CommSystem,
  105. //                                                ref_seq,
  106. //                                                1.0, //samp_rate
  107. //                                                128 ); //block_size
  108.   //=============================================================
  109.   #include "sim_postamble.cpp"
  110.   return 0;
  111. }