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

3G开发

开发平台:

Visual C++

  1. //
  2. //  File = decimate_sim.cpp
  3. //
  4. #define SIM_NAME "Decimate"
  5. #define SIM_TITLE "Simple Decimation"
  6. #include "global_stuff.h" 
  7. #include "tone_gen.h"
  8. #include "multi_tone_gen.h"
  9. #include "andf1fir.h"
  10. #include "cpxtophs.h"
  11. #include "siganchr.h"
  12. #include "bart_pdgm_wind.h"
  13. #include "downsampler_T.h"
  14. #include "discrete_delay_T.h"
  15. #include "add_gaus_noise.h"
  16. #include "spec_analyzer.h"
  17. #include "pwrmtr.h"
  18. //=========================================================
  19. main()
  20. {
  21. #include "sim_preamble.cpp"
  22.   //=========================================================================
  23.   //  Misc special processing
  24.   //=========================================================================
  25.   //  Allocate signals
  26.   FLOAT_SIGNAL(test_sig);
  27.   FLOAT_SIGNAL(noisy_test_sig);
  28.   FLOAT_SIGNAL(noise_only_sig);
  29.   FLOAT_SIGNAL(filt_noise);
  30.   FLOAT_SIGNAL(power_meas_sig);
  31.   FLOAT_SIGNAL(delayed_test_sig);
  32.   FLOAT_SIGNAL(downsamp_test_sig);
  33.   FLOAT_SIGNAL(downsamp_noise);
  34.   FLOAT_SIGNAL(filt_sig);
  35.   FLOAT_SIGNAL(delayed_downsamp_sig);
  36.   FLOAT_SIGNAL(est_avg_sig_pwr_1);
  37.   FLOAT_SIGNAL(est_avg_sig_pwr_3);
  38.   FLOAT_SIGNAL(est_avg_sig_pwr_4);
  39.   FLOAT_SIGNAL(est_avg_sig_pwr_5);
  40.   FLOAT_SIGNAL(est_avg_sig_pwr_6);
  41.   
  42.   //============================================================
  43.   //  Construct, initialize and connect models
  44. //   ToneGener* sig_gen = new  ToneGener( "sig_gen",
  45. //                                       CommSystem,
  46. //                                       test_sig );
  47.    MultipleToneGener* sine_gen_1 = new MultipleToneGener( "sine_gen_1",
  48.                        CommSystem,
  49.                        test_sig );
  50.    AdditiveGaussianNoise<float>* noise_gen = new AdditiveGaussianNoise<float> (
  51.                                               "noise_gen",
  52.                                               CommSystem,
  53.                                               test_sig,
  54.                                               noisy_test_sig,
  55.                                               noise_only_sig,
  56.                                               power_meas_sig);
  57.    SpectrumAnalyzer<float>* spec_analyzer_1 = 
  58.                   new SpectrumAnalyzer<float>(  "spec_analyzer_1",
  59.                                                 CommSystem,
  60.                                                 test_sig );
  61.    SpectrumAnalyzer<float>* spec_analyzer_7 = 
  62.                   new SpectrumAnalyzer<float>(  "spec_analyzer_7",
  63.                                                 CommSystem,
  64.                                                 noisy_test_sig );
  65.    PowerMeter* power_meter_1 = new PowerMeter( "power_meter_1",
  66.                                              CommSystem,
  67.                                              test_sig,
  68.                                              est_avg_sig_pwr_1);
  69.    AnlgDirectFormFir* direct_fir = new AnlgDirectFormFir( "direct_fir",
  70.                                                           CommSystem,
  71.                                                           test_sig,
  72.                                                           filt_sig );
  73.    SpectrumAnalyzer<float>* spec_analyzer_5 = 
  74.                   new SpectrumAnalyzer<float>(  "spec_analyzer_5",
  75.                                                 CommSystem,
  76.                                                 filt_sig );
  77.    PowerMeter* power_meter_5 = new PowerMeter( "power_meter_5",
  78.                                              CommSystem,
  79.                                              filt_sig,
  80.                                              est_avg_sig_pwr_5);
  81.    Downsampler< float > *downsampler = new Downsampler<float>( "downsampler",
  82.                                 CommSystem,
  83.                                 filt_sig,
  84.                                 downsamp_test_sig );
  85.    SpectrumAnalyzer<float>* spec_analyzer_2 = 
  86.                   new SpectrumAnalyzer<float>(  "spec_analyzer_2",
  87.                                                 CommSystem,
  88.                                                 downsamp_test_sig );
  89.    SpectrumAnalyzer<float>* spec_analyzer_3 = 
  90.                   new SpectrumAnalyzer<float>(  "spec_analyzer_3",
  91.                                                 CommSystem,
  92.                                                 noise_only_sig );
  93.      PowerMeter* power_meter_3 = new PowerMeter( "power_meter_3",
  94.                                              CommSystem,
  95.                                              noise_only_sig,
  96.                                              est_avg_sig_pwr_3);
  97.  AnlgDirectFormFir* noise_fir = new AnlgDirectFormFir( "noise_fir",
  98.                                                           CommSystem,
  99.                                                           noise_only_sig,
  100.                                                           filt_noise );
  101.    SpectrumAnalyzer<float>* spec_analyzer_6 = 
  102.                   new SpectrumAnalyzer<float>(  "spec_analyzer_6",
  103.                                                 CommSystem,
  104.                                                 filt_noise );
  105.    PowerMeter* power_meter_6 = new PowerMeter( "power_meter_6",
  106.                                              CommSystem,
  107.                                              filt_noise,
  108.                                              est_avg_sig_pwr_6);
  109.    Downsampler< float > *noise_downsampler = new Downsampler<float>( "noise_downsampler",
  110.                                 CommSystem,
  111.                                 filt_noise,
  112.                                 downsamp_noise );
  113.    SpectrumAnalyzer<float>* spec_analyzer_4 = 
  114.                   new SpectrumAnalyzer<float>(  "spec_analyzer_4",
  115.                                                 CommSystem,
  116.                                                 downsamp_noise );
  117.    PowerMeter* power_meter_4 = new PowerMeter( "power_meter_4",
  118.                                              CommSystem,
  119.                                              downsamp_noise,
  120.                                              est_avg_sig_pwr_4);
  121.    SignalAnchor* temp_anchor = new SignalAnchor( "temp_anchor",
  122.                                                 CommSystem,
  123.                                                 test_sig);
  124.   //=============================================================
  125.   #include "sim_postamble.cpp"
  126.   return 0;
  127. }