Fix warnings for raman amp type varieties

Currently, a warning about fiber lineic loss being above threshold is
printed even when the warning is triggered by that the previous node is
not a fiber, which is confusing. Additionally, when a warning about
raman is triggered, the code in the following else clause is not
executed, which means that a potential warning about gain level is
disabled. These two warnings are independent and the second one should
not be disabled by the first one.

Signed-off-by: Jonas Mårtensson <jonas.martensson@ri.se>
Change-Id: I8ad58b4ebf6e7df1a949a77d67ed948ef385c47e
This commit is contained in:
Jonas Mårtensson
2021-09-28 13:08:57 +02:00
parent d28c67143e
commit f94d06f124

View File

@@ -303,9 +303,14 @@ def set_egress_amplifier(network, this_node, equipment, pref_ch_db, pref_total_d
node.params.update_params(extra_params.__dict__)
dp += power_reduction
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 node.params.raman and not raman_allowed:
if isinstance(prev_node, elements.Fiber):
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:
print(f'{ansi_escapes.red}WARNING{ansi_escapes.reset}: raman is used in node {node.uid}\n '
'but previous node is not a fiber\n')
# 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 - \