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

ocsPhotodetector.hh

Go to the documentation of this file.
00001 // $Id: ocsPhotodetector.hh,v 1.2 2008/08/08 02:22:28 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_PHOTODETECTOR_HH_
00015 #define _OCS_PHOTODETECTOR_HH_
00016 
00017 #include "ocsOptSignal.hh"
00018 
00019 // ##### This structure simplifies the access to the field matrices
00020 
00021 #ifndef _PHOSSIL_FFT_POWER_MATRICES_
00022 #define _PHOSSIL_FFT_POWER_MATRICES_
00023 
00024 struct fftPowerMatrices 
00025 {
00026       cplx* tPowerSignal;    
00027       cplx* fPowerSignal;
00028 };
00029 
00030 #endif /* _PHOSSIL_FFT_POWER_MATRICES_ */
00031 
00032 // ##### Class Photodetector
00033 class Photodetector
00034 {
00035    public:
00036       Photodetector();
00037       Photodetector(string InFileName,OptSignal *oOptSignal2);
00038       Photodetector(string InFileName,OptSignal *oOptSignal2,RanNumGen *RNG2);
00039 
00040      // Use this constructor when you have multiple receivers and you
00041      // want to save memory:
00042 
00043       Photodetector(string InFileName,OptSignal *oOptSignal2,RanNumGen *RNG2,
00044                     fftPowerMatrices & sfftPM2,fftPowerMatrices & WorksfftPM2);
00045 
00046       Photodetector(Photodetector & OrigPhotodetector);
00047                                                    // Copy constructor
00048 
00049       Photodetector & operator=(Photodetector & RHS_Photodetector);
00050       
00051       void SetOptSignal(OptSignal *oOptSignal2);
00052 
00053       ~Photodetector();
00054       void ReleaseMemory();
00055       void InitPhotodetector();
00056       void DetectOptSignal();
00057 
00058       void AddShotNoise(void);
00059       void AddShotNoiseOLD(void);
00060 
00061       double GetRFPower(double Freq);
00062       double GetRFPhase(double Freq);
00063       double GetRFPowerFromFreqIndex(int FreqIndex);
00064       double GetRFPhaseFromFreqIndex(int FreqIndex);
00065 
00066       void ComputeWorkDifferentiatedThenSquaredElecSignal(void);
00067       void ComputeWorkContEXORElecSignal(void);
00068       void ComputeWorkBinaryEXORElecSignal(void);
00069       void ComputeWorkSumDelayedHalfBitPeriodThenSquare(void);
00070 
00071       //double GetAverageCurrent(void);
00072       double GetAverageElecPower(void);
00073       double GetAverageElecCurrent(void);
00074 
00075       double GetAverageAbsElecPower(void);
00076 
00077       double GetMaxCurrentIsolatedBit1(void);
00078       double GetSignalBandwidth(void);
00079 
00080       void InitPhotodetector(cfftw *fft2
00081                            ,fftMatrices sfftM2
00082                            ,double ConvFactOptElecPhotod2);      
00083 
00086 
00087       void GenerateImpulseCurrent(void);
00088   
00089       void Time2Freq(void);
00090       void Freq2Time(void);
00091       void WorkTime2Freq(void);
00092       void fftshift(void);
00093       void ifftshift(void);
00094       void TimeShiftSignal(double dTime);
00095 
00096       double GetConvFactOptElecPhotod()
00097             {return ConvFactOptElecPhotod;};
00098       int GetQtPoints(void) {return qtPoints;};
00099       double GetDeltaTime(void) {return DeltaTime;};
00100       double GetDeltaFreq(void) {return DeltaFreq;};
00101       double GetTimeWindow(void) {return TimeWindow;};
00102       double GetFreqWindow(void) {return FreqWindow;};
00103       int GetStringLength(void) {return (int) (TimeWindow/BitPeriod );};
00104       
00105   int GetDebugLevel(void) {return DebugLevel;};
00106 
00107       void WriteFileTimePower(string OutFile);
00108       void WriteFileFreqPower(string OutFile,int OmitDCFlag);
00109       void WriteFileFreqPower(string OutFile);
00110       
00111       // // ## Methods suitable for electrical equalization
00112       //void ClearElecSignal(void);
00113       //void AddElecSignal(Photodetector *oPhotodetectorOrig);
00114       //void AddElecSignal(Photodetector *oPhotodetectorOrig,
00115       //                            double MultiplFactor, 
00116       //                            double AmpShiftBeforeMultipl,
00117       //                            double TimeShift);
00118       //void AddConstantElecSignal(double ConstantIntensity);
00119                               
00120       fftPowerMatrices sfftPM; 
00121       fftPowerMatrices WorksfftPM; 
00122            //  Required in ComputeWork... methods of Photodetector that are
00123            // called by double ElecSignalStat::ComputePhaseTargetFreq(void)
00124 
00125       cfftw *fft;
00126       OptSignal *oOptSignal;
00127 
00128    private:      
00129       
00130       
00131       fftMatrices sfftM;  
00132        
00133       int ObjectInitialized;             
00134       int qtPoints,qtPointsLast;
00135       double ConvFactOptElecPhotod;
00136       double DeltaFreq, DeltaTime,FreqWindow,TimeWindow;
00137       double BitPeriod;
00138 
00139      // Parameters related to shot noise
00140 
00141       int AddShotNoiseFlag;
00142       double ShotNoiseCoeff;
00143 
00144       double ShotNoiseVarianceCoeff; // Out of date
00145 
00146       RanNumGen * RNG;
00147 
00148   int DebugLevel;
00149 
00150      };
00151 
00152 #endif /* _OCS_PHOTODETECTOR_HH_ */
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 

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