28 Commits

Author SHA1 Message Date
Jan Kundrát
049b077ee4 Use real IP addresses for the US-based Cassinis
Change-Id: I158bb84261a56d71074155880c4359033b2f1044
2020-03-07 16:49:39 -08:00
Jan Kundrát
ab2080a805 Update IP addresses and hostnames for the OFC2020 demo
Change-Id: Ie8d30d56f94d1ce14f8ac62ceec7f0e57a3486b2
2020-02-12 17:32:07 +01:00
Jan Kundrát
8ab54e76df Merge branch 'develop' into experimental/2020-ofc
Change-Id: I4f7d3cc91734a03251b4ad4d82b05aad68d0ef5f
2020-02-12 17:18:50 +01:00
Mohammed Naser
0465397b1d Add empty Zuul configuration
In order for Zuul to start self-testing, it must actually have
a project entry listed.  This is the initial commit.

Change-Id: I017cb036f3191e46446d82b96a6acd35f2adcd0e
2020-01-28 20:20:41 +01:00
Jan Kundrát
d3ec39d506 Bump version to 2.1
Change-Id: I9f27fc87c5ca43e473fe212d2ee3dad7b12d4061
2020-01-15 00:09:48 +01:00
Jan Kundrát
bfe68a5948 Merge branch 'develop'
Change-Id: If7860b243cb504613a7fffafad2d601510000af7
2020-01-15 00:09:18 +01:00
Esther Le Rouzic
2ea3363613 Merge pull request #331 from Orange-OpenSource/pr_test
update version setup.py
2020-01-14 13:02:32 +00:00
DELFOUR Emmanuelle TGI/DATA-IA
89cce6e6a3 update version setup.py 2020-01-14 10:22:21 +01:00
Jan Kundrát
0f10ac706c Merge pull request #267 from Orange-OpenSource/capacity_planning-part2
This brings in the concept of OMS (so far created implicitly based on the input topology), spectrum assignment, etc.
2020-01-13 09:30:45 +00:00
EstherLerouzic
66d26f0ffa add the missing else to handle non first_fit policy
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2020-01-10 18:46:24 +00:00
EstherLerouzic
3c96914482 replace todo with TODO
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2020-01-10 18:41:40 +00:00
EstherLerouzic
61b1e73362 remove unused testing piece of code
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2020-01-10 18:40:18 +00:00
Jan Kundrát
03435079cc refactoring: simplify code flow a bit
- no need to explicitly log exceptions that are about to be raised
- kill some extra commented-out prints

Change-Id: I73bae5a2456644c4d4ff45bd984d44c27bc22ec4
2020-01-10 18:17:44 +00:00
Jan Kundrát
6661907c1d fix typos
Change-Id: I0a4d2c14c5e873dd521736525bb9b10c9b70975b
2020-01-10 18:17:17 +00:00
Jan Kundrát
fe811f725c tests: use native pytest features for exception handling
Using `with pytest.raises` is better than open coding the equivalent
feature. Similarly, when a block is not expected to raise an exception,
let's just let it run outside of a `try` block and rely on the test
framework to report a possible failure when hitting an unhandled
exception.

Change-Id: Icb1bb83e649733b56fcdc9168cabf88c9cf8d478
2020-01-10 18:16:53 +00:00
Jan Kundrát
f015c6abed ROADM module replacements 2020-01-07 16:29:15 +01:00
Jan Kundrát
8598e6591f Merge pull request #304 from Orange-OpenSource/user_error_catching_improvment
Give more useful comment for user to correct topology
2019-12-12 16:11:54 +00:00
EstherLerouzic
5e2259062c Give more useful comment for user to correct topology
when a node name used in link does not correspond to listed
node names, Bad link msg was thrown without info on which link
causes the problem.
This change gives additional info on link and catch the user error
more cleanly.

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
2019-12-12 15:55:33 +00:00
Alessio Ferrari
d483802a86 Edn-to-end test for Raman amplification 2019-12-12 12:52:59 +00:00
Jan Kundrát
9a0eece69c Merge pull request #322 from jktjkt/master
docs: Link to the updated meeting event
2019-12-09 20:46:06 +00:00
Jan Kundrát
1657bfd05f build: workaround Sphinx doc build failure
Upstream bugreport at sphinx-doc/sphinx#6887 suggests that this is due
to pip picking up the 0.16b0.dev0 pre-release...

Bug: https://github.com/sphinx-doc/sphinx/issues/6887
2019-12-09 16:05:56 +01:00
Jan Kundrát
49bf558916 docs: Link to the updated meeting event 2019-12-09 14:31:59 +01:00
Jan Kundrát
99f44a597b Merge remote-tracking branch 'origin/develop' 2019-11-13 19:59:35 +01:00
Jan Kundrát
a21f3fe6ee Merge pull request #312 from jktjkt/fixes
Small refactoring for itufs/utifl
2019-10-16 05:38:37 +00:00
Jan Kundrát
0ccbb2960c Merge pull request #277 from Orange-OpenSource/capacity_planning-part1
Capacity planning part1
2019-10-16 05:36:56 +00:00
Jan Kundrát
029bac4b03 utils: more descriptive name for itufl
This might have nothing to do with the ITU frequency grid (it's really
just about a uniform distribution), so let's give it a more readable
name and more readable parameters.
2019-10-06 20:43:50 +02:00
Jan Kundrát
a27ad57220 Do not use confusing default values
This looks like the root cause of bug #243, the default values suggested
that this function works in THz.

These defaults are not used anywhere, so let's get rid of something
which adds no value and actively confuses people.
2019-10-06 20:38:31 +02:00
Jan Kundrát
8d31d924f2 Remove unused function 2019-10-06 20:37:24 +02:00
15 changed files with 468 additions and 113 deletions

8
.zuul.yaml Normal file
View File

