00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
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
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
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 class OptAmplifier
00173 {
00174 public:
00175
00176
00177
00178
00179 ~OptAmplifier();
00180
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
00228
00229
00230
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
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
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
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
00330
00331 private:
00332
00333
00334
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
00370
00371
00372 double AmplifyOptSignalSteadyStateSaturatedGain(int ScalarNotVectorFlag);
00373
00374
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
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;
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
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;
00438
00439
00440
00441
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
00453
00454 double * LinearGainProfile;
00455 double RippleAmplitudeLinear;
00456 double RipplePeriod;
00457 double RelativeRippleShift;
00458 double LinearGainFixedTotalOutputPower;
00459
00460
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
00523 double DeltaZ;
00524 int TypeIntergration;
00525 int NumIntItr;
00526
00527 double UpperN,LowerN;
00528 double * UpperNBackward;
00529
00530
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
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
00554 cplx* BiasedNoise;
00555
00556
00557 };
00558
00559 #endif
00560
00561
00562
00563
00564
00565
00566
00567