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:
EstherLerouzic
2018-12-19 15:22:03 +00:00
parent 8d97fcd735
commit 9cfb57dc4b
5 changed files with 25 additions and 18 deletions

View File

@@ -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)