Skip to content

Commit

Permalink
Use design delta_p and gains instead of p_spani
Browse files Browse the repository at this point in the history
Remove the visualisation of the effective_pch in amp because actual
and target are the relevant ones. effective_pch was artificially
related to a mix of reference channel and noisy channel (mixed between
on the fly redesign but using actual ROADM equalisation which includes noise
in its actual loss).

the change does no more rely on the target power (which is rounded)
but on the designed gain, which is not rounded.

Propagations are slightly changed for openroadm simulations because of that.
(I verified)

The gain of amp was estimated on the fly with p_spni also in case of
RamanFiber preceding elements. removing p_spani requies that an estimation
of Raman gain be done during design.

This commit also adds this estimation.

Signed-off-by: EstherLerouzic <[email protected]>
Change-Id: I960b85e99f85a7d168ac5349e325c4928fa5673b
  • Loading branch information
EstherLerouzic committed Nov 2, 2023
1 parent 4277f34 commit 9c2e596
Show file tree
Hide file tree
Showing 17 changed files with 117 additions and 107 deletions.
6 changes: 1 addition & 5 deletions gnpy/core/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,6 @@ def __str__(self):
f' Power Out (dBm): {self.pout_db:.2f}',
f' Delta_P (dB): ' + (f'{self.delta_p:.2f}' if self.delta_p is not None else 'None'),
f' target pch (dBm): ' + (f'{self.target_pch_out_db:.2f}' if self.target_pch_out_db is not None else 'None'),
f' effective pch (dBm): {self.effective_pch_out_db:.2f}',
f' actual pch out (dBm): {total_pch}',
f' output VOA (dB): {self.out_voa:.2f}'])

Expand Down Expand Up @@ -813,24 +812,21 @@ def interpol_params(self, spectral_info):
self.slot_width = self.channel_freq[1] - self.channel_freq[0]

"""in power mode: delta_p is defined and can be used to calculate the power target
This power target is used calculate the amplifier gain"""
This power target correspond to the channel used for design"""
pref = spectral_info.pref
if self.delta_p is not None and self.operational.delta_p is not None:
# use the user defined target
self.target_pch_out_db = round(self.operational.delta_p + pref.p_span0, 2)
self.effective_gain = self.target_pch_out_db - pref.p_spani
elif self.delta_p is not None:
# use the design target if no target were set
self.target_pch_out_db = round(self.delta_p + pref.p_span0, 2)
self.effective_gain = self.target_pch_out_db - pref.p_spani

"""check power saturation and correct effective gain & power accordingly:"""
# Compute the saturation accounting for actual power at the input of the amp
self.effective_gain = min(
self.effective_gain,
self.params.p_max - self.pin_db
)
self.effective_pch_out_db = round(pref.p_spani + self.effective_gain, 2)

"""check power saturation and correct target_gain accordingly:"""
self.nf = self._calc_nf()
Expand Down
72 changes: 63 additions & 9 deletions gnpy/core/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
Working with networks which consist of network elements
"""

from copy import deepcopy
from operator import attrgetter
from gnpy.core import ansi_escapes, elements
from gnpy.core.exceptions import ConfigurationError, NetworkTopologyError
from gnpy.core.utils import round2float, convert_length, psd2powerdbm, lin2db, watt2dbm
from gnpy.core.info import ReferenceCarrier
from gnpy.core.utils import round2float, convert_length, psd2powerdbm, lin2db, watt2dbm, dbm2watt
from gnpy.core.info import ReferenceCarrier, create_input_spectral_information
from gnpy.core.parameters import SimParams
from collections import namedtuple


Expand Down Expand Up @@ -130,7 +132,7 @@ def target_power(network, node, equipment): # get_fiber_dp
SPAN_LOSS_REF = 20
POWER_SLOPE = 0.3
dp_range = list(equipment['Span']['default'].delta_power_range_db)
node_loss = span_loss(network, node)
node_loss = span_loss(network, node, equipment)

try:
dp = round2float((node_loss - SPAN_LOSS_REF) * POWER_SLOPE, dp_range[2])
Expand Down Expand Up @@ -177,12 +179,64 @@ def next_node_generator(network, node):
yield from next_node_generator(network, next_node)


