Attachment 'roh1.py'

Download

   1 #!/usr/bin/python
   2 # Uloha ROH1
   3 # Vytvoril Radek Podgorny <radek@podgorny.cz>
   4 # Tohle je fakt prasarna, ale snad to pomuze. Teoreticky funguje pro vsechny uhly...
   5 
   6 from math import *
   7 
   8 Eps0 = 8.854187817 * 10**-12
   9 
  10 points = []
  11 # Tady zadej svoje parametry
  12 points.append((263.145, 134.0, 1));
  13 points.append((493.62, 197.158, -1));
  14 alpha= 1.0472
  15 tau = 0.00265628
  16 Epsr = 27.6
  17 r = 0.00467
  18 
  19 
  20 # Dopocitat dalsi body
  21 num = int(round(2*pi/alpha));
  22 
  23 
  24 def mirror():
  25 	r1 = (points[0][0]**2 + points[0][1]**2)**0.5
  26 	r2 = (points[1][0]**2 + points[1][1]**2)**0.5
  27 	ang1 = atan(points[0][1]/points[0][0])
  28 	ang2 = atan(points[1][1]/points[1][0])
  29 
  30 	for i in range(2,num+1,2):
  31 		points.append((cos(i*alpha-ang1)*r1, sin(i*alpha-ang1)*r1, -points[0][2]))
  32 		points.append((cos(i*alpha-ang2)*r2, sin(i*alpha-ang2)*r2, -points[1][2]))
  33 
  34 		points.append((cos(i*alpha+ang1)*r1, sin(i*alpha+ang1)*r1, points[0][2]))
  35 		points.append((cos(i*alpha+ang2)*r2, sin(i*alpha+ang2)*r2, points[1][2]))
  36 
  37 	del points[num*2]
  38 	del points[num*2]
  39 
  40 def dist(a, b):
  41 	return ((b[0]-a[0])**2 + (b[1]-a[1])**2)**0.5
  42 
  43 
  44 def fi(c):
  45 	fic = 0.0
  46 	for i in range(num*2):
  47 		if (dist(points[i], c) > r):
  48 			fic += -(tau*points[i][2])/(2*pi*Eps0*Epsr) * log(dist(points[i], c))
  49 		else:
  50 			fic += -(tau*points[i][2])/(2*pi*Eps0*Epsr) * log(r)
  51 	return fic
  52 
  53 def Ey(c):
  54 	Ey = 0.0
  55 	for i in range(num*2):
  56 		if (dist(points[i], c) >= r):
  57 			E = (tau*points[i][2])/(2*pi*Eps0*Epsr*dist(points[i], c))
  58 			p = (c[1]-points[i][1])/dist(c, points[i])
  59 			Ey += E*p
  60 	return Ey
  61 
  62 
  63 mirror()
  64 
  65 c = ((points[0][0]+points[1][0])/2, (points[0][1]+points[1][1])/2)
  66 print("Potencial mezi A a B je " + str(fi(c)))
  67 
  68 C = tau/(fi(points[0])-fi(points[1]))
  69 print("Kapacita 1m vedeni AB je " + str(C))
  70 
  71 print("Potencial bodu A je " + str(fi(points[0])))
  72 
  73 print("Napeti mezi A a B je " + str(fi(points[0])-fi(points[1])))
  74 
  75 E = tau/(2*pi*Eps0*Epsr*r)
  76 print("Maximalni intenzita je " + str(E))
  77 
  78 F = tau*Ey(points[0])
  79 print("Sile na 1m vodice A ve smeru y je " + str(F))
  80 
  81 for i in range(num*2-2):
  82 	del points[2]
  83 points[1] = (points[1][0], points[1][1], 0)
  84 mirror()
  85 C = tau/fi(points[0])
  86 print("Kapacita 1m vedeni A (vzhledem k deskam) je " + str(C))

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2004-10-02 15:36:47, 1.1 KB) [[attachment:coul1.py]]
  • [get | view] (2004-10-02 15:36:48, 1.0 KB) [[attachment:koax1.py]]
  • [get | view] (2004-10-02 15:36:48, 1.2 KB) [[attachment:magn1.py]]
  • [get | view] (2004-10-02 15:36:48, 2.1 KB) [[attachment:roh1.py]]
  • [get | view] (2004-10-02 15:36:48, 0.8 KB) [[attachment:vlna1.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.