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

3G开发

开发平台:

Visual C++

  1. //
  2. //  File = contindelay_sim.cpp
  3. //
  4. #define SIM_NAME "RealCorr_Test"
  5. #define SIM_TITLE "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_tone_gen.h"
  15. #include "ramp_gen.h"
  16. #include "contin_delay_tester.h"
  17. #include "contin_delay2_T.h"
  18. #include "correlator.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(corr_out_sig);
  40.   FLOAT_SIGNAL(baseband_wave);
  41.   //============================================================
  42.   //  Construct, initialize and connect models
  43.    BitGener* bit_gen = new BitGener( "bit_gen",
  44.                                       CommSystem,
  45.                                       bit_seq );
  46.   
  47.    SignalAnchor* bit_seq_anchr = new SignalAnchor( "bit_seq_anchr",
  48.                                                    CommSystem,
  49.                                                    bit_seq );
  50.    BasebandWaveform* baseband_gen = new BasebandWaveform(   "baseband_gen",
  51.                                                 CommSystem,
  52.                                                 bit_seq,
  53.                                                 binary_wave,
  54.                                                 bit_clock );
  55.   ButterworthFilterByIir<float>* base_filt = new ButterworthFilterByIir<float>( "base_filt",
  56.                                                         CommSystem,
  57.                                                         binary_wave,
  58.                                                         filt_wave);
  59.   Control<bool>* delay_chg_enab = new Control<bool>( "delay_chg_enab",
  60.                                                    CommSystem );
  61.   Control<float>* dynam_float_dly = new Control<float>( "dynam_float_dly",
  62.                                                    CommSystem );
  63.   //ContinuousDelayTester< float >* dyn_delay_knob = 
  64.   //                          new ContinuousDelayTester< float >( 
  65.   //                                                "dyn_delay_knob",
  66.   //                                                CommSystem,
  67.   //                                                filt_wave,
  68.   //                                                test_sig_2,
  69.   //                                                dynam_float_dly,
  70.   //                                                delay_chg_enab );
  71.   
  72.   ContinuousDelay2< float >* delay_2 = new ContinuousDelay2< float >( 
  73.                                                 "delay_2",
  74.                                                 CommSystem,
  75.                                                 filt_wave,
  76.                                                 delayed_test_sig,
  77.                                                 dynam_float_dly,
  78.                                                 delay_chg_enab);
  79.   Control<float>* delay_at_max_corr = new Control<float>( "delay_at_max_corr",
  80.                                                           CommSystem);
  81.   Control<int>* samps_delay_at_max_corr = new Control<int>( "samps_delay_at_max_corr",
  82.                                                             CommSystem);
  83.   RealCorrelator* correlator = new RealCorrelator(  "correlator",
  84.                                                     CommSystem,
  85.                                                     delayed_test_sig,
  86.                                                     filt_wave,
  87.                                                     corr_out_sig,
  88.                                                     delay_at_max_corr,
  89.                                                     samps_delay_at_max_corr);
  90. //  SignalAnchor* temp_anchor = new SignalAnchor( "temp_anchor",
  91. //                                                CommSystem,
  92. //                                                filt_wave,
  93. //                                                0.0078125, //samp_intvl
  94. //                                                4096 ); //block_size
  95. //  SignalAnchor* temp_anchor_3 = new SignalAnchor( "temp_anchor_3",
  96. //                                                CommSystem,
  97. //                                                ref_seq,
  98. //                                                1.0, //samp_rate
  99. //                                                128 ); //block_size
  100.   //=============================================================
  101.   #include "sim_postamble.cpp"
  102.   return 0;
  103. }