def span_loss(network, node):
def estimate_raman_gain(node, equipment):
"""If node is RamanFiber, then estimate the possible Raman gain if any
for this purpose propagate a fake signal in a copy.
to be accurate the nb of channel should be the same as in SI, but this increases computation time
"""
f_min = equipment['SI']['default'].f_min
f_max = equipment['SI']['default'].f_max
roll_off = equipment['SI']['default'].roll_off
baud_rate = equipment['SI']['default'].baud_rate
power_dbm = equipment['SI']['default'].power_dbm
power = dbm2watt(equipment['SI']['default'].power_dbm)
spacing = equipment['SI']['default'].spacing
tx_osnr = equipment['SI']['default'].tx_osnr

sim_params = {
"raman_params": {
"flag": True,
"result_spatial_resolution": 10e3,
"solver_spatial_resolution": 50
},
"nli_params": {
"method": "ggn_spectrally_separated",
"dispersion_tolerance": 1,
"phase_shift_tolerance": 0.1,
"computed_channels": [1, 18, 37, 56, 75]
}
}
if isinstance(node, elements.RamanFiber):
# in order to take into account gain generated in RamanFiber, propagate in the RamanFiber with
# SI reference channel.
spectral_info_input = create_input_spectral_information(f_min=f_min, f_max=f_max, roll_off=roll_off,
baud_rate=baud_rate, power=power, spacing=spacing,
tx_osnr=tx_osnr)
n_copy = deepcopy(node)
# need to set ref_pch_in_dbm in order to correctly run propagate of the element, because this
# setting has not yet been done by autodesign
n_copy.ref_pch_in_dbm = power_dbm
SimParams.set_params(sim_params)
pin = watt2dbm(sum(spectral_info_input.signal))
spectral_info_out = n_copy(spectral_info_input)
pout = watt2dbm(sum(spectral_info_out.signal))
estimated_gain = pout - pin + node.loss
return round(estimated_gain, 2)
else:
return 0.0


def span_loss(network, node, equipment):
"""Total loss of a span (Fiber and Fused nodes) which contains the given node"""
loss = node.loss if node.passive else 0
loss += sum(n.loss for n in prev_node_generator(network, node))
loss += sum(n.loss for n in next_node_generator(network, node))
return loss
# add the possible Raman gain
gain = estimate_raman_gain(node, equipment)
gain += sum(estimate_raman_gain(n, equipment) for n in prev_node_generator(network, node))
gain += sum(estimate_raman_gain(n, equipment) for n in next_node_generator(network, node))

return loss - gain


