Add some tests to support partial per degree target power definition

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
This commit is contained in:
EstherLerouzic
2019-10-30 16:10:02 +00:00
committed by Jan Kundrát
parent 3481ba8ee3
commit fa826391f6
2 changed files with 17 additions and 13 deletions

View File

@@ -160,9 +160,15 @@ class Roadm(Node):
#but add channels are not, so we define an effective loss
#in the case of add channels
if self.per_degree_target_pch_out_db:
temp = next(el['target_pch_out_db'] \
for el in self.per_degree_target_pch_out_db if el['to_node']==degree)
# find the target power on this degree
try:
temp = next(el['target_pch_out_db'] \
for el in self.per_degree_target_pch_out_db if el['to_node']==degree)
except StopIteration:
# if no target power is defined on this degree use the global one
temp = self.params.target_pch_out_db
else:
# if no per degree target power are defined, use the global one
temp = self.params.target_pch_out_db
self.effective_pch_out_db = min(pref.p_spani, temp)
self.effective_loss = pref.p_spani - self.effective_pch_out_db