def main(): Load_sim_number = 1 wg = waveguide() frequency_vector = [] nValues = 10 values = np.linspace(0,.0003,nValues) for i in range(nValues): wg = waveguide() x = values[i] wg.set_scalez(x) wg.compute_LCVI() wg.save(Load_sim_number) #wg.load(Load_sim_number) #wg.plot() modes = wg.eigenmodes[0][0:2] sim_wg = simulated_wg(Load_sim_number) #sim_wg.test_interpolate() sim_wg.build_L_mat() sim_wg.build_C_mat() freq = sim_wg.get_frequencies()[1:3]/10**9 print "Simulated Frequencies:", freq print "HFSS Frequencies:", modes diff = (freq-modes)/freq print "Difference:", diff frequency_vector.append(freq) hfss.release() print frequency_vector np.save("../data/frequencyvector", frequency_vector) plt.plot(values, frequency_vector) plt.show()
def main(): Load_sim_number = 1 wg = waveguide() frequency_vector = [] nValues = 10 values = np.linspace(0, .0003, nValues) for i in range(nValues): wg = waveguide() x = values[i] wg.set_scalez(x) wg.compute_LCVI() wg.save(Load_sim_number) #wg.load(Load_sim_number) #wg.plot() modes = wg.eigenmodes[0][0:2] sim_wg = simulated_wg(Load_sim_number) #sim_wg.test_interpolate() sim_wg.build_L_mat() sim_wg.build_C_mat() freq = sim_wg.get_frequencies()[1:3] / 10**9 print "Simulated Frequencies:", freq print "HFSS Frequencies:", modes diff = (freq - modes) / freq print "Difference:", diff frequency_vector.append(freq) hfss.release() print frequency_vector np.save("../data/frequencyvector", frequency_vector) plt.plot(values, frequency_vector) plt.show()
def main(): wg = waveguide() wg.compute_LCVI() print wg.inductance wg.save() wg.load() print wg.inductance wg.plot() hfss.release()
def optimize_scalez(): print "optimize scalez" Load_sim_number = 1 wg = waveguide() frequency_vector = [] nValues = 11 values = np.linspace(0.0000,.0005,nValues) scale_x = 0.0005 wg.set_scalex(scale_x) for i in range(nValues): wg = waveguide() z = values[i] wg.set_scalez(z) wg.compute_LCVI() #wg.load(Load_sim_number) wg.plot() wg.save(Load_sim_number) # #wg.plot() modes = wg.eigenmodes[0][0:2] sim_wg = simulated_wg(Load_sim_number) #sim_wg.test_interpolate() sim_wg.build_L_mat(verbose = True) sim_wg.build_C_mat(verbose = True) freq_tmp = sim_wg.get_frequencies() if (freq_tmp[0] > 3*(10**9)): freq = freq_tmp[0:2]/10**9 print freq_tmp[0] print "0:2" else: freq = freq_tmp[1:3]/10**9 print"1:3" #print freq_tmp print "scalex", scale_x print "scalez (opt)", z print "Eigenmode Frequencies:", freq print "HFSS Frequencies:", modes diff = (freq-modes)/freq print "Difference:", diff frequency_vector.append(diff) hfss.release() print "optimize scalez" print values print frequency_vector np.save("../data/frequencyvector", frequency_vector) plt.plot(values, frequency_vector) plt.show()
def One_Trial(): print "One Trial" Load_sim_number = 1 wg = waveguide() frequency_vector = [] scale_x = 0.0005 wg.set_scalex(scale_x) z = 0.00004 wg.set_scalez(z) wg = waveguide(angle_n = 100) wg.compute_LCVI(cap_surf = "CrossSecIntSurf", ind_surf = "CrossSecIntSurf1") #wg.load(Load_sim_number) #wg.plot() wg.save(Load_sim_number) # #wg.plot() modes = wg.eigenmodes[0][0:2] sim_wg = simulated_wg(Load_sim_number) #sim_wg.test_interpolate() #GET LC VALUES and BUILD MATRIX sim_wg.build_L_mat(verbose = True) sim_wg.build_C_mat(verbose = True) freq_tmp = sim_wg.get_frequencies() hfss.release() #Get best values if (freq_tmp[0] > 3*(10**9)): freq = freq_tmp[0:2]/10**9 print freq_tmp[0] print "0:2" else: freq = freq_tmp[1:3]/10**9 print"1:3" #Display Results print freq_tmp # print all HFSS Frequencies print "scalex", scale_x print "scalez (opt)", z print "Eigenmode Frequencies:", freq print "HFSS Frequencies:", modes diff = (freq-modes)/freq print "Difference:", diff frequency_vector.append(diff) np.save("../data/frequencyvector", freq_tmp)
def main(): Load_sim_number = 1 wg = waveguide(angle_n = 20) wg.compute_LCVI() wg.save(Load_sim_number) wg.load(Load_sim_number) wg.plot() modes = wg.eigenmodes[0][0:2] sim_wg = simulated_wg(Load_sim_number) sim_wg.test_interpolate() sim_wg.build_L_mat(verbose=True) sim_wg.build_C_mat(verbose=True) freq = sim_wg.get_frequencies()[1:3]/10**9 print "Simulated Frequencies:", freq print "HFSS Frequencies:", modes diff = (freq-modes)/freq print "Difference:", diff hfss.release()