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

3G开发

开发平台:

Visual C++

  1. //
  2. //  File = decimate_sim.cpp
  3. //
  4. #define SIM_NAME "Zm_Nonlin"
  5. #define SIM_TITLE "Memoryless Nonlinearities"
  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. #include "ideal_am.h"
  19. #include "ideal_hard_lim.h"
  20. //=========================================================
  21. main()
  22. {
  23. #include "sim_preamble.cpp"
  24.   //=========================================================================
  25.   //  Misc special processing
  26.   //=========================================================================
  27.   //  Allocate signals
  28.   FLOAT_SIGNAL(test_sig);
  29.   FLOAT_SIGNAL(limited_sig);
  30.   FLOAT_SIGNAL(carrier_sig);
  31.   FLOAT_SIGNAL(noisy_test_sig);
  32.   FLOAT_SIGNAL(noise_only_sig);
  33.   FLOAT_SIGNAL(lp_noise_sig);
  34.   FLOAT_SIGNAL(power_meas_sig);
  35.   FLOAT_SIGNAL(delayed_test_sig);
  36.   FLOAT_SIGNAL(downsamp_test_sig);
  37.   FLOAT_SIGNAL(downsamp_noise);
  38.   FLOAT_SIGNAL(filt_sig);
  39.   FLOAT_SIGNAL(delayed_downsamp_sig);
  40.   FLOAT_SIGNAL(est_avg_sig_pwr_1);
  41.   FLOAT_SIGNAL(est_avg_sig_pwr_3);
  42.   FLOAT_SIGNAL(est_avg_sig_pwr_4);
  43.   FLOAT_SIGNAL(est_avg_sig_pwr_5);
  44.   FLOAT_SIGNAL(est_avg_sig_pwr_6);
  45.   
  46.   //============================================================
  47.   //  Construct, initialize and connect models
  48. //   ToneGener* sig_gen = new  ToneGener( "sig_gen",
  49. //                                       CommSystem,
  50. //                                       test_sig );
  51.    MultipleToneGener* sine_gen_1 = new MultipleToneGener( "sine_gen_1",
  52.                        CommSystem,
  53.                        carrier_sig );
  54.    AdditiveGaussianNoise<float>* noise_gen = new AdditiveGaussianNoise<float> (
  55.                                               "noise_gen",
  56.                                               CommSystem,
  57.                                               carrier_sig,
  58.                                               noisy_test_sig,
  59.                                               noise_only_sig,
  60.                                               power_meas_sig);
  61.    AnlgDirectFormFir* noise_filt = new AnlgDirectFormFir( "noise_filt",
  62.                                                           CommSystem,
  63.                                                           noise_only_sig,
  64.                                                           lp_noise_sig );
  65.    IdealAmplitudeModulator* modulator = new IdealAmplitudeModulator( "modulator",
  66.                                                                   CommSystem,
  67.                                                                   carrier_sig,
  68.                                                                   lp_noise_sig,
  69.                                                                   test_sig);
  70.    SpectrumAnalyzer<float>* spec_analyzer_1 = 
  71.                   new SpectrumAnalyzer<float>(  "spec_analyzer_1",
  72.                                                 CommSystem,
  73.                                                 test_sig );
  74.     IdealHardLimiter* limiter = new IdealHardLimiter( "limiter",
  75.                                                       CommSystem,
  76.                                                       test_sig,
  77.                                                       limited_sig);
  78.    SpectrumAnalyzer<float>* spec_analyzer_2 = 
  79.                   new SpectrumAnalyzer<float>(  "spec_analyzer_2",
  80.                                                 CommSystem,
  81.                                                 limited_sig );
  82.   AnlgDirectFormFir* direct_fir = new AnlgDirectFormFir( "direct_fir",
  83.                                                           CommSystem,
  84.                                                           limited_sig,
  85.                                                           filt_sig );
  86.    SpectrumAnalyzer<float>* spec_analyzer_3 = 
  87.                   new SpectrumAnalyzer<float>(  "spec_analyzer_3",
  88.                                                 CommSystem,
  89.                                                 filt_sig );
  90.    SignalAnchor* temp_anchor = new SignalAnchor( "temp_anchor",
  91.                                                 CommSystem,
  92.                                                 test_sig);
  93.   //=============================================================
  94.   #include "sim_postamble.cpp"
  95.   return 0;
  96. }