From 9cfb57dc4bc0fffcae8638990b492755b4c4ff2c Mon Sep 17 00:00:00 2001 From: EstherLerouzic Date: Wed, 19 Dec 2018 15:22:03 +0000 Subject: [PATCH] bug fix due to tx_osnr add tx_osnr was impacting automatic mode selection feature : this commit solves the error + add a novel version of the excel example with an empty mode cases Signed-off-by: EstherLerouzic --- examples/meshTopologyExampleV2.xls | Bin 14848 -> 14848 bytes examples/meshTopologyExampleV2_services.json | 16 ++++++------- examples/path_requests_run.py | 2 ++ gnpy/core/equipment.py | 1 + gnpy/core/request.py | 24 +++++++++++-------- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/examples/meshTopologyExampleV2.xls b/examples/meshTopologyExampleV2.xls index ade7566e51c1b5f2821dae409e913c59c58e7c6c..ab72a957dea0dfc90573bc450b271184e07b7213 100644 GIT binary patch delta 823 zcmY*WJ4+l<7(I6$cV=g2_T?fQwh&oT?6R(}Ai+ull4cR?(k+6`AO=kq8(%B9g;>cg zZ2SXu!6}SjVP#>MPL!ldTH6#$NJ#SCS@hnWY36+A&UYTS)9$oC%?FjuBIvQv4BxMQ z>>|L=a(}R}vEFWVk;T1O2~OG9h-IpLDa>bK(19KJVD!d;!Ui#MT49sc>O2QW=qug< zSR8E?zu2_Y%o0lj5~MFKzK?drVs&#e%%~rvpl-mB0-7K#poNF!IWC8V#3)1bZM4bu zN}90TbD&{q{4A?^x)xALBr0R^q(s3!LuylOkD{NC!6;EM#6qvQ80mOUgDk3@eO78AMg une&Nd)1P{UIkMLIXB=ONwdoP}u|E6m^T{0(`&K==o_=kzo9Ne!WBv!*tZ-!j delta 815 zcmZuvyGjE=6g`uDn%&Jq;wuY^1i^$P8br}93Zkfut&NB_#s`Y&G$bP03BndO_JV?_ zTUi9`1-G&D2mFQL^Uhk#2+qL3nRD;C=iZq{wNbsDbTS7i(9*E5zP+(`3S%nb1iGt8K$ zJ04?_LJma+I%9N~!xx=dbcQ+Sg=M#iZnF4al;OF>hOJU0BR>3Gm&FXbA6`-H(geyx jG&WbyZoI9LKJ#v_%Q`rGVcwyd_a8^b753q`#th{LxGZYG diff --git a/examples/meshTopologyExampleV2_services.json b/examples/meshTopologyExampleV2_services.json index eacbea1c..3fef7f95 100644 --- a/examples/meshTopologyExampleV2_services.json +++ b/examples/meshTopologyExampleV2_services.json @@ -10,7 +10,7 @@ "te-bandwidth": { "technology": "flexi-grid", "trx_type": "Voyager", - "trx_mode": "mode 1", + "trx_mode": null, "effective-freq-slot": [ { "n": "null", @@ -45,7 +45,7 @@ } ], "spacing": 50000000000.0, - "max-nb-of-channel": 80, + "max-nb-of-channel": null, "output-power": 0.0012589254117941673, "path_bandwidth": 0 } @@ -133,8 +133,8 @@ } ], "spacing": 50000000000.0, - "max-nb-of-channel": 80, - "output-power": 0.0012589254117941673, + "max-nb-of-channel": null, + "output-power": null, "path_bandwidth": 60000000000.0 } }, @@ -152,7 +152,7 @@ "te-bandwidth": { "technology": "flexi-grid", "trx_type": "vendorA_trx-type1", - "trx_mode": "mode 2", + "trx_mode": null, "effective-freq-slot": [ { "n": "null", @@ -160,8 +160,8 @@ } ], "spacing": 75000000000.0, - "max-nb-of-channel": 63, - "output-power": 0.0019952623149688794, + "max-nb-of-channel": null, + "output-power": null, "path_bandwidth": 150000000000.0 } }, @@ -188,7 +188,7 @@ ], "spacing": 75000000000.0, "max-nb-of-channel": 63, - "output-power": 0.0019952623149688794, + "output-power": null, "path_bandwidth": 20000000000.0 } }, diff --git a/examples/path_requests_run.py b/examples/path_requests_run.py index f3e7d343..dcbf4580 100755 --- a/examples/path_requests_run.py +++ b/examples/path_requests_run.py @@ -69,6 +69,7 @@ def requests_from_json(json_data,equipment): # 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) + print(trx_params['tx_osnr']) # 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']: @@ -208,6 +209,7 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist): pathreq.tsp_mode = mode['format'] pathreq.format = mode['format'] pathreq.OSNR = mode['OSNR'] + pathreq.tx_osnr = mode['tx_osnr'] pathreq.bit_rate = mode['bit_rate'] else : total_path = [] diff --git a/gnpy/core/equipment.py b/gnpy/core/equipment.py index 26b624ca..5dfa34fe 100644 --- a/gnpy/core/equipment.py +++ b/gnpy/core/equipment.py @@ -173,6 +173,7 @@ def trx_mode_params(equipment, trx_type_variety='', trx_mode='', error_message=F "OSNR": None, "bit_rate": None, "roll_off": None, + "tx_osnr":None, "cost":None} trx_params = {**mode_params} trx_params['frequency'] = equipment['Transceiver'][trx_type_variety].frequency diff --git a/gnpy/core/request.py b/gnpy/core/request.py index 4a9ac9f3..bab680c4 100644 --- a/gnpy/core/request.py +++ b/gnpy/core/request.py @@ -410,22 +410,26 @@ def propagate_and_optimize_mode(path, req, equipment, show=False): if m['baud_rate'] == b] modes_to_explore = sorted(modes_to_explore, key = lambda x: x['bit_rate'], reverse=True) + print(modes_to_explore) # step2 : computes propagation for each baudrate: stop and select the first that passes found_a_feasible_mode = False # TODO : the case of roll of is not included: for now use SI one # TODO : if the loop in mode optimization does not have a feasible path, then bugs - si = create_input_spectral_information( - req.frequency['min'], equipment['SI']['default'].roll_off, - b, req.power, req.spacing, req.nb_channel, req.tx_osnr) - for el in path: - si = el(si) + for m in modes_to_explore : + si = create_input_spectral_information( + req.frequency['min'], equipment['SI']['default'].roll_off, + b, req.power, req.spacing, req.nb_channel, m['tx_osnr']) + for el in path: + si = el(si) if show : print(el) - for m in modes_to_explore : - if round(mean(path[-1].snr+lin2db(b/(12.5e9))),2) > m['OSNR'] : - found_a_feasible_mode = True - return path, m - # only get to this point if no budrate/mode staisfies OSNR requirement + if path[-1].snr is not None: + if round(mean(path[-1].snr+lin2db(b/(12.5e9))),2) > m['OSNR'] : + found_a_feasible_mode = True + return path, m + else: + return [], None + # only get to this point if no baudrate/mode satisfies OSNR requirement # returns the last propagated path and mode msg = f'Warning! Request {req.request_id}: no mode satisfies path SNR requirement.\n' print(msg)