diff --git a/gnpy/core/network.py b/gnpy/core/network.py index 3017d672f..2a0f0e80a 100644 --- a/gnpy/core/network.py +++ b/gnpy/core/network.py @@ -17,8 +17,7 @@ from gnpy.core.exceptions import ConfigurationError, NetworkTopologyError from gnpy.core.utils import round2float, convert_length, psd2powerdbm, lin2db, watt2dbm, dbm2watt from gnpy.core.info import ReferenceCarrier, create_input_spectral_information -from gnpy.tools import json_io -from gnpy.core.parameters import SimParams +from gnpy.core.parameters import SimParams, EdfaParams from gnpy.core.science_utils import RamanSolver @@ -540,7 +539,7 @@ def add_roadm_booster(network, roadm): network.remove_edge(roadm, next_node) amp = elements.Edfa( uid=f'Edfa_booster_{roadm.uid}_to_{next_node.uid}', - params=json_io.Amp.default_values, + params=EdfaParams.default_values, metadata={ 'location': { 'latitude': roadm.lat, @@ -566,7 +565,7 @@ def add_roadm_preamp(network, roadm): network.remove_edge(prev_node, roadm) amp = elements.Edfa( uid=f'Edfa_preamp_{roadm.uid}_from_{prev_node.uid}', - params=json_io.Amp.default_values, + params=EdfaParams.default_values, metadata={ 'location': { 'latitude': roadm.lat, @@ -595,7 +594,7 @@ def add_inline_amplifier(network, fiber): network.remove_edge(fiber, next_node) amp = elements.Edfa( uid=f'Edfa_{fiber.uid}', - params=json_io.Amp.default_values, + params=EdfaParams.default_values, metadata={ 'location': { 'latitude': (fiber.lat + next_node.lat) / 2, diff --git a/gnpy/core/parameters.py b/gnpy/core/parameters.py index 4e701af02..52fb3f2c1 100644 --- a/gnpy/core/parameters.py +++ b/gnpy/core/parameters.py @@ -398,6 +398,38 @@ def asdict(self): class EdfaParams: + default_values = { + 'f_min': 191.3e12, + 'f_max': 196.1e12, + 'multi_band': None, + 'bands': [], + 'type_variety': '', + 'type_def': '', + 'gain_flatmax': None, + 'gain_min': None, + 'p_max': None, + 'nf_model': None, + 'dual_stage_model': None, + 'preamp_variety': None, + 'booster_variety': None, + 'nf_min': None, + 'nf_max': None, + 'nf_coef': None, + 'nf0': None, + 'nf_fit_coeff': None, + 'nf_ripple': 0, + 'dgt': None, + 'gain_ripple': 0, + 'tilt_ripple': 0, + 'f_ripple_ref': None, + 'out_voa_auto': False, + 'allowed_for_design': False, + 'raman': False, + 'pmd': 0, + 'pdl': 0, + 'advance_configurations_from_json': None + } + def __init__(self, **params): try: self.type_variety = params['type_variety'] diff --git a/gnpy/tools/json_io.py b/gnpy/tools/json_io.py index c55b26646..dbf30cb55 100644 --- a/gnpy/tools/json_io.py +++ b/gnpy/tools/json_io.py @@ -21,7 +21,7 @@ from gnpy.core.science_utils import estimate_nf_model from gnpy.core.info import Carrier from gnpy.core.utils import automatic_nch, automatic_fmax, merge_amplifier_restrictions -from gnpy.core.parameters import DEFAULT_RAMAN_COEFFICIENT +from gnpy.core.parameters import DEFAULT_RAMAN_COEFFICIENT, EdfaParams from gnpy.topology.request import PathRequest, Disjunction, compute_spectrum_slot_vs_bandwidth from gnpy.topology.spectrum_assignment import mvalue_to_slots from gnpy.tools.convert import xls_to_json_data @@ -180,35 +180,7 @@ class RamanFiber(Fiber): class Amp(_JsonThing): - default_values = { - 'f_min': 191.35e12, - 'f_max': 196.1e12, - 'type_variety': '', - 'type_def': '', - 'gain_flatmax': None, - 'gain_min': None, - 'p_max': None, - 'nf_model': None, - 'dual_stage_model': None, - 'preamp_variety': None, - 'booster_variety': None, - 'nf_min': None, - 'nf_max': None, - 'nf_coef': None, - 'nf0': None, - 'nf_fit_coeff': None, - 'nf_ripple': 0, - 'dgt': None, - 'gain_ripple': 0, - 'tilt_ripple': 0, - 'f_ripple_ref': None, - 'out_voa_auto': False, - 'allowed_for_design': False, - 'raman': False, - 'pmd': 0, - 'pdl': 0, - 'advance_configurations_from_json': None - } + default_values = EdfaParams.default_values def __init__(self, **kwargs): self.update_attr(self.default_values, kwargs, 'Amp')