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

ocsReduOptSignal.hh

Go to the documentation of this file.
00001 // $Id: 
00002 //###################################################################
00003 //
00004 //           Optical Communication Systems Simulator
00005 //
00006 //       Copyright (2000):
00007 //       Optical Fiber Communications Laboratory (OFCL)
00008 //       Computer Science & Electrical Engineering Department (CSEE)
00009 //       University of Maryland Baltimore County (UMBC)
00010 //
00011 //###################################################################
00012 
00013 #ifndef _OCS_REDU_OPT_SIGNAL_HH_
00014 #define _OCS_REDU_OPT_SIGNAL_HH_
00015 
00016 #ifndef _OCS_SYSTEM_HDRS_
00017 #define _OCS_SYSTEM_HDRS_
00018 
00019 #include <iostream.h>
00020 #include <string.h>
00021 #include <math.h> 
00022 #include <fstream.h>
00023 #include <complex.h>
00024 #include <stdlib.h>
00025 #include <stdio.h>
00026 #include <strstream>
00027 
00028 #include <string>
00029 using namespace std;
00030 
00031 
00032 #endif /* _OCS_SYSTEM_HDRS_ */
00033 
00034 #include "ocsConst.hh"
00035 #include "ocsReducedModelTools.hh"
00036 #include "ocsReadWriteTools.hh"
00037 #include "ocsRanNumGen.hh"
00038 #include "ModulationFormats.hh"
00039 
00040 #ifndef _OVERLOADED_OPERATORS_
00041 #define _OVERLOADED_OPERATORS_
00042 //## Added by Ivan Lima to make the source compatible with g++
00043 //## Most of the new code consists of overloading operators
00044 
00045 inline double log (int a);
00046 inline double log(int a)
00047 {
00048    return log( (double) a );
00049 }
00050 
00051 inline double sqrt(int a);
00052 inline double sqrt(int a)
00053 {
00054    return sqrt( (double) a );
00055 }
00056 
00057 // End of extra 
00058 #endif   // _OVERLOADED_OPERATORS_
00059 
00060 
00062 
00071 // ##### Class ReduOptSignal
00072 class ReduOptSignal
00073 {
00074    public:
00075 
00077       ReduOptSignal(string InFileName, 
00078                     double SignalNoiseBandwidth2);
00079 
00080 
00082 
00083       ReduOptSignal(string InFileName2,string JobName);
00084 
00085 
00087       ~ReduOptSignal();
00088 
00090 
00091       ReduOptSignal(ReduOptSignal & OrigReduOptSignal);
00092 
00094 
00095    ReduOptSignal & operator=(ReduOptSignal & RHS_ReduOptSignal);
00096 
00097 
00101 
00102   void AddReducedNoise(ReduOptSignal * ReduOptSignal1);
00103 
00106 
00107       void RegenerateReduOptSignal(void);
00108 
00113 
00114       void RegenerateReduOptSignal(double * OptPowerChannArray2);
00115 
00121 
00122       void RegenerateReduOptSignalVaryingPower(void);
00123 
00124 
00125 
00127 
00128       void DepolarizeReduNoise(void);
00129 
00132 
00133       void WriteFileOptSignal(char *outFile);
00134 
00136 
00137       void WriteMatlabFileOptSignal(string OutFileName);
00138 
00139 
00141  
00142  
00143      void SetOptElecFilterBandwidth
00144                    ( double OptFilterBandwidthTmp
00145                     ,double ElecFilterBandwidthTmp);
00146 
00148  
00149      void SetOptElecFilterBandwidth
00150                    ( string FileNameOptFilter
00151                     ,string FileNameElecFilter);
00152 
00153       void SetEnhancementFactor(double EnhancementFactorTmp)
00154            {EnhancementFactor = EnhancementFactorTmp;};    
00155 
00156       double GetChannSpacing(void) {return ChannSpacing;}; 
00157 
00158       double GetSignalNoiseBandwidth(void) 
00159              {return SignalNoiseBandwidth;};
00160 
00161 
00163 
00165       double GetDegreeOfPolarization(void);
00166 
00168 
00169       double GetTotalPower(void);
00170 
00172 
00173       double GetSignalPower(void);
00174 
00176 
00177       const char * WriteTypePulse(void);
00178 
00179 
00180 
00182 
00183       double GetQ_Factor(int ChannelArrayIndex);
00184 
00185       double GetBitErrorRate(double Q_Factor) {return 
00186                 exp(-sq(Q_Factor)/2)/(Q_Factor*sqrt(2*pi));};
00187 
00189 
00190       double GetOptSNR(int ChannelArrayIndex);
00191 
00192       double GetSignal(int ChannelArrayIndex) 
00193          {return StokesSignal[0][ChannelArrayIndex];};
00194 
00196 
00197       void GetTotalStokes( double *StokesTotal);
00198 
00200 
00207       double GetStokesSignal(int StokesIndex,
00208                              int ChannelArrayIndex)
00209          {return StokesSignal[StokesIndex][ChannelArrayIndex]
00210                 /StokesSignal[0][ChannelArrayIndex];
00211          };
00212        
00214 
00215       double GetNoiseInsideChannel(int ChannelArrayIndex);
00216       double GetScalarProdSignalNoise(int ChannelArrayIndex);      
00217       double GetCoPolarizedNoiseInsideChannel(int ChannelArrayIndex);
00218       double GetOrthogPolarizedNoiseInsideChannel(int ChannelArrayIndex);            
00219  
00221 
00228       double GetStokesNoiseInsideChannel(int StokesIndex,
00229                              int ChannelArrayIndex)
00230          {
00231          //return StokesNoise[StokesIndex][ChannelArrayIndex]
00232          //       /StokesNoise[0][ChannelArrayIndex];
00233             return GetStokesNoise(StokesIndex,ChannelArrayIndex);
00234          };
00235 
00236       double GetStokesNoise(int StokesIndex,
00237                              int ChannelArrayIndex)
00238          {return StokesNoise[StokesIndex][ChannelArrayIndex]
00239                 /( StokesNoise[0][ChannelArrayIndex] );
00240             //      +StokesExtraUnpolChannNoise/NumChannels );
00241          };
00242 
00245   
00246 
00247       double GetNoiseInsideBandwidth(int ChannelArrayIndex,
00248                                      double BandwidthNoise);
00249 
00253 
00254       double GetTotalNoiseSpectralDensity(void)
00255         { return GetNoiseInsideBandwidth(0,1.0);};
00256 
00257       double GetCoPolarizedNoiseInsideBandwidth(int ChannelArrayIndex,
00258                                               double BandwidthNoise );
00259       double GetOrthogPolarizedNoiseInsideBandwidth(int ChannelArrayIndex,
00260                                               double BandwidthNoise );
00261                                               
00262       double GetNormSignalNoiseBeatingCopolarized(int ChannelArrayIndex);
00263                                               
00264       double GetNormSignalNoiseBeatingOrthogPolarized(int ChannelArrayIndex);
00265 
00266 
00268 
00269       double GetElecTimeDomainSNR(int ChannelArrayIndex);
00270 
00274 
00275       double GetOutageProbGaussian(double MeanPenalty, 
00276                    double StdDevPenalty, double MaxAcceptablePenalty);
00277 
00279 
00280       void SetNumChannels(int NumChannels2);
00281       void SetOptPowerChannel(double OptPowerChann2) 
00282             {OptPowerChann = OptPowerChann2;};      
00283 
00284       int GetNumChannels(void) {return NumChannels;};
00285       double GetOptPowerChann(void) {return OptPowerChann;};
00286       double GetBitRateChann(void)  {return BitRateChann;};
00287 
00289 
00290       int GetChannelArrayIndex(int ChannelPhysicalIndex);
00291 
00293 
00294       int GetChannelPhysicalIndex(int ChannelArrayIndex);
00295 
00297 
00298       double GetCenterFreq(void) {return CenterFreq;};
00299 
00301 
00304       double GetFrequency(int ChannelArrayIndex) 
00305              {return Frequency[ChannelArrayIndex];};
00306 
00307   
00308       double GetEnhancementFactor(void)
00309              {return EnhancementFactor;};    
00310 
00311 
00313 
00314       void SetInStokes( const int ChannelArrayIndex
00315                        ,double * StokesVector);
00316 
00318 
00319       double GetInStokes( const int ChannelArrayIndex
00320                          ,const int StokesIndex);
00321 
00322 
00323 
00324       // ## These vectors contain the actual data
00325 
00327 
00330       double *StokesSignal[4];
00331 
00333 
00336       double *StokesNoise[4];
00337 
00338    private:
00339 
00340       // ## Private Methods
00341 
00344 
00345       void AllocateMemory(void);
00346 
00348 
00349       void ReleaseMemory(void);
00350 
00353 
00354       void ProcessReduOptSignalParameters(ifstream *InFile);
00355 
00358 
00359       void InitializeInStokes(ifstream * InFile);
00360 
00361 
00363 
00371       int ReadInStokes( string InStokesName
00372                        ,int ch
00373                        ,ifstream * InFile);
00374 
00375 
00377 
00378       void SetInStokes( const int ChannelArrayIndex 
00379                        ,const int StokesIndex 
00380                        ,double StokesValue);  
00381 
00383 
00384       double *GetInStokes(const int ChannelArrayIndex);
00385 
00386 
00388 
00389   void ReadFileFreqPower(string FrequencyDataInFileName);
00390 
00391 
00392       // ## Private data
00393 
00395 
00399       typePulse TypePulse;
00400 
00402 
00413       double CenterFreq;
00414 
00416 
00421       double CenterWavelength;
00422 
00424       int NumChannels;
00425 
00427 
00434       double ChannSpacing;
00435 
00437 
00449       double SignalNoiseBandwidth;
00450 
00451 
00453 
00457       double BitRateChann;
00458 
00460 
00461       double OptPowerChann; 
00462 
00465 
00466       double * OptPowerChannArray; 
00467 
00468 
00470 
00471       double *InStokes;
00472 
00474 
00479       double OptFilterBandwidth;
00480 
00482 
00486       double ElecFilterBandwidth;
00487 
00489 
00499       double EnhancementFactor;
00500 
00502 
00506       string InFileName;
00507 
00510 
00511       double *Frequency;
00512 
00513 };
00514 
00515 #endif // _OCS_REDU_OPT_SIGNAL_HH_
00516 
00517 
00518 
00519 
00520 
00521 
00522 
00523 
00524 
00525 
00526 
00527 

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