00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef _OCS_OPT_FIBER_HH_
00015 #define _OCS_OPT_FIBER_HH_
00016
00017
00018 #include "ocsOptSignal.hh"
00019
00020
00021
00022 class OptFiber
00023 {
00024 public:
00025
00026 OptFiber();
00027
00028
00029
00030
00031
00032
00033
00034 OptFiber(string InFileName, OptSignal *oOptSignal2, RanNumGen *RNG2);
00035
00036
00037
00038
00039 void PropagateFiberScalarNLS(double *PropagatedLengthFiber);
00040
00041
00042
00043
00044
00045
00046 void PropagateFiberDecoupledNLS(double *PropagatedLengthFiber);
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
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);
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
00089
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
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);};
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
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);
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
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
00220
00221 double GetLocalBeatLength(void);
00222
00223 double GetLocalBeatLength(double Freq)
00224 {return 2*pi/abs(2*dBeta_2dOmega*2*pi*Freq);};
00225
00226
00227
00228
00229
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;
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;
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];
00272
00273 double DeltaZ;
00274 double dBeta_2dOmega;
00275 double gamma;
00276 double NonLinCoupling[2][2];
00277
00278
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
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