mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-10-30 01:32:21 +00:00
Changing optical power and nb channels as optional input for requests
- normal way is usually to apply the design optical power for all channels. This change uses the default power (same power as used for design) but enables to force an arbitrary power if needed. TODO : introduce spectral power density to apply power depending on baudrate. - definition of min max frequency and spacing define the nb of channels: uses min max frequencies and spacing to determine nb-channels. It is possible to force a different spacing for the request. TODO: check that the value is consistant with baudrate and min max values. Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
This commit is contained in:
@@ -62,10 +62,17 @@ def requests_from_json(json_data,equipment):
|
||||
params['spacing'] = req['path-constraints']['te-bandwidth']['spacing']
|
||||
|
||||
# recover trx physical param (baudrate, ...) from type and mode
|
||||
# in trx_mode_params optical power is read from equipment['SI']['default'] and
|
||||
# nb_channel is computed based on min max frequency and spacing
|
||||
trx_params = trx_mode_params(equipment,params['trx_type'],params['trx_mode'],True)
|
||||
params.update(trx_params)
|
||||
params['power'] = req['path-constraints']['te-bandwidth']['output-power']
|
||||
params['nb_channel'] = req['path-constraints']['te-bandwidth']['max-nb-of-channel']
|
||||
# optical power might be set differently in the request. if it is indicated then the
|
||||
# params['power'] is updated
|
||||
if req['path-constraints']['te-bandwidth']['output-power']:
|
||||
params['power'] = req['path-constraints']['te-bandwidth']['output-power']
|
||||
# same process for nb-channel
|
||||
if req['path-constraints']['te-bandwidth']['max-nb-of-channel'] :
|
||||
params['nb_channel'] = req['path-constraints']['te-bandwidth']['max-nb-of-channel']
|
||||
requests_list.append(Path_request(**params))
|
||||
return requests_list
|
||||
|
||||
|
||||
@@ -68,7 +68,8 @@ class Path_request:
|
||||
f'baud_rate:\t{self.baud_rate * 1e-9} Gbaud',
|
||||
f'bit_rate:\t{self.bit_rate * 1e-9} Gb/s',
|
||||
f'spacing:\t{self.spacing * 1e-9} GHz',
|
||||
f'power: \t{round(lin2db(self.power)+30,2)} dBm'
|
||||
f'power: \t{round(lin2db(self.power)+30,2)} dBm',
|
||||
f'nb channels: \t{self.nb_channel}'
|
||||
'\n'])
|
||||
class Disjunction:
|
||||
def __init__(self, *args, **params):
|
||||
@@ -570,6 +571,7 @@ def compute_path_dsjctn(network, equipment, pathreqlist, disjunctions_list):
|
||||
for d in disjunctions_list :
|
||||
test_sol = True
|
||||
while test_sol:
|
||||
# print('coucou')
|
||||
if candidates[d.disjunction_id] :
|
||||
for p in candidates[d.disjunction_id][0]:
|
||||
if allpaths[id(p)].req in pathreqlist_disjt:
|
||||
|
||||
@@ -32,7 +32,7 @@ logger = getLogger(__name__)
|
||||
# Type for input data
|
||||
class Request(namedtuple('Request', 'request_id source destination trx_type mode \
|
||||
spacing power nb_channel disjoint_from nodes_list is_loose')):
|
||||
def __new__(cls, request_id, source, destination, trx_type, mode , spacing , power , nb_channel , disjoint_from ='' , nodes_list = None, is_loose = ''):
|
||||
def __new__(cls, request_id, source, destination, trx_type, mode , spacing , power = None, nb_channel = None , disjoint_from ='' , nodes_list = None, is_loose = ''):
|
||||
return super().__new__(cls, request_id, source, destination, trx_type, mode, spacing, power, nb_channel, disjoint_from, nodes_list, is_loose)
|
||||
|
||||
# Type for output data: // from dutc
|
||||
@@ -73,8 +73,14 @@ class Request_element(Element):
|
||||
exit()
|
||||
# excel input are in GHz and dBm
|
||||
self.spacing = Request.spacing * 1e9
|
||||
self.power = db2lin(Request.power) * 1e-3
|
||||
self.nb_channel = int(Request.nb_channel)
|
||||
if Request.power :
|
||||
self.power = db2lin(Request.power) * 1e-3
|
||||
else:
|
||||
self.power = None
|
||||
if Request.nb_channel :
|
||||
self.nb_channel = int(Request.nb_channel)
|
||||
else:
|
||||
self.nb_channel = None
|
||||
if not isinstance(Request.disjoint_from,str):
|
||||
value = str(int(Request.disjoint_from))
|
||||
if value.endswith('.0'):
|
||||
|
||||
Reference in New Issue
Block a user