mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-02 02:57:52 +00:00
Add some tests to support partial per degree target power definition
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
This commit is contained in:
committed by
Jan Kundrát
parent
3481ba8ee3
commit
fa826391f6
@@ -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:
|
||||
# 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
|
||||
|
||||
@@ -316,19 +316,17 @@ def set_egress_amplifier(network, roadm, equipment, pref_total_db):
|
||||
# next_node = next(n for n in network.successors(node))
|
||||
# next_node = find_last_node(next_node)
|
||||
|
||||
try:
|
||||
if node.params.per_degree_target_pch_out_db:
|
||||
if node.per_degree_target_pch_out_db:
|
||||
# find the target power on this degree
|
||||
# need to change this ! #############################
|
||||
prev_dp = next(el["target_pch_out_db"] for el in node.params.per_degree_target_pch_out_db if el["to_node"]==next_node.uid)
|
||||
node.params = node.params._replace(target_pch_out_db=prev_dp)
|
||||
try:
|
||||
prev_dp = next(el["target_pch_out_db"] for el in \
|
||||
node.per_degree_target_pch_out_db if el["to_node"]==next_node.uid)
|
||||
except StopIteration:
|
||||
# if no target power is defined on this degree use the global one
|
||||
prev_dp = getattr(node.params, 'target_pch_out_db', 0)
|
||||
else:
|
||||
# if no per degree target power is given use the global one
|
||||
prev_dp = getattr(node.params, 'target_pch_out_db', 0)
|
||||
node.params = node.params._replace(target_pch_out_db=prev_dp)
|
||||
except AttributeError:
|
||||
prev_dp = getattr(node.params, 'target_pch_out_db', 0)
|
||||
|
||||
####### en fait change pas les elements !, faudrait plusieurs pchtarget dans le roadm
|
||||
dp = prev_dp
|
||||
prev_voa = 0
|
||||
voa = 0
|
||||
|
||||
Reference in New Issue
Block a user