Telecominfraproject/oopt-gnpy

Variable gain amp model documentation and modification

cgkelly opened this issue · 15 comments

The current VGA model for estimating NF at intermediate points is based on an assumption that is overly aggressive for many amplifiers. As well, there isn't any documentation on the derivation of the existing model. The attached slide deck outlines the existing model derivation, plus suggested modifications to better fit actual amplifiers, with an example. It also outlines why the intermediate variable delta_p is not required and has no impact on the resulting nf fit. (It has an impact on practical amp design, but not the model).
GNPY_variable_gain_amp_model.pptx

Additional context
Add any other context or screenshots about the feature request here.
Updated slide deck to correct an equation and to illustrate GNPY advanced amplifier model fits
GNPY_variable_gain_amp_model_v2.pptx

Thanks a lot for taking the time to describe the issue in detail, and for planning to present this during our Thursday call as I've been told by @ggrammel. Looking forward to the discussion!

ojnas commented

@cgkelly, thanks, this is very interesting input. I agree that the current variable_gain model in GNPy is probably too optimistic and could be improved. About the derivations in the slides, I could not make sense of the equation for g2 on slide 5, is it really correct? Also, regarding delta_p elimination, I was not able to completely follow the derivation of the final equation for the blended model on slide 10 but I made a quick implementation and it does indeed give the same results as the existing GNPy implementation for k=1.

If we decide to add your proposed model to GNPy there are a couple of things we need to discuss:

1. How do we handle "backwards compatibility"?
If we modify the existing variable_gain type_def, this will change simulation results for users existing topologies. We could keep the existing implementation and add a new type_def for your proposal but then we have to explain why there are two alternatives and explain the difference in documentation, etc., which may be tricky.

2. How do we set the k parameter?
I think setting k=0 as default like you propose is too pessimistic. Also, I don't think k should be a user defined input since this would make the usage too complicated and it is not a parameter that can be found in any datasheets. Maybe it would be possible to calculate k based on existing parameters using additional assumptions? For example, would it be reasonable to assume that p1_max < p2_max always? It seems this could be used to at least calculate a lower bound on k since in your example on slide 3 this condition is violated for k=0.

@cgkelly can you please drop me a mail at jan.kundrat@telecominfraproject.com? I would like to send you today's recording to check if it's OK.

ojnas commented

Updated slide deck to correct an equation and to illustrate GNPY advanced amplifier model fits

I'm getting different results for the polynomial fits. It looks like maybe you are doing NF=f(gain_flatmax - gain) instead of f(gain - gain_flatmax).

Here's the video recording where we discussed this. (We were not able to record via webex, and this backup recording did not catch my voice.)

Meeting recording

The plan is to introduce the k parameter, and to default to the existing value for "legacy JSON files". When we switch to YANG+JSON, its default will change -- and the conversion script will preserve the existing default to prevent any changes in simulation.

@EstherLerouzic might be able to offer insight into how significantly the results change once the code is there and once she re-run their internal test suite.

ojnas commented

@cgkelly, please check my comment above. In the slides you presented at the PSE meeting today, I think you swapped gain_target and gain_flatmax when you calculated NF vs. gain_target based on polynomial coefficients.

Hi Jonas, my understanding of the polynomial NF code is that NF = f(-g), where g = gain-gainflatmax.
This of course becomes NF=f(gainflatmax-gain).

ojnas commented

my understanding is that NF = f(-g), where g = gain-gainflatmax.

@cgkelly, no the relevant code is in this function:

def _nf(self, type_def, nf_model, nf_fit_coeff, gain_min, gain_flatmax, gain_target):

i.e. (line 689):

nf_avg = polyval(nf_fit_coeff, -dg)

where (line 678):

dg = max(gain_flatmax - gain_target, 0)

ojnas commented

There seems to be an error in the amplifier_model_description.rst file

@cgkelly, Yes, I agree the documentation is misleading as I also pointed out here: #355

Inversing the sign of dg (to match the code) results in a nearly linear fit for NF vs gain (with a slope of ~-0.5 dB/dB) for the Juniper HG booster, which is a more believable fit (the NF does not increase again at high gains). This amplifier does not fit the VGA model well regardless of the k coefficient.

Just to exclude the possibility that whoever calculated the polynomial fit for the Juniper HG booster also had an incorrect understanding of how the model is actually implemented, @ggrammel do you still have the underlying data?