def GPreach(pathind, numsig, yearind, nyqch): truesnr = SNRgen(pathind, yearind, nyqch) x = np.linspace(0, numpoints, numpoints) prmn, sigma = GPtrain(x, truesnr) prmn = np.mean(prmn) if (prmn - FT128) / sigma > numsig: FT = FT128 mfG = 128 elif (prmn - FT64) / sigma > numsig: FT = FT64 mfG = 64 elif (prmn - FT32) / sigma > numsig: FT = FT32 mfG = 32 elif (prmn - FT16) / sigma > numsig: FT = FT16 mfG = 16 elif (prmn - FT8) / sigma > numsig: FT = FT8 mfG = 8 elif (prmn - FT4) / sigma > numsig: FT = FT4 mfG = 4 elif (prmn - FT2) / sigma > numsig: FT = FT2 mfG = 2 else: print("not able to establish a link") # ============================================================================= # if nyqch: # C = 32*np.log2(1 + db2lin(prmn)) # else: # C = 41.6*np.log2(1 + db2lin(prmn)) # ============================================================================= C = 2 * np.log2( 1 + db2lin(prmn) ) # Shannon capacity of AWGN channel under and average power constraint in bits/symb if SNRnew(pathind, yearind, nyqch) > FT: estbl = 1 Um = prmn - numsig * sigma - FT else: estbl = 0 return mfG, estbl, Um, C
def GPreach(pathind, numsig, yearind, nyqch, edgeinds, edgelens, numlamlk, pthdists, pths): truesnr = SNRgen(pathind, yearind, nyqch, edgeinds, edgelens, numlamlk, pthdists, pths) #print(truesnr) x = np.linspace(0, numpoints, numpoints) prmn, sigma = GPtrain(x, truesnr) prmn = np.mean(prmn) #print(prmn) if (prmn - FT128) / sigma > numsig: FT = FT128 mfG = 128 elif (prmn - FT64) / sigma > numsig: FT = FT64 mfG = 64 elif (prmn - FT32) / sigma > numsig: FT = FT32 mfG = 32 elif (prmn - FT16) / sigma > numsig: FT = FT16 mfG = 16 elif (prmn - FT8) / sigma > numsig: FT = FT8 mfG = 8 elif (prmn - FT4) / sigma > numsig: FT = FT4 mfG = 4 elif (prmn - FT2) / sigma > numsig: FT = FT2 mfG = 2 else: print("not able to establish a link") C = 2 * np.log2( 1 + db2lin(prmn) ) # Shannon capacity of AWGN channel under and average power constraint in bits/symb newsnrval = SNRnew(pathind, yearind, nyqch, edgeinds, edgelens, numlamlk, pthdists, pths) if newsnrval > FT: estbl = 1 Um = prmn - numsig * sigma - FT else: estbl = 0 #print(FT) return mfG, estbl, Um, C
def rtmreach(pathind, numsig, yearind, nyqch): # RTM = real-time + (D) margin truesnr = SNRgen(pathind, yearind, nyqch) meansnr = np.mean(truesnr) if meansnr - fmD > FT128: FT = FT128 mfG = 128 elif meansnr - fmD > FT64: FT = FT64 mfG = 64 elif meansnr - fmD > FT32: FT = FT32 mfG = 32 elif meansnr - fmD > FT16: FT = FT16 mfG = 16 elif meansnr - fmD > FT8: FT = FT8 mfG = 8 elif meansnr - fmD > FT4: FT = FT4 mfG = 4 elif meansnr - fmD > FT2: FT = FT2 mfG = 2 else: print("not able to establish a link") # ============================================================================= # if nyqch: # C = 32*np.log2(1 + db2lin(meansnr)) # else: # C = 41.6*np.log2(1 + db2lin(meansnr)) # ============================================================================= C = 2 * np.log2(1 + db2lin(meansnr)) # this yields capacity in bits/sym if SNRnew(pathind, yearind, nyqch) > FT: estbl = 1 Um = meansnr - fmD - FT else: estbl = 0 return mfG, estbl, Um, C
def SNRnew( pathind, yearind, nyqch ): # function for generating a new SNR value to test if uncertainty is dealt with Ls = LspansA D = Disp # rather than the worst-case number gam = NLco lam = 1550 # operating wavelength centre [nm] f = 299792458 / (lam * 1e-9) # operating frequency [Hz] c = 299792.458 # speed of light in vacuum [nm/ps] -> needed for calculation of beta2 Rs = 32 # symbol rate [GBaud] h = 6.63 * 1e-34 # Planck's constant [Js] allin = np.log( (10**(alpha[yearind] / 10)) ) / 2 # fibre loss [1/km] -> weird definition, due to exponential decay of electric field instead of power, which is standard beta2 = (D * (lam**2)) / ( 2 * np.pi * c) # dispersion coefficient at given wavelength [ps^2/km] Leff = (1 - np.exp(-2 * allin * Ls)) / (2 * allin) # effective length [km] Leffa = 1 / (2 * allin) # the asymptotic effective length [km] links = edgeinds[pathind] # links traversed by path numlinks = len(links) # number of links traversed Gnlisp = np.empty([numlinks, 1]) for i in range(numlinks): numlam = numlamlk[links[i]][ 0] # select number wavelengths on given link #print(numlam) if nyqch: NchNy = numlam BWNy = (NchNy * Rs) / 1e3 else: NchRS = numlam Df = 50 # 50 GHz grid BchRS = 41.6 # RS from GN model paper - raised cosine + roll-off of 0.3 # ===================== find Popt for one span ========================== numpch = len(PchdBm) Pchsw = 1e-3 * 10**(PchdBm / 10) # ^ [W] if nyqch: Gwdmsw = (Pchsw * NchNy) / ( BWNy * 1e12) # flat-top value of PSD of signal [W/Hz] Gnlisw = 1e24 * (8 / 27) * (gam**2) * (Gwdmsw**3) * (Leff**2) * ( (np.arcsinh((np.pi**2) * 0.5 * beta2 * Leffa * (BWNy**2))) / (np.pi * beta2 * Leffa)) else: Gwdmsw = Pchsw / (BchRS * 1e9) Gnlisw = 1e24 * (8 / 27) * (gam**2) * (Gwdmsw**3) * (Leff**2) * ( (np.arcsinh( (np.pi**2) * 0.5 * beta2 * Leffa * (BchRS**2) * (NchRS**((2 * BchRS) / Df)))) / (np.pi * beta2 * Leffa)) G = alpha[yearind] * Ls NFl = 10**(NF[yearind] / 10) Gl = 10**(G / 10) Pasesw = NFl * h * f * ( Gl - 1 ) * Rs * 1e9 # [W] the ASE noise power in one Nyquist channel across all spans snrsw = (Pchsw) / (Pasesw * np.ones(numpch) + Gnlisw * Rs * 1e9) Popt = PchdBm[np.argmax(snrsw)] # ======================================================================= totnumspans = int(pthdists[pathind] / Ls) # total number of spans traversed for the path numspans = int( edgelens[pathind][i][0] / Ls) # number of spans traversed for each link in the path if nyqch: Gwdm = (1e-3 * 10**(Popt / 10) * NchNy) / ( BWNy * 1e12) # flat-top value of PSD of signal [W/Hz] Gnlisp[i] = 1e24 * (8 / 27) * (gam**2) * (Gwdm**3) * (Leff**2) * ( (np.arcsinh((np.pi**2) * 0.5 * beta2 * Leffa * (BWNy**2))) / (np.pi * beta2 * Leffa)) * numspans else: Gwdm = (1e-3 * 10**(Popt / 10)) / (BchRS * 1e9) Gnlisp[i] = 1e24 * (8 / 27) * (gam**2) * (Gwdm**3) * (Leff**2) * ( (np.arcsinh((np.pi**2) * 0.5 * beta2 * Leffa * (BchRS**2) * (NchRS**((2 * BchRS) / Df)))) / (np.pi * beta2 * Leffa)) * numspans Gnli = np.sum(Gnlisp) Pase = NF[yearind] * h * f * (db2lin(alpha[yearind] * Ls) - 1) * Rs * 1e9 * totnumspans Pch = 1e-3 * 10**(Popt / 10) snr = (Pch / (Pase + Gnli * Rs * 1e9)) - db2lin(trxaging[yearind] + oxcaging[yearind]) snr = (snr**(-1) + (db2lin(TRxb2b))**(-1))**(-1) #snr = snr + np.random.normal(0,db2lin(sd),numpoints) sdnorm = sd[yearind] return lin2db(snr) + np.random.normal(0, sdnorm, 1)