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

3G开发

开发平台:

Visual C++

  1. //
  2. //  File = interpolate_sim.cpp
  3. //
  4. #define SIM_NAME "Interpolate"
  5. #define SIM_TITLE "Simple Interpolation"
  6. #include "global_stuff.h" 
  7. #include "tone_gen.h"
  8. #include "multi_tone_gen.h"
  9. //#include "cpx_freq_dom_filt.h"
  10. //#include "cpxtoquad.h"
  11. //#include "quad_to_polar.h"
  12. #include "andf1fir.h"
  13. #include "cpxtophs.h"
  14. #include "siganchr.h"
  15. //#include "bart_pdgm_wind.h"
  16. #include "ms_error_T.h"
  17. #include "upsampler_T.h"
  18. #include "discrete_delay_T.h"
  19. #include "spec_analyzer.h"
  20. #include "correlator.h"
  21. #include "contin_delay2_T.h"
  22. //=========================================================
  23. main()
  24. {
  25. #include "sim_preamble.cpp"
  26.   //=========================================================================
  27.   //  Misc special processing
  28.   //=========================================================================
  29.   //  Allocate signals
  30.   FLOAT_SIGNAL(test_sig);
  31.   FLOAT_SIGNAL(ref_sig);
  32.   FLOAT_SIGNAL(delayed_ref_sig);
  33.   FLOAT_SIGNAL(upsamp_test_sig);
  34.   FLOAT_SIGNAL(filt_sig);
  35.   FLOAT_SIGNAL(correl_out_sig);
  36.   FLOAT_SIGNAL(interm_filt_sig_1);
  37.   FLOAT_SIGNAL(interm_filt_sig_2);
  38.   FLOAT_SIGNAL(delayed_filt_sig);
  39.   //============================================================
  40.   //  Construct, initialize and connect models
  41. //   ToneGener* sig_gen = new  ToneGener( "sig_gen",
  42. //                                       CommSystem,
  43. //                                       test_sig );
  44.    MultipleToneGener* sine_gen_1 = new MultipleToneGener( "sine_gen_1",
  45.                        CommSystem,
  46.                        test_sig );
  47.    MultipleToneGener* ref_sine_gen = new MultipleToneGener( "ref_sine_gen",
  48.                        CommSystem,
  49.                        ref_sig );
  50.    SpectrumAnalyzer<float>* spec_analyzer_1 = 
  51.                   new SpectrumAnalyzer<float>(  "spec_analyzer_1",
  52.                                                 CommSystem,
  53.                                                 ref_sig );
  54.    Upsampler< float > *upsampler = new Upsampler<float>( "upsampler",
  55.                                 CommSystem,
  56.                                 test_sig,
  57.                                 upsamp_test_sig );
  58.    SpectrumAnalyzer<float>* spec_analyzer_2 = 
  59.                   new SpectrumAnalyzer<float>(  "spec_analyzer_2",
  60.                                                 CommSystem,
  61.                                                 upsamp_test_sig );
  62. //   SincInterpolator* recon_box = 
  63. //                  new SincInterpolator(   "recon_box",
  64. //                                          CommSystem,
  65. //                                          tone_sig);
  66.    AnlgDirectFormFir* direct_fir = new AnlgDirectFormFir( "direct_fir",
  67.                                                           CommSystem,
  68.                                                           upsamp_test_sig,
  69.                                                           interm_filt_sig_1 );
  70.    AnlgDirectFormFir* direct_fir_2 = new AnlgDirectFormFir( "direct_fir_2",
  71.                                                           CommSystem,
  72.                                                           interm_filt_sig_1,
  73.                                                           interm_filt_sig_2 );
  74.    AnlgDirectFormFir* direct_fir_3 = new AnlgDirectFormFir( "direct_fir_3",
  75.                                                           CommSystem,
  76.                                                           interm_filt_sig_2,
  77.                                                           filt_sig );
  78.    SpectrumAnalyzer<float>* spec_analyzer_3 = 
  79.                   new SpectrumAnalyzer<float>(  "spec_analyzer_3",
  80.                                                 CommSystem,
  81.                                                 filt_sig );
  82.   Control<float>* delay_at_max_corr = new Control<float>( "delay_at_max_corr",
  83.                                                    CommSystem );
  84.   Control<int>* samps_delay_at_max_corr = new Control<int>( "samps_delay_at_max_corr",
  85.                                                    CommSystem );
  86. //   RealCorrelator *ref_correl = new RealCorrelator( "ref_correl",
  87. //                                                      CommSystem,
  88. //                                                      filt_sig,
  89. //                                                      ref_sig,
  90. //                                                      correl_out_sig,
  91. //                                                      delay_at_max_corr,
  92. //                                                      samps_delay_at_max_corr);
  93.    ContinuousDelay2< float >* cont_ref_delay = new ContinuousDelay2< float >( 
  94.                                                                "cont_ref_delay",
  95.                                                                CommSystem,
  96.                                                                ref_sig,
  97.                                                                delayed_ref_sig);
  98. //   DiscreteDelay< float >* ref_delay = new DiscreteDelay<float>( "ref_delay",
  99. //                                                                 CommSystem,
  100. //                                                                 ref_sig,
  101. //                                                                 delayed_ref_sig);
  102.    DiscreteDelay< float >* filt_delay = new DiscreteDelay<float>( "filt_delay",
  103.                                                                  CommSystem,
  104.                                                                  filt_sig,
  105.                                                                  delayed_filt_sig);
  106.    MeanSquareError< float >* error_meter = new MeanSquareError<float>( 
  107.                                                    "error_meter",
  108.                                                    CommSystem,
  109.                                                    delayed_filt_sig,
  110.                                                    delayed_ref_sig);
  111.    SignalAnchor* temp_ref_anchor = new SignalAnchor( "temp_ref_anchor",
  112.                                                       CommSystem,
  113.                                                       ref_sig);
  114.    SignalAnchor* temp_anchor = new SignalAnchor( "temp_anchor",
  115.                                                 CommSystem,
  116.                                                 test_sig);
  117.   //=============================================================
  118.   #include "sim_postamble.cpp"
  119.   return 0;
  120. }