@@ -0,0 +1,8 @@
---
- project:
check:
jobs:
- noop
gate:
jobs:
- noop

View File

@@ -27,7 +27,7 @@ Documentation: https://gnpy.readthedocs.io
Get In Touch
~~~~~~~~~~~~
There are `weekly calls <https://telecominfraproject.workplace.com/events/458339931322799/>`__ about our progress.
There are `weekly calls <https://telecominfraproject.workplace.com/events/702894886867547/>`__ about our progress.
Newcomers, users and telecom operators are especially welcome there.
We encourage all interested people outside the TIP to `join the project <https://telecominfraproject.com/apply-for-membership/>`__.

View File

@@ -1,7 +1,7 @@
{
"elements": [
{
"uid": "netconf:10.0.254.93:830",
"uid": "netconf:10.0.254.76:830",
"type": "Transceiver"
},
{
@@ -11,7 +11,7 @@
"target_pch_out_db": -2.0,
"per_degree_target_pch_out_db": [
{
"to_node": "netconf:10.0.254.93:830",
"to_node": "netconf:10.0.254.76:830",
"target_pch_out_db": -25
},
{
@@ -26,7 +26,7 @@
}
},
{
"uid": "netconf:10.0.254.101:830",
"uid": "netconf:10.0.254.78:830",
"type": "Roadm",
"params": {
"target_pch_out_db": -23.0,
@@ -143,7 +143,7 @@
}
},
{
"uid": "netconf:10.0.254.235:830",
"uid": "netconf:10.0.254.79:830",
"type": "Roadm",
"params": {
"target_pch_out_db": -23.0,
@@ -260,7 +260,7 @@
}
},
{
"uid": "netconf:10.0.254.94:830",
"uid": "netconf:10.0.254.77:830",
"type": "Transceiver"
},
{
@@ -270,7 +270,7 @@
"target_pch_out_db": -2.0,
"per_degree_target_pch_out_db": [
{
"to_node": "netconf:10.0.254.94:830",
"to_node": "netconf:10.0.254.77:830",
"target_pch_out_db": -25
},
{
@@ -852,20 +852,20 @@
],
"connections": [
{
"from_node": "netconf:10.0.254.93:830",
"from_node": "netconf:10.0.254.76:830",
"to_node": "netconf:10.0.254.107:830"
},
{
"from_node": "netconf:10.0.254.107:830",
"to_node": "netconf:10.0.254.93:830"
"to_node": "netconf:10.0.254.76:830"
},
{
"from_node": "netconf:10.0.254.101:830",
"from_node": "netconf:10.0.254.78:830",
"to_node": "roadm-Amsterdam-L1-booster"
},
{
"from_node": "roadm-Amsterdam-L1-preamp",
"to_node": "netconf:10.0.254.101:830"
"to_node": "netconf:10.0.254.78:830"
},
{
"from_node": "netconf:10.0.254.107:830",
@@ -881,10 +881,10 @@
},
{
"from_node": "splice-(patch-(roadm-Amsterdam-AD)-(roadm-Amsterdam-L1))-(roadm-Amsterdam-L1)",
"to_node": "netconf:10.0.254.101:830"
"to_node": "netconf:10.0.254.78:830"
},
{
"from_node": "netconf:10.0.254.101:830",
"from_node": "netconf:10.0.254.78:830",
"to_node": "splice-(roadm-Amsterdam-L1)-(patch-(roadm-Amsterdam-L1)-(roadm-Amsterdam-AD))"
},
{
@@ -900,7 +900,7 @@
"to_node": "netconf:10.0.254.107:830"
},
{
"from_node": "netconf:10.0.254.101:830",
"from_node": "netconf:10.0.254.78:830",
"to_node": "splice-(roadm-Amsterdam-L1)-(patch-(roadm-Amsterdam-L1)-(roadm-Amsterdam-L2))"
},
{
@@ -913,15 +913,15 @@
},
{
"from_node": "splice-(patch-(roadm-Amsterdam-L1)-(roadm-Amsterdam-L2))-(roadm-Amsterdam-L2)",
"to_node": "netconf:10.0.254.235:830"
"to_node": "netconf:10.0.254.79:830"
},
{
"from_node": "netconf:10.0.254.235:830",
"from_node": "netconf:10.0.254.79:830",
"to_node": "roadm-Amsterdam-L2-booster"
},
{
"from_node": "roadm-Amsterdam-L2-preamp",
"to_node": "netconf:10.0.254.235:830"
"to_node": "netconf:10.0.254.79:830"
},
{
"from_node": "netconf:10.0.254.107:830",
@@ -937,10 +937,10 @@
},
{
"from_node": "splice-(patch-(roadm-Amsterdam-AD)-(roadm-Amsterdam-L2))-(roadm-Amsterdam-L2)",
"to_node": "netconf:10.0.254.235:830"
"to_node": "netconf:10.0.254.79:830"
},
{
"from_node": "netconf:10.0.254.235:830",
"from_node": "netconf:10.0.254.79:830",
"to_node": "splice-(roadm-Amsterdam-L2)-(patch-(roadm-Amsterdam-L2)-(roadm-Amsterdam-AD))"
},
{
@@ -956,7 +956,7 @@
"to_node": "netconf:10.0.254.107:830"
},
{
"from_node": "netconf:10.0.254.235:830",
"from_node": "netconf:10.0.254.79:830",
"to_node": "splice-(roadm-Amsterdam-L2)-(patch-(roadm-Amsterdam-L2)-(roadm-Amsterdam-L1))"
},
{
@@ -969,15 +969,15 @@
},
{
"from_node": "splice-(patch-(roadm-Amsterdam-L2)-(roadm-Amsterdam-L1))-(roadm-Amsterdam-L1)",
"to_node": "netconf:10.0.254.101:830"
"to_node": "netconf:10.0.254.78:830"
},
{
"from_node": "netconf:10.0.254.94:830",
"from_node": "netconf:10.0.254.77:830",
"to_node": "netconf:10.0.254.225:830"
},
{
"from_node": "netconf:10.0.254.225:830",
"to_node": "netconf:10.0.254.94:830"
"to_node": "netconf:10.0.254.77:830"
},
{
"from_node": "netconf:10.0.254.100:830",

View File

@@ -141,28 +141,35 @@ for _, E in enumerate(J["elements"]):
# E["operational"]["out_voa"] = 21
translate = {
"trx-Amsterdam": "10.0.254.93",
"trx-Bremen": "10.0.254.94",
#"trx-Amsterdam": "10.0.254.93",
#"trx-Bremen": "10.0.254.94",
"trx-Amsterdam": "10.0.254.76",
"trx-Bremen": "10.0.254.77",
# coherent-v9u
# Amsterdam A/D: coherent-v9u
"roadm-Amsterdam-AD": "10.0.254.107",
# -spi
# Bremen A/D: -spi
"roadm-Bremen-AD": "10.0.254.225",
# Amsterdam -> Bremen ...QC8B
"roadm-Amsterdam-L1": "10.0.254.101",
# ...QCP9
# Amsterdam -> Bremen ...QR79
"roadm-Amsterdam-L1": "10.0.254.78",
# Bremen -> Amsterdam ...QCP9
"roadm-Bremen-L2": "10.0.254.102",
# WKP: Bremen -> Cologne
# Bremen -> Cologne ...WKP
"roadm-Bremen-L1": "10.0.254.100",
# LK6: Cologne -> Bremen
# Cologne -> Bremen ...QLK6
"roadm-Cologne-L2": "10.0.254.104",
# TQQ: Cologne -> Amsterdam
# Cologne -> Amsterdam ...TQQ
"roadm-Cologne-L1": "10.0.254.99",
# NFP: Amsterdam -> Cologne
"roadm-Amsterdam-L2": "10.0.254.235",
# Amsterdam -> Cologne ...Q7JS
"roadm-Amsterdam-L2": "10.0.254.79",
# spare Line/Degree ...QC8B
"spare-line-degree": "10.0.254.101",
# spare Add/Drop: ...NNN
"spare-add-drop": "10.0.254.228",
}
import json

View File

@@ -32,6 +32,7 @@ from json import dumps
from pathlib import Path
from difflib import get_close_matches
from gnpy.core.utils import silent_remove
from gnpy.core.exceptions import NetworkTopologyError
import time
all_rows = lambda sh, start=0: (sh.row(x) for x in range(start, sh.nrows))
@@ -509,9 +510,12 @@ def parse_excel(input_filename):
all_cities = Counter(n.city for n in nodes)
if len(all_cities) != len(nodes):
raise ValueError(f'Duplicate city: {all_cities}')
if any(ln.from_city not in all_cities or
ln.to_city not in all_cities for ln in links):
raise ValueError(f'Bad link.')
bad_links = []
for lnk in links:
if lnk.from_city not in all_cities or lnk.to_city not in all_cities:
bad_links.append([lnk.from_city, lnk.to_city])
if bad_links:
raise NetworkTopologyError(f'Bad link(s): {bad_links}.')
return nodes, links, eqpts

View File

@@ -25,7 +25,7 @@ from collections import namedtuple
from gnpy.core.node import Node
from gnpy.core.units import UNITS
from gnpy.core.utils import lin2db, db2lin, itufs, itufl, snr_sum
from gnpy.core.utils import lin2db, db2lin, arrange_frequencies, snr_sum
from gnpy.core.science_utils import propagate_raman_fiber, _psi
class Transceiver(Node):
@@ -630,7 +630,7 @@ class Edfa(Node):
self.channel_freq, self.nf, self.interpol_dgt and self.interpol_gain_ripple
"""
# TODO|jla: read amplifier actual frequencies from additional params in json
amplifier_freq = itufl(len(self.params.dgt), self.params.f_min, self.params.f_max) # Hz
amplifier_freq = arrange_frequencies(len(self.params.dgt), self.params.f_min, self.params.f_max) # Hz
self.channel_freq = frequencies
self.interpol_dgt = interp(self.channel_freq, amplifier_freq, self.params.dgt)

View File

@@ -37,14 +37,10 @@ class Bitmap:
self.freq_index = list(range(n_min, n_max+1))
if bitmap is None:
self.bitmap = [1] * (n_max-n_min+1)
elif len(bitmap) == len(self.freq_index):
self.bitmap = bitmap
else:
if len(bitmap) == len(self.freq_index):
self.bitmap = bitmap
else:
msg = f'bitmap is not consistant with f_min{f_min} - n :' +\
f'{n_min} and f_max{f_max}- n :{n_max}'
LOGGER.critical(msg)
raise SpectrumError(msg)
raise SpectrumError(f'bitmap is not consistant with f_min{f_min} - n: {n_min} and f_max{f_max}- n :{n_max}')
def getn(self, i):
""" converts the n (itu grid) into a local index
@@ -72,7 +68,7 @@ class Bitmap:
OMSParams = namedtuple('OMSParams', 'oms_id el_id_list el_list')
class OMS:
""" OMS class is the logical container that represent a link betwoeen two adjacent ROADMs and
""" OMS class is the logical container that represent a link between two adjacent ROADMs and
records the crossed elements and the occupied spectrum
"""
def __init__(self, *args, **params):
@@ -102,7 +98,7 @@ class OMS:
""" frequencies expressed in Hz
"""
if existing_spectrum is None:
# add some 150 GHz margin to eable a center channel on f_min
# add some 150 GHz margin to enable a center channel on f_min
# use ITU-T G694.1
# Flexible DWDM grid definition
# For the flexible DWDM grid, the allowed frequency slots have a nominal
@@ -122,13 +118,9 @@ class OMS:
def assign_spectrum(self, nvalue, mvalue):
""" change oms spectrum to mark spectrum assigned
"""
# print("assign_spectrum")
# print(f'n , m :{n},{m}')
if (nvalue is None or mvalue is None or isinstance(nvalue, float)
or isinstance(mvalue, float) or mvalue == 0):
msg = f'could not assign None values'
LOGGER.critical(msg)
raise SpectrumError(msg)
raise SpectrumError('could not assign None values')
startn, stopn = mvalue_to_slots(nvalue, mvalue)
# print(f'startn stop n {startn} , {stopn}')
# assumes that guardbands are sufficient to ensure that assigning a center channel
@@ -241,19 +233,8 @@ def build_oms_list(network, equipment):
nd_out.oms_list = []
nd_out.oms_list.append(oms_id)
# print(f'coucou2 {oms.oms_id} {oms.el_id_list[0]} {oms.el_id_list[-1]}')
# for e in oms.el_id_list:
# print(f' {e}')
# TODO do not forget to correct next line !
# to test different grids
# TODO move this to test
if oms_id < 3:
oms.update_spectrum(equipment['SI']['default'].f_min,
equipment['SI']['default'].f_max, grid=0.00625e12)
else:
oms.update_spectrum(equipment['SI']['default'].f_min,
equipment['SI']['default'].f_max, grid=0.00625e12)
oms.update_spectrum(equipment['SI']['default'].f_min,
equipment['SI']['default'].f_max, grid=0.00625e12)
# oms.assign_spectrum(13,7) gives back (193137500000000.0, 193225000000000.0)
# as in the example in the standard
# oms.assign_spectrum(13,7)
@@ -357,6 +338,8 @@ def select_candidate(candidates, policy):
return candidates[0]
else:
return (None, None, None)
else:
raise ServiceError('Only first_fit spectrum assignment policy is implemented.')
def pth_assign_spectrum(pths, rqs, oms_list, rpths):
""" basic first fit assignment
@@ -372,9 +355,9 @@ def pth_assign_spectrum(pths, rqs, oms_list, rpths):
except AttributeError:
nb_wl = ceil(rqs[i].path_bandwidth / rqs[i].bit_rate)
# computes the total nb of slots according to requested spacing
# todo : express superchannels
# TODO : express superchannels
# assumes that all channels must be grouped
# todo : enables non contiguous reservation in case of blocking
# TODO : enables non contiguous reservation in case of blocking
requested_m = ceil(rqs[i].spacing / 0.0125e12) * nb_wl
# concatenate all path and reversed path elements to derive slots availability
(center_n, startn, stopn), path_oms = spectrum_selection(pth + rpths[i], oms_list, requested_m,

View File

@@ -73,35 +73,19 @@ def c():
return constants.c
def itufs(spacing, startf=191.35, stopf=196.10):
"""Creates an array of frequencies whose default range is
191.35-196.10 THz
:param spacing: Frequency spacing in THz
:param starf: Start frequency in THz
:param stopf: Stop frequency in THz
:type spacing: float
:type startf: float
:type stopf: float
:return an array of frequnecies determined by the spacing parameter
:rtype: numpy.ndarray
"""
return np.arange(startf, stopf + spacing / 2, spacing)
def itufl(length, startf=191.35, stopf=196.10):
"""Creates an array of frequencies whose default range is
191.35-196.10 THz
def arrange_frequencies(length, start, stop):
"""Create an array of frequencies
:param length: number of elements
:param starf: Start frequency in THz
:param stopf: Stop frequency in THz
:param star: Start frequency in THz
:param stop: Stop frequency in THz
:type length: integer
:type startf: float
:type stopf: float
:return an array of frequnecies determined by the spacing parameter
:type start: float
:type stop: float
:return an array of frequencies determined by the spacing parameter
:rtype: numpy.ndarray
"""
return np.linspace(startf, stopf, length)
return np.linspace(start, stop, length)
def h():
"""

View File

@@ -1,4 +1,5 @@
alabaster>=0.7.12,<1
docutils==0.15.2
flask==1.0.2
flask-restful==0.3.7
matplotlib>=3.1.0,<4

View File

@@ -11,7 +11,7 @@ with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
setup(
name='gnpy',
version='1.2.0',
version='2.1',
description='route planning and optimization tool for mesh optical networks',
long_description=long_description,
long_description_content_type='text/x-rst; charset=UTF-8',

View File

@@ -0,0 +1,97 @@
,signal,ase,nli
0,0.0002869472910750076,3.829243751386179e-08,2.157043502374111e-07
1,0.000284426444181902,3.8108068606265256e-08,2.1799950841472648e-07
2,0.0002819286625240274,3.7925434667811625e-08,2.2023841125044652e-07
3,0.0002794537215642205,3.774451238936698e-08,2.224218994135113e-07
4,0.0002756243295734432,3.739256063612741e-08,2.2343448272114653e-07
5,0.0002718482755003954,3.7044477620123535e-08,2.2437826192962217e-07
6,0.0002681247979313455,3.6700201831013766e-08,2.2525495466695055e-07
7,0.0002644507001383656,3.635953568122817e-08,2.2606415187870565e-07
8,0.0002608253488031495,3.602242321653821e-08,2.268074852150968e-07
9,0.00025690468888571607,3.564391587795796e-08,2.2718285844824803e-07
10,0.0002530414048173237,3.5269661038482016e-08,2.2749429758476786e-07
11,0.0002492279873568786,3.4899736994459975e-08,2.277374766526846e-07
12,0.0002454639458992114,3.4534068616323406e-08,2.2791414400784552e-07
13,0.00024174879168999762,3.417258192135115e-08,2.280260208417629e-07
14,0.00023798746912556782,3.3802278288721e-08,2.2798420759779948e-07
15,0.00023427697848575827,3.3436265380528345e-08,2.2788101592690985e-07
16,0.00023061678363205047,3.30744682841412e-08,2.2771816297652923e-07
17,0.00022700656967542085,3.271682680678683e-08,2.2749755602884014e-07
18,0.0002234457948096593,3.236326805537296e-08,2.236182244259085e-07
19,0.0002195336193536736,3.195819496314336e-08,2.193976173454328e-07
20,0.00021568313139087874,3.155821230359698e-08,2.1524945887103656e-07
21,0.00021189361260563733,3.116322489050993e-08,2.1117277567390236e-07
22,0.00020816423698459606,3.0773141693336075e-08,2.0716649124094935e-07
23,0.0002044941867087381,3.038787321635763e-08,2.032295417993187e-07
24,0.00020116081520673765,3.00440338127331e-08,1.9963693210324778e-07
25,0.00019787569461895006,2.9704199888387147e-08,1.9610141536963145e-07
26,0.00019463824873065924,2.9368302916351224e-08,1.9262221997372471e-07
27,0.0001914486066928752,2.903632427420397e-08,1.8919927457565086e-07
28,0.00018830616497930887,2.870819640079397e-08,1.858317840670677e-07
29,0.00018521032563368435,2.838385281897912e-08,1.8251896218718178e-07
30,0.00018216049720979434,2.8063228018898468e-08,1.7926003240909075e-07
31,0.0001791561867005718,2.7746255438682553e-08,1.76054318231933e-07
32,0.00017619680881744213,2.7432871709278503e-08,1.7290105534292413e-07
33,0.00017328178390236163,2.7123014438128492e-08,1.6979948820364567e-07
34,0.00017049664136784971,2.6828118382010868e-08,1.668331233176527e-07
35,0.0001677518922618999,2.6536524600591003e-08,1.639139770351797e-07
36,0.00016504703499520338,2.6248178236430935e-08,1.6104139135571758e-07
37,0.0001623826677977635,2.596311344676757e-08,1.579538179464147e-07
38,0.0001597582427278653,2.5681275450827438e-08,1.549209871570718e-07
39,0.0001571732182028194,2.5402610321183817e-08,1.5194201541886346e-07
40,0.00015462705891566638,2.512706495768609e-08,1.490160317195833e-07
41,0.00015212101646392648,2.4854546722771583e-08,1.4614388817377845e-07
42,0.00014965447757986727,2.4585006051161647e-08,1.4332463586636234e-07
43,0.00014722683809507942,2.4318394065447274e-08,1.4055734193947907e-07
44,0.0001447164668892396,2.4034548127308286e-08,1.3772590008270512e-07
45,0.00014224784112375704,2.3753926686114635e-08,1.3494914625939818e-07
46,0.00013982028367499942,2.3476475779461364e-08,1.3222606385780792e-07
47,0.00013743418748445304,2.3202244204140228e-08,1.2955665313419502e-07
48,0.00013508884015386575,2.2931178307200807e-08,1.269398709602497e-07
49,0.00013278354172499636,2.2663225269637508e-08,1.243746944213211e-07
50,0.0001305176041972383,2.2398333101097452e-08,1.2186012017916144e-07
51,0.00012829168984639723,2.2136419884279648e-08,1.1939640981690787e-07
52,0.00012610506317956035,2.1877436733290284e-08,1.169825203056231e-07
53,0.000123957002859191,2.1621335420785434e-08,1.1461743054419468e-07
54,0.00012180241033649304,2.1360152817604167e-08,1.1225922783038433e-07
55,0.00011968650905779935,2.1101906890578305e-08,1.0994951537259513e-07
56,0.000117608577762061,2.0846548870078847e-08,1.0757395097864581e-07
57,0.00011556891128259058,2.0594151467353748e-08,1.0524972555992308e-07
58,0.00011356676177301841,2.0344667169015006e-08,1.0297570549831857e-07
59,0.00011160139690545192,2.00980493433389e-08,1.0075078305548045e-07
60,0.00010967209909252646,1.985425227516509e-08,9.857387536569511e-08
61,0.00010777915187087522,1.9613208260272527e-08,9.644480679616336e-08
62,0.00010592181397175155,1.937487453011716e-08,9.436248424611683e-08
63,0.00010409936038610526,1.913920913597429e-08,9.23258408012148e-08
64,0.00010246447558375888,1.8936226281729442e-08,9.046927135291653e-08
65,0.00010085803630104006,1.87354387522902e-08,8.865067925960373e-08
66,9.927950010553608e-05,1.853681852284204e-08,8.686925127146881e-08
67,9.772837346090978e-05,1.834034443508121e-08,8.512422533827548e-08
68,9.620413430112097e-05,1.8145990199784238e-08,8.341482250639003e-08
69,9.470627135913274e-05,1.795373041706864e-08,8.174028142913882e-08
70,9.323428359797426e-05,1.776354066998682e-08,8.009985766376296e-08
71,9.178813743816942e-05,1.7575386852678668e-08,7.849321446941785e-08
72,9.03673300948529e-05,1.7389247191220127e-08,7.691961625609547e-08
73,8.897136946427622e-05,1.7205101122769978e-08,7.537834446342857e-08
74,8.760740745800998e-05,1.7025337039390582e-08,7.387513417420477e-08
75,8.626710469266086e-05,1.684760610568072e-08,7.274492099363918e-08
76,8.495000573672162e-05,1.6671894857242002e-08,7.163427447510873e-08
77,8.365569697520994e-05,1.649819993412593e-08,7.054284583689279e-08
78,8.238374036674246e-05,1.6326513144182658e-08,6.947026569965565e-08
79,8.113370706498376e-05,1.6156829499842502e-08,6.841617243780552e-08
80,7.990517700269747e-05,1.5989147949913657e-08,6.738021182874466e-08
81,7.86978423091888e-05,1.5823469853370494e-08,6.636212425984957e-08
82,7.751129541079691e-05,1.5659805288834794e-08,6.536156604375694e-08
83,7.634513730458643e-05,1.549817228640182e-08,6.4378200720386e-08
84,7.530262080974352e-05,1.5364274253504764e-08,6.349909645089537e-08
85,7.427675504203847e-05,1.523236211656126e-08,6.263403294276386e-08
86,7.326723873728748e-05,1.5102509684796054e-08,6.17827561543225e-08
87,7.227232864621635e-05,1.497407531211962e-08,6.094379608688325e-08
88,7.129179755315639e-05,1.4847053209180731e-08,6.011696114034632e-08
89,7.032542203609286e-05,1.4721438007057792e-08,5.930206291361871e-08
90,6.937298231674387e-05,1.4597224779058979e-08,5.8498916078193026e-08
91,6.843339696762452e-05,1.4474430063551042e-08,5.7706608718023995e-08
92,6.750649045006184e-05,1.435304906112738e-08,5.692499280974924e-08
93,6.659208967850971e-05,1.4233077472549144e-08,5.615392239861094e-08
94,6.554258932109723e-05,1.4075047005202515e-08,5.5268928972034715e-08
95,6.450957734109015e-05,1.3918652473373596e-08,5.439783940505763e-08
1 signal ase nli
2 0 0.0002869472910750076 3.829243751386179e-08 2.157043502374111e-07
3 1 0.000284426444181902 3.8108068606265256e-08 2.1799950841472648e-07
4 2 0.0002819286625240274 3.7925434667811625e-08 2.2023841125044652e-07
5 3 0.0002794537215642205 3.774451238936698e-08 2.224218994135113e-07
6 4 0.0002756243295734432 3.739256063612741e-08 2.2343448272114653e-07
7 5 0.0002718482755003954 3.7044477620123535e-08 2.2437826192962217e-07
8 6 0.0002681247979313455 3.6700201831013766e-08 2.2525495466695055e-07
9 7 0.0002644507001383656 3.635953568122817e-08 2.2606415187870565e-07
10 8 0.0002608253488031495 3.602242321653821e-08 2.268074852150968e-07
11 9 0.00025690468888571607 3.564391587795796e-08 2.2718285844824803e-07
12 10 0.0002530414048173237 3.5269661038482016e-08 2.2749429758476786e-07
13 11 0.0002492279873568786 3.4899736994459975e-08 2.277374766526846e-07
14 12 0.0002454639458992114 3.4534068616323406e-08 2.2791414400784552e-07
15 13 0.00024174879168999762 3.417258192135115e-08 2.280260208417629e-07
16 14 0.00023798746912556782 3.3802278288721e-08 2.2798420759779948e-07
17 15 0.00023427697848575827 3.3436265380528345e-08 2.2788101592690985e-07
18 16 0.00023061678363205047 3.30744682841412e-08 2.2771816297652923e-07
19 17 0.00022700656967542085 3.271682680678683e-08 2.2749755602884014e-07
20 18 0.0002234457948096593 3.236326805537296e-08 2.236182244259085e-07
21 19 0.0002195336193536736 3.195819496314336e-08 2.193976173454328e-07
22 20 0.00021568313139087874 3.155821230359698e-08 2.1524945887103656e-07
23 21 0.00021189361260563733 3.116322489050993e-08 2.1117277567390236e-07
24 22 0.00020816423698459606 3.0773141693336075e-08 2.0716649124094935e-07
25 23 0.0002044941867087381 3.038787321635763e-08 2.032295417993187e-07
26 24 0.00020116081520673765 3.00440338127331e-08 1.9963693210324778e-07
27 25 0.00019787569461895006 2.9704199888387147e-08 1.9610141536963145e-07
28 26 0.00019463824873065924 2.9368302916351224e-08 1.9262221997372471e-07
29 27 0.0001914486066928752 2.903632427420397e-08 1.8919927457565086e-07
30 28 0.00018830616497930887 2.870819640079397e-08 1.858317840670677e-07
31 29 0.00018521032563368435 2.838385281897912e-08 1.8251896218718178e-07
32 30 0.00018216049720979434 2.8063228018898468e-08 1.7926003240909075e-07
33 31 0.0001791561867005718 2.7746255438682553e-08 1.76054318231933e-07
34 32 0.00017619680881744213 2.7432871709278503e-08 1.7290105534292413e-07
35 33 0.00017328178390236163 2.7123014438128492e-08 1.6979948820364567e-07
36 34 0.00017049664136784971 2.6828118382010868e-08 1.668331233176527e-07
37 35 0.0001677518922618999 2.6536524600591003e-08 1.639139770351797e-07
38 36 0.00016504703499520338 2.6248178236430935e-08 1.6104139135571758e-07
39 37 0.0001623826677977635 2.596311344676757e-08 1.579538179464147e-07
40 38 0.0001597582427278653 2.5681275450827438e-08 1.549209871570718e-07
41 39 0.0001571732182028194 2.5402610321183817e-08 1.5194201541886346e-07
42 40 0.00015462705891566638 2.512706495768609e-08 1.490160317195833e-07
43 41 0.00015212101646392648 2.4854546722771583e-08 1.4614388817377845e-07
44 42 0.00014965447757986727 2.4585006051161647e-08 1.4332463586636234e-07
45 43 0.00014722683809507942 2.4318394065447274e-08 1.4055734193947907e-07
46 44 0.0001447164668892396 2.4034548127308286e-08 1.3772590008270512e-07
47 45 0.00014224784112375704 2.3753926686114635e-08 1.3494914625939818e-07
48 46 0.00013982028367499942 2.3476475779461364e-08 1.3222606385780792e-07
49 47 0.00013743418748445304 2.3202244204140228e-08 1.2955665313419502e-07
50 48 0.00013508884015386575 2.2931178307200807e-08 1.269398709602497e-07
51 49 0.00013278354172499636 2.2663225269637508e-08 1.243746944213211e-07
52 50 0.0001305176041972383 2.2398333101097452e-08 1.2186012017916144e-07
53 51 0.00012829168984639723 2.2136419884279648e-08 1.1939640981690787e-07
54 52 0.00012610506317956035 2.1877436733290284e-08 1.169825203056231e-07
55 53 0.000123957002859191 2.1621335420785434e-08 1.1461743054419468e-07
56 54 0.00012180241033649304 2.1360152817604167e-08 1.1225922783038433e-07
57 55 0.00011968650905779935 2.1101906890578305e-08 1.0994951537259513e-07
58 56 0.000117608577762061 2.0846548870078847e-08 1.0757395097864581e-07
59 57 0.00011556891128259058 2.0594151467353748e-08 1.0524972555992308e-07
60 58 0.00011356676177301841 2.0344667169015006e-08 1.0297570549831857e-07
61 59 0.00011160139690545192 2.00980493433389e-08 1.0075078305548045e-07
62 60 0.00010967209909252646 1.985425227516509e-08 9.857387536569511e-08
63 61 0.00010777915187087522 1.9613208260272527e-08 9.644480679616336e-08
64 62 0.00010592181397175155 1.937487453011716e-08 9.436248424611683e-08
65 63 0.00010409936038610526 1.913920913597429e-08 9.23258408012148e-08
66 64 0.00010246447558375888 1.8936226281729442e-08 9.046927135291653e-08
67 65 0.00010085803630104006 1.87354387522902e-08 8.865067925960373e-08
68 66 9.927950010553608e-05 1.853681852284204e-08 8.686925127146881e-08
69 67 9.772837346090978e-05 1.834034443508121e-08 8.512422533827548e-08
70 68 9.620413430112097e-05 1.8145990199784238e-08 8.341482250639003e-08
71 69 9.470627135913274e-05 1.795373041706864e-08 8.174028142913882e-08
72 70 9.323428359797426e-05 1.776354066998682e-08 8.009985766376296e-08
73 71 9.178813743816942e-05 1.7575386852678668e-08 7.849321446941785e-08
74 72 9.03673300948529e-05 1.7389247191220127e-08 7.691961625609547e-08
75 73 8.897136946427622e-05 1.7205101122769978e-08 7.537834446342857e-08
76 74 8.760740745800998e-05 1.7025337039390582e-08 7.387513417420477e-08
77 75 8.626710469266086e-05 1.684760610568072e-08 7.274492099363918e-08
78 76 8.495000573672162e-05 1.6671894857242002e-08 7.163427447510873e-08
79 77 8.365569697520994e-05 1.649819993412593e-08 7.054284583689279e-08
80 78 8.238374036674246e-05 1.6326513144182658e-08 6.947026569965565e-08
81 79 8.113370706498376e-05 1.6156829499842502e-08 6.841617243780552e-08
82 80 7.990517700269747e-05 1.5989147949913657e-08 6.738021182874466e-08
83 81 7.86978423091888e-05 1.5823469853370494e-08 6.636212425984957e-08
84 82 7.751129541079691e-05 1.5659805288834794e-08 6.536156604375694e-08
85 83 7.634513730458643e-05 1.549817228640182e-08 6.4378200720386e-08
86 84 7.530262080974352e-05 1.5364274253504764e-08 6.349909645089537e-08
87 85 7.427675504203847e-05 1.523236211656126e-08 6.263403294276386e-08
88 86 7.326723873728748e-05 1.5102509684796054e-08 6.17827561543225e-08
89 87 7.227232864621635e-05 1.497407531211962e-08 6.094379608688325e-08
90 88 7.129179755315639e-05 1.4847053209180731e-08 6.011696114034632e-08
91 89 7.032542203609286e-05 1.4721438007057792e-08 5.930206291361871e-08
92 90 6.937298231674387e-05 1.4597224779058979e-08 5.8498916078193026e-08
93 91 6.843339696762452e-05 1.4474430063551042e-08 5.7706608718023995e-08
94 92 6.750649045006184e-05 1.435304906112738e-08 5.692499280974924e-08
95 93 6.659208967850971e-05 1.4233077472549144e-08 5.615392239861094e-08
96 94 6.554258932109723e-05 1.4075047005202515e-08 5.5268928972034715e-08
97 95 6.450957734109015e-05 1.3918652473373596e-08 5.439783940505763e-08

View File

@@ -0,0 +1,223 @@
{
"uid": "Span1",
"params": {
"length": 80,
"loss_coef": 0.2,
"length_units": "km",
"att_in": 0,
"con_in": 0.5,
"con_out": 0.5,
"type_variety": "SSMF",
"dispersion": 0.0000167,
"gamma": 0.00127,
"raman_efficiency": {
"cr": [
0,
0.0000094,
0.0000292,
0.0000488,
0.0000682,
0.0000831,
0.000094,
0.0001014,
0.0001069,
0.0001119,
0.0001217,
0.0001268,
0.0001365,
0.000149,
0.000165,
0.000181,
0.0001977,
0.0002192,
0.0002469,
0.0002749,
0.0002999,
0.0003206,
0.0003405,
0.0003592,
0.000374,
0.0003826,
0.0003841,
0.0003826,
0.0003802,
0.0003756,
0.0003549,
0.0003795,
0.000344,
0.0002933,
0.0002024,
0.0001158,
0.0000846,
0.0000714,
0.0000686,
0.000085,
0.0000893,
0.0000901,
0.0000815,
0.0000667,
0.0000437,
0.0000328,
0.0000296,
0.0000265,
0.0000257,
0.0000281,
0.0000308,
0.0000367,
0.0000585,
0.0000663,
0.0000636,
0.000055,
0.0000406,
0.0000277,
0.0000242,
0.0000187,
0.000016,
0.000014,
0.0000113,
0.0000105,
0.0000098,
0.0000098,
0.0000113,
0.0000164,
0.0000195,
0.0000238,
0.0000226,
0.0000203,
0.0000148,
0.0000109,
0.0000098,
0.0000105,
0.0000117,
0.0000125,
0.0000121,
0.0000109,
0.0000098,
0.0000082,
0.0000066,
0.0000047,
0.0000027,
0.0000019,
0.0000012,
4e-7,
2e-7,
1e-7
],
"frequency_offset": [
0,
500000000000,
1000000000000,
1500000000000,
2000000000000,
2500000000000,
3000000000000,
3500000000000,
4000000000000,
4500000000000,
5000000000000,
5500000000000,
6000000000000,
6500000000000,
7000000000000,
7500000000000,
8000000000000,
8500000000000,
9000000000000,
9500000000000,
10000000000000,
10500000000000,
11000000000000,
11500000000000,
12000000000000,
12500000000000,
12750000000000,
13000000000000,
13250000000000,
13500000000000,
14000000000000,
14500000000000,
14750000000000,
15000000000000,
15500000000000,
16000000000000,
16500000000000,
17000000000000,
17500000000000,
18000000000000,
18250000000000,
18500000000000,
18750000000000,
19000000000000,
19500000000000,
20000000000000,
20500000000000,
21000000000000,
21500000000000,
22000000000000,
22500000000000,
23000000000000,
23500000000000,
24000000000000,
24500000000000,
25000000000000,
25500000000000,
26000000000000,
26500000000000,
27000000000000,
27500000000000,
28000000000000,
28500000000000,
29000000000000,
29500000000000,
30000000000000,
30500000000000,
31000000000000,
31500000000000,
32000000000000,
32500000000000,
33000000000000,
33500000000000,
34000000000000,
34500000000000,
35000000000000,
35500000000000,
36000000000000,
36500000000000,
37000000000000,
37500000000000,
38000000000000,
38500000000000,
39000000000000,
39500000000000,
40000000000000,
40500000000000,
41000000000000,
41500000000000,
42000000000000
]
}
},
"operational": {
"temperature": 283,
"raman_pumps": [
{
"power": 0.2,
"frequency": 205000000000000,
"propagation_direction": "counterprop"
},
{
"power": 0.206,
"frequency": 201000000000000,
"propagation_direction": "counterprop"
}
]
},
"metadata": {
"location": {
"latitude": 1,
"longitude": 0,
"city": null,
"region": ""
}
}
}

View File

@@ -0,0 +1,14 @@
{
"raman_computed_channels": [1, 18, 37, 56, 75],
"raman_parameters": {
"flag_raman": true,
"space_resolution": 10e3,
"tolerance": 1e-8
},
"nli_parameters": {
"nli_method_name": "ggn_spectrally_separated",
"wdm_grid_size": 50e9,
"dispersion_tolerance": 1,
"phase_shift_tollerance": 0.1
}
}

View File

@@ -309,26 +309,11 @@ def test_json_response_generation(xls_input, expected_response_file):
if i == 1:
my_rq = deepcopy(rqs[i])
my_rq.M = 0
error_handled = False
try:
temp_result = {
'response': Result_element(my_rq, pth, reversed_propagatedpths[i]).json}
except ServiceError:
error_handled = True
if not error_handled:
print('Service error with M=0 not correctly handled')
raise AssertionError()
error_handled = False
with pytest.raises(ServiceError):
Result_element(my_rq, pth, reversed_propagatedpths[i]).json
my_rq.blocking_reason = 'NO_SPECTRUM'
try:
temp_result = {
'response': Result_element(my_rq, pth, reversed_propagatedpths[i]).json}
print(temp_result)
except ServiceError:
error_handled = True
if error_handled:
print('Service error with NO_SPECTRUM blocking reason not correctly handled')
raise AssertionError()
Result_element(my_rq, pth, reversed_propagatedpths[i]).json
result.append(Result_element(rqs[i], pth, reversed_propagatedpths[i]))

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: Alessio Ferrari
"""
checks that RamanFiber propagates properly the spectral information. In this way, also the RamanSolver and the NliSolver
are tested.
"""
import json
from pandas import read_csv
from numpy.testing import assert_allclose
from gnpy.core.info import create_input_spectral_information
from gnpy.core.elements import RamanFiber
from gnpy.core.network import load_sim_params
from pathlib import Path
TEST_DIR = Path(__file__).parent
def test_raman_fiber():
""" Test the accuracy of propagating the RamanFiber.
"""
# spectral information generation
power = 1e-3
with open(TEST_DIR / 'data' / 'eqpt_config.json', 'r') as file:
eqpt_params = json.load(file)
spectral_info_params = eqpt_params['SI'][0]
spectral_info_params.pop('power_dbm')
spectral_info_params.pop('power_range_db')
spectral_info_params.pop('tx_osnr')
spectral_info_params.pop('sys_margins')
spectral_info_input = create_input_spectral_information(power=power, **spectral_info_params)
# RamanFiber
with open(TEST_DIR / 'data' / 'raman_fiber_config.json', 'r') as file:
raman_fiber_params = json.load(file)
sim_params = load_sim_params(TEST_DIR / 'data' / 'sim_params.json')
fiber = RamanFiber(**raman_fiber_params)
fiber.sim_params = sim_params
# propagation
spectral_info_out = fiber(spectral_info_input)
p_signal = [carrier.power.signal for carrier in spectral_info_out.carriers]
p_ase = [carrier.power.ase for carrier in spectral_info_out.carriers]
p_nli = [carrier.power.nli for carrier in spectral_info_out.carriers]
expected_results = read_csv(TEST_DIR / 'data' / 'expected_results_science_utils.csv')
assert_allclose(p_signal, expected_results['signal'], rtol=1e-3)
assert_allclose(p_ase, expected_results['ase'], rtol=1e-3)
assert_allclose(p_nli, expected_results['nli'], rtol=1e-3)