SiEPIC / SiEPIC-Tools

Package for KLayout to add integrated optics / silicon photonics functionality (waveguides, netlist extraction, circuit simulations, etc)
Other
181 stars 90 forks source link

Automatic Waveguide SBend #179

Closed jevillegasd closed 2 years ago

jevillegasd commented 2 years ago

Inserts waveguide bends #153 as part of the guiding line that generates the waveguide. The SBend takes precedence over the creation of normal bends where it's possible to install them, but they are only placed provided a normal bend doesn't fit. It uses the Bezier Parallel function from SiEPIC.utils.geometry.

Here are some images of how the Bends look. image

Tested it against EBeam, Athabasca, AMF, and others and it seems to be working fine in all.

Concerns:

jevillegasd commented 2 years ago

Found a bug when the sbend starts too close from a previous normal bend (case that should not try to install an SBend I suppose, giving precendece to whoever is the first in the list of points). I am fixing this and will send a new commit

image

mustafacc commented 2 years ago

Wow @jevillegasd - you work fast.

This is quite nice - I've been testing it on a few PDKs, and so far, so good.

Some odd behaviours I'm seeing on my end (testing on EBeam PDK):

image

I agree with adding a checkbox to support older waveguides. Can this property be used to catch the false "minimum radius" DFT flag? i.e., if s-bend is checked, and the minimum radius flag occurs at the S-bend, then it's a false positive. I think this can be sorted out in the future.

(FYI I'm holding off on merging this pull request until SiEPIC-Tools V0.3.93 is released next week - we're working on a stable version for the release of https://www.aimphotonics.com/dream-photonics-component-library)

jevillegasd commented 2 years ago

Hey @mustafacc , I was able to reproduce your error and fixed the it, it was a tiny mistake when checking if there was enough clearance for the bend.

The minimum error marking is still handled by the existing waveguide methods, if no s-bend is placed, then it tries to isnert normal bends and detects there if there are any minimum bend violations. Because of this there is a condition, when an sbend is too close to one of the ends, that gets detected as a minimum radius violation instead of a 'not enough clearance for sbend' , because well, no sbends violations are being handled. That's the situation you had in the image you posted (although still the method was checking for the wrong clearance).

About the internal error popping out I was not able to reproduce it, even before the fix I did.

jevillegasd commented 2 years ago

This last commit should do the job. It needs updating the WAVEGUIDE.XML file with the parameter <sbends>true</sbends> to allow inserting the sbends.

mustafacc commented 2 years ago

Thanks @jevillegasd - I think I came across another case that's missed by the automated S-bend generation: S-bends seem to be generating nicely laterally. However, it seems like the vertical sections are missed. I can see from your screenshots that you are able to instantiate vertical S-bends without the issue I'm seeing:

image

Regarding S-bend option in waveguidex.xml: is it possible to set the default to be true unless the user overrides this argument? The main reason is to enable this feature for backwards compatibility without having to update all the various PDKs waveguide.xml with " true" option.

jevillegasd commented 2 years ago

Hey @mustafacc, thanks for double checking. trying to replicate your error I found out it's worse than I thought! Actually right now the SBend placement is working only drawing from bottom to top or left to right waveguides. I'll debug and update the commit.

jevillegasd commented 2 years ago

Hey @mustafacc . I've corrected the issue, just needed to include a condition to mirror the waveguide points upon creation. These are the test cases that I used, and it worked well in all of them. Please let me know if you can give it a look and if it works on your end.

image

The 'circle' paths are clockwise and counter-clockwise and with bends towards the outside and the inside.

mustafacc commented 2 years ago

Thanks a lot @jevillegasd , I've tested on additional test cases and PDKs and the automated S-bend works on all the cases so far.