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

ocsOptFiber.hh

Go to the documentation of this file.
00001 // $Id: ocsOptFiber.hh,v 1.2 2006/05/11 23:46:04 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_OPT_FIBER_HH_
00015 #define _OCS_OPT_FIBER_HH_
00016 
00017 
00018 #include "ocsOptSignal.hh"
00019 
00020 // ##### Class OptFiber
00021 
00022 class OptFiber
00023 {
00024    public:
00025 
00026       OptFiber();
00027 
00028   // #########################################
00029   // 
00030   // ## The following methods added by John Zweck
00031 
00032   // Use this constructor:
00033 
00034   OptFiber(string InFileName, OptSignal *oOptSignal2, RanNumGen *RNG2);
00035 
00036   // This method modifies X polarization only and should be used 
00037   // in conjunction with OptAmplifier::AmplifySignalScalar()
00038       
00039   void PropagateFiberScalarNLS(double *PropagatedLengthFiber);
00040 
00041  // This method modifies X and Y polarizations  and can be used when there
00042   // is no PMD, but where the amps have PDL/PDG
00043   // It should be used 
00044   // in conjunction with OptAmplifier::AmplifySignal
00045 
00046   void PropagateFiberDecoupledNLS(double *PropagatedLengthFiber);
00047 
00048   // ## The PropagateFiberScalarNLS method outputs dist-time-power
00049   // ## data at  FirstWriteLength + k*DeltaWriteLength for k=0,1,2...
00050   // ## provided the flag  WriteFlag is set.
00051   // ## The TimeIndexIncrement variable enables the data to be sampled
00052   // ## in time every TimeIndexIncrement
00053   // ## The int *NumSlicesZ keeps track of how many times we have written
00054   // ## out the data along the whole transmission line.
00055   // ## Note that it you can initially have 
00056   // ## PropogatedLengthFiber > FirstWriteLength
00057   // ## in which case you output at the first k for which 
00058   // ## PropogatedLengthFiber >= FirstWriteLength + k*DeltaWriteLength
00059   // ## To make sure this is done correctly we need to also pass 
00060   // ## NumSlicesFirstWriteLength.
00061 
00062 
00063       void PropagateFiberScalarNLSWriteData(double *PropagatedLengthFiber,
00064                                    int WriteFlag,
00065                                    char *DistTimePowerPhaseFileName,
00066                                    int TimeIndexIncrement,
00067                                    double FirstWriteLength,
00068                                    double DeltaWriteLength, 
00069                                    int *NumSlicesZ,
00070                                    int NumSlicesFirstWriteLength);
00071 
00072 
00073       void SwitchOptSignalData(OptSignal *oOptSignal2);
00074       void SetLengthFiberAndQtStepsFiber(double Length,int numSteps);
00075       void SetStepLengths(double *usrStepLength); 
00076       void SetStepLength(double StepLength, int StepNumber); //## Avoid this function
00077       void SetSndOrDispFiber(double SndOrDispFiber2);
00078       void SetFstOrDispFiber(double FstOrDispFiber2);
00079       void SetGammaFiber(double gamma2);
00080       void SetAttenuation(double AttenuationFiber2);
00081 
00082 
00083 
00084       void GetRandomStepLengths(double RelativeRangeLengths); 
00085       void WriteFileStepLengths(char *outFile);       
00086           
00087 
00088       //## The next two functions are out of the standard
00089       //## Anyway, we can live with that.
00090       double GetFirstOrderDispersion() {return  FstOrDispFiber;};
00091       double GetSecondOrderDispersion() {return  SndOrDispFiber;};
00092       double GetFiberLength() {return LengthFiber;};
00093 
00094       double GetFstOrDispFiber() {return  FstOrDispFiber;};
00095       double GetSndOrDispFiber() {return  SndOrDispFiber;};
00096       void   WriteFileDispersionProfile(char *outFile);  
00097       double GetLengthFiber() {return LengthFiber;};
00098       int    GetQtStepsFiber() {return qtStepsFiber;};
00099       double GetAttenuationFiber() {return AttenuationFiber;};
00100       double GetNepperAttenuationFiber() {return NepperAttenuationFiber;};
00101       double GetNonLinIndexFiber() {return NonLinIndexFiber;};
00102       double GetGamma() {return gamma;};
00103 
00104 
00105       void SetNonLinCoupling(double a11, double a12, double a21, double a22) 
00106             {NonLinCoupling[0][0] = a11;
00107              NonLinCoupling[0][1] = a12;
00108              NonLinCoupling[1][0] = a21;
00109              NonLinCoupling[1][1] = a22;};
00110 
00111   // ##############################
00112 
00113       ~OptFiber();
00114 
00115 
00116       //###########################
00117       //## Methods related to PMD
00118       void SetMeanDGD_SqrtLength(double MeanDGD_SqrtLength2);
00119       void SetPMD_Fiber(double PMD_Fiber2);   
00120 
00121       void GetFiberSampleCompleteScatt(void);
00122       void SkipOptFibers(int qtOptFibersSkipped);
00123       
00124       void PropagateFiberCoupledNLS(double *PropagatedLength);
00125 
00126       void PropagateFiberCoupledNLS(void)
00127          {double PropagatedLength;
00128           PropagateFiberCoupledNLS(&PropagatedLength);}; //## IL (9/6/02)
00129 
00130       void PropagateFullNonlinearFiberCoupledNLS(double *PropagatedLengthFiber)
00131             {PropagateFullNonlinearFiberCoupledNLS(PropagatedLengthFiber,0);};      
00132 
00133       void PropagateFullNonlinearFiberCoupledNLS(double *PropagatedLengthFiber,
00134                                                  double DampTime);
00135                   
00136 
00140 
00141       void PropagateFiberCoupledNLSFreqDomainOnly(double *PropagatedLength);
00142 
00143       void TransformJonesVectorThroughFiber(double RelFreq,cplx *JonesVec);
00144 
00145       void GetFiberSampleUnifRz(void);
00146       void GetFiberSampleUnifRyRzRy(void);
00147       void GetFiberSampleUnifRxRzRy(void);
00148 
00149       //## Apply Importance Sampling (high DGDs for BiasingParam > 0)
00150       double GetFiberSample(int TypeDistrib, double BiasingParam);     
00151       double GetFiberSampleImportSamplingFstSndOrderPDV_Exp(
00152                                  double BiasedAngleFstOrder,
00153                                  double BiasingParamFstOrder,
00154                                  double BiasingParamSndOrder);        
00155 
00156       double GetFiberSampleImportSamplingFstSndOrderPDV_VariableAngleExp(
00157                                  double BiasedAngleFstOrder,
00158                                  double BiasingParamFstOrder,
00159                                  double BiasingParamSndOrder);    
00160 
00161       double GetFiberSampleImportSamplingExp(double BiasingParam);
00162       double GetFiberSampleImportSamplingCosRx(double BiasingParam);
00163       double GetFiberSampleImportSamplingSndOrderPDV_Exp(
00164                                            double BiasedAngle,
00165                                            double BiasingParam);
00166       double GetFiberSampleImportSamplingSndOrderPDV_VariableAngleExp(
00167                                      double BiasedAngle,
00168                                      double BiasingParam); 
00169 
00170       double GetHeuristicBalanceForSndOrderPDV_VariableAngleExp(
00171                             string InFileNameWithDirectories, 
00172                             string InFileNameWithImpSampWeights,
00173                             string OutFileNameWithHeuristicBalance); 
00174                                      
00175       void SetScatteringMatrix( int IndexStep, double Theta
00176                                ,double Phi, double Psi);
00177       void SetScatteringMatrixRxRzRy( int IndexStep, double Theta 
00178                                 ,double Phi, double Psi);                              
00179       void SetScatteringMatrixRzRxRzRyRzRy( int IndexStep, 
00180       double Chi, double Ksi,double Delta,double Phi,double Theta, double Psi)  ;                               
00181            
00182       double GetDGD(double Freq);   
00183       double GetDGD_Manakov(double Freq);  // ## Slower version    
00184       double GetSndOrderDGD(double Freq);
00185       double GetThirdOrderDGD(double Freq);
00186       double Get_dDGD_domega(double Freq);
00187       double GetNum_dDGD_domega(double Freq);
00188       double GetNum_d2DGD_domega2(double Freq);      
00189       void GetInPD_Vector(double Freq, double *InPD_Vector);   
00190       void GetInPD_VectorOld(double Freq, double *InPD_Vector);   
00191       void RotateThroughFiber(double Freq, double *OutVector);         
00192       void GetOutPD_Vector(double Freq, double *OutPD_Vector);
00193       void GetOutPD_VectorOld(double Freq, double *OutPD_Vector);
00194       void GetSndOrderOutPD_Vector(double Freq
00195                                   ,double *SndOrderOutPD_Vector);
00196       void GetSndOrderOutPD_Vector(double Freq
00197                                   ,double *SndOrderOutPD_Vector
00198                                   ,double *OutPD_Vector);
00199       void GetNumSndOrderOutPD_Vector(double Freq
00200                                   ,double *SndOrderOutPD_Vector);
00201       void GetThirdOrderOutPD_Vector(double Freq
00202                                   ,double *ThirdOrderOutPD_Vector);
00203      void GetThirdOrderOutPD_Vector(double Freq
00204                                   ,double *ThirdOrderOutPD_Vector
00205                                   ,double *SndOrderOutPD_Vector
00206                                   ,double *OutPD_Vector);
00207       void GetNumThirdOrderOutPD_Vector(double Freq
00208                                   ,double *ThirdOrderOutPD_Vector);
00209       void GetNumOutPD_Vector(double *NumOutPD_Vector[3]);      
00210       double GetExpectedDGD(void)
00211              {return rms2meanDGD()*sqrt(LengthFiber)*PMD_Fiber; };
00212       //       {return sqrt(8./(3.*pi)*LengthFiber)*PMD_Fiber; };
00213       double GetExpectedSndOrderDGD(void) 
00214              {return sq(GetExpectedDGD())/sqrt(3.); };
00215       double GetExpectedThirdOrderDGD(void) 
00216              {return cube(GetExpectedDGD())/sqrt(7./3.); };
00217       double GetMeanDGD_SqrtLength(void) 
00218              {return sqrt(1e3)/1e-12*MeanDGD_SqrtLength;};
00219              //## return value in ps/km^{1/2}
00220 
00221       double GetLocalBeatLength(void);
00222 
00223       double GetLocalBeatLength(double Freq) 
00224          {return 2*pi/abs(2*dBeta_2dOmega*2*pi*Freq);};
00225 
00226       //FiberParam soOptFiber;
00227 
00228       //double ExpectedDGD;
00229       //double ExpectedSndOrderDGD;
00230 
00231 
00232    private:
00233       void AllocateMemory_SetLengthSteps(void); 
00234       double rms2meanDGD(void);
00235       void ReleaseMemory(void);
00236       void GetEulerMatrix(int IndexStep);
00237       void GetRyRzRyMatrix(int IndexStep);
00238       void GetRxRzRyMatrix(int IndexStep);
00239       void GetRxRzRyRzRyMatrix(int IndexStep); 
00240       void GetRzRxRzRyRzRyMatrix(int IndexStep);     
00241       void GetTmOut(void);
00242       int TypeScattering; // ## 1 -> Euler Matrix; 2 -> RyRz
00243       OptSignal *oOptSignal;
00244       cfftw *fft;
00245       fftMatrices sfftM;                   
00246       int    MemAllocated;
00247       
00248       RanNumGen * RNG;
00249       
00250       int    GotFiberSample;
00251       double *theta,*psi,*phi; 
00252       double *delta,*ksi, *chi; //## For biasing the 2nd Order PDV
00253       double *StepLength; 
00254       int    qtStepsFiber;
00255       int    qtStepsFiberLast;
00256       double LengthFiber;
00257       double PMD_Fiber;
00258       double MeanDGD_SqrtLength;
00259       double FstOrDispFiber;
00260       double SndOrDispFiber;
00261       double NonLinIndexFiber;
00262       int    WithNonLin;              
00263       double EffectAreaFiber;  
00264       double AttenuationFiber;      
00265       double NepperAttenuationFiber;
00266       double CenterFreq;      
00267       int    qtPoints;
00268       double DeltaFreq;     
00269 
00270       double cvtheta2,cvtheta;      
00271       cplx   *TransM[2][2]; // ## Vector with all complex 2x2 Euler Matrix
00272         
00273       double DeltaZ;         
00274       double dBeta_2dOmega;
00275       double gamma;
00276       double NonLinCoupling[2][2];
00277 
00278       // ## Variables used for numerical calculation of PD vector
00279       fftMatrices sfftNumPD_Vector;
00280       double *Tmp1PD_Vector[3];        
00281       double *Tmp2PD_Vector[3];    
00282       double *Dev1PD_Vector[3];       
00283       double *Dev2PD_Vector[3];             
00284       
00285       //## For the importance sampling
00286       bool FlagImportSamplingSndOrderPDV_VariableAngleExp;
00287 
00288       int DebugLevel;
00289 }; 
00290 
00291 #endif //## _OCS_OPT_FIBER_HH_
00292 
00293 
00294 
00295 
00296 
00297 
00298 
00299 
00300 
00301 

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