From 6eb1c54bbc0877f4211225a3b171466b0249c00c Mon Sep 17 00:00:00 2001 From: EstherLerouzic Date: Tue, 26 Nov 2024 14:13:37 +0100 Subject: [PATCH] feat: add more warnings on amplifiers when user settings do not match library Signed-off-by: EstherLerouzic Change-Id: Id387b7781d9637f1d18c453dae75330962229902 --- gnpy/core/network.py | 7 ++++++- tests/invocation/logs_power_sweep_example | 5 +++++ tests/invocation/logs_transmission_saturated | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gnpy/core/network.py b/gnpy/core/network.py index 0f90240c9..08cbd0541 100644 --- a/gnpy/core/network.py +++ b/gnpy/core/network.py @@ -780,7 +780,12 @@ def set_one_amplifier(node: elements.Edfa, prev_node, next_node, power_mode: boo + '\tmax flat gain: ' + f'{equipment["Edfa"][node.params.type_variety].gain_flatmax}dB ; ' + f'required gain: {round(gain_target, 2)}dB. Please check amplifier type.\n') - + if gain_target - equipment['Edfa'][node.params.type_variety].gain_min < 0 and verbose: + logger.warning(f'\n\tWARNING: effective gain in Node {node.uid}\n' + + f'\tis below user specified amplifier {node.params.type_variety}\n' + + '\tmin gain: ' + + f'{equipment["Edfa"][node.params.type_variety].gain_min}dB ; ' + + f'required gain: {round(gain_target, 2)}dB. Please check amplifier type.\n') node.delta_p = dp if power_mode else None node.effective_gain = gain_target node.tilt_target = _tilt_target diff --git a/tests/invocation/logs_power_sweep_example b/tests/invocation/logs_power_sweep_example index 7969b904e..515ca239f 100644 --- a/tests/invocation/logs_power_sweep_example +++ b/tests/invocation/logs_power_sweep_example @@ -14,6 +14,11 @@ WARNING gnpy.core.network:network.py is above user specified amplifier std_low_gain max flat gain: 16dB ; required gain: 21.22dB. Please check amplifier type. +WARNING gnpy.core.network:network.py + WARNING: effective gain in Node east edfa in Stbrieuc to Rennes_STA + is below user specified amplifier std_medium_gain + min gain: 15dB ; required gain: 12.0dB. Please check amplifier type. + WARNING gnpy.core.network:network.py WARNING: target gain and power in node west edfa in Rennes_STA to Stbrieuc is beyond all available amplifiers capabilities and/or extended_gain_range: diff --git a/tests/invocation/logs_transmission_saturated b/tests/invocation/logs_transmission_saturated index 264c33f0a..5b211ad9f 100644 --- a/tests/invocation/logs_transmission_saturated +++ b/tests/invocation/logs_transmission_saturated @@ -14,6 +14,11 @@ WARNING gnpy.core.network:network.py is above user specified amplifier std_low_gain max flat gain: 16dB ; required gain: 21.18dB. Please check amplifier type. +WARNING gnpy.core.network:network.py + WARNING: effective gain in Node east edfa in Stbrieuc to Rennes_STA + is below user specified amplifier std_medium_gain + min gain: 15dB ; required gain: 12.0dB. Please check amplifier type. + WARNING gnpy.core.network:network.py WARNING: target gain and power in node west edfa in Rennes_STA to Stbrieuc is beyond all available amplifiers capabilities and/or extended_gain_range: