mirror of
				https://github.com/Telecominfraproject/oopt-gnpy.git
				synced 2025-10-30 17:47:50 +00:00 
			
		
		
		
	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 <esther.lerouzic@orange.com>
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							| @@ -10,7 +10,7 @@ | |||||||
|         "te-bandwidth": { |         "te-bandwidth": { | ||||||
|           "technology": "flexi-grid", |           "technology": "flexi-grid", | ||||||
|           "trx_type": "Voyager", |           "trx_type": "Voyager", | ||||||
|           "trx_mode": "mode 1", |           "trx_mode": null, | ||||||
|           "effective-freq-slot": [ |           "effective-freq-slot": [ | ||||||
|             { |             { | ||||||
|               "n": "null", |               "n": "null", | ||||||
| @@ -45,7 +45,7 @@ | |||||||
|             } |             } | ||||||
|           ], |           ], | ||||||
|           "spacing": 50000000000.0, |           "spacing": 50000000000.0, | ||||||
|           "max-nb-of-channel": 80, |           "max-nb-of-channel": null, | ||||||
|           "output-power": 0.0012589254117941673, |           "output-power": 0.0012589254117941673, | ||||||
|           "path_bandwidth": 0 |           "path_bandwidth": 0 | ||||||
|         } |         } | ||||||
| @@ -133,8 +133,8 @@ | |||||||
|             } |             } | ||||||
|           ], |           ], | ||||||
|           "spacing": 50000000000.0, |           "spacing": 50000000000.0, | ||||||
|           "max-nb-of-channel": 80, |           "max-nb-of-channel": null, | ||||||
|           "output-power": 0.0012589254117941673, |           "output-power": null, | ||||||
|           "path_bandwidth": 60000000000.0 |           "path_bandwidth": 60000000000.0 | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
| @@ -152,7 +152,7 @@ | |||||||
|         "te-bandwidth": { |         "te-bandwidth": { | ||||||
|           "technology": "flexi-grid", |           "technology": "flexi-grid", | ||||||
|           "trx_type": "vendorA_trx-type1", |           "trx_type": "vendorA_trx-type1", | ||||||
|           "trx_mode": "mode 2", |           "trx_mode": null, | ||||||
|           "effective-freq-slot": [ |           "effective-freq-slot": [ | ||||||
|             { |             { | ||||||
|               "n": "null", |               "n": "null", | ||||||
| @@ -160,8 +160,8 @@ | |||||||
|             } |             } | ||||||
|           ], |           ], | ||||||
|           "spacing": 75000000000.0, |           "spacing": 75000000000.0, | ||||||
|           "max-nb-of-channel": 63, |           "max-nb-of-channel": null, | ||||||
|           "output-power": 0.0019952623149688794, |           "output-power": null, | ||||||
|           "path_bandwidth": 150000000000.0 |           "path_bandwidth": 150000000000.0 | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
| @@ -188,7 +188,7 @@ | |||||||
|           ], |           ], | ||||||
|           "spacing": 75000000000.0, |           "spacing": 75000000000.0, | ||||||
|           "max-nb-of-channel": 63, |           "max-nb-of-channel": 63, | ||||||
|           "output-power": 0.0019952623149688794, |           "output-power": null, | ||||||
|           "path_bandwidth": 20000000000.0 |           "path_bandwidth": 20000000000.0 | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
|   | |||||||
| @@ -69,6 +69,7 @@ def requests_from_json(json_data,equipment): | |||||||
|         # nb_channel is computed based on min max frequency and spacing |         # nb_channel is computed based on min max frequency and spacing | ||||||
|         trx_params = trx_mode_params(equipment,params['trx_type'],params['trx_mode'],True) |         trx_params = trx_mode_params(equipment,params['trx_type'],params['trx_mode'],True) | ||||||
|         params.update(trx_params) |         params.update(trx_params) | ||||||
|  |         print(trx_params['tx_osnr']) | ||||||
|         # optical power might be set differently in the request. if it is indicated then the  |         # optical power might be set differently in the request. if it is indicated then the  | ||||||
|         # params['power'] is updated |         # params['power'] is updated | ||||||
|         if req['path-constraints']['te-bandwidth']['output-power']: |         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.tsp_mode = mode['format'] | ||||||
|                     pathreq.format = mode['format'] |                     pathreq.format = mode['format'] | ||||||
|                     pathreq.OSNR = mode['OSNR'] |                     pathreq.OSNR = mode['OSNR'] | ||||||
|  |                     pathreq.tx_osnr = mode['tx_osnr'] | ||||||
|                     pathreq.bit_rate = mode['bit_rate'] |                     pathreq.bit_rate = mode['bit_rate'] | ||||||
|                 else : |                 else : | ||||||
|                     total_path = [] |                     total_path = [] | ||||||
|   | |||||||
| @@ -173,6 +173,7 @@ def trx_mode_params(equipment, trx_type_variety='', trx_mode='', error_message=F | |||||||
|                        "OSNR": None, |                        "OSNR": None, | ||||||
|                        "bit_rate": None, |                        "bit_rate": None, | ||||||
|                        "roll_off": None, |                        "roll_off": None, | ||||||
|  |                        "tx_osnr":None, | ||||||
|                        "cost":None} |                        "cost":None} | ||||||
|         trx_params = {**mode_params} |         trx_params = {**mode_params} | ||||||
|         trx_params['frequency'] = equipment['Transceiver'][trx_type_variety].frequency |         trx_params['frequency'] = equipment['Transceiver'][trx_type_variety].frequency | ||||||
|   | |||||||
| @@ -410,22 +410,26 @@ def propagate_and_optimize_mode(path, req, equipment, show=False): | |||||||
|                 if m['baud_rate'] == b] |                 if m['baud_rate'] == b] | ||||||
|             modes_to_explore = sorted(modes_to_explore,  |             modes_to_explore = sorted(modes_to_explore,  | ||||||
|                 key = lambda x: x['bit_rate'], reverse=True) |                 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 |             # step2 : computes propagation for each baudrate: stop and select the first that passes | ||||||
|             found_a_feasible_mode = False |             found_a_feasible_mode = False | ||||||
|             # TODO : the case of roll of is not included: for now use SI one |             # 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 |             # TODO : if the loop in mode optimization does not have a feasible path, then bugs | ||||||
|  |             for m in modes_to_explore : | ||||||
|                 si = create_input_spectral_information( |                 si = create_input_spectral_information( | ||||||
|                 req.frequency['min'], equipment['SI']['default'].roll_off, |                 req.frequency['min'], equipment['SI']['default'].roll_off, | ||||||
|             b, req.power, req.spacing, req.nb_channel, req.tx_osnr) |                 b, req.power, req.spacing, req.nb_channel, m['tx_osnr']) | ||||||
|                 for el in path: |                 for el in path: | ||||||
|                     si = el(si) |                     si = el(si) | ||||||
|                 if show : |                 if show : | ||||||
|                     print(el) |                     print(el) | ||||||
|             for m in modes_to_explore : |                 if path[-1].snr is not None: | ||||||
|                     if round(mean(path[-1].snr+lin2db(b/(12.5e9))),2) > m['OSNR'] : |                     if round(mean(path[-1].snr+lin2db(b/(12.5e9))),2) > m['OSNR'] : | ||||||
|                         found_a_feasible_mode = True |                         found_a_feasible_mode = True | ||||||
|                         return path, m |                         return path, m | ||||||
|         # only get to this point if no budrate/mode staisfies OSNR requirement |                 else:   | ||||||
|  |                     return [], None | ||||||
|  |         # only get to this point if no baudrate/mode satisfies OSNR requirement | ||||||
|         # returns the last propagated path and mode |         # returns the last propagated path and mode | ||||||
|         msg = f'Warning! Request {req.request_id}: no mode satisfies path SNR requirement.\n' |         msg = f'Warning! Request {req.request_id}: no mode satisfies path SNR requirement.\n' | ||||||
|         print(msg) |         print(msg) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 EstherLerouzic
					EstherLerouzic