Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build no amp in roadm and add roadm restrictions on amps #230

Merged

Conversation

EstherLerouzic
Copy link
Collaborator

This PR adds the amp restriction in Roadms (booster and preamp).
to use it with xls input file
-user may enter (valid) restrictions in eqpt_config.json and all roadms will have same restriction
-user may add per Roadm restriction in Nodes sheet (column 9 and 10 for booster and preamp, respectively). this will override eqpt_config general input for this particular node
to use it with json:

  • user may enter (valid) restrictions in eqpt_config.json and all roadms will have same restriction
  • user must add a valid restriction field in the json roadm element. this will override general input
    Note that restrictions apply to the entire roadm, and not per degree.

a special case without booster is enabled via the xls eqpt sheet: if a Roadm amp is marked fused, this will add a Fused element instead of an amp, enabling special design of roadms without booster. This can be applied per degree

This PR refers to #211 discussion. @jeanluc-auge, @ojnas , @jktjkt could you please have a look and tell me how to improve ? Thanks !

Copy link
Collaborator

@jktjkt jktjkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Esther, inline are some comments and nitpicks on how I would do things differently to increase readability a bit. Feedback is very welcome. I'll be looking into the actual code next week.

gnpy/core/elements.py Outdated Show resolved Hide resolved
gnpy/core/network.py Outdated Show resolved Hide resolved
gnpy/core/network.py Outdated Show resolved Hide resolved
gnpy/core/network.py Outdated Show resolved Hide resolved
gnpy/core/network.py Outdated Show resolved Hide resolved
gnpy/core/network.py Outdated Show resolved Hide resolved
gnpy/core/network.py Outdated Show resolved Hide resolved
gnpy/core/network.py Show resolved Hide resolved
gnpy/core/network.py Outdated Show resolved Hide resolved
tests/data/eqpt_config.json Show resolved Hide resolved
@jktjkt jktjkt added this to WIP in GNPy May 21, 2019
@EstherLerouzic EstherLerouzic marked this pull request as ready for review May 21, 2019 16:37
@codecov

This comment has been minimized.

@EstherLerouzic
Copy link
Collaborator Author

Please do not merge yet: I am still working on the associated tests

@EstherLerouzic EstherLerouzic force-pushed the build_no_amp_in_roadm branch 2 times, most recently from 263acad to 8d45f98 Compare May 23, 2019 12:31
gnpy/core/equipment.py Outdated Show resolved Hide resolved
gnpy/core/equipment.py Outdated Show resolved Hide resolved
gnpy/core/network.py Show resolved Hide resolved
gnpy/core/network.py Outdated Show resolved Hide resolved
gnpy/core/utils.py Outdated Show resolved Hide resolved

