Tagged: pin, parameterize, directional coupler
- This topic has 4 replies, 3 voices, and was last updated 5 years, 6 months ago by AleksandarK.
-
AuthorPosts
-
3 June 2019 at 22:24 #5541AleksandarKMember
Dear developers,
I am wondering how can a Directional Coupler,
like in the picture above, be implemented in nazca?
I have the latest Nazca-Design package.
Thanks in advance.
3 June 2019 at 23:02 #5544XaveerModeratorDear Aleksandar,
There are many ways to do this. The example below uses the built-in demofab cross-section. You can use a very similar implementation for your own technology, by following the cross-section tutorial https://nazca-design.org/implement-a-cross-section/. You can make your directional coupler into a building block and re-use it many times by encapsulating it in a cell and adding pins to it. Look at https://nazca-design.org/crate-bb-using-polygon/ for inspiration.
Here’s an example for the directional coupler, using sinebend curves.
import nazca as nd import nazca.demofab as demo with nd.Cell("Coupler") as coupler: # Upper arm demo.shallow.sinebend(distance=100, offset=-40).put(0, 50) demo.shallow.strt(length=20).put() demo.shallow.sinebend(distance=100, offset=40).put() # Lower arm demo.shallow.sinebend(distance=100, offset=40).put(0, -50) demo.shallow.strt(length=20).put() demo.shallow.sinebend(distance=100, offset=-40).put() # Add pins nd.Pin("a0").put(0, 50, 180) nd.Pin("a1").put(0, -50, 180) nd.Pin("b0").put(220, 50, 0) nd.Pin("b1").put(220, -50, 0) coupler.put(0, 0) coupler.put(0, -200, 10) nd.export_plt()
Xaveer
4 June 2019 at 07:35 #5547AleksandarKMemberThank you very much!
That solves my problems.
4 June 2019 at 10:43 #5548RonaldKeymasterTo make it more robust Xaveer’s example can be parametrized and pins can be set by reference:
import nazca as nd import nazca.demofab as demo def coupler(length=20, sep=100, gap=20): with nd.Cell("Coupler") as C: # Upper arm u1 = demo.shallow.sinebend(distance=100, offset=-0.5*(sep-gap)).put(0, 0.5*sep) demo.shallow.strt(length=length).put() u2 = demo.shallow.sinebend(distance=100, offset=0.5*(sep-gap)).put() # Lower arm l1 = demo.shallow.sinebend(distance=100, offset=0.5*(sep-gap)).put(0, -0.5*sep) demo.shallow.strt(length=length).put() l2 = demo.shallow.sinebend(distance=100, offset=-0.5*(sep-gap)).put() # Add pins nd.Pin("a0", pin=u1.pin['a0']).put() nd.Pin("a1", pin=l1.pin['a0']).put() nd.Pin("b0", pin=u2.pin['b0']).put() nd.Pin("b1", pin=l2.pin['b0']).put() return C coupler().put(0, 0) coupler(length=40, gap=5, sep=50).put(0, 100, 10) nd.export_plt()
Note that setting pins by reference can be done using the ‘pin’ keyword. This will automatically copy all pin properties to the new pin.
# p is pin nd.Pin("a0").put(p) # set the new pin at the position of p nd.Pin("a0", pin=p).put() # copy all properties of p and put it on the position of p
Ronald
5 June 2019 at 17:33 #5557AleksandarKMemberThank you Roland. That is helpful as well!
-
AuthorPosts
- You must be logged in to reply to this topic.