-
Notifications
You must be signed in to change notification settings - Fork 19
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
Incosistent Results for same circuit #43
Comments
Hi, I've started looking into this. I havent figured out yet why your results are different from interconnect, but the reason why you have different results between two different simulations in SAX is pretty obvious: your netlists are not equivalent. This becomes clear when you visualize them: the one on the left (your second example) has crossing links while the one on the right (your first example) has not. This would not be an issue if the couplings in the couplers are the same, but they are not. |
Apologies for the confusion in my earlier code submission; you were right that the connections were incorrect. I've updated the code and corrected the layout, but the results still aren't consistent. Here's the revised function: def cascaded_amzi_generator(n, backend="klu"):
netlist = {
"instances": {},
"connections": {},
"ports": {},
}
models = {
"coupler": coupler,
"waveguide": waveguide,
}
# Loop values to build network
for i in range(1, n + 1):
# Define instance names and initialize
coupler_name = f"coupler_{i}"
top_name = f"top_{i}"
btm_name = f"btm_{i}"
netlist["instances"][coupler_name] = "coupler"
netlist["instances"][top_name] = "waveguide"
netlist["instances"][btm_name] = "waveguide"
# Interstage connections
netlist["connections"][f"{coupler_name},out1"] = f"{btm_name},in0"
netlist["connections"][f"{coupler_name},out0"] = f"{top_name},in0"
# Connections between stages
if i > 1:
netlist["connections"][f"btm_{i-1},out0"] = f"{coupler_name},in1"
netlist["connections"][f"top_{i-1},out0"] = f"{coupler_name},in0"
netlist["instances"]["final"] = "coupler"
netlist["connections"][f"{top_name},out0"] = "final,in0"
netlist["connections"][f"{btm_name},out0"] = "final,in1"
# External ports
netlist["ports"]["in0"] = "coupler_1,in0"
netlist["ports"]["in1"] = "coupler_1,in1"
netlist["ports"]["out0"] = "final,out0"
netlist["ports"]["out1"] = "final,out1"
# Map for figures
map=netlist["connections"] | netlist["ports"]
# Create the circuit
mzi_ideal, info = sax.circuit(netlist=netlist, models=models, backend=backend)
return mzi_ideal, info,map with the parameters: wli=1.5493214338870651
wlf=1.555747057602491
wavelengths = np.linspace(wli, wlf, 100_000)
n = 2
params = {"wl": wavelengths}
dc_array=np.array([0.066393494773,0.7499093045])
wg_array=np.array([619.9997725,309.9998863])
for i in range(1, n + 1):
params[f"coupler_{i}"] = {"coupling": dc_array[i-1]}
params[f"top_{i}"] = {"length": wg_array[i-1]}
params[f"btm_{i}"] = {"length": 0} I believe this layout is equivalent to the intended design. The INTERCONNECT file I was using is the one from here: Additionally, I haven't yet figured out how to handle visualization with SAX, and I haven't found much documentation on it. If there are any resources or examples you can point me to, I'd be very grateful. |
Hello, I'm currently trying to simulate a circuit. Initially, I was attempting to recreate results I got with another software, ANSYS INTERCONNECT, on an optical filter. The results were expected to be as follows:
However, on attempting to recreate the circuit in SAX, I got varying results, even across two files that represent the same circuit.
Note that I have already confirmed the waveguide/coupler modelling is equivalent to ITNERCONNECT, So that is not the issue. Here are the scripts for each:
First plot
Plot 2:
The text was updated successfully, but these errors were encountered: