add warning in case gain over max_flat_gain + extended_gain_range

This is an old pull request rebased and restricted to only raising warning.
The initial work also limited gain, which is finally not a desired behaviour:
an advanced user might want to have this high gain.

the only impact on test is that it raises warnings on almost all amplifiers
on the mesh_topology_exampleV2.xls: indeed all of them are set to low_gain
but without gain specified and the result of autodesign results in higher gains
than supported by this amplifier variety.

This may be confusing for users to see these warnings on an example from gnpy
so I will push a new commit changing the amp types to avoid this.
The alternative would be to push the warnings into the logger, so they
remain invisible, but I think that the example change makes more sense.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: Idf0c67137b5b466b07ddc7817f53a82f92a21a5b
This commit is contained in:
EstherLerouzic
2020-08-31 16:48:22 +02:00
committed by Jan Kundrát
parent e6ee512001
commit 94b9c16d67
2 changed files with 31 additions and 0 deletions

View File

@@ -302,6 +302,17 @@ def set_egress_amplifier(network, roadm, equipment, pref_total_db):
gain_target += power_reduction
elif node.params.raman and not raman_allowed:
print(f'{ansi_escapes.red}WARNING{ansi_escapes.reset}: raman is used in node {node.uid}\n but fiber lineic loss is above threshold\n')
else:
# if variety is imposed by user, and if the gain_target (computed or imposed) is also above
# variety max gain + extended range, then warn that gain > max_gain + extended range
if gain_target - equipment['Edfa'][node.params.type_variety].gain_flatmax - \
equipment['Span']['default'].target_extended_gain > 1e-2:
# 1e-2 to allow a small margin according to round2float min step
print(f'{ansi_escapes.red}WARNING{ansi_escapes.reset}: '
f'WARNING: effective gain in Node {node.uid} is above user '
f'specified amplifier {node.params.type_variety}\n'
f'max flat gain: {equipment["Edfa"][node.params.type_variety].gain_flatmax}dB ; '
f'required gain: {gain_target}dB. Please check amplifier type.')
node.delta_p = dp if power_mode else None
node.effective_gain = gain_target

View File

@@ -1,4 +1,24 @@
Computing path requests gnpy/example-data/meshTopologyExampleV2.xls into JSON format
WARNING: WARNING: effective gain in Node east edfa in Lannion_CAS to Corlay is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 21.0dB. Please check amplifier type.
WARNING: WARNING: effective gain in Node west edfa in Lorient_KMA to Loudeac is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 28.0dB. Please check amplifier type.
WARNING: WARNING: effective gain in Node east edfa in Lannion_CAS to Stbrieuc is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 21.0dB. Please check amplifier type.
WARNING: WARNING: effective gain in Node east edfa in Lannion_CAS to Morlaix is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 21.0dB. Please check amplifier type.
WARNING: WARNING: effective gain in Node east edfa in Lorient_KMA to Loudeac is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 21.0dB. Please check amplifier type.
WARNING: WARNING: effective gain in Node west edfa in Lannion_CAS to Corlay is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 28.0dB. Please check amplifier type.
WARNING: WARNING: effective gain in Node west edfa in Vannes_KBE to Lorient_KMA is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 23.0dB. Please check amplifier type.
WARNING: WARNING: effective gain in Node east edfa in Vannes_KBE to Lorient_KMA is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 21.0dB. Please check amplifier type.
WARNING: WARNING: effective gain in Node east edfa in Rennes_STA to Stbrieuc is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 21.0dB. Please check amplifier type.
WARNING: WARNING: effective gain in Node east edfa in Brest_KLA to Morlaix is above user specified amplifier std_low_gain
max flat gain: 16dB ; required gain: 21.0dB. Please check amplifier type.
List of disjunctions
[Disjunction 3
relaxable: false