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

ocsRamanAmp.hh

Go to the documentation of this file.
00001 // $Id: ocsRamanAmp.hh,v 1.3 2008/08/08 02:23:11 zweck Exp $
00002 
00003 //###################################################################
00004 //
00005 //           Optical Communication Systems Simulator
00006 //
00007 //       Copyright (2001):
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_RAMAN_AMP_HH_
00015 #define _OCS_RAMAN_AMP_HH_
00016 
00017 //#include "ocsGlobalStructures.hh"
00018 #include "ocsOptSignal.hh"
00019 
00020 enum typeRamanNoise { RAMAN_NOISE_OFF = 0, 
00021                           RAMAN_NOISE_ON_RANDOM_PHASE = 1,
00022                                                   RAMAN_NOISE_ON_GAUSSIAN_WHITE = 2,
00023                                                   RAMAN_NOISE_ON_NO_RNG = 3 }; 
00024 // ##### Class RamanAmp
00025 
00026 class RamanAmp
00027 {
00028    public:
00029 
00030     //#### Methods by Jonathan Hu:
00031     // Please see algorithm in: Bumki Min, PTL vol.12 No. 11
00032         // P.1486-1488 Nov. 2000 also see Howard Kidorf, PTL vol 11. No. 5. pp. 530-532
00033         // May 1999
00034         //
00035         
00036       RamanAmp();
00037       ~RamanAmp();
00038       void ReleaseMemory();
00039           RamanAmp(string Job, string InFileName, RanNumGen *RNG2, int TNumFiber);
00040           
00041           RamanAmp(string Job, string InFileName, RanNumGen *RNG2, OptSignal *oOptSignal1,
00042                          int TNumFiber);
00043           
00044           void AllocateMemory();
00045           
00046           void PrepareSignal();
00047           void PrepareSignalCW();
00048           void PrepareSignalNonFourier();
00049           void SetGainProfile(double FiberLength, string InFileName);
00050           void ReadPlainFileGainLoss(double FiberLength,string InFileName);
00051           void ReadRamanGainLossWavelengthGrid(double FiberLength,string InFileName);
00052           void PrepareNextStep();
00053                 //      asdg
00054 //      void InitRamanIteration();
00055           void RamanIteration();
00056           void AddNoise();
00057           void PropagateSignalandNoise(OptSignal *NFSignal, OptSignal *Noise);
00058           void PropagateNoise(OptSignal *Noise);
00059           
00060           void ShootingGeneticAlgorithmsVictor();
00061           void GeneticAlgorithmsVictor(double * Vector);
00062         
00063         
00064         
00065           void PrepareSignalStart();
00066           void PrepareSignalLastRound();
00067           void CallLastRound();
00068           void ForwardLastRound(int StepI);
00069           double OptimizeForwardIntegrationLastRound(int IntStepI, double * PreSig);
00070           void SingalRayleighBScattteringBackward(int StepI);
00071           void DoubleRayleighBScattteringForward(int StepI);
00072           void SetPumpPower(double Value);
00073           
00074           void ShootingGAVictor();
00075           void ShootingGA();
00076           void ShootingGAVaryCW();
00077           void ShootingGeneticAlgorithms(double VectorEqSpace);
00078           void ShootingGeneticAlgorithmsVaryCW(double VectorEqSpace); 
00079           void ShootingIntegration(int NExtItr);
00080           void ShootingIntegrationExample(int NExtItr);
00081           void GetPumpInitGuessFromIntg(double * TargetAlpha);
00082           void UpdateIndividualWavelength(double VectorSpaceUpdate);
00083           void UpdateIndividualWavelength(int Num, double * VectorUpdate, 
00084                                 double Space, double CW);
00085           void GeneticAlgorithmsVaryCW(double * Vector, double PumpSpace, double * CW);
00086           void GeneticAlgorithms(double * Vector);
00087           void CalculateFrel();
00088 
00089           void InitRamanIteration();
00090           void RelaxRamanIteration();     
00091       void ForwardStep(int StepI);
00092       void BackwardStep(int StepI);
00093           double OptimizeForwardIntegration(int IntStepI, double * PreSig);
00094           double OptimizeBackwardIntegration(int IntStepI, double * PrePum);
00095 
00096           void FirstGuessForwardShooting(int IntStepI, double * PreSig, double * PrePum);
00097           void ShootingRamanIteration();
00098       void PrePumpShooting(int PreShootingStepI);
00099   //    void PrePumpShootingL2R(int PreShootingStepI);
00100           void SignalOnlyPropagation(int PreShootingStepI);
00101       void PreSignalShooting(int PreShootingStepI);
00102           void PreSignalShootingWOA(int PreShootingStepI);
00103         //  void PrePumpShootingLastOne(int StepI);
00104           void ForwardShooting(int StepI);
00105 //        void RKShooting(int IntStepI);
00106 //        void RKShootingSimple(int IntStepI);
00107 //        void RKShootingtext(int IntStepI);
00108           double OptimizeForwardShootingIntegration(int IntStepI, double * PreSig, double * PrePum);
00109           double OptimizeForwardPumpShootingIntegration(int IntStepI, double * PreSig, double * PrePum);
00110           double OptimizeForwardSignalShootingIntegration(int IntStepI, double * PreSig, double * PrePum);
00111           void InternalRelaxationInForwardShooting(int IntStepI, double * PreSig, double * PrePum);
00112           
00113           void ParallelCorrection(double * ShootingValue, double * Target);       
00114           void ParallelCorrectionNewton(double * ShootingValue, double * Target);
00115           void OneByOneCorrection(double * ShootingValue, double * Target);
00116           void ParallelIntgCorrection(double * ShootingValue, double * Target); 
00117           void ParallelIntgCorrectionNewton(double *ShootingValue, double * Target);
00118           void UEvolution(int StepI, double * MatrixU);
00119           
00120           void GetMatrixW(int WStepI, double * MatrixW);
00121       void GaussianElimination(double * MatrixU, double * CorrectP, double * EpxirP);
00122           void MatrixCopy(double * M1, double * M2, int M, int N);
00123           void MatrixMultiply(double * M1, double * M2, int N);
00124           void MatrixPlus(double * M1, double * M2, int N);
00125           void MatrixPlus(double * M1, double * M2, int M, int N);
00126           void DisplayM(double * M1 , int M , int N);
00127           void MatrixDivid(double * M1, double M, int N);
00128           void MatrixDivid(double * M1, double Num, int M, int N);
00129           void MatrixMultiply(double * M1, double M2, int N);
00130           void MatrixSubtract(double * M1, double * M2, int M, int N);
00131           void MatrixReducedMultiply(double * M1, double * M2, int N , int P);
00132           //double F2W(double Frequency) {  return( 3e+8 / Frequency);};
00133           //double W2F(double WaveLength) { return( 3e+8 / WaveLength); };
00134 
00135       
00136           double GetTempDepFactor(double Wavelength1,double Wavelength2);
00137       double GetRamanGainFreqGrid(double Wavelength1, double Wavelength2, int NumSteps);
00138       double GetRamanGainFreqGrid(double Wavelength1, double Wavelength2);
00139       double GetRamanGain(double Wavelength1, double Wavelength2, int NumSteps);
00140           double GetRamanGain(double Wavelength1, double Wavelength2);
00141           double GetRamanGainClose(double Wave1, double Wave2, int Index);
00142           double GetAttenuationFiber(double Wavelength);
00143       double GetAttenuationFiber(double Wavelength, int NumSteps );
00144  //  double GetRamanPowerFreq(double Z, double Freq);
00145           double GetRamanPowerFreqIndex(double Z, int SignalFreqIndex);
00146           void SetAmpLength(double Value);
00147           void SetTypeRamanNoise(typeRamanNoise TypeRamanNoise2);
00148           void DoubleRamanPumpPower();
00149         
00150           string WriteTypeRamanNoise(void);
00151           void WriteSignalWaveLthPower(string OutFileName, int Num);
00152       void WriteSignalWaveLthPowerWith$(string OutFileName, int Num);
00153       void WritePumpWaveLthPower(string OutFileName, int Num);
00154       void WritePumpPower(string OutFileName);
00155           void WritePumpPowerdB(string OutFileName);
00156           void WriteSignalOutputPower(string OutFileName);
00157           void WriteSignalOutputPowerdB(string OutFileName);
00158       void WriteSignalConvergence(string OutFileName);
00159       void WriteSignalTrack(string OutFileName, int Num);
00160           void WriteSignalTrack(string OutFileName);
00161           void WriteAveragePowerdBm(int loop);
00162           void WriteEqIntgData(string InFileName);        
00163           void WriteGainShapeData(string InFileName,string OutFileName1,string OutFileName2);  
00164           void WriteCentralWavelength(string InFileName,string OutFileName1);
00165       void WriteSignalNoise(OptSignal *Signal1, OptSignal *NFSignal, OptSignal *N, string
00166                                                 OutSignalNoiseFileName);
00167           
00168 
00169         //  void GetAccuratePump();
00170         
00171         
00172           void RamanTransient();
00173 
00174    private:
00175           void Calculatedsdt(double * oSigTemp,double * oPumTemp,double * dPsigdt,double * dPpumdt);
00176           void Mac24BF(double * oSignalTemp,double * oPumpTemp,double * dPsdt,double * dPpdt);
00177           void Mac24FB(double * oSignalTemp,double * oPumpTemp,double * dPsdt,double * dPpdt);
00178           void CalculateForwarddsdt(double * oSigTemp,double * oPumTemp,double * dPsigdt,double * dPpumdt);
00179           void CalculateBackwarddsdt(double * oSigTemp,double * oPumTemp,double * dPsigdt,double * dPpumdt);
00180 
00181 
00182 
00183 // just for debug
00184 
00185           void ReadPlainFileGain(double FiberLength,string InFileName);
00186           void ReadPlainFileLoss(double FiberLength, string InFileName);
00187       double  WaveLengthStart;
00188       double WavelengthStep;
00189 
00190 
00191 
00192    private:
00193       typeRamanNoise TypeRamanNoise;
00194         
00195           double DeltaZ(int NumSteps);
00196       
00197    
00198       double * oSignalWaveLth;  
00199       double * oSignalPower;
00200       double * oSignalPowerPre;
00201           double * oSignalSample;
00202           double * oSignalTrack;
00203           double * oIntgSigPower;
00204           double * SigFEnergy;
00205           
00206           double * oASEWaveLth;
00207           double * oSRBWaveLth;
00208           double * oDRBWaveLth;
00209           double * oASEPower;
00210           double * oSRBPower;
00211           double * oDRBPower;
00212           
00213       double * oPumpWaveLth;
00214       double * oPumpPower;
00215           double * oPumpTarget;
00216           double * oPumpTrack;
00217           double * oPumpTargetBackup;
00218       double * oPumpPowerPre;
00219           double * oPumpPower45Converted;
00220           double * oPumpWaveLthInput;
00221           double * oPumpPowerInput;
00222           
00223           double * oPumpIntgTarget;
00224 //        double * IntgPumPower;
00225       
00226       double * oRamanGain;
00227           double * oLoss;
00228       double PumpAttenuation;
00229           
00230       double * DeltaPsignal;
00231       double DeltaPsignalsign;
00232       double * DeltaPpump;
00233       double DeltaPpumpsign;
00234           
00235           double * PreCorrectP;
00236 
00237       double CompCoeff;
00238       double * DeltaPpumpTotal;
00239       double * DeltaPsignalTotal;
00240       
00241       int TypeIntergration;
00242           //int TypePerturbation;
00243           int TypeAlgorithm;
00244           int TypeCorrect;
00245           double WeightCorrect;
00246           double IterationAccurateTh;
00247           double ShootingAccurateTh;
00248 
00249           //double PerturbationRatio;
00250           
00251           double RamanStartLength;
00252       double AmpLength;
00253       double DeltaZConst;
00254           double * DeltaZArray;
00255       int NumSigCh;
00256       int NumPumCh;
00257           int NumASECh;
00258           int NumSRBCh;
00259           int NumDRBCh;
00260           
00261           int NumFibersPumped;
00262           int NumFiberIndex;
00263           int * FiberLocation;
00264           
00265           
00266           int PumpWavelengthForGain;
00267           double  WaveLengthStartGain;
00268       double WavelengthStepGain;
00269       int  NumGainWidth;
00270           double  WaveLengthStartLoss;
00271       double WavelengthStepLoss;
00272       int  NumLossWidth;
00273           double FreqStartGain;
00274           double FreqStepGain;
00275 
00276           
00277           double GlobleRipple;
00278 
00279           int NumPumChTotal;
00280       int NumCh;
00281       int NumIteration;
00282           int NumIntItr;
00283           
00284           int TypeGeneticAlgorithms;
00285           int Population;
00286           int SelectionFixedNum;
00287           double CrossRate;
00288           double MutationRate;
00289           int StartNumSpace;
00290           int EndNumSpace;
00291           
00292 //        int MultiFiberFlag;
00293           int AccurateSign;
00294 //        double AccurateTh;
00295           int BlowupSign;
00296           int FixSignalShootingSign;
00297           int FixPumpShootingSign;
00298 //      double AttenuationFiber;
00299       double RayleighBackscatterCoeff;
00300       int NumZSteps;
00301       
00302       string JobRaman;
00303 
00304           int NumTSteps ; 
00305           double DeltaT ;  
00306 
00307    
00308       OptSignal *oOptSignal;
00309       RanNumGen *RNG; 
00310 
00311       cfftw *fft;
00312       fftMatrices sfftM;
00313           int qtPoints;
00314           double DeltaFreq, FreqWindow, DeltaTime, TimeWindow;
00315       int ObjectInitialized;                          
00316       int TypeOptFilter;
00317       int OrderOptFilter;
00318       double FreqFWHM_OptFilter;
00319       double RelativeCenterFreqOptFilter;
00320 //         double SpliterLossFactor;
00321           double PumpPowerFactor;
00322         string InFileNameSave;
00323                 int NoFourierSignal;
00324                 int  ReadPlainFileGainLossFlag;
00325                 int ReadRamanGainLossWavelengthGridFlag;
00326 
00327 };
00328 
00329 #endif /* _OCS_RAMAN_AMP_HH_ */
00330 
00331 
00332 
00333 
00334 

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