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

ocsOptFiberLocalError.hh

Go to the documentation of this file.
00001 // $Id: ocsOptFiberLocalError.hh,v 1.8 2008/08/08 02:21:34 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_LOCAL_ERROR_HH_
00015 #define _OCS_OPT_FIBER_LOCAL_ERROR_HH_
00016 
00017 #include "ocsOptSignal.hh"
00018 #include "ocsRamanAmp.hh"
00019 
00020 
00022 
00028 enum typeRamanAmplification { NO_RAMAN = 0, 
00029                               SIMPLE_RAMAN = 1, 
00030                               FULL_RAMAN = 2 }; 
00031 
00032 
00034 
00061 enum typeFiberLossGain {LOSSY_FIBER = 0,
00062                         FIBER_AMPLIFIER = 1};
00063 
00098 enum typeFiberAmplifierNoise {FIBER_AMP_NOISE_OFF = 0,
00099                               FIBER_AMP_NOISE_GAUSSIAN_WHITE = 2};
00100 
00101 
00222 enum typeFiberAmplifierGain {FIBER_AMP_UNSATURATED_FLAT_GAIN = 0,
00223                              FIBER_AMP_SATURABLE_SUPERGAUSSFILT_GAIN = 1};      
00224 
00225 
00227 
00238 enum typeFastSaturableAbsorption {QUADRATIC_ANALYTIC=0,QUADRATIC=1};
00239 
00240 
00242 
00294 enum typeStepSizes { LOCAL_ERROR_3RD = 1, 
00295                      LOCAL_ERROR_2ND = 2, 
00296                      WALK_OFF = 3,
00297                      CONSTANT = 4 };
00298 
00301 
00302 enum { APPLY_ONCE = 0, APPLY_TWICE = 1 };
00303 
00574 class OptFiberLocalError
00575 {
00576 
00577  public:
00578 
00580 
00581   OptFiberLocalError(string InFileName, OptSignal *oOptSignal, RanNumGen *RNG2,
00582                     string Job2);
00583 
00584   void SetRamanAmpPointer(RamanAmp * oRaman2);
00585 
00587 
00588  ~OptFiberLocalError(void);
00589 
00591 
00592  void Propagate(double * PropagatedLength,int * ZStepNum);
00593 
00596 
00597  void PropagateWithRaman(double * PropagatedLength,
00598                          int * ZStepNum,
00599                          double  RamanStartingLength2);
00600  
00601  string WriteTypeSolver(void);
00602  string WriteTypeStepSizes(void); 
00603  string WriteTypeFiberLossGain(void);
00604  string WriteTypeFiberAmplifierNoise(void);
00605  string WriteTypeFiberAmplifierGain(void);
00606 
00607  void OpenStepSizesFile(string StepSizesFileName,int Mode);
00608  void WriteStepSizes(double PropagatedLength);
00609  void WriteAveragePowerdBm(double PropagatedLength2);
00610 
00611  // Get methods
00612 
00613  double GetFirstOrderDispersion() {return  FstOrDispFiber;};
00614  double GetSecondOrderDispersion() {return  SndOrDispFiber;};
00615  double GetFiberLength() {return LengthFiber;};
00616  double GetNepperAttenuationFiber() {return NepperAttenuationFiber;};
00617  double GetNonLinIndexFiber() {return NonLinIndexFiber;};
00618  double GetGamma() {return gamma;};
00619  double GetDeltaZ() {return DeltaZ;}; 
00620  int GetNumStepsBetweenScatterings() {return NumStepsBetweenScatterings;};
00621 
00622  void SetNumStepsBetweenScatterings(int value) 
00623         {NumStepsBetweenScatterings = value;
00624          SetFiberLengthsForPMD(); };
00625 
00627 
00628   double GetDispersion(double Wavelength);
00629 
00630  // Set methods
00631 
00632  void SetTypeStepSizes(int TypeStepSizes2);
00633  void SetWalkOffParameter(double WalkOffParameter2); 
00634  void SetConstantDeltaZ(double DeltaZValue);
00635 
00636  // void SetNumStepsBetweenScatterings(int Value);
00637 
00638  void SetOutputStepSizesFlag(int OutputStepSizesFlag2);
00639  void SetRelativeErrorGoal(double RelativeErrorGoal2);
00640 
00641 
00646  void SetFstOrDispFiber(double FstOrDispFiber2);
00647 
00652  void SetSndOrDispFiber(double SndOrDispFiber2);
00653  void RecoverSndOrDispFiber();
00654 
00655  void SetDispersion(double DispersionFiberRefWavelength,
00656                     double DispSlopeFiberRefWavelength); // s/m^2 and s/m^3
00657 
00662  void SetGammaFiber(double gamma2);
00663  void RecoverGammaFiber();
00664 
00667 
00668  void SetAttenuationdB(double AttenuationFiber2);
00669 
00673  
00674  void SetNepperAttenuation(double NepperAttenuation2);
00675 
00676 
00678 
00679  void SetFiberAmplifierUnsaturatedNepperGain(
00680            double FiberAmplifierUnsaturatedNepperGain2);
00681 
00687 
00688  void ComputeDeltaZMax(void);
00689 
00690  void SetWriteAveragePowerdBmFlag(int Value);
00691 
00692   void SetWritePulseWidthFlag(int Value) {WritePulseWidthFlag = Value;};
00693 
00694   void SetFiberLength(double Value);
00695   void SetScatteringStepSize(double Value);
00696 
00697   // ####### Methods related to Manakov-PMD equation ######
00698 
00699   void GetNewFiberRealization(void);
00700   void SetFiberRealization(int SectionNumber, 
00701                            double Theta2, double Phi2, double Psi2);
00702 
00703   void ApplyPMDCompleteScatteringFreqDomainOperator(
00704                        int ScatteringSectionIndex);
00705   
00706   void ComputeEulerMatrixAndUpdateOutputPDVector(int ScatteringSectionIndex);
00707 
00708   void GetEulerMatrix(double theta,double phi,double psi);
00709 
00710   void SetFiberLengthsForPMD(void);
00711 
00712   void SetMeanDGDPerSqrtLength(double MeanDGDPerSqrtLength2);
00713   void SetPMD(double PMD2);
00714   double GetFreqDerivativeOfBirefringence(void);
00715 
00716   double GetDGD(void);  
00717  
00718   void PropagateOutputPDVector(double Freq,
00719                                 double theta, double phi, double psi);
00720 
00721   double GetExpectedDGD() 
00722              {return sqrt(8./(3.*pi)*LengthFiber)*PMD; };
00723   double GetExpectedSndOrderDGD() 
00724              {return sq(GetExpectedDGD())/sqrt(3.); };
00725   double GetMeanDGD_SqrtLength(void) 
00726              {return sqrt(1e3)/1e-12*MeanDGDPerSqrtLength;};
00727 
00728   // JZ Commented out 
00729    void UpdateJonesMatrixAfterBiregringence(double StepSizeZ);
00730 
00731   // ########## PUBLIC DATA #####################
00732   
00733 
00734 public:
00735 
00736   RamanAmp * oRaman;
00737 
00738   // ########## PRIVATE METHODS ####################
00739 
00740  private:
00741 
00742   // Private Methods
00743 
00744  void PropagateWithPMD(double * PropagatedLength,
00745                                            int * ZStepNum);
00746 
00747  void PropagateWithoutPMD(double * PropagatedLength,
00748                                            int * ZStepNum);
00749 
00750  void PropagateLocalError(double * PropagatedLength, int * ZStepNum);
00751 
00752 
00753  void PropagateConstStepSizeOrWalkOff(double * PropagatedLength,
00754                                         int * ZStepNum);
00755 
00756 
00757  void ResetVolatileVariables(void);
00758 
00759  void inline UpdateFreq(void);
00760  void inline UpdateTime(void);
00761 
00762  void ComputeWalkOffStepSize(void);
00763 
00764  void ComputeDispersionOperator(double StepSizeZ);
00765  void ApplyDispersionOperator(bool ApplyTwiceFlag);
00766  void ApplySaturableGainOperator(double StepSizeZ);
00767  void ApplyFreqDomainOperator(bool ApplyDispersionTwiceFlag,
00768                               double GainSatStepSizeZ);
00769 
00770  void ApplyRamanOperator(double CurrentZValueWithinFiber2,double ZStep2);
00771  void ApplyTimeDomainOperator(double StepSizeZ);
00772 
00773  void ApplyKerrNonlinearityOperator(double StepSizeZ);
00774  void ApplyFastSaturableAbsorptionOperator(double StepSizeZ);
00775  void ApplyFastSaturableAbsorptionQuadraticAnalytic(double StepSizeZ);
00776  void ApplyFastSaturableAbsorptionHeunsMethod(double StepSizeZ);
00777  cplx FastSaturableAbsorptionFunction(cplx u);
00778 
00779  double ComputeMaxPower(void);
00780 
00781  void CopyFftMatricesFreqData(fftMatrices * OrigData,fftMatrices * CopyOfData);
00782 
00783  double ComputeThirdOrderSolutionAndRelativeError(void);
00784  double ComputeThirdOrderSolutionAndRelativeErrorOLD(void);
00785 
00786   // AccumulatedFirstOrderDispersion is a data member in the 
00787   // OptSignal class which keeps track of the total dispersion
00788   // (beta'') in s^2 which the signal has experienced.
00789   // The UpdateAccumulatedFirstOrderDispersion is called each z-step.
00790 
00791  void UpdateAccumulatedFirstOrderDispersion(double StepSize);
00792  void UpdateAccumulatedSecondOrderDispersion(double StepSize);
00793 
00797 
00798  void FiberAmplifierComputeSaturableGain(void);
00799 
00803 
00804  double FiberAmplifierComputeSaturableGainForHeunsMethod(bool FirstStep);
00805 
00808 
00809  double FiberAmplifierGetEnergyForHeunsMethod(bool FirstStep);
00810 
00815 
00828   void FiberAmplifierComputeNoiseAmplitudeFactor(double StepSize);
00829 
00832 
00833   void FiberAmplifierAddMonteCarloNoise(double StepSize);
00834 
00835   void AllocateMemoryForEulerAngles(void);
00836 
00837   // Private Raman Methods
00838   
00839   void ApplySimpleRamanOperator(double CurrentZValueWithinFiber2,
00840                                 double ZStep2);
00841 
00842   void ApplyFullRamanOperator(double CurrentZValueWithinFiber2,double ZStep2);
00843 
00844   // ########## PRIVATE DATA ######################
00845 
00846   // Private Data
00847 
00848  ofstream StepSizesFile;
00849 
00850  int OutputStepSizesFlag;
00851  int StepSizesFileMode;
00852  string Job;
00853 
00854  typeSimulation TypeSimulation;
00855 
00857   /* Options are 
00858      -# SCALAR_NLS = 1: The PDE is the scalar nonlinear Schroedinger equation
00859         as used in optical communications. This code can be run with or without
00860         the 8/9-ths factor in the Kerr nonlinearity term. This factor should
00861         be included when using a scalar PDE to
00862         model noise-free systems in the limit as the birefringence
00863         goes to zero, or more precsiely in the limit that the characteristic 
00864         length scale for PMD is longer than system length (See CRM's paper
00865         J Eng Math, Eqn 68).
00866      -# VECTOR_MANAKOV_PMD = 2: The PDE is the vector Manakov equation
00867         as in CRM's J Eng Math, Eqn (67), in the case that there is no linear
00868         PMD term and no nonlinear PMD. This equation is appropriate for
00869         simulations with noise when the characteristic 
00870         length scale for PMD is longer than system length.
00871      -# VECTOR_MANAKOV_NO_PMD = 3: The PDE is the vector Manakov equation
00872         as in CRM's J Eng Math, Eqn (67) with linear PMD (but not nonlinear
00873         PMD term). Includes the birefringence and random scattering on 
00874         the Poincare sphere.
00875   */
00876 
00877   typeSolver TypeSolver;
00878 
00879   typeStepSizes TypeStepSizes; // This variable used to be called
00880                                // TypeAlgorithm
00881 
00882 
00883   typeFiberLossGain TypeFiberLossGain;
00884 
00885   typeFiberAmplifierNoise TypeFiberAmplifierNoise;
00886 
00889 
00890   double FiberAmplifierSpontaneousEmissionFactor;
00891 
00893 
00909   double FiberAmplifierNoiseMaxStepSizeFactor;
00910 
00912   /*
00913 
00914     Used when TypeFiberLossGain = FIBER_AMPLIFIER and 
00915       TypeFiberAmplifierGain == FIBER_AMP_SATURABLE_SUPERGAUSSFILT_GAIN
00916 
00917     The step size is chosen to gaurantee that
00918 
00919     Power(z+delta_z)/Power(z) < FiberAmplifierGainSaturationMaxGainPerStep
00920    
00921     Note that this gain is specified on a linear scale.
00922 
00923     Default value is 1.01
00924 
00925     This ensures that power is correctly computed in calculation of saturable
00926     gain.
00927 
00928     \sa enum typeFiberAmplifierGain.
00929 
00930     \sa FiberAmplifierNoiseMaxStepSizeFactor
00931 
00932   */ 
00933 
00934   double FiberAmplifierGainSaturationMaxGainPerStep;
00935 
00937 
00938   double FiberAmplifierNoiseAmplitudeFactor;
00939 
00941 
00942   typeFiberAmplifierGain TypeFiberAmplifierGain;
00943 
00947 
00948   double FiberAmplifierSuperGaussFiltGainCoefficient;
00949 
00953 
00954   int FiberAmplifierSuperGaussFiltOrder;
00955 
00958 
00959   double FiberAmplifierUnsaturatedNepperGain;
00960 
00963 
00964   double FiberAmplifierSaturationEnergy;
00965 
00967 
00968   double FiberAmplifierSaturableGainPerLength;
00969 
00970   typeFastSaturableAbsorption TypeFastSaturableAbsorption;
00971 
00973 
00985   double FastSaturableAbsorptionCoefficient;
00986 
00989 
00990   bool DoFastSaturableAbsorptionFlag;
00991 
00996 
00997   bool DoTimeOperatorExactlyFlag;
00998 
01000 
01008   bool DispersionOperatorValid;
01009 
01027  int ScalarSolverEightNinthsFlag; 
01028 
01029  OptSignal * oOptSignal;
01030  RanNumGen * RNG;
01031  cfftw *fft;
01032  fftMatrices sfftM;  
01033 
01034  cplx * FreqDomainOperatorX;
01035  cplx * FreqDomainOperatorY;
01036 
01037  cplx * SqFreqDomainOperatorX;
01038  cplx * SqFreqDomainOperatorY;
01039 
01040   
01041  fftMatrices sfftM_Start;
01042  fftMatrices sfftM_Coarse;
01043  cplx * LaserWorkX;
01044  cplx * LaserWorkY;
01045 
01046 
01047  double LengthFiber;
01048  
01049  double RamanStartingLength;
01050  double PropagatedLengthStartFiber;
01051  int NumStepsBetweenScatterings; // For const step size second order algorithm
01052 
01053   double ReferenceFreq;
01054   double ReferenceWavelength;
01055 
01056 
01057   double DispersionFiberCenterWavelength; // s/(m^2)
01058   double DispSlopeFiberCenterWavelength; // s/(m^3)
01059 
01062 
01063  bool SetFstSndOrDispDirectlyFlag; 
01064 
01065  double FstOrDispFiber; // s^2/m
01066  double SndOrDispFiber;
01067  double SndOrDispFiber_Save;
01068  double NonLinIndexFiber;
01069 
01072 
01073  int    WithNonLin;                   
01074 
01075  double EffectAreaFiber;  
01076 
01078 
01092  double AttenuationFiber;      
01093 
01097 
01098  double NepperAttenuationFiber;
01099 
01100   typeRamanAmplification TypeRamanAmplification;
01101 
01102 // Variables for simple raman model
01103 
01104   double RamanOnOffGaindB;
01105   double NepperRamanGain;
01106   double NepperRamanPumpLoss;
01107 
01108  double CenterFreq;      
01109  int    qtPoints;
01110  double DeltaFreq;     
01111  double gamma;
01112  double gamma_Save;
01113 
01114  double CurrentZValueWithinFiber; 
01115    // Ranges from 0 to LengthFiber during
01116   // course of propagation within the current fiber
01117 
01119 
01124  double DeltaZ;
01125  double DeltaZMaxInfile, DeltaZMax;
01126 
01128 
01129  double DeltaZInitial;
01130 
01131  bool InitializedDeltaZInitialFlag;
01132  
01133  double WalkOffStepSize;
01134  double WalkOffLastStepSize;
01135  int WalkOffNumSteps;
01136  double WalkOffParameter;
01137  
01138  double MaxPower;
01139 
01140  double FWHM_Pulse;
01141 
01142  bool TimeDataValid;
01143  bool FreqDataValid;
01144 
01145  double RelativeError;
01146  double RelativeErrorGoal;
01147 
01148  int LocalErrorFreqLimit;
01149 
01150  int WriteAveragePowerdBmFlag;
01151  int WritePulseWidthFlag;
01152  
01153    // ####### Variables related to Manakov-PMD equation ######
01154 
01155   double *OutputPDVector;
01156   double *InputPDVector;
01157   
01158   // Variables related to birefringence strength
01159 
01160  double PMD;
01161  double MeanDGDPerSqrtLength;
01162 
01163  // Variables related to random rotation of axes of birefringence
01164 
01165  double ScatteringStepSize;
01166  cplx EulerMatrix[2][2];
01167 
01168   int NumberScatterings;
01169   double TotalLengthFiber;
01170   double LengthFiberExceptLast, LengthFiberLast;
01171 
01172   // Arrays for length NumberScatterings for the Euler angles
01173 
01174   double * Theta;
01175   double * Phi;
01176   double * Psi;
01177 
01178  double *PDVectorHai;             //added by Hai 8/14/03
01179  
01180  
01181  cplx *JonesMatrix;   //added by Hai 7-1-03
01182  int NumberOfChannels;  //added by Hai 7-1-03
01183  double *FreqChannels;   //added by Hai 7-1-03
01184 
01185 
01186 
01187 
01188 };
01189 
01190 #endif /* _OCS_OPT_FIBER_LOCAL_ERROR_HH_ */
01191 
01192 
01193 
01194 
01195 

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