• Main Page
  • Related Pages
  • Classes
  • Files
  • File List
  • File Members

ocsElecFilter.hh

Go to the documentation of this file.
00001 // $Id: ocsElecFilter.hh,v 1.2 2005/07/06 16:27:46 zweck Exp $
00002 
00003 //###################################################################
00004 //
00005 //           Optical Communication Systems Simulator
00006 //
00007 //       Copyright (2000):
00008 //       Optical Fiber Communications Laboratory (OFCL)
00009 //       Computer Science & Electrical Engineering Department (CSEE)
00010 //       University of Maryland Baltimore County (UMBC)
00011 //
00012 //###################################################################
00013 
00014 #ifndef _OCS_ELEC_FILTER_HH_
00015 #define  _OCS_ELEC_FILTER_HH_
00016 
00017 #include "ocsOptSignal.hh"
00018 #include "ocsPhotodetector.hh"
00019 
00020 
00022 
00030 enum typeElecFilter { NO_ELEC_FILTER = 0, 
00031                       GAUSSIAN = 1, 
00032                       BESSEL = 2,
00033                       MEASURED = 3,
00034                       INTEGRATE_AND_DUMP = 4,
00035                       ANRITSU = 5,
00036                       GAUSSIAN_AND_ANRITSU = 6}; 
00037 
00038 // ##### Input parameter to initialize Electrical Filters
00039 struct ElecFilterParam
00040 {
00041    int TypeElecFilter;
00042    int OrderElecFilter;
00043    double FreqFWHM_ElecFilter;
00044    double CenterFreqElecFilter;
00045 };
00046 
00047 // ##### Class Electrical filter
00048 
00049 class ElecFilter
00050 {
00051    public:
00052       ElecFilter();
00053       void InitElecFilter(cfftw *fft2
00054                       ,fftPowerMatrices sfftPM2
00055                       , ElecFilterParam ElecFilter);
00056 
00057       ElecFilter(string InFileName, Photodetector *oPhotodetector2);
00058 
00059       ElecFilter(ElecFilter *oElecFilter2, Photodetector *oPhotodetector2);
00060 
00063 
00064       ElecFilter(string InFileName, Photodetector *oPhotodetector2,
00065                  cplx * MeasuredFilterFreq2,bool ReadMeasuredFilterFlag);
00066 
00067 
00068       ElecFilter(string InFileName, cfftw *fft2,fftPowerMatrices sfftPM2);
00069   
00070       void FilterElecSignal(void);
00071  
00072       void SetPhotodetector(Photodetector *oPhotodetector2);
00073 
00074          // add by Jonathan Hu
00075           string GetAnritsuFilterFileName(void)
00076             {return AnritsuFilterFileName;};
00077                         
00078       typeElecFilter GetTypeElecFilter(void)
00079             {return TypeElecFilter;};
00080 
00081       int GetOrderElecFilter(void)
00082             {return OrderElecFilter;};
00083 
00084       double GetCenterFreqElecFilter(void)
00085             {return CenterFreqElecFilter;};                         
00086 
00087       double GetFreqFWHM_ElecFilter(void)
00088             {return FreqFWHM_ElecFilter;};
00089       cplx GetMeasuredFilterFreq(int ii) 
00090             {return MeasuredFilterFreq[ii];};
00091       void SetFreqFWHM_ElecFilter(double FreqFWHM_ElecFilter2);
00092       
00093       void Set_f_3dB_ElecFilter(double f_3dB_ElecFilter2);
00094       
00095       double Get_f_3dB_ElecFilter(void)
00096             {return FreqFWHM_ElecFilter/2.;};
00097 
00098       void WriteFreqPowerGaussianFilter(string OutFileName);
00099       
00100       //writes to file the impulse response of the filter
00101       //that is the output signal when the input signal is an impulse
00102       //at the center of the time window
00103       void WriteTimePowerFilter(string OutFileName);
00104       // writes to file the frequency response of the filter
00105       void WriteFreqPowerFilter(string OutFileName);
00106 
00107       double ComputeMatchAndFilter(void);
00108 
00109       
00110      void GetClockRecoveryTime(BitString *oBitString); // By Wei Wang
00111      void WriteFreqCplxFilter(string OutFileName);
00112 
00113      double GetCurrentEquivalentSpectralWidth(void);
00114      void WriteFilterImpulseResponse(string FileNameImpulseResponseTime,
00115                                      string FileNameImpulseResponseFreq);
00116 
00117   int GetDebugLevel(void) {return DebugLevel;};
00118 
00119   // ######## PUBLIC DATA ##################
00120 
00123 
00124    double * AverageCurrentInBit;
00125 
00126   // ########## PRIVATE METHODS ##################
00127    
00128    private:
00129 
00130      void ElectricalFilterB5(cplx *my_power_time,cfftw *fft, 
00131                              double omega_0, double fwhm_norm);
00132      void ElectricalFilterB4(cplx *my_power_time,cfftw *fft, 
00133                              double omega_0, double fwhm_norm);
00134      void ElectricalFilterGaussian(cplx *my_power_time, 
00135                                    cfftw *fft, double omega_0, 
00136                                    double fwhm_norm);
00137 
00139      
00140      void IntegrateAndDumpFilter(cplx *my_power_time,cfftw *fft);
00141 
00144 
00152      void ElectricalFilterMeasured(void);
00153 
00155  
00156      void ReadMeasuredFilterData(void);
00157 
00158      void ReadMeasuredFilterData(cplx *MeasuredFilterFreq2);
00159 
00160    // the following function is writen by Jonathan Hu
00161          double GetPhase(double Frequency);
00162          void ReadElecPhase(string InFileName);
00163          void ReadElecPhasePaola(string InFileName);
00164         
00165          double GetElecGain(double Frequency);
00166          void ReadElecGain(string InFileName);
00167 
00168          double * xElecGain;
00169          double * yElecGain;
00170          double * y2ElecGain;
00171          double ElecGainStartFreq;
00172          double ElecGainStepFreq;
00173          int NumElecGainWidth;
00174 
00175          string AnritsuFilterFileName;
00176 
00177          double * xElecPhase;
00178          double * yElecPhase;
00179          double * y2ElecPhase;
00180         double ElecPhaseStartFreq;
00181         double ElecPhaseStepFreq;
00182         int NumElecPhaseWidth;
00183         int RunAnritsuFilter;
00184         void AnritsuFilter(cplx *my_power_time, cfftw *fft, double omega_0, 
00185                 double fwhm_norm);
00186         void AnritsuFilterPaola(cplx *my_power_time, cfftw *fft, 
00187                 double omega_0, 
00188                 double fwhm_norm);
00189         double GainPeak;
00190         double FreqGain3dB;
00191         
00192         double splint( double *xa,  double *ya,  double *y2a, int n, double x);
00193         void spline(double *x,  double *y,  int n, double yp1, double ypn,  double *y2);
00194         double GaussianSmooth(double *y, int Order, int N );
00195 
00196         // up to here (JH)
00197         
00198 
00200 
00226      void IntegrateAndDumpFilter_OLD(void);
00227  
00228      void AllocateMemoryForAverageCurrentinBit(void);
00229 
00230      double GetAverageCurrentInTimeRange(double LeftTime, 
00231                                          double RightTime);
00232 //       int GetBitWeightCenter(int index);
00233 
00234 
00235      cplx Bessel5(double omega, double omega_0, double FWHM);
00236      cplx Bessel4(double omega, double omega_0, double FWHM);
00237      double Gaussian(double omega, double omega_0, double FWHM);
00238 
00240 
00241     cplx IntegrateAndDump(double freq); 
00242 
00244 
00245      void Time2Freq(void);
00246  
00248 
00249     void Freq2Time(void);
00250 
00251    // ########## PRIVATE DATA ##################
00252   
00253       fftPowerMatrices sfftPM;
00254       cfftw *fft;   
00255       int ObjectInitialized;                  
00256       int qtPoints;
00257 
00258       double DeltaFreq, DeltaTime,FreqWindow, TimeWindow, BitLength; 
00259       double ClockRecoveryTimeForIntegrateAndDump;
00260       int StringLength;
00261 
00262 
00264 
00272       typeElecFilter TypeElecFilter;
00273       int OrderElecFilter;
00274       double FreqFWHM_ElecFilter; 
00275 
00276       // FreqFWHM_ElecFilter is the FWHM of the power of the filter
00277       // in the frequency domain. (JZ)
00278 
00279       double CenterFreqElecFilter;  
00280 
00282 
00284       string MeasuredElecFilterFileName;
00285 
00287 
00288       cplx * MeasuredFilterFreq;
00289       Photodetector *oPhotodetector;
00290 
00291       int DebugLevel;
00292 
00293    
00294 };
00295 
00296 #endif /*  _OCS_ELEC_FILTER_HH_ */
00297 
00298 
00299 
00300 
00301 
00302 
00303 

Generated on Fri Jul 2 2010 12:57:46 for OCS by  doxygen 1.7.1