>>> d3 = {'params': {'restrictions': {'preamp_variety_list': ['foo'], 'booster_variety_list': ['bar']}}}
>>> merge_dicts_recursively(d1, d3)
{'params': {'restrictions': {'preamp_variety_list': [], 'booster_variety_list': []}}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EstherLerouzic , can you please confirm that this is a correct behavior? I don't know whether it would make more sense to merge the leaf lists or not. Either way, this test just documents the current behavior.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the commits !
This is the correct behaviour. Restriction read from node overrides restriction from eqpt_config.json if they exist, so we should not merge preamp and booster lists.
so maybe the naming is not correct, it is more an update

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please feel free to squash my changes to the commits which introduce that code. Or not, I do not really have a preference here.
  • Also feel free to rename this function if you feel like doing that. Perhaps something like merge_amplifier_restrictions?

jktjkt added a commit to jktjkt/oopt-gnpy that referenced this pull request May 23, 2019
There are no doctests right now, but they will (might?) be added (see
PR Telecominfraproject#230).
@jktjkt
Copy link
Collaborator

jktjkt commented May 24, 2019

And just FYI, it would be a bit easier for me if the work is split into small commits, each doing only one thing. This commit 038fe18 includes both trivial whitespace changes and replacing prints by logging plus exceptions. If these were separate, I would be able to glance over the trivial whitespace fixes very quickly, and focus on the more important changes.

If this is not a big problem for you, please consider splitting your work and committing more often.

"""Raised when the json equipment is not formed correctly
"""
import sys
sys.tracebacklimit = 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this is a nice coding pattern. Raising an exception should not result in a random callback into the sys module and trying to reconfigure backtrace behavior. Also, this variable is no longer available in Python 3.

If the intention is to suppress detailed error messages, then I suggest moving any UI-affecting bits into the CLI driver, i.e., examples/transmission_main_example.py. I'll create another pull request for these exceptions.

@EstherLerouzic
Copy link
Collaborator Author

hi @jktjkt ,
Is there anything else I should do for this PR to be at the level needed to be merged in develop ?

@jktjkt
Copy link
Collaborator

jktjkt commented May 31, 2019

Is there anything else I should do for this PR to be at the level needed to be merged in develop ?

I would like to have these two addressed before this gets merged:

Either you or me can do either of these two, please tell me what your preference is.

Which one is better from your point of view?

I apologize that #244 is not in yet, but I got stuck at #249 (help from anyone is appreciated there, I simply do not understand the EDFA model enough to make progress).

@EstherLerouzic
Copy link
Collaborator Author

OK ! thanks for the feedback !
I prefer to do the backporting this series on top of recent develop
and I will remove the -15dBm@transponder_RX change from this PR

@jktjkt
Copy link
Collaborator

jktjkt commented May 31, 2019

Thanks for completing this. Now the git history of this PR contains stuff which undoes another stuff done within this pull request, and I do not think that it's worth it to preserve such a level of detail. The new feature in general is reasonably compact, so it can be merged in a single commit (or two, with the utils/ change separated out). I'll force-push a cleanup shortly.

@@ -134,7 +138,8 @@ def from_json(cls, filename, **kwargs):
config = Path(filename).parent / 'default_edfa_config.json'

type_variety = kwargs['type_variety']
type_def = kwargs.get('type_def', 'variable_gain') #default compatibility with older json eqpt files
type_def = kwargs.get('type_def', 'variable_gain')
#default compatibility with older json eqpt files
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it's more intuitive if these comments are listed at the same line, or before the line they refer to. I've cleaned this.

gnpy/core/network.py Outdated Show resolved Hide resolved
@jktjkt jktjkt force-pushed the build_no_amp_in_roadm branch 2 times, most recently from ff22e5f to 69f398d Compare May 31, 2019 14:12
@jktjkt
Copy link
Collaborator

jktjkt commented May 31, 2019

@EstherLerouzic , can you please check that the descriptions given in the commit at the tip of this branch and in the README reflect reality? I tried to add a summary of what this thing is about into the commit message, and I also updated the README part about ROADMs.

@jktjkt jktjkt moved this from Needs Coding to Needs Review in GNPy May 31, 2019
jktjkt
jktjkt previously approved these changes May 31, 2019
@EstherLerouzic
Copy link
Collaborator Author

@jktjkt, I think the sentence "In case a per-degree exception is needed, add the Fused node to a
specific degree. When the Fused element is present, the restrictions no longer apply, and amplifiers can be placed manually."
should rather be something like:
"If a per-degree exception is needed, the amplifier of this degree can be defined in the Eqpt sheet or in the network json input. If no booster amplifier should be placed on a degree:

  • (in case of an excel input) the term fused should be used for the amplifier type in the eqpt sheet. This will disable the automatic placement of an amplifier on this degree by setting a 'Fused' (logical) node instead.
  • (In case of a json input), simply insert a 'Fused' node on the Roadm degree output.
    "
    Thanks for the changes !

GNPy automation moved this from Needs Review to Needs Coding Jun 3, 2019
@jktjkt
Copy link
Collaborator

jktjkt commented Jun 3, 2019

@EstherLerouzic , could you please check the updated wording? I've verified that you already put a correct wording into the Excel documentation, so I adjusted the commit message and clarified the JSON format in the main README.rst.

@EstherLerouzic
Copy link
Collaborator Author

@jktjkt , the new wording is not correct for the fused part with excel input
'If no booster amplifier should be placed on a degree, use the Fused
node in place of an amplifier.'
because there will be an edfa placed between the ROADM and the 'Fused' node. This is why I have introduced the 'fused' (small 'f' ) keyword in the Eqpt parsing.
the correct sentence should be something like :
"If no booster amplifier should be placed on a degree, use a Fused
node in place of an amplifier in case of json input, or use the 'fused' keyword for the amplifier type in the eqpt sheet for excel input. This will disable the automatic placement of an amplifier on this degree."

The Change in README is OK for me

Copy link
Collaborator

@jktjkt jktjkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize that I missed this during my review -- apparently I got confused by Fused vs. fused. I like that you described this as a hack, but it did not trip me for some reason. Sorry for that.

I do not like this approach. It sounds like a workaround for a deficiency in the Excel->JSON conversion. Rather than creating Edfa nodes with type_variety fused and replacing them here in gnpy/core/network.py, let's fix the Excel parser so that it creates correct data. That way we won't have to maintain extra (and undocumented) feature in a place where it does not belong (IMHO).

Right now I do not see this feature being used in the example Excel files (or am I wrong?). The test is there, but it modifies an input so that it "matches" how the Excel->JSON conversion output would look like.

I would prefer to:

  • Have some Excel file modified with this lowercase-fused no-booster use case. This should be done by you to prevent future errors on my side.
  • Move the parsing code into convert.py and adjust the unit tests. I can do this, or you can do this -- whatever you prefer.

@EstherLerouzic
Copy link
Collaborator Author

I have done the requested changes.

@EstherLerouzic
Copy link
Collaborator Author

@jktjkt ,
in my last commits I corrected a bug (sorry) + updated tests and rebased all this on the latest develop . Could you check if this is OK for you ?
Besides, all tests are running ok on my computer, but the PR is not passing tests via travis on github: any idea ? (I have found no detailed report on the cause of this failure, and don't know what to correct). Thanks a lot for your help !

@EstherLerouzic
Copy link
Collaborator Author

I found the issue !
docstring was not correct with the bug correction, and since it is tested with travis, the test fails

Co-authored-by: Esther Le Rouzic <esther.lerouzic@orange.com>
This feature is intended to support designs such as OpenROADM where the
line degree integrates a specific preamp/booster pair. In that case, it
does not make sense for our autodesign to "pick an amplifier". The
restrictions can be activated by:

- Listing them in `eqpt_config.json`, so that they are effective for all
ROADM instances.
- On a per-ROADM basis within the Excel sheet or the JSON definitions.

Restrictions apply to an entire ROADM as a whole, not to the individual
degrees.

If a per-degree exception is needed, the amplifier of this degree can be
defined in the equipment sheet or in the network definition.

If no booster amplifier should be placed on a degree, use the `Fused`
node in place of an amplifier.

Signed-off-by: Esther Le Rouzic <esther.lerouzic@orange.com>
Co-authored-by: Jan Kundrát <jan.kundrat@telecominfraproject.com>
Copy link
Collaborator

@jktjkt jktjkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've squashed them into just two commits, and made some minor clean-ups, e.g. this:

if not key in foo:
  raise Foo(...)

instead of trying to access foo[key] and catching the KeyError exception.

I'll merge this once all check are completed.

@jktjkt jktjkt merged commit 5be30d8 into Telecominfraproject:develop Jun 6, 2019
GNPy automation moved this from Needs Coding to Done Jun 6, 2019
@EstherLerouzic EstherLerouzic deleted the build_no_amp_in_roadm branch September 23, 2019 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
GNPy
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants