Telecominfraproject / oopt-gnpy

Optical Route Planning Library, Based on a Gaussian Noise Model
http://telecominfraproject.com
BSD 3-Clause "New" or "Revised" License
198 stars 87 forks source link

Propagating partial spectral load #506

Open abhiman84 opened 1 month ago

abhiman84 commented 1 month ago

The issue reported here is similar to https://github.com/Telecominfraproject/oopt-gnpy/issues/456

Instead of propagating full spectrum load, I want to propagate selective spectrum for my simulation. For this purpose, I modified the SI block in ./usr/local/lib/python3.9/site-packages/gnpy/example-data/eqpt_config.json as:

"SI":[{ "f_min": 191.3e12, "baud_rate": 32e9, "f_max":192.1e12, "spacing": 50e9, "power_dbm": 0, "power_range_db": [0,0,1], "roll_off": 0.15, "tx_osnr": 40, "sys_margins": 2 },{ "f_min": 193.3e12, "baud_rate": 32e9, "f_max":194.1e12, "spacing": 50e9, "power_dbm": 0, "power_range_db": [0,0,1], "roll_off": 0.15, "tx_osnr": 40, "sys_margins": 2 } ],

Then run the command : gnpy-transmission-example $(gnpy-example-data)/raman_edfa_example_network.json --sim $(gnpy-example-data)/sim_params.json --show-channels

But, I get the following error :

gnpy-transmission-example (gnpy-example-data)/sim_params.json --show-channels There are 16 channels propagating Power mode is set to True => it can be modified in eqpt_config.json - Span <class 'numpy.ndarray'> Traceback (most recent call last): File "/usr/local/bin/gnpy-transmission-example", line 8, in sys.exit(transmission_main_example()) File "/usr/local/lib/python3.9/site-packages/gnpy/tools/cli_examples.py", line 243, in transmission_main_example design_network(ref_req, network, equipment, set_connector_losses=True, verbose=True) File "/usr/local/lib/python3.9/site-packages/gnpy/core/network.py", line 775, in design_network build_network(network, equipment, pref_ch_db, pref_total_db, set_connector_losses=set_connector_losses, File "/usr/local/lib/python3.9/site-packages/gnpy/core/network.py", line 762, in build_network set_egress_amplifier(network, roadm, equipment, pref_ch_db, pref_total_db, verbose) File "/usr/local/lib/python3.9/site-packages/gnpy/core/network.py", line 318, in set_egress_amplifier node_loss = span_loss(network, prev_node, equipment) File "/usr/local/lib/python3.9/site-packages/gnpy/core/network.py", line 244, in span_loss gain += sum(estimate_raman_gain(n, equipment) for n in prev_node_generator(network, node)) File "/usr/local/lib/python3.9/site-packages/gnpy/core/network.py", line 244, in gain += sum(estimate_raman_gain(n, equipment) for n in prev_node_generator(network, node)) File "/usr/local/lib/python3.9/site-packages/gnpy/core/network.py", line 229, in estimate_raman_gain spectral_info_out = n_copy(spectral_info_input) File "/usr/local/lib/python3.9/site-packages/gnpy/core/elements.py", line 676, in call self.propagate(spectral_info) File "/usr/local/lib/python3.9/site-packages/gnpy/core/elements.py", line 724, in propagate spectral_info.nli += NliSolver.compute_nli(spectral_info, stimulated_raman_scattering, self) File "/usr/local/lib/python3.9/site-packages/gnpy/core/science_utils.py", line 311, in compute_nli eta = NliSolver._ggn_spectrally_separated(cut_indices, spectral_info, fiber, srs) File "/usr/local/lib/python3.9/site-packages/gnpy/core/science_utils.py", line 392, in _ggn_spectrally_separated gamma = outer(fiber.gamma(frequency[cut_indices]), ones(nch)) IndexError: index 17 is out of bounds for axis 0 with size 16

I got same error when using -spectrum option in the command line and specifying the same channels as in SI block of eqpt_config.json as above.

Kindly advise, thanks

EstherLerouzic commented 1 month ago

Dear @abhiman84 ,

GNPY does not currently consider more than one SI in the SI block. If you wish to propagate different types of channels within the spectrum you must use the --spectrum option.

The definition in spectrum file is a bit different from SI (although similar):

should be like that:

{
      "spectrum":[
            {
            "f_min": 191.4e12,
            "f_max":193.1e12,
            "baud_rate": 32e9,
            "slot_width": 50e9,
            "delta_pdb": 0,
            "roll_off": 0.15,
            "tx_osnr": 40,
            "label": "mode_1"
            },
            {
            "f_min": 193.1625e12,
            "f_max":195e12,
            "baud_rate": 64e9,
            "slot_width": 75e9,
            "roll_off": 0.15,
            "tx_osnr": 40,
            "label": "mode_2"
            }
      ]
}

see documentation here for the detailed explanation of each attribute: https://github.com/Telecominfraproject/oopt-gnpy/blob/master/docs/json.rst#arbitrary-channel-definition

I am not sure to understand correctly your example: the line command:

gnpy-transmission-example (gnpy-example-data)/sim_params.json --show-channels

is missing the positional topology attribute : gnpy/example-data/raman_edfa_example_network.json, the sim_params.json file is missing the --sim-params option...

I think the command should rather be something like:

gnpy-transmission-example (gnpy-example-data)/raman_edfa_example_network.json --sim-params (gnpy-example-data)/sim_params.json --spectrum <spectrum_file.json> --show-channels

with spectrum_file.json the file where you have defined the spectrum you want to propagate.

Hope this help!

regards