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
Build no amp in roadm and add roadm restrictions on amps #230
Conversation
There was a problem hiding this 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.
6e7a2a7
to
6010301
Compare
This comment has been minimized.
This comment has been minimized.
Please do not merge yet: I am still working on the associated tests |
263acad
to
8d45f98
Compare
|
||
>>> d3 = {'params': {'restrictions': {'preamp_variety_list': ['foo'], 'booster_variety_list': ['bar']}}} | ||
>>> merge_dicts_recursively(d1, d3) | ||
{'params': {'restrictions': {'preamp_variety_list': [], 'booster_variety_list': []}}} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
?
There are no doctests right now, but they will (might?) be added (see PR Telecominfraproject#230).
3a795ec
to
038fe18
Compare
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 If this is not a big problem for you, please consider splitting your work and committing more often. |
gnpy/core/utils.py
Outdated
"""Raised when the json equipment is not formed correctly | ||
""" | ||
import sys | ||
sys.tracebacklimit = 0 |
There was a problem hiding this comment.
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.
hi @jktjkt , |
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). |
OK ! thanks for the feedback ! |
038fe18
to
cc14496
Compare
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 |
gnpy/core/equipment.py
Outdated
@@ -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 |
There was a problem hiding this comment.
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.
ff22e5f
to
69f398d
Compare
69f398d
to
985de51
Compare
@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, I think the sentence "In case a per-degree exception is needed, add the
|
985de51
to
d2df792
Compare
@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 |
@jktjkt , the new wording is not correct for the fused part with excel input The Change in README is OK for me |
There was a problem hiding this 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.
I have done the requested changes. |
fcfedbf
to
e94a78e
Compare
@jktjkt , |
I found the issue ! |
Co-authored-by: Esther Le Rouzic <esther.lerouzic@orange.com>
0e1fc2f
to
b07efa4
Compare
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>
b07efa4
to
d94dc51
Compare
There was a problem hiding this 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.
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:
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 !