Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sys margins #199

Merged
merged 8 commits into from
Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions examples/eqpt_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
],
"Roadms":[{
"gain_mode_default_loss": 20,
"power_mode_pout_target": -20
"power_mode_pout_target": -20,
"add_drop_osnr": 38
}],
"SI":[{
"f_min": 191.3e12,
Expand All @@ -108,11 +109,8 @@
"power_dbm": 0,
"power_range_db": [0,0,0.5],
"roll_off": 0.15,
"OSNR": 11,
"bit_rate":100e9,
"tx_osnr": 45,
"min_spacing": 37.5e9,
"cost":1
"tx_osnr": 40,
"sys_margins": 0
}],
"Transceiver":[
{
Expand All @@ -129,7 +127,7 @@
"OSNR": 11,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 45,
"tx_osnr": 40,
"min_spacing": 37.5e9,
"cost":1
},
Expand All @@ -139,7 +137,7 @@
"OSNR": 15,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 45,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost":1
}
Expand All @@ -158,7 +156,7 @@
"OSNR": 12,
"bit_rate": 100e9,
"roll_off": 0.15,
"tx_osnr": 45,
"tx_osnr": 40,
"min_spacing": 37.5e9,
"cost":1
},
Expand All @@ -168,7 +166,7 @@
"OSNR": 18,
"bit_rate": 300e9,
"roll_off": 0.15,
"tx_osnr": 45,
"tx_osnr": 40,
"min_spacing": 62.5e9,
"cost":1
},
Expand All @@ -178,7 +176,7 @@
"OSNR": 21,
"bit_rate": 400e9,
"roll_off": 0.15,
"tx_osnr": 45,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost":1
},
Expand All @@ -188,7 +186,7 @@
"OSNR": 16,
"bit_rate": 200e9,
"roll_off": 0.15,
"tx_osnr": 45,
"tx_osnr": 40,
"min_spacing": 75e9,
"cost":1
}
Expand Down
36 changes: 18 additions & 18 deletions examples/meshTopologyExampleV2.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"type": "Roadm"
},
{
"uid": "ingress fused spans in Corlay",
"uid": "west fused spans in Corlay",
"metadata": {
"location": {
"city": "Corlay",
Expand All @@ -133,7 +133,7 @@
"type": "Fused"
},
{
"uid": "ingress fused spans in Loudeac",
"uid": "west fused spans in Loudeac",
"metadata": {
"location": {
"city": "Loudeac",
Expand All @@ -145,7 +145,7 @@
"type": "Fused"
},
{
"uid": "ingress fused spans in Morlaix",
"uid": "west fused spans in Morlaix",
"metadata": {
"location": {
"city": "Morlaix",
Expand All @@ -157,7 +157,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Corlay",
"uid": "east fused spans in Corlay",
"metadata": {
"location": {
"city": "Corlay",
Expand All @@ -169,7 +169,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Loudeac",
"uid": "east fused spans in Loudeac",
"metadata": {
"location": {
"city": "Loudeac",
Expand All @@ -181,7 +181,7 @@
"type": "Fused"
},
{
"uid": "egress fused spans in Morlaix",
"uid": "east fused spans in Morlaix",
"metadata": {
"location": {
"city": "Morlaix",
Expand Down Expand Up @@ -652,34 +652,34 @@
},
{
"from_node": "fiber (Lannion_CAS → Corlay)-F061",
"to_node": "ingress fused spans in Corlay"
"to_node": "west fused spans in Corlay"
},
{
"from_node": "ingress fused spans in Corlay",
"from_node": "west fused spans in Corlay",
"to_node": "fiber (Corlay → Loudeac)-F010"
},
{
"from_node": "fiber (Loudeac → Corlay)-F010",
"to_node": "egress fused spans in Corlay"
"to_node": "east fused spans in Corlay"
},
{
"from_node": "egress fused spans in Corlay",
"from_node": "east fused spans in Corlay",
"to_node": "fiber (Corlay → Lannion_CAS)-F061"
},
{
"from_node": "fiber (Corlay → Loudeac)-F010",
"to_node": "ingress fused spans in Loudeac"
"to_node": "west fused spans in Loudeac"
},
{
"from_node": "ingress fused spans in Loudeac",
"from_node": "west fused spans in Loudeac",
"to_node": "fiber (Loudeac → Lorient_KMA)-F054"
},
{
"from_node": "fiber (Lorient_KMA → Loudeac)-F054",
"to_node": "egress fused spans in Loudeac"
"to_node": "east fused spans in Loudeac"
},
{
"from_node": "egress fused spans in Loudeac",
"from_node": "east fused spans in Loudeac",
"to_node": "fiber (Loudeac → Corlay)-F010"
},
{
Expand Down Expand Up @@ -748,18 +748,18 @@
},
{
"from_node": "fiber (Lannion_CAS → Morlaix)-F059",
"to_node": "ingress fused spans in Morlaix"
"to_node": "west fused spans in Morlaix"
},
{
"from_node": "ingress fused spans in Morlaix",
"from_node": "west fused spans in Morlaix",
"to_node": "fiber (Morlaix → Brest_KLA)-F060"
},
{
"from_node": "fiber (Brest_KLA → Morlaix)-F060",
"to_node": "egress fused spans in Morlaix"
"to_node": "east fused spans in Morlaix"
},
{
"from_node": "egress fused spans in Morlaix",
"from_node": "east fused spans in Morlaix",
"to_node": "fiber (Morlaix → Lannion_CAS)-F059"
},
{
Expand Down
32 changes: 19 additions & 13 deletions examples/path_requests_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,32 @@ def requests_from_json(json_data,equipment):
# params['power'] is updated
if req['path-constraints']['te-bandwidth']['output-power']:
params['power'] = req['path-constraints']['te-bandwidth']['output-power']

# same process for nb-channel
fmin = params['frequency']['min']
fmax = params['frequency']['max']
f_min = params['f_min']
f_max_from_si = params['f_max']
if req['path-constraints']['te-bandwidth']['max-nb-of-channel'] is not None :
params['nb_channel'] = req['path-constraints']['te-bandwidth']['max-nb-of-channel']
nch = req['path-constraints']['te-bandwidth']['max-nb-of-channel']
params['nb_channel'] = nch
spacing = params['spacing']
params['f_max'] = f_min + nch*spacing
else :
params['nb_channel'] = automatic_nch(fmin,fmax,params['spacing'])
consitency_check(params)
params['nb_channel'] = automatic_nch(f_min,f_max_from_si,params['spacing'])

consistency_check(params, f_max_from_si)

try :
params['path_bandwidth'] = req['path-constraints']['te-bandwidth']['path_bandwidth']
except KeyError:
pass
requests_list.append(Path_request(**params))
return requests_list

def consitency_check(params):
fmin = params['frequency']['min']
fmax = params['frequency']['max']
max_recommanded_nb_channels = automatic_nch(fmin,fmax,
params['spacing'])
def consistency_check(params, f_max_from_si):
f_min = params['f_min']
f_max = params['f_max']
max_recommanded_nb_channels = automatic_nch(f_min,f_max,
params['spacing'])
if params['baud_rate'] is not None:
#implicitely means that a mode is defined with min_spacing
if params['min_spacing']>params['spacing'] :
Expand All @@ -103,10 +109,10 @@ def consitency_check(params):
print(msg)
logger.critical(msg)
exit()
if params['nb_channel']>max_recommanded_nb_channels:
if f_max>f_max_from_si:
msg = dedent(f'''
Requested channel number {params["nb_channel"]}, baud rate {params["baud_rate"]} GHz and requested spacing {params["spacing"]*1e-9}GHz
is not consistent with frequency range {fmin*1e-12} THz, {fmax*1e-12} THz, min recommanded spacing {params["min_spacing"]*1e-9}GHz.
is not consistent with frequency range {f_min*1e-12} THz, {f_max*1e-12} THz, min recommanded spacing {params["min_spacing"]*1e-9}GHz.
max recommanded nb of channels is {max_recommanded_nb_channels}
Computation stopped.''')
logger.critical(msg)
Expand Down Expand Up @@ -206,7 +212,7 @@ def compute_path_with_disjunction(network, equipment, pathreqlist, pathlist):
logger.warning(msg)
total_path = []
else:
total_path,mode = propagate_and_optimize_mode(total_path,pathreq,equipment, show=False)
total_path,mode = propagate_and_optimize_mode(total_path,pathreq,equipment)
# if no baudrate satisfies spacing, no mode is returned and an empty path is returned
# a warning is shown in the propagate_and_optimize_mode
if mode is not None :
Expand Down
43 changes: 35 additions & 8 deletions gnpy/core/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from gnpy.core.node import Node
from gnpy.core.units import UNITS
from gnpy.core.utils import lin2db, db2lin, itufs
from gnpy.core.utils import lin2db, db2lin, itufs, snr_sum

class Transceiver(Node):
def __init__(self, *args, **kwargs):
Expand All @@ -35,20 +35,47 @@ def __init__(self, *args, **kwargs):
self.osnr_nli = None
self.snr = None
self.passive = False
self.baud_rate = None

def _calc_snr(self, spectral_info):
with errstate(divide='ignore'):
self.osnr_ase = [lin2db(divide(c.power.signal, c.power.ase))
self.baud_rate = [c.baud_rate for c in spectral_info.carriers]
ratio_01nm = [lin2db(12.5e9/b_rate) for b_rate in self.baud_rate]

#set raw values to record original calculation, before update_snr()
self.raw_osnr_ase = [lin2db(divide(c.power.signal, c.power.ase))
for c in spectral_info.carriers]
ratio_01nm = [lin2db(12.5e9/c.baud_rate)
for c in spectral_info.carriers]
self.osnr_ase_01nm = [ase - ratio for ase, ratio
in zip(self.osnr_ase, ratio_01nm)]
self.osnr_nli = [lin2db(divide(c.power.signal, c.power.nli))
self.raw_osnr_ase_01nm = [ase - ratio for ase, ratio
in zip(self.raw_osnr_ase, ratio_01nm)]
self.raw_osnr_nli = [lin2db(divide(c.power.signal, c.power.nli))
for c in spectral_info.carriers]
self.snr = [lin2db(divide(c.power.signal, c.power.nli+c.power.ase))
self.raw_snr = [lin2db(divide(c.power.signal, c.power.nli+c.power.ase))
for c in spectral_info.carriers]

self.osnr_ase = self.raw_osnr_ase
self.osnr_ase_01nm = self.raw_osnr_ase_01nm
self.osnr_nli = self.raw_osnr_nli
self.snr = self.raw_snr

def update_snr(self, *args):
"""
snr_added in 0.1nm
compute SNR penalties such as transponder Tx_osnr or Roadm add_drop_osnr
only applied in request.py / propagate on the last Trasceiver node of the path
all penalties are added in a single call because to avoid uncontrolled cumul
"""
#use raw_values so that the added snr penalties are not cumulated
snr_added = 0
for s in args:
snr_added += db2lin(-s)
snr_added = -lin2db(snr_added)
self.osnr_ase = list(map(lambda x,y:snr_sum(x,y,snr_added),
self.raw_osnr_ase, self.baud_rate))
self.snr = list(map(lambda x,y:snr_sum(x,y,snr_added),
self.raw_snr, self.baud_rate))
self.osnr_ase_01nm = list(map(lambda x:snr_sum(x,12.5e9,snr_added),
self.raw_osnr_ase_01nm))

@property
def to_json(self):
return {'uid' : self.uid,
Expand Down
Loading