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

ocsOptAmplifier.hh

Go to the documentation of this file.
00001 // $Id: ocsOptAmplifier.hh,v 1.8 2007/10/24 14:29:19 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 // some change is writen by Jonathan Hu 
00015 // new constructor
00016 // several functions
00017 
00018 
00019 #ifndef _OCS_OPT_AMPLIFIER_HH_
00020 #define _OCS_OPT_AMPLIFIER_HH_
00021 
00022 #include "ocsOptSignal.hh"
00023 #include "ocsOptSpectrumAnalyzer.hh"
00024 #include "ocsPolDepAttenuator.hh"
00025 #include "ocsReduOptAmplifier.hh"
00026 
00027 // The following two enums are also defined in ocsReduOptAmplifier.hh
00028 
00029 #ifndef _OCS_TYPE_AMPLIFIER_
00030 #define _OCS_TYPE_AMPLIFIER_
00031 
00032 enum typeAmplifier { NO_AMPLIFICATION = 0,
00033                      SCALAR_SIMPLE = 1, SCALAR_SATURATED = 2, 
00034                      VECTOR_SIMPLE = 3, VECTOR_SATURATED = 4, 
00035                      VECTOR_FIXED_OUTPUT_POWER = 5,
00036                      VECTOR_FIXED_TOTAL_OUTPUT_POWER = 6 };
00037 
00038 
00040 
00065 #ifndef _TYPE_AMPLIFIER_NOISE_
00066 #define _TYPE_AMPLIFIER_NOISE_
00067 
00068 enum typeAmplifierNoise { NOISE_OFF = 0, 
00069                           NOISE_ON_CONST_POWER_RANDOM_PHASE = 1,
00070                           NOISE_ON_GAUSSIAN_WHITE = 2, 
00071                           NOISE_ON_NO_RNG = 3,
00072                           NOISE_ON_SEMI_ANALYTICAL = 4, 
00073                           NOISE_ON_BIASED = 5}; 
00074                                                   
00075                                                           
00076 #endif // _TYPE_AMPLIFIER_NOISE_
00077 
00078 #endif /* _OCS_TYPE_AMPLIFIER_ */
00079 
00080 enum typeGainProfile { FLAT_GAIN = 1,  RIPPLED_GAIN = 2, 
00081                        USER_DEFINED_GAIN_PROFILE = 3,
00082                        FLAT_GAIN_INSIDE_BANDWIDTH = 4,
00083                                            HOMOGENEOUS_MODEL = 5 };
00084 
00085 // The OptAmplifier class has been written by Ivan Lima and 
00086 // John Zweck. It can be used for any of the following:
00087 
00088 // As a general rule, the user should only use the constructor and the  
00089 // the methods
00090 
00091 // SetTypeAmplifier(typeAmplifier TypeAmplifier2)
00092 // SetTypeAmplifierNoise(typeAmplifier TypeAmplifierNoise2)
00093 // SetTypeGainProfile(typeGainProfile TypeGainProfile2)
00094  
00095 // AmplifyOptSignal(void)
00096 
00097 // The enum types  typeAmplifier and  typeAmplifierNoise are defined in
00098 // ocsGlobalStructures.hh. 
00099 
00100 // Possible values for typeAmplifier are 
00101 
00102 // NO_AMPLIFICATION
00103 // SCALAR_SIMPLE
00104 // VECTOR_SIMPLE
00105 // SCALAR_SATURATED
00106 // VECTOR_SATURATED
00107 // VECTOR_FIXED_OUTPUT_POWER
00108 
00109 
00110 // Possible values for typeAmplifierNoise are 
00111 
00112 // NOISE_OFF
00113 // NOISE_ON
00114 // NOISE_ON_GAUSSIAN_WHITE 
00115 // NOISE_ON_SEMI_ANALYTICAL
00116 // NOISE_ON_BIASED              added by walter for MMC and importance sampling
00117 //                              simulation
00118 
00119 
00120 // NOTE: Users should use SCALAR amps with NOISE_ON with great caution!!!!!!
00121 // The code has not been debugged in this situation.
00122 
00123 // If the propagation along the fiber is scalar 
00124 // (i.e. only the X polarization is being propagated) then the user should
00125 // use one of the two SCALAR options above.
00126 
00127 // Possible values for typeGainProfile are
00128 
00129 // FLAT_GAIN
00130 // RIPPLED_GAIN
00131 // USER_DEFINED_GAIN_PROFILE
00132 // FLAT_GAIN_INSIDE_BANDWIDTH
00133 
00134 // CAUTION: Currently USER_DEFINED_GAIN_PROFILE has not been 
00135 // implemented while RIPPLED_GAIN only works for the
00136 // VECTOR_FIXED_OUTPUT_POWER type of amplifier.
00137 
00138 
00139 // The saturated amplifier code has been extensively tested 
00140 // both as an isolated device and as a component of a large system.
00141 // These tests were made by comparing a system which was simulated
00142 // using the OCS code with an experimental system in Gary Carter's lab.
00143 // In particular, we obtained excellent agreement between simulation 
00144 // and experiment for the evolution of both the noise-power
00145 //  and the signal-to-noise ratio.
00146 
00147 // The method WriteSteadyStateGainVersusPower can be used to
00148 // estimate the two basic parameters, UnsaturatedGaindB and SaturatingPowerdB,
00149 // of the 
00150 
00151 // The saturating amplifier model has two basic parameters, 
00152 // UnsaturatedGaindB and SaturatingPowerdB. These can be estimated
00153 // from experimental data using the WriteSteadyStateGainVersusPower
00154 // method which gives GaindB versus InputPowerdB.
00155 
00156 // Note that the parameter SaturatingPowerdB is not the "3dB down"
00157 // power level, but rather is an intrinsic parameter of the ODE 
00158 // which describes the evolution of power along the amplifier's fiber.
00159 
00160 // FUTURE IMPROVEMENTS:
00161 
00162 // (1) Allow SaturatingPower_3dB_down as an input parameter
00163 // (2) Add ability to have a gain profile (Gain versus wavelength)
00164 //     which is often important for WDM simulations.
00165 // (3) Implement the coupled amplifier model described in Ruo-Mei's
00166 //     "Theory versus Experiment" paper which should be used in the 
00167 //      situation that the relaxation time of the amplifiers in a 
00168 //      recirculating loop is comparable to the time required for
00169 //      light to travel around the loop.
00170 // (4) Add Moshe Horowitz n_sp model for high gain amps.
00171 
00172 class OptAmplifier
00173 {
00174    public:
00175 
00176      // The following TWO methods are now OUT OF DATE (JZ)
00177 
00178       //OptAmplifier(); 
00179       ~OptAmplifier(); //## Do nothing, for now.
00180       //void GetAmplifierSample(long *fSeedNoise); // to be implemented  
00181 
00182       void SetFixedOutputPowerFromCurrentOptSignal(void);
00183       void SetFixedTotalOutputPowerFromCurrentOptSignal(void);
00184 
00185       void SetPolDepGain(double PolDepGainOptAmplifier2)
00186                     {PolDepGainOptAmplifier = PolDepGainOptAmplifier2;};
00187       double GetPolDepGain(void) 
00188                 {return PolDepGainOptAmplifier;};
00189 
00190       void SetGainCompressionSaturatedAmplifier(
00191                    double GainTarget_dB, double GainCompression_dB, 
00192                    double OutputPowerTarget);
00193                 
00194       double GetSpectralNoisePowerDensityAddedPerPolarization(void)
00195                 {return (sq(NoiseAmplitudeFactor)*CenterFreq
00196                          /DeltaFreq);};
00197                          
00198       void AmplifyAlternateOptSignalWithoutNoiseWithPrevioslyComputedGain(
00199               OptSignal *oOptSignal2);                   
00200 
00201       void SwitchOptSignalData(OptSignal *oOptSignal2);
00202 
00203       typeAmplifier GetTypeAmplifier(void)
00204              {return TypeAmplifier;};
00205 
00206       typeAmplifierNoise GetTypeAmplifierNoise(void)
00207              {return TypeAmplifierNoise;};
00208 
00209 
00210       double GetLinearGainOptAmplif(void)
00211             {return LinearGainOptAmplif;};
00212 
00213       double GetFixedTotalOutputPower(void) 
00214              {return OutputPowerLinear;};
00215 
00216       void SetFixedTotalOutputPower(double OutputPowerLinear2) 
00217              {OutputPowerLinear = OutputPowerLinear2;};
00218 
00219       void SetLinearGainOptAmplif(double Value)
00220              { LinearGainOptAmplif = Value; };
00221 
00222       void SetNoiseAmplitudeFactor(double Value);
00223 
00224       double GetNoiseAmplitudeFactor(void)
00225              {return NoiseAmplitudeFactor;};
00226 
00227      // #########  Methods Added by John Zweck ############
00228 
00229 
00230        // Use this constructor from now on:
00231 
00232        OptAmplifier(string InFileName,OptSignal *oOptSignal2, RanNumGen *RNG2);
00233        OptAmplifier(string InFileName,OptSignal *oOptSignal2, RanNumGen *RNG2,
00234                     OptSpectrumAnalyzer *PowerMeter2);
00235 
00236        void SetGain(double dBGain2);
00237 
00238        void SetTypeAmplifier(typeAmplifier TypeAmplifier2);
00239        void SetTypeAmplifierNoise(typeAmplifierNoise TypeAmplifierNoise2);
00240        void SetTypeGainProfile(typeGainProfile TypeGainProfile2);
00241 
00242        string WriteTypeAmplifier(void);
00243        string WriteTypeAmplifierNoise(void);
00244        string WriteTypeGainProfile(void);
00245 
00246        void AmplifyOptSignal(void);
00247 
00248        void WriteSteadyStateGainVersusPower(string OutFileName,
00249                         double InputPowerMaxLinear, int NumPowerSteps);
00250 
00251       void WriteGainProfile(string OutFileName);
00252 
00253 
00254        double GetSaturatingPowerLinear(void){return SaturatingPowerLinear;}; 
00255 
00256       double GetdBGain() {return dBGain;};
00257 
00258       void SetDebugLevel(int Level) {DebugLevel = Level;};
00259 
00260 // used by Jonathan Hu
00261         OptAmplifier(string InDir2, string InFileName, 
00262                            OptSignal *oOptSignal2, RanNumGen *RNG2);
00263 
00264         OptAmplifier(string InDir2, string InFileName, 
00265                      OptSignal *oOptSignal2, double * InputS, 
00266                      RanNumGen *RNG2, double F, double TotalTime2, 
00267                      int DataPointInCye2);
00268                                                    
00269         void PropagateSignalandNoise(OptSignal *NoiseFreeSignal,
00270                                      OptSignal * Noise);
00271                                    
00272         void ReadGainProfile(string InFileName, int SignalPowerInputIndex);
00273         void ReadGainPowerDependent(string InFileName);
00274         void ReadInEDFAGain(string InDir3);
00275         void ReadInGainFlatenFilter(string InFileName);
00276         void ReadInPolynomialFilter(string InFileName);
00277                 
00278         void ReadInErParameter(string InDir3);
00279                 
00280         void Loss(double Loss);
00281         void AmplitudeFluctuation();
00282         void ResetTransient(double F, double TT);
00283 
00284   double GetSignalEms(double Wavelength);
00285   double GetSignalAbs(double Wavelength);
00286   
00287   double GetPumpPowerSystem0dB();
00288   double GetPumpPowerTransparency();
00289   void SetPumpPower(double Power);
00290   void CalculateAverageN2T(int IntStepT);
00291   void CalculateGain();
00292 
00293   double GetGainFlatenFilter(double Wavelength);
00294   double GetPolynomialFilter(double Wavelength);
00295 
00296   void ApplyGainFlatenFilter();  
00297 
00298 // for transit
00299         void ChannelAddDrop();
00300         void ForwardTSignalStep(int StepsT);
00301         void ForwardTPumpStep(int StepsT);
00302         void ForwardTPumpSignalStep(int StepT);
00303         
00304         void ApplyPolynomial();
00305     void SetAmpLength(double AmpLength2);
00306     void SetPumpPowerTime(double PumpPowerT);
00307     void SetSaturationFactorAdjuctment(double SA);
00308         void SetEMSAdjustGA(double EMSAdjustGA2);
00309         void SetABSAdjustGA(double ABSAdjustGA2);
00310 
00311     void AmplifyOptSignalScalarSinTim();
00312         void AmplifyOptSignalScalarSinFreq();
00313 
00314 
00315   // added By Walter for MMC and importance sampling simulation  
00316    void SetBiasedNoiseVector(double* z_try, int dimension,
00317                              int AddBiasedNoiseFlag);
00318 
00319    void WriteFileBiasedNoiseTime(string PathAndFileName);
00320 
00321    void WriteFileBiasedNoiseFreq(string PathAndFileName);
00322    
00323         void TimeShiftBiasedNoise(int NumOfBitSlots);
00324                                     
00325    double GetSpontaneousEmissionFactor() 
00326           {return SpontaneousEmissionFactor;};
00327 
00328   
00329 // ######## Private Methods #############
00330 
00331  private:
00332 
00333 // used by Jonathan Hu
00334 // used by Jonathan Hu
00335   void PropagatSignal();
00336   double GetEDFAGain(double Wavel, double SignalPower, double PumpPowerC);
00337   void AmplifyWithUserDefinedGain();
00338   void ReleaseMemory();
00339   double GetAttenuationFiber(double Wavelength);
00340   void FirstGuessForward(int IntStepI, double * PreSig, double * PrePum, 
00341                          double * PreNoi);
00342   double OptimizeForward(int IntStepI, double * PreSig, double * PrePum, 
00343                          double * PreNoi);
00344   void CalculateUpperN(int IntStepI, double * SigPower, double * PumPower, 
00345                        double * NoiPower);
00346   void ForwardStep(int StepI);
00347   void BackwardStep(int StepI);
00348   void AmplifyHomogeneous();
00349   double GetPumpAbs(double Wavelength);
00350 
00351   double GetPumpEms(double Wavlength) {return(0.0);};
00352   void ReadPumpCrossSection(string InDir4);
00353   void ReadSignalCrossSection(string InDir4);
00354 
00355   double PumpCurrent2Power(double Current);
00356 
00357 //  #######################################
00358 
00359   void AmplifyWithFlatGain(void);
00360   void AmplifyWithRippledGain(void);
00361   void ComputeNoiseAmplitudeFactor(void);
00362 
00363   void AdjustGainFixedTotalOutputPowerVector(void);
00364 
00365   void AmplifyOptSignalVector(void);   
00366   void AddPolDepGainEffect(void);
00367 
00368   void AmplifyOptSignalScalar(void); 
00369          // Use above method in conjunction with scalar NLS solver
00370          // Only operates on the X polarization
00371 
00372  double AmplifyOptSignalSteadyStateSaturatedGain(int ScalarNotVectorFlag);
00373         // Flag == 1 means using a scalar NLS solver with X polarization only
00374         // Flag == 0 means using a vector-NLS or Manakov solver with X&Y pols
00375 
00376   void AmplifyGaussianStatisticsNoise(void);
00377 
00378  double SteadyStateSaturatedGain(double InputPower);
00379 
00380  void ComputeGainForFixedOutputPower(void);
00381  void ComputeGainForFixedOutputPower_OLD(void);
00382  void ComputeGainForFixedTotalOutputPower(void);
00383 
00384  void AmplifyOptSignalVectorWithGainProfile(void);
00385  void ComputeNoiseAmplitudeFactorGainProfile(void);
00386  void AllocateGainProfileMemory();
00387  void AddRippleToGain(void); 
00388 
00389 
00390 
00391   // ######### Private Data ##############
00392            
00393    private:
00394       void SetPolDepGainPolarization(void);
00395       void PolDepAmplification(void);   
00396       double LinearGainOptAmplif;
00397       double GainBandwidthHz, GainMinRelFreqHz, GainMaxRelFreqHz;
00398       double LinearNoiseFigOptAmplif;
00399       double NoiseAmplitudeFactor;
00400 
00401       double UserSpecifiedNoiseAmplitudeFactor;
00402 
00403       bool UserHasSpecifiedNoiseAmplitudeFactorFlag;
00404 
00405       double ModeOptAmplif; // Out of date
00406           double GetTempDepFactor(double Wavelength);
00407 
00408       typeAmplifier TypeAmplifier;
00409       typeAmplifierNoise TypeAmplifierNoise;
00410       typeGainProfile TypeGainProfile;
00411       typeSimulation TypeSimulation;
00412 
00413       double NoiseFigOptAmplifier;
00414       double SpontaneousEmissionFactor;
00415 
00416       double dBGain;
00417       double OutputPowerLinear;
00418 
00419       RanNumGen *RNG;      
00420       OptSignal *oOptSignal;
00421       OptSpectrumAnalyzer *PowerMeter ;
00422       PolDepAttenuator oPolDepAttenuator;
00423 
00424       ReduOptAmplifier * oReduOptAmplifier;
00425 
00426       double PolDepGainOptAmplifier;  
00427       //double *PolDepGainOrigPhase;
00428       double PolDepGain_thetaZthetaY[2];      
00429 
00430       cfftw *fft;
00431       fftMatrices sfftM;
00432       int qtPoints;
00433       double CenterFreq;
00434       double DeltaFreq;
00435       int    ObjectInitialized;
00436 
00437       int DebugLevel; // 1,2,3 with 3 spooling most info to LogFile
00438 
00439   // Variables for Gain Saturated Amplifiers
00440   // See SteadyStateSaturatedGain method for definitions of these
00441   // variables (JZ)
00442 
00443       double AmpLength;
00444       int NumZSteps;     
00445       double SaturatingPowerLinear;
00446       double SaturatingPowerdBm;
00447       
00448       double UnsaturatedGaindB;
00449       double UnsaturatedGainLinear;
00450       double UnsaturatedDifferentialGainLinear;
00451 
00452   // Variables related to non-flat gain profiles
00453 
00454   double * LinearGainProfile;
00455   double RippleAmplitudeLinear;
00456   double RipplePeriod;
00457   double RelativeRippleShift;
00458   double LinearGainFixedTotalOutputPower;
00459   
00460   // variables used by Joanthan Hu
00461 
00463  
00464   int TotPumpPowerIndex;
00465 
00466   int TotSignalPowerIndex;
00467   int NumGainWidth,NumGainWidthDep;
00468   double AmplifierPumpPowerC;
00469   double * oEDFAGain;
00470   double * oEDFAGainPowerDependent;
00471   int    ObjectInitializedJH;  
00472   string InDir;
00473   double StartWavelength;
00474   double DeltaWavelength;
00475   double StartPumpPower;
00476   double DeltaPumpPower;
00477   double MidPower;
00478   
00479   double PumpPowerSystem0dB;
00480   double PumpPowerTransparency;
00481   
00482   int PumpWavelengthForGain; 
00483   double WavelengthStartCrossSection;
00484   double WavelengthStepCrossSection;
00485   int NumCrossSectionWidth;
00486 
00487   double * oSignalPower;
00488   double * oPumpPower;
00489   double * oSignalWaveLth;
00490   double * oPumpWaveLth;
00491   int NumSigCh, NumPumCh, NumNoiCh;
00492   double * oSignalAbs;
00493   double * oSignalEms;
00494   double PumpABS;
00495   double * oPumpAbs;
00496   double * oNoiseWaveLth;
00497   double * oNoiseFPower;
00498   double * oNoiseBPower;
00499   
00501   double  WavelengthStartFilter;
00502   double  WavelengthStepFilter;
00503   int  NumFilterWidth;
00504   double * oGainFlatenFilter;
00505  
00506 
00507   double  WavelengthStartPolynomialFilter;
00508   double  WavelengthStepPolynomialFilter;
00509   int  NumPolynomialFilterWidth;
00510   double * oPolynomialFilter;
00511 
00512   double PumpPowerFactor;
00513   
00514  double DeltaWave;
00515  double ConfinementFactor;
00516  double AttenuationFiber;        
00517  double DopantConcentration;
00518  double EffectArea;
00519  double LifeTime;
00520  double SaturationFactorAdjuctment;
00521 
00522 // double AmpLength;
00523  double DeltaZ;
00524  int TypeIntergration;
00525  int NumIntItr;
00526  
00527  double UpperN,LowerN;
00528  double * UpperNBackward;
00529 
00530 // following is for transit
00531         int NumTSteps;
00532         double DeltaT;
00533         double * IntrinsicSaturationPowerPump ; 
00534         double * IntrinsicSaturationPowerSignal;
00535         double * GainSig ;
00536         double * GainPum ;
00537 
00538         double * PumpInput ;
00539         double * AbsorptionLossSignal ;
00540         double * AbsorptionLossPump ; 
00541         
00542 // used for Transient
00543         double * SignalInput;
00544         double * AverageN2T;
00545         double SaturationFactor;
00546         double TotalTime;
00547         int     DataPointInCye;
00548         double ABSAdjustGA;
00549         double EMSAdjustGA;
00550 
00551         int PolynomialFilterAppliedFlag;
00552 
00553   // added by Walter for MMC and importance sampling simulations
00554         cplx* BiasedNoise;
00555 
00556 
00557 };
00558 
00559 #endif /* _OCS_OPT_AMPLIFIER_HH_ */
00560 
00561 
00562 
00563 
00564 
00565 
00566 
00567 

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