Improve Select_edfa algorithm

can pick up the best NF amplifier among several amplifiers
sharing the same gain and/or power requirements when these requirements
are not satisfied (used to take the highest gain or the highest power)

Signed-off-by: Jean-Luc Auge <jeanluc.auge@orange.com>
This commit is contained in:
Jean-Luc Auge
2018-08-08 15:11:59 +02:00
parent 87e748cd83
commit a49c137b78
2 changed files with 16 additions and 7 deletions

View File

@@ -31,7 +31,7 @@
"type_def": "fixed_gain", "type_def": "fixed_gain",
"gain_flatmax": 20, "gain_flatmax": 20,
"gain_min": 20, "gain_min": 20,
"p_max": 20, "p_max": 21,
"nf0": 5.5, "nf0": 5.5,
"allowed_for_design": true "allowed_for_design": true
}, },

View File

@@ -87,15 +87,24 @@ def select_edfa(gain_target, power_target, equipment):
for edfa_variety, edfa in edfa_dict.items() for edfa_variety, edfa in edfa_dict.items()
if edfa.allowed_for_design] if edfa.allowed_for_design]
acceptable_gain_list = list(filter(lambda x : x.gain>-TARGET_EXTENDED_GAIN, edfa_list)) acceptable_gain_list = \
list(filter(lambda x : x.gain>-TARGET_EXTENDED_GAIN, edfa_list))
if len(acceptable_gain_list) < 1: if len(acceptable_gain_list) < 1:
#no amplifier satisfies the required gain, so pick the highest gain: #no amplifier satisfies the required gain, so pick the highest gain:
return max(edfa_list, key=itemgetter(2)).variety #filter on gain gain_max = max(edfa_list, key=itemgetter(2)).gain
acceptable_power_list = list(filter(lambda x : x.power>=0, acceptable_gain_list)) #pick up all amplifiers that share this max gain:
if len(acceptable_power_list) < 1: acceptable_gain_list = \
list(filter(lambda x : x.gain-gain_max>-0.1, edfa_list))
acceptable_power_list = \
list(filter(lambda x : x.power>=0, acceptable_gain_list))
if len(acceptable_power_list) < 1:
#no amplifier satisfies the required power, so pick the highest power: #no amplifier satisfies the required power, so pick the highest power:
return max(acceptable_gain_list, key=itemgetter(1)).variety #filter on power power_max = \
# gain and power requirements are satisfied: max(acceptable_gain_list, key=itemgetter(1)).power
#pick up all amplifiers that share this max gain:
acceptable_power_list = \
list(filter(lambda x : x.power-power_max>-0.1, acceptable_gain_list))
# gain and power requirements are resolved,
# =>chose the amp with the best NF among the acceptable ones: # =>chose the amp with the best NF among the acceptable ones:
return min(acceptable_power_list, key=itemgetter(3)).variety #filter on NF return min(acceptable_power_list, key=itemgetter(3)).variety #filter on NF