using gnpy.core.elements to perform customised simulation #495
-
from gnpy.core.elements import Fiber
from gnpy.core.elements import Edfa
from gnpy.core.elements import Transceiver,Fiber
from gnpy.core.info import SpectralInformation, ReferenceCarrier
from gnpy.core.utils import lin2db, db2lin
from gnpy.core.parameters import FiberParams ,EdfaParams
import numpy as np
from gnpy.tools.json_io import load_equipment
## grid=192.2 to 195.7625THZ ## spacing 37.5GHZ ### baudrate=28GBD
###########################spectral Information######################################
fr=np.arange(192.2*(10**12),195.8*(10**12),37.5*(10**9),float)#frequency
br=np.ones(96)*(28*(10**9))#baudrate
sw=np.ones(96)*(37.5*(10**9))#slotwidth
sig=np.ones(96)*(100*(10**-3))#signal power
nli=np.zeros(96)#nli noise power
ase=np.zeros(96)#ase power
roll_off=np.ones(96)*0.15#roll off facter
cd=np.zeros(96)#chromatic dispersion
pmd=np.zeros(96)#polarization modedispersion
pdl=np.zeros(96)
latency=np.zeros(96)#latenmcy
power_daelta=np.zeros(96)#power sweep target tooptimize the gain ofthe amplifer#sincethe span length is constant in our case ==0
txOsnr=np.zeros =np.ones(96)*db2lin(40)
label=range(1,97,1)
label=np.array(label)
spec_info=SpectralInformation(frequency=fr,baud_rate=br,slot_width=sw,signal=sig,nli=nli,ase=ase,roll_off=roll_off,chromatic_dispersion=cd,pmd=pmd,pdl=pdl,latency=latency,delta_pdb_per_channel=power_daelta,tx_osnr=txOsnr,label=label)
#######################end of spectral information######################################################################################
###############################################fiber parameters##########################################################################
FiberParams={'length':80,'length_units':'km','con_in':0,'con_out':0,'dispersion':1.7*(10**-5),'dispersion_slope':None,'effective_area':None,'gamma':1.3,'pmd_coef':0,'loss_coef':db2lin(0.2)}
########################################################End of fiber parameters##########################################################
########################################EDFA############################################################
Edfa_params = {
'f_min': 192.2e12,
'f_max': 196.1e12,
'type_variety': 'trial',
'type_def': 'fixed_gain',
'gain_flatmax': 16,
'gain_min': 16,
'p_max': 15,
'nf_model':'Model_fg(nf0=5.5)',
'dual_stage_model': None,
'preamp_variety': None,
'booster_variety': None,
'nf_min': None,
'nf_max': None,
'nf_coef': None,
'nf0': 5,
'nf_fit_coeff': None,
'nf_ripple': [0.0],
'dgt':[1.0, 1.017807767853702, 1.0356155337864215, 1.0534217504465226, 1.0712204022764056, 1.0895983485572227, 1.108555289615659, 1.1280891949729075, 1.1476135933863398, 1.1672278304018044, 1.1869318618366975, 1.2067249615595257, 1.2264996957264114, 1.2428104897182262, 1.2556591482982988, 1.2650555289898042, 1.2744470198196236, 1.2838336236692311, 1.2932153453410835, 1.3040618749785347, 1.316383926863083, 1.3301807335621048, 1.3439818461440451, 1.3598972673004606, 1.3779439775587023, 1.3981208704326855, 1.418273806730323, 1.4340878115214444, 1.445565137158368, 1.45273959485914, 1.4599103316162523, 1.4670307626366115, 1.474100442252211, 1.48111939735681, 1.488134243479226, 1.495145456062699, 1.502153039909686, 1.5097346239790443, 1.5178910621476225, 1.5266220576235803, 1.5353620432989845, 1.545374152761467, 1.5566577309558969, 1.569199764184379, 1.5817353179379183, 1.5986915141218316, 1.6201194134191075, 1.6460167077689267, 1.6719047669939942, 1.6918150918099673, 1.7057507692361864, 1.7137640932265894, 1.7217732861435076, 1.7297783508684146, 1.737780757913635, 1.7459181197626403, 1.7541903672600494, 1.7625959636196327, 1.7709972329654864, 1.7793941781790852, 1.7877868031023945, 1.7961751115773796, 1.8045606557581335, 1.8139629377087627, 1.824381436842932, 1.835814081380705, 1.847275503201129, 1.862235672444246, 1.8806927939516411, 1.9026104247588487, 1.9245345552113182, 1.9482128147680253, 1.9736443063300082, 2.0008103857988204, 2.0279625371819305, 2.055100772005235, 2.082225099873648, 2.1183028432496016, 2.16337565384239, 2.2174389328192197, 2.271520771371253, 2.322373696229342, 2.3699990328716107, 2.414398437185221, 2.4587748041127506, 2.499446286796604, 2.5364027376452056, 2.5696460593920065, 2.602860350286428, 2.630396440815385, 2.6521732021128046, 2.6681935771243177, 2.6841217449620203, 2.6947834587664494, 2.705443819238505, 2.714526681131686] ,
'gain_ripple': [0.0],
'tilt_ripple': 0,
'f_ripple_ref': None,
'out_voa_auto': False,
'allowed_for_design': False,
'raman': False,
'pmd': 0,
'pdl': 0,
'advance_configurations_from_json': None
}
#################################################End of edfa parameters########################################################
first_transciever=Transceiver(uid=1,name='one')
first_fiber=Fiber(uid=2,name='two',params=FiberParams)
first_edfa=Edfa(uid=4,name='four',params=Edfa_params)
a=first_transciever(spec_info)
b=first_edfa(a)
Hello community, C:\Users\admin\PycharmProjects\gnpy_api_exploration\oopt-gnpy\gnpy\core\parameters.py:210: RuntimeWarning: overflow encountered in scalar power
self._contrast = 0.5 * (c / (2 * pi * self._ref_frequency * self._core_radius * self._n1) * exp(
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.1.3\plugins\python-ce\helpers\pydev\pydevd.py", line 1496, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.1.3\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:\Users\admin\PycharmProjects\gnpy_api_exploration\trial.py", line 74, in <module>
b=first_edfa(a)
^^^^^^^^^^^^^
File "C:\Users\admin\PycharmProjects\gnpy_api_exploration\oopt-gnpy\gnpy\core\elements.py", line 1096, in __call__
self.propagate(spectral_info)
File "C:\Users\admin\PycharmProjects\gnpy_api_exploration\oopt-gnpy\gnpy\core\elements.py", line 1084, in propagate
self.interpol_params(spectral_info)
File "C:\Users\admin\PycharmProjects\gnpy_api_exploration\oopt-gnpy\gnpy\core\elements.py", line 856, in interpol_params
self.effective_gain = min(
^^^^
TypeError: '<' not supported between instances of 'float' and 'NoneType'
.
Can someone Help me out ,Please? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
hi all, |
Beta Was this translation helpful? Give feedback.
-
Dear @akhil-mutike |
Beta Was this translation helpful? Give feedback.
Hi all,
I solved the issue i am facing.One has to create named tuple with model name(there are different defined in the code ,search for those) and parameters(like nf0,nf_min,nf_max) as arguments.Then use this tuple to define the model by specifying the parameters for the key "nf_model" in FiberParams.