SiEPIC / SiEPIC-Tools

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

DC source issue when do the interconnect simulation. #183

Open xxma94 opened 2 years ago

xxma94 commented 2 years ago

Hi In my SiEPIC-Tools 0.3.91, the code of find electrical IO pins: DCsources += "N" + str(Vn) + NetName + " dcsource amplitude=0 sch_x=%s sch_y=%s\n" % (-2-Vn/3., -2+Vn/8.) will raise an error in my interconnect (2022 R1), which is (1) Error loading netlist: the element 'dcsource' is not available in the library. The auto generated netlist will need an element called 'dcsource'. However, in lumerical the dc source is called 'DC Source'. When I manually change the 'dcsource' to 'DC Source' in netlist file (*.spi), the netlist works well.

jevillegasd commented 2 years ago

I am using 2021-R2.3 and I see the same specification for the DC Source name. I wonder on which version of Lumerical the source used the previous naming.

jevillegasd commented 2 years ago

Similar to this issue, currently spice_netlistexport replaces spaces in the names of components by '' characters. This is necessary because the spice netlist reading needs to see the whole string as a single parameter, and leaving spaces would just go to the next parameter, making the reading incorrect.

However netlist reading does support space characters, but to use them double quotes need to be added on the spice netlist text, for example: This is incorrect:

Ring_0 N$1 N$0 Optical Ring Modulator library="Modulators/Optical" length= 628.319u loss=11.262u "effective index"=2.253 "group index"=2.636 dispersion=400.000u

But this is correct:

Ring_0 N$1 N$0 "Optical Ring Modulator" library="Modulators/Optical" length= 628.319u loss=11.262u "effective index"=2.253 "group index"=2.636 "dispersion"=400.000u

Currently, if I include a component that wants to use said model (from the standard Interconnect Library), it would export the netlist as:

"Optical_Ring_Modulator"_0 N$1 N$0 "Optical_Ring_Modulator" library="Modulators/Optical" "length"= 628.319u "loss"=11.262u "effective index"=2.253 "group index"=2.636 "dispersion"=400.000u

This of course generates an error in the netlist importing because no such component exists. There is no workaround that I could find other than changing the spice_netlistexport method. The change would be small, but it might generate compatibility issues with components that currently rely on SiEPIC changing the space character in their name to a '' character.

What do you guys think??

lukasc-ubc commented 2 years ago

You make a good suggestion. To fix any issues, we would just need to check all the PDKs and make sure that they have the correct name and don’t count on the _ conversion.

jevillegasd commented 2 years ago

I made the change in #185 , and included get and set methods for SPICE params (the set method finds the text in the component and replaces it, the get is a wrapper of the existing get_parameter method)