Skip to content

Commit

Permalink
Added Scrollerbar Function
Browse files Browse the repository at this point in the history
  • Loading branch information
minjiechen committed Oct 29, 2014
1 parent 8448be7 commit bed683d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 47 deletions.
11 changes: 0 additions & 11 deletions error.log
Original file line number Diff line number Diff line change
@@ -1,11 +0,0 @@
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1473, in __call__
return self.func(*args)
File "gui.py", line 472, in generate_netlist_errors
self.generate_netlist()
File "gui.py", line 349, in generate_netlist
self.getImpe()
File "gui.py", line 305, in getImpe
A=cmath.exp(-Psi*h[i1])
TypeError: 'int' object has no attribute '__getitem__'
17 changes: 17 additions & 0 deletions file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sigma = 5.8e7
c = 2.5e-3
gt = 1e-3
Ae = 548.1e-6
lindex = [1,2,2,1]
mur = 1500
nwinding = 2
h = [0.0175e-3,0.0175e-3,0.0175e-3,0.0175e-3]
f = 10e6
m = [1,1,1,1]
nc = 1
s = [1.353e-3,0.787e-3,0.14e-3,0.787e-3,1.353e-3]
le = 240e-3
wstyle = [0,1]
gb = 2e-3
w = [5e-3,5e-3,5e-3,5e-3]
nlayer = 4
66 changes: 30 additions & 36 deletions gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self,root):
self.root=root
Frame.__init__(self,self.root)

self.root.title('Planar Magnetics Analyzing System (PMAS)')
self.root.title('Planar Magnetics Analyzing Tool (PLAMAT)')


self.file_opt=options={}
Expand Down Expand Up @@ -156,23 +156,21 @@ def checkgeom(self):
nlayer=int(self.nlayer.get())

if nwinding!= max(literal_eval(self.lindex.get())):
tkMessageBox.showerror(message='Error: nwinding mismatch with lindex. Please retry.')
tkMessageBox.showerror(message='nwinding mismatch with lindex, please retry')
elif nwinding!= len(literal_eval(self.wstyle.get())):
tkMessageBox.showerror(message='Error: nwinding mismatch with wstyle. Please retry.')
tkMessageBox.showerror(message='nwinding mismatch with wstyle, please retry')
elif nlayer!=len(literal_eval(self.h.get())):
tkMessageBox.showerror(message='Error: nlayer mismatch with h. Please retry.')
tkMessageBox.showerror(message='nlayer mismatch with h, please retry')
elif nlayer!=(len(literal_eval(self.s.get()))-1):
tkMessageBox.showerror(message='Error: nlayer mismatch with s. Please retry.')
tkMessageBox.showerror(message='nlayer mismatch with s, please retry')
elif nlayer!=len(literal_eval(self.w.get())):
tkMessageBox.showerror(message='Error: nlayer mismatch with w. Please retry.')
tkMessageBox.show(message='nlayer mismatch with w, please retry')
elif nlayer!=len(literal_eval(self.lindex.get())):
tkMessageBox.showerror(message='Error: nlayer mismatch with lindex. Please retry.')
tkMessageBox.showerror(message='nlayer mismatch with lindex, please retry')
elif nlayer!=len(literal_eval(self.m.get())):
tkMessageBox.showerror(message='Error: nlayer mismatch with m. Please retry.')
elif max(literal_eval(self.wstyle.get()))>1:
tkMessageBox.showerror(message='Error: winding style can only be 0=series or 1=parallel. Please retry.')
tkMessageBox.showerror(message='nlayer mismatch with m, please retry')
else:
tkMessageBox.showinfo(message='Geometry format is correct! Please continue.')
tkMessageBox.showinfo(message='Geometry format is correct, please continue')


def printlabels(self):
Expand Down Expand Up @@ -376,7 +374,7 @@ def generate_netlist(self):
for index_layer in range(NumofLayer):
if WindingIndex[index_layer]==index_winding+1:
f.write('\n* --> Includes Layer {}'.format(index_layer+1))
f.write('\n* ---> thickness {:4.2f}mm, width {:4.2f}mm, {} turns, spacing above {:4.2f}mm, spacing below {:4.2f}mm'.format(h[index_layer]*1e3, w[index_layer]*1e3, m[index_layer], s[index_layer]*1e3, s[index_layer+1]*1e3))
f.write('\n* ---> thickness {}, width {}, turns {}, spacing above {:4.2f}m, spacing below {:4.2f}m'.format(h[index_layer], w[index_layer], m[index_layer], s[index_layer]*1e3, s[index_layer+1]*1e3))
totalturn=totalturn+m[index_layer]
f.write('\n* -> Winding {0} has {1} total turns; \n* --> External Port Name: PortP{0}, PortN{0}'.format(index_winding+1, totalturn))

Expand All @@ -389,7 +387,7 @@ def generate_netlist(self):
for index_layer in range(NumofLayer):
if WindingIndex[index_layer]==index_winding+1:
f.write('\n* --> Includes Layer {}'.format(index_layer+1))
f.write('\n* ---> thickness {:4.2f}mm, width {:4.2f}mm, {} turns, spacing above {:4.2f}mm, spacing below {:4.2f}mm'.format(h[index_layer]*1e3, w[index_layer]*1e3, m[index_layer], s[index_layer]*1e3, s[index_layer+1]*1e3))
f.write('\n* ---> thickness {}, width {}, turns {}, spacing above {:4.2f}m, spacing below {:4.2f}m'.format(h[index_layer], w[index_layer], m[index_layer], s[index_layer]*1e3, s[index_layer+1]*1e3))
numSeriesLayers+=1
totalturn=totalturn+m[index_layer]
f.write('\n* -> Winding {0} has {1} total turns; \n* --> External Port Name: PortP{0}, PortN{0}'.format(index_winding+1, totalturn))
Expand All @@ -409,23 +407,23 @@ def generate_netlist(self):
ls=self.Ls[index]
mx=m[index]

f.write('\n\n*NetList for Layer {}'.format(index+1))
f.write('\nLe{0} N{0} P{0} {1}'.format(index,mx**2))
f.write('\nLi{0} G Md{0} {1}'.format(index,1))
f.write('\nLg{0} Mg{0} Md{0} {1:14.2f}p'.format(index,lb*1e12))
f.write('\nRg{0} Mc{0} Mg{0} {1:14.2f}m'.format(index,rb*1e3))
f.write('\nRt{0} Mc{0} Mt{0} {1:14.2f}u'.format(index,ra*1e6))
f.write('\nRb{0} Mb{0} Mc{0} {1:14.2f}u'.format(index,ra*1e6))
f.write('\nLt{0} T{0} Mt{0} {1:14.2f}p'.format(index,la*1e12))
f.write('\nLb{0} Mb{0} B{0} {1:14.2f}p'.format(index,la*1e12))
f.write('\nLs{0} B{0} T{1} {2:14.2f}n'.format(index,index+1,ls*1e9))
f.write('\nK{0} Le{0} Li{0} 1'.format(index))
f.write('\n\n*NetList for Layer {}'.format(index+1))
f.write('\nLe{0} N{0} P{0} {1}'.format(index,mx**2))
f.write('\nLi{0} G Md{0} {1}'.format(index,1))
f.write('\nLg{0} Mg{0} Md{0} {1:14.2f}p'.format(index,lb*1e12))
f.write('\nRg{0} Mc{0} Mg{0} {1:14.2f}m'.format(index,rb*1e3))
f.write('\nRt{0} Mc{0} Mt{0} {1:14.2f}u'.format(index,ra*1e6))
f.write('\nRb{0} Mb{0} Mc{0} {1:14.2f}u'.format(index,ra*1e6))
f.write('\nLt{0} T{0} Mt{0} {1:14.2f}p'.format(index,la*1e12))
f.write('\nLb{0} Mb{0} B{0} {1:14.2f}p'.format(index,la*1e12))
f.write('\nLs{0} B{0} T{1} {2:14.2f}n'.format(index,index+1,ls*1e9))
f.write('\nK{0} Le{0} Li{0} 1'.format(index))

#Print the ferrite cores and top spacing
f.write('\n\n*NetList for Top and Bottom Ferrites, as well as the First Spacing on Top Side')
f.write('\nLft T0 G {:14.2f}u'.format(self.Lft*1e6))
f.write('\nLfb T{} G {:14.2f}u'.format(NumofLayer+1,self.Lfb*1e6))
f.write('\nLs0 T1 T0 {:14.2f}n'.format(self.Lts*1e9))
f.write('\nLft T0 G {:14.2f}u'.format(self.Lft*1e6))
f.write('\nLfb T{} G {:14.2f}u'.format(NumofLayer+1,self.Lfb*1e6))
f.write('\nLs0 T1 T0 {:14.2f}n'.format(self.Lts*1e9))

#Print the external connections
f.write('\n\n*NetList for Winding Interconnects')
Expand All @@ -439,8 +437,8 @@ def generate_netlist(self):
for index_layer in range(NumofLayer):
if WindingIndex[index_layer]==index_winding+1:
f.write('\n* -->Include layer {}'.format(index_layer+1))
f.write('\nRexP{0} PortP{1} P{0} 1n'.format(index_layer+1,index_winding+1))
f.write('\nRexN{0} PortN{1} N{0} 1n'.format(index_layer+1,index_winding+1))
f.write('\nRexP{0} PortP{1} P{0} 1n'.format(index_layer+1,index_winding+1))
f.write('\nRexN{0} PortN{1} N{0} 1n'.format(index_layer+1,index_winding+1))


#Series Connected
Expand All @@ -455,11 +453,11 @@ def generate_netlist(self):
Serieslayers[numSeriesLayers]=index_layer+1
numSeriesLayers+=1
#defining two wires from external port to the front and end layers
f.write('\nRexP{0} PortP{1} P{0} 1n'.format(Serieslayers[1],index_winding+1))
f.write('\nRexN{0} PortN{1} N{0} 1n'.format(Serieslayers[numSeriesLayers-1],index_winding+1))
f.write('\nRexP{0} PortP{1} P{0} 1n'.format(Serieslayers[1],index_winding+1))
f.write('\nRexN{0} PortN{1} N{0} 1n'.format(Serieslayers[numSeriesLayers-1],index_winding+1))
#defining the interconnects among series connected layers
for index_SeriesLayers in range(numSeriesLayers-2):
f.write('\nRexM{0} N{0} P{1} 1n'.format(Serieslayers[index_SeriesLayers+1],Serieslayers[index_SeriesLayers+2]))
f.write('\nRexM{0} N{0} P{1} 1n'.format(Serieslayers[index_SeriesLayers+1],Serieslayers[index_SeriesLayers+2]))



Expand All @@ -468,9 +466,6 @@ def generate_netlist(self):
f.write('\n***** Netlist Ends ********')
f.write('\n******************************************************************')
f.close()
<<<<<<< HEAD
tkMessageBox.showinfo(message='Successfully Generated Netlist!')
=======
tkMessageBox.showinfo(message='Successfully Generated Netlist')

def generate_netlist_errors(self):
Expand All @@ -497,7 +492,6 @@ def __init__(self, root):
self.canvas.pack(side="top", fill="both", expand=True)
self.canvas.create_window((6,6), window=self.frame, anchor="nw",
tags="self.frame")
>>>>>>> upstream/master

self.frame.bind("<Configure>", self.OnFrameConfigure)

Expand Down

0 comments on commit bed683d

Please sign in to comment.