def find_first_node(network, node):
Expand Down Expand Up @@ -247,7 +301,7 @@ def set_egress_amplifier(network, this_node, equipment, pref_ch_db, pref_total_d
if next_node in visited_nodes:
raise NetworkTopologyError(f'Loop detected for {type(node).__name__} {node.uid}, please check network topology')
if isinstance(node, elements.Edfa):
node_loss = span_loss(network, prev_node)
node_loss = span_loss(network, prev_node, equipment)
voa = node.out_voa if node.out_voa else 0
if node.operational.delta_p is None:
dp = target_power(network, next_node, equipment) + voa
Expand Down Expand Up @@ -600,7 +654,7 @@ def add_connector_loss(network, fibers, default_con_in, default_con_out, EOL):
fiber.params.con_out += EOL


def add_fiber_padding(network, fibers, padding):
def add_fiber_padding(network, fibers, padding, equipment):
"""last_fibers = (fiber for n in network.nodes()
if not (isinstance(n, elements.Fiber) or isinstance(n, elements.Fused))
for fiber in network.predecessors(n)
Expand All @@ -609,7 +663,7 @@ def add_fiber_padding(network, fibers, padding):
next_node = get_next_node(fiber, network)
if isinstance(next_node, elements.Fused):
continue
this_span_loss = span_loss(network, fiber)
this_span_loss = span_loss(network, fiber, equipment)
if this_span_loss < padding:
# add a padding att_in at the input of the 1st fiber:
# address the case when several fibers are spliced together
Expand Down Expand Up @@ -650,7 +704,7 @@ def add_missing_fiber_attributes(network, equipment):
add_connector_loss(network, fibers, default_span_data.con_in, default_span_data.con_out, default_span_data.EOL)
# don't group split fiber and add amp in the same loop
# =>for code clarity (at the expense of speed):
add_fiber_padding(network, fibers, default_span_data.padding)
add_fiber_padding(network, fibers, default_span_data.padding, equipment)


def build_network(network, equipment, pref_ch_db, pref_total_db, set_connector_losses=True, verbose=True):
Expand Down
2 changes: 2 additions & 0 deletions gnpy/topology/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from gnpy.core.elements import Transceiver, Roadm
from gnpy.core.utils import lin2db
from gnpy.core.info import create_input_spectral_information, carriers_to_spectral_information, ReferenceCarrier
from gnpy.core.network import design_network
from gnpy.core.exceptions import ServiceError, DisjunctionError
import gnpy.core.ansi_escapes as ansi_escapes
from copy import deepcopy
Expand Down Expand Up @@ -1114,6 +1115,7 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist):
# elements to simulate performance, several demands having the same destination
# may use the same transponder for the performance simulation. This is why
# we use deepcopy: to ensure that each propagation is recorded and not overwritten
design_network(pathreq, network, equipment, verbose=False)
total_path = deepcopy(pathlist[i])
print(f'Computed path (roadms):{[e.uid for e in total_path if isinstance(e, Roadm)]}')
# for debug
Expand Down
23 changes: 6 additions & 17 deletions tests/invocation/openroadm-v4-Stockholm-Gothenburg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Edfa Edfa_booster_roadm_Stockholm_to_fiber (Stockholm → Norrköping)_(1/2)
Power Out (dBm): 21.82
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.00
output VOA (dB): 0.00
Fiber fiber (Stockholm → Norrköping)_(1/2)
Expand All @@ -54,8 +53,7 @@ Edfa Edfa_fiber (Stockholm → Norrköping)_(1/2)
Power Out (dBm): 21.84
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.02
actual pch out (dBm): 2.01
output VOA (dB): 0.00
Fiber fiber (Stockholm → Norrköping)_(2/2)
type_variety: SSMF
Expand All @@ -73,12 +71,11 @@ Edfa Edfa_preamp_roadm_Norrköping_from_fiber (Stockholm → Norrköping)_(2/2)
noise figure (dB): 12.59
(including att_in)
pad att_in (dB): 0.00
Power In (dBm): 5.53
Power Out (dBm): 21.87
Power In (dBm): 5.52
Power Out (dBm): 21.86
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.04
actual pch out (dBm): 2.03
output VOA (dB): 0.00
Roadm roadm_Norrköping
effective loss (dB): 22.00
Expand All @@ -95,7 +92,6 @@ Edfa Edfa_booster_roadm_Norrköping_to_fiber (Norrköping → Linköping)
Power Out (dBm): 21.82
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.00
output VOA (dB): 0.00
Fiber fiber (Norrköping → Linköping)
Expand All @@ -118,7 +114,6 @@ Edfa Edfa_preamp_roadm_Linköping_from_fiber (Norrköping → Linköping)
Power Out (dBm): 21.83
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.01
output VOA (dB): 0.00
Roadm roadm_Linköping
Expand All @@ -136,7 +131,6 @@ Edfa Edfa_booster_roadm_Linköping_to_fiber (Linköping → Jönköping)
Power Out (dBm): 21.82
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.00
output VOA (dB): 0.00
Fiber fiber (Linköping → Jönköping)
Expand All @@ -156,11 +150,10 @@ Edfa Edfa_preamp_roadm_Jönköping_from_fiber (Linköping → Jönköping)
(including att_in)
pad att_in (dB): 0.00
Power In (dBm): -4.97
Power Out (dBm): 21.86
Power Out (dBm): 21.87
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.04
actual pch out (dBm): 2.05
output VOA (dB): 0.00
Roadm roadm_Jönköping
effective loss (dB): 22.00
Expand All @@ -177,7 +170,6 @@ Edfa Edfa_booster_roadm_Jönköping_to_fiber (Jönköping → Borås)
Power Out (dBm): 21.82
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.00
output VOA (dB): 0.00
Fiber fiber (Jönköping → Borås)
Expand All @@ -200,7 +192,6 @@ Edfa Edfa_preamp_roadm_Borås_from_fiber (Jönköping → Borås)
Power Out (dBm): 21.84
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.02
output VOA (dB): 0.00
Roadm roadm_Borås
Expand All @@ -218,7 +209,6 @@ Edfa Edfa_booster_roadm_Borås_to_fiber (Borås → Gothenburg)
Power Out (dBm): 21.82
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.00
output VOA (dB): 0.00
Fiber fiber (Borås → Gothenburg)
Expand All @@ -241,7 +231,6 @@ Edfa Edfa_preamp_roadm_Gothenburg_from_fiber (Borås → Gothenburg)
Power Out (dBm): 21.84
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.02
output VOA (dB): 0.00
Roadm roadm_Gothenburg
Expand Down
25 changes: 7 additions & 18 deletions tests/invocation/openroadm-v5-Stockholm-Gothenburg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Edfa Edfa_booster_roadm_Stockholm_to_fiber (Stockholm → Norrköping)_(1/2)
Power Out (dBm): 21.82
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.00
output VOA (dB): 0.00
Fiber fiber (Stockholm → Norrköping)_(1/2)
Expand All @@ -54,8 +53,7 @@ Edfa Edfa_fiber (Stockholm → Norrköping)_(1/2)
Power Out (dBm): 21.84
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.02
actual pch out (dBm): 2.01
output VOA (dB): 0.00
Fiber fiber (Stockholm → Norrköping)_(2/2)
type_variety: SSMF
Expand All @@ -70,15 +68,14 @@ Edfa Edfa_preamp_roadm_Norrköping_from_fiber (Stockholm → Norrköping)_(2/2)
type_variety: openroadm_mw_mw_preamp_worstcase_ver5
effective gain(dB): 16.33
(before att_in and before output VOA)
noise figure (dB): 11.44
noise figure (dB): 11.43
(including att_in)
pad att_in (dB): 0.00
Power In (dBm): 5.53
Power Out (dBm): 21.86
Power In (dBm): 5.52
Power Out (dBm): 21.85
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.04
actual pch out (dBm): 2.03
output VOA (dB): 0.00
Roadm roadm_Norrköping
effective loss (dB): 22.00
Expand All @@ -95,7 +92,6 @@ Edfa Edfa_booster_roadm_Norrköping_to_fiber (Norrköping → Linköping)
Power Out (dBm): 21.82
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.00
output VOA (dB): 0.00
Fiber fiber (Norrköping → Linköping)
Expand All @@ -118,7 +114,6 @@ Edfa Edfa_preamp_roadm_Linköping_from_fiber (Norrköping → Linköping)
Power Out (dBm): 21.83
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.01
output VOA (dB): 0.00
Roadm roadm_Linköping
Expand All @@ -136,7 +131,6 @@ Edfa Edfa_booster_roadm_Linköping_to_fiber (Linköping → Jönköping)
Power Out (dBm): 21.82
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.00
output VOA (dB): 0.00
Fiber fiber (Linköping → Jönköping)
Expand All @@ -156,10 +150,9 @@ Edfa Edfa_preamp_roadm_Jönköping_from_fiber (Linköping → Jönköping)
(including att_in)
pad att_in (dB): 0.00
Power In (dBm): -4.97
Power Out (dBm): 21.86
Power Out (dBm): 21.87
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.04
output VOA (dB): 0.00
Roadm roadm_Jönköping
Expand All @@ -177,7 +170,6 @@ Edfa Edfa_booster_roadm_Jönköping_to_fiber (Jönköping → Borås)
Power Out (dBm): 21.82
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.00
output VOA (dB): 0.00
Fiber fiber (Jönköping → Borås)
Expand All @@ -200,8 +192,7 @@ Edfa Edfa_preamp_roadm_Borås_from_fiber (Jönköping → Borås)
Power Out (dBm): 21.84
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.01
actual pch out (dBm): 2.02
output VOA (dB): 0.00
Roadm roadm_Borås
effective loss (dB): 22.00
Expand All @@ -218,7 +209,6 @@ Edfa Edfa_booster_roadm_Borås_to_fiber (Borås → Gothenburg)
Power Out (dBm): 21.82
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.00
output VOA (dB): 0.00
Fiber fiber (Borås → Gothenburg)
Expand All @@ -241,7 +231,6 @@ Edfa Edfa_preamp_roadm_Gothenburg_from_fiber (Borås → Gothenburg)
Power Out (dBm): 21.84
Delta_P (dB): 0.00
target pch (dBm): 2.00
effective pch (dBm): 2.00
actual pch out (dBm): 2.02
output VOA (dB): 0.00
Roadm roadm_Gothenburg
Expand Down
Loading

0 comments on commit 9c2e596

Please sign in to comment.