Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef _NOISE_COVARIANCE_
00015 #define _NOISE_COVARIANCE_
00016
00017
00018 #include "ocsOptSignal.hh"
00019 #include "ocsOptFiberLocalError.hh"
00020 #include "ocsOptAmplifier.hh"
00021 #include "ocsLumpedLoss.hh"
00022 #include "MatrixTools.hh"
00023
00026
00037 enum typeNoiseMethod { AWGN = 0, MC_WITHOUT_K=1,
00038 MC_WITH_K=2, ODE=3};
00039
00041
00049 enum typeJitterSeparation { NONE = 0, PHASE_ONLY = 1, PHASE_AND_TIMING = 2};
00050
00051
00057
00064 class NoiseCovariance
00065 {
00066
00067 public:
00068
00069
00070
00072
00073 NoiseCovariance(string InFileName, string Job2,OptSignal * Signal2);
00074
00077
00078 NoiseCovariance & operator=(NoiseCovariance & RHS_NoiseCovariance);
00079
00081
00082 void ResetVolatileParameters(void);
00083
00085
00086 ~NoiseCovariance(void);
00087
00089
00090 void Propagate(OptFiberLocalError * Fiber2);
00091
00093
00094 void Amplify(OptAmplifier * Amplifier2);
00095
00098
00099 void Attenuate(LumpedLoss * oLumpedLoss);
00100
00102
00103 void TurnOffJitterSeparation(void);
00104
00106
00107 void TurnOnJitterSeparation(void);
00108
00109 string WriteTypeNoiseMethod(void);
00110
00111 string WriteTypeJitterSeparation(void);
00112
00113 void WriteFileNoiseFreeSignalAndCovarianceMatrix(
00114 string OutFileNamesSuffix);
00115
00118
00119 void ReadFileNoiseFreeSignalAndCovarianceMatrix(
00120 string InFileNamesPrefix);
00121
00123
00124 void WriteFileAWGNNoiseFreeSignalAndNoiseSpectralDensity(
00125 string OutFileNameSuffix);
00126
00127 void WriteFileTimeField(string OutFileName,fftMatrices Field);
00128 void WriteFileFreqField(string OutFileName,fftMatrices Field);
00129
00132
00141 void GetReducedNoiseFreeSignal(fftMatrices & ReceiverReducedNoiseFreeSignal);
00142
00146
00147 void ComputeCovarianceMatrixAWGN(void);
00148
00154
00155 void SetCovarianceMatrixAWGN(double OSNRdB, double B_OSA);
00156
00159
00160 void InitializeCovarianceMatrix(double TotalNoiseSpectralDensity);
00161
00167
00168 void PropagateAnalyticCWSignalNoLossNoDispersion(
00169 OptFiberLocalError * Fiber2,OptAmplifier * Amplifier2);
00170
00173
00174 void GetCovarianceMatrix(double ** ReceiverCovarianceMatrix,
00175 bool ReadInSignalAndCovMatrixFlag,
00176 double SetOSNRdB, double B_OSA);
00177
00178 int GetCovMatrixDim(void) {return CovMatrixDim;};
00179 int GetCovMatrixFirstIndex(void) {return CovMatrixFirstIndex;};
00180 int GetCovMatrixLastIndex(void) {return CovMatrixLastIndex;};
00181
00182 string GetJobName(void) {return Job;};
00183
00184 double GetPropagatedLength(void) {return PropagatedLength;};
00185
00186 private:
00187
00188
00189
00192
00193 void AllocateMemory(void);
00194
00195
00197
00198 void Propagator(void);
00199
00201
00207 void ComputeColumnPropagator(int PerturbedFreqIndex,double Delta,
00208 bool RealNotImag,double TotalEnergy);
00209
00210
00212
00213 void Perturb(int PerturbedFreqIndex,double Delta, bool RealNotImag);
00214
00215
00217
00233 void Perturb(int PerturbedFreqIndex,double Delta,
00234 bool RealNotImag, int ChannelIndex);
00235
00237
00238 void UpdateCovMatrixODE(void);
00239
00241
00251 void ApplyArtificialDispersionCompensation(fftMatrices SignalData,
00252 bool DisentangleFlag);
00253
00254
00257
00258 void ComputeArtificialDispersionCompensationOperator(void);
00259
00260 void AmplifyCovarianceMatrix(double LinearGain);
00261
00262 void LumpedLossCovarianceMatrix(double LossLinear);
00263
00264 void ComputeReducedSignal(fftMatrices Signal2,fftMatrices ReducedSignal2);
00265
00269
00270 void ApplyArtificialCentralChannelDemux(fftMatrices& PerturbationEnd);
00271
00275
00276 void RestoreChannels(fftMatrices& PerturbationEnd);
00277
00278
00279
00280 public:
00281 OptSignal * Signal;
00282
00283
00284
00285 private:
00286
00287 typeNoiseMethod TypeNoiseMethod;
00288 typeJitterSeparation TypeJitterSeparation;
00289 typeJitterSeparation TypeJitterSeparationInput;
00290 bool AlsoRemoveZerosJitter;
00291
00292 string Job;
00293 OptFiberLocalError * Fiber;
00294 OptAmplifier * Amplifier;
00295
00296 double PropagatedLength;
00297 double PropagatedLengthSaved;
00298 int ZStepNum;
00299 int ZStepNumSaved;
00300
00304
00305 double AccumulatedFirstOrderDispersion;
00306
00310
00311 double AccumulatedSndOrderDispersion;
00312
00314
00315 double DeltaFrac;
00316
00318
00319 fftMatrices DataToPropagate;
00320
00321 typeSimulation TypeSimulation;
00322
00324
00325 int SignalVecDim;
00326
00329
00330 cfftw * fft;
00331
00332
00334
00338 int CovMatrixDim;
00339
00341
00345 int CovMatrixFirstIndex;
00346
00348
00352 int CovMatrixLastIndex;
00353
00354
00357
00366 cfftw * Reduced_fft;
00367
00370
00374 double **CovarianceMatrix;
00375
00378
00382 double **PropagatorMatrix;
00383
00387
00391 double **TempProductMatrix;
00392
00396
00397 double * CovarianceStorageVec;
00398
00402
00403 double * PropagatorStorageVec;
00404
00408
00409 double * TempProductStorageVec;
00410
00411
00414
00415 fftMatrices NoiseFreeSignalStart;
00416
00418
00419 fftMatrices NoiseFreeSignalEnd;
00420
00423
00424 fftMatrices jcNoiseFreeSignalEnd;
00425
00428
00429 fftMatrices jcOmegaNoiseFreeSignalEnd;
00430
00432
00433 fftMatrices PerturbationEnd;
00434
00436
00448 fftMatrices ReducedPerturbationEnd;
00449
00450 cplx * ArtificialDispersionCompensationOperator;
00451
00470 fftMatrices ReducedNoiseFreeSignal;
00471
00473
00474 fftMatrices ReducedNoiseFreeSignalStorage;
00475
00476
00477
00478
00479
00480
00481 int ChannelOfCovarianceMatrix;
00482
00483
00484 int NumberOfChannels;
00485
00486
00487
00488 fftMatrices PerturbationEnd_saved;
00489
00490 };
00491
00492 #endif // _NOISE_COVARIANCE_
00493
00494
00495
00496
00497
00498