Telecominfraproject / oopt-gnpy

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

Inconsistent docs about amplifier models #240

Open jktjkt opened 5 years ago

jktjkt commented 5 years ago

@ggrammel 's brownfield docs refers to gain_flatmax. The definition within examples/edfa_model/amplifier_models_description.rst looks good, but the short summary that is in the word document (and which originated either in the wiki, or in README.rst) is different and a bit confusing (it looks like refers to a different thing on a fixed-gain amp vs. a variable-gain one).

ojnas commented 5 years ago

The definition in amplifier_models_description.rst says:

If gain > gain_flatmax, the amplifier will tilt, based on its dgt function

If gain > gain_flatmax + target_extended_gain, the amplifier output power is reduced to not exceed the extended gain range.

While this sounds reasonable with respect to how a real EDFA operates, it doesn't seem to describe what is currently implemented in GNPy.

jeanluc-auge commented 5 years ago

It does in auto-design mode. Didn't want to force a power reduction when the settings are input by the user: see this bloc For the tilt, I have implemented it a long time ago and not checked since as we didn't have fiber SRS support. May be worth re-checking now.

ojnas commented 5 years ago

Ok, but I don't think this is implemented:

If gain > gain_flatmax, the amplifier will tilt, based on its dgt function

Correct me if I'm wrong but as far as I can see, what is implemented today is that you can set tilt target independently of gain.

jeanluc-auge commented 5 years ago

Have you tested it ? It used to work (a year ago) when I added the VOA in the code. It happens down here

ojnas commented 5 years ago

Maybe we're talking past each other. In my understanding, if gain > gain_max, the amplifier gain should tilt even if tilt target is set to 0. Now, looking at the code you linked to (I have looked at it before and maybe I have misunderstood something so please help):

g1st = array(self.interpol_gain_ripple) + self.params.gain_flatmax \
          + array(self.interpol_dgt) * dgts1
voa = lin2db(mean(db2lin(g1st))) - self.effective_gain

Assuming tilt target is 0 (so we have dgts1 = 0) and gain_ripple is flat, then g1st is flat. (Here, if effective_gain is higher than gain_flatmax, voa will be negative which is a bit confusing).

Further down we have:

deltax = max(g1st) - min(g1st)
# if no ripple deltax = 0 and xlow = xcent: div 0
# TODO|jla: add check for flat gain response
if abs(deltax) <= 0.05: # not enough ripple to consider calculation
     return g1st - voa

Since g1st is flat deltax = 0, and a flat gain will be returned even if gain > gain_max.

jeanluc-auge commented 5 years ago

It is written in the code: not enough ripple to consider calculation. See other cases. And try it with an advanced edfa model.

ojnas commented 5 years ago

DGT and ripple are two separate things. I'm talking about DGT. I have tried setting gain_target in the network json much higher than gain_flatmax specified in the eqpt config json and the gain is still flat. It does not matter which amplifier model is used.

mkalinkevich commented 2 years ago

I'm seeing the same problem, no matter which amplifier model is used, gain is always flat, gain tilting based on gain_flatmax and DGT is not working. Meanwhile ripple is OK. Are there any plans to validate that functionality ?

caffery-chen commented 1 year ago

Hi I bumped into same issue. Some observation would love to have the author to confirm. As long as my understanding is correct, it shall be fine to wait for another release with this issue closed.

  1. gain> gain_flatmax, if target_tilt =0, then the gain_profile will have tilt = 0. ( I tried to set the target_tilt to the value we actually measured at particular gain, the outcome utilizing DGT can match with the measurement)
  2. the polyfit for the NF take gain_flatmax as if its gain_max, for gain > gain_flatmax, the -dg will be 0 and the NF is not correctly represented in this case. dg = max(gain_flatmax - gain_target, 0)