diff --git a/gnpy/tools/cli_examples.py b/gnpy/tools/cli_examples.py index 155d0042..0dd64710 100644 --- a/gnpy/tools/cli_examples.py +++ b/gnpy/tools/cli_examples.py @@ -410,7 +410,8 @@ def path_requests_run(args=None): f'-', f'{rqs[i].blocking_reason}'] except AttributeError: line = [f'{rqs[i].request_id}', f' {rqs[i].source} to {rqs[i].destination} : ', psnrb, - psnr, f'{rqs[i].OSNR}', f'{rqs[i].tsp_mode}', f'{round(rqs[i].path_bandwidth * 1e-9,2)}', + psnr, f'{rqs[i].OSNR + equipment["SI"]["default"].sys_margins}', + f'{rqs[i].tsp_mode}', f'{round(rqs[i].path_bandwidth * 1e-9,2)}', f'{ceil(rqs[i].path_bandwidth / rqs[i].bit_rate) }', f'({rqs[i].N},{rqs[i].M})'] data.append(line) diff --git a/gnpy/tools/json_io.py b/gnpy/tools/json_io.py index 70bf6c1a..016d66dd 100644 --- a/gnpy/tools/json_io.py +++ b/gnpy/tools/json_io.py @@ -230,14 +230,6 @@ def load_equipment(filename): return _equipment_from_json(json_data, filename) -def _update_trx_osnr(equipment): - """add sys_margins to all Transceivers OSNR values""" - for trx in equipment['Transceiver'].values(): - for m in trx.mode: - m['OSNR'] = m['OSNR'] + equipment['SI']['default'].sys_margins - return equipment - - def _update_dual_stage(equipment): edfa_dict = equipment['Edfa'] for edfa in edfa_dict.values(): @@ -298,7 +290,6 @@ def _equipment_from_json(json_data, filename): equipment[key][subkey] = RamanFiber(**entry) else: raise EquipmentConfigError(f'Unrecognized network element type "{key}"') - equipment = _update_trx_osnr(equipment) equipment = _update_dual_stage(equipment) _roadm_restrictions_sanity_check(equipment) return equipment diff --git a/gnpy/topology/request.py b/gnpy/topology/request.py index 28a88eb5..0e41572c 100644 --- a/gnpy/topology/request.py +++ b/gnpy/topology/request.py @@ -375,7 +375,8 @@ def propagate_and_optimize_mode(path, req, equipment): path[-1].update_snr(this_mode['tx_osnr'], equipment['Roadm']['default'].add_drop_osnr) else: path[-1].update_snr(this_mode['tx_osnr']) - if round(min(path[-1].snr + lin2db(this_br / (12.5e9))), 2) > this_mode['OSNR']: + if round(min(path[-1].snr + lin2db(this_br / (12.5e9))), 2) \ + > this_mode['OSNR'] + equipment['SI']['default'].sys_margins: return path, this_mode else: last_explored_mode = this_mode @@ -1092,11 +1093,11 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist): # baud_rate was defined propagate(total_path, pathreq, equipment) temp_snr01nm = round(mean(total_path[-1].snr+lin2db(pathreq.baud_rate/(12.5e9))), 2) - if temp_snr01nm < pathreq.OSNR: + if temp_snr01nm < pathreq.OSNR + equipment['SI']['default'].sys_margins: msg = f'\tWarning! Request {pathreq.request_id} computed path from' +\ f' {pathreq.source} to {pathreq.destination} does not pass with' +\ f' {pathreq.tsp_mode}\n\tcomputedSNR in 0.1nm = {temp_snr01nm} ' +\ - f'- required osnr {pathreq.OSNR}' + f'- required osnr {pathreq.OSNR} + {equipment["SI"]["default"].sys_margins} margin' print(msg) LOGGER.warning(msg) pathreq.blocking_reason = 'MODE_NOT_FEASIBLE' @@ -1139,11 +1140,12 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist): propagated_reversed_path = rev_p temp_snr01nm = round(mean(propagated_reversed_path[-1].snr +\ lin2db(pathreq.baud_rate/(12.5e9))), 2) - if temp_snr01nm < pathreq.OSNR: + if temp_snr01nm < pathreq.OSNR + equipment['SI']['default'].sys_margins: msg = f'\tWarning! Request {pathreq.request_id} computed path from' +\ f' {pathreq.source} to {pathreq.destination} does not pass with' +\ f' {pathreq.tsp_mode}\n' +\ - f'\tcomputedSNR in 0.1nm = {temp_snr01nm} - required osnr {pathreq.OSNR}' + f'\tcomputedSNR in 0.1nm = {temp_snr01nm} -' \ + f' required osnr {pathreq.OSNR} + {equipment["SI"]["default"].sys_margins} margin' print(msg) LOGGER.warning(msg) # TODO selection of mode should also be on reversed direction !!