home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1 / HamRadio.cdr / tech / eepub05 / spirlind.pas < prev    next >
Pascal/Delphi Source File  |  1987-03-18  |  5KB  |  132 lines

  1. Program SpirlInd;  {  Program to Calculate Inductance of Spirals   }
  2.  
  3.  
  4. var      No_turns            : integer; { Number of Turns in Spiral Inductor }
  5.          Ro                  : real;    { Beginning Inside Radius            }
  6.          Cond_Wid            : real;    { Width of Conductor of Inductor     }
  7.          Spac_Wid            : real;    { Space-Width of Inductor            }
  8.          Sum,Sum1            : real;
  9.          a,b,k1,k2,k3        : real;    { Arbitrary Variables for Calculations}
  10.          i,j,k               : integer; { Looping Parameters                 }
  11.          Mt                  : real;    { Mutual Inductance for n Loops      }
  12.          c                   : real;    { Distance Variable Used in Ext Ind C}
  13.          LSI                 : real;    { External Self Inductance           }
  14.          aR,bR               : real;    { Distance Variables in Ground Plane }
  15.          Sub_thick           : real;    { Substrate Thickness                }
  16.          Mr                  : real;    { Negative Mutual Inductance Due to  }
  17.                                         { Presence of Ground Plane           }
  18.          L_tot               : real;    { Total Inductance of Spiral Inductor}
  19.          Uo                  : real;
  20.          w1                  : real;
  21.  
  22. Function Elp1(X: real): real;  { Complete Elliptic Integral of First Kind  }
  23.  
  24. var      a0,a1,a2,a3,a4      : real;
  25.          b0,b1,b2,b3,b4      : real;
  26.          x1,x2,x3,x4         : real;
  27.          ab,ac               : real;
  28.  
  29. begin
  30.          X:=  1 - X;
  31.          a0:= 1.38629436112;   a1:= 0.09666344259;   a2:= 0.03590092383;
  32.          a3:= 0.03742563713; a4:= 0.01451196212;
  33.          b0:= 0.5;   b1:= 0.12498593597;   b2:= 0.06880248576;  b3:= 0.03328355346;
  34.          b4:= 0.00441787012;
  35.          x1:= X;
  36.          x2:= X*x1;
  37.          x3:= X*x2;
  38.          x4:= X*x3;
  39.          ab:= a0 + a1 * x1 + a2 * x2 + a3 * x3 + a4 * x4;
  40.          ac:= (b0+b1*x1+b2*x2+b3*x3+b4*x4)*Ln(1/x1);
  41.          ab:= ab + ac;
  42.          Elp1:= ab;
  43. end;
  44.  
  45. Function Elp2(X: real): real;  { Complete Elliptic Integral of Second Kind  }
  46.  
  47. var      a1,a2,a3,a4         : real;
  48.          b1,b2,b3,b4         : real;
  49.          x1,x2,x3,x4         : real;
  50.  
  51. begin
  52.     X:=  1 - X;
  53.     a1:= 0.44325141463;   a2:= 0.0626060122;   a3:= 0.04757383546;
  54.     a4:= 0.01736506451;
  55.     b1:= 0.2499836831;    b2:= 0.09200180037;  b3:= 0.04069697526;
  56.     b4:= 0.00526449639;
  57.     x1:= X;
  58.     x2:= X*x1;
  59.     x3:= X*x2;
  60.     x4:= X*x3;
  61.     Elp2:=1.0+a1*x1+a2*x2+a3*x3+a4*x4 + (b1*x1+b2*x2+b3*x3+b4*x4)*Ln(1/x1);
  62. end;
  63. begin
  64. clrscr;
  65. writeln;
  66. writeln('                         Enter All Dimensions in Mils ');
  67. writeln;
  68. write('           Enter Number of Spirals ');
  69. readln(No_turns);
  70. write('           Enter Beginning Inside Radius of Spiral,  Conductor Width ');
  71. readln(Ro,Cond_Wid);
  72. write('           Enter The Space Width Between Turns,  Substrate Thickness ');
  73. readln(Spac_Wid,Sub_thick);
  74. Ro:= Ro*0.0254/1000.0;
  75. Cond_Wid:= Cond_Wid*0.0254/1000.0;
  76. Spac_Wid:= Spac_Wid*0.0254/1000.0;
  77. Sub_thick:= Sub_thick*0.0254/1000.0;
  78. Uo:= 4*Pi*1.E-7;
  79. Sum1:= 0.0;            {  Calculation of Mutual Inductance for n Loops  }
  80. for k:= 1 to No_turns-1  do
  81.     begin
  82.     Sum:= 0.0;
  83.     a:= Ro + (k-0.5)*(Cond_Wid + Spac_Wid);
  84.     for j:= k+1 to No_turns do
  85.          begin
  86.          b:= Ro + (j-0.5)*(Cond_Wid + Spac_Wid);
  87.          k1:= sqrt(4*a*b)/(a+b);
  88.          Sum:= Sum + Uo*sqrt(a*b)*((2/k1-1)*Elp1(k1) - 2/k1*Elp2(k1));
  89.          end;
  90.     Sum1:= Sum1 + Sum;
  91.     end;
  92. Mt:= 2*Sum1;
  93. writeln;
  94. writeln('               Mutual Inductance = ',Mt);
  95. writeln;
  96.                           { Calculation of External Self Inductance       }
  97. w1:= Cond_Wid/2;
  98. Sum:= 0.0;
  99. for k:= 1 to No_turns do
  100.     begin
  101.     c:= Ro + (k-0.5)*(Cond_Wid + SPac_Wid);
  102.     k2:= sqrt(4*c*(c-w1))/(2*c-w1);
  103.     Sum:= Sum + Uo*(2*c-w1)*((1-k2*k2/2)*Elp1(k2) - Elp2(k2));
  104.     end;
  105. LSI:= Sum;
  106. writeln('               External Self-Inductance = ',LSI);
  107. writeln;
  108.                           {  Calculation of Ground Plane Effect           }
  109. Sum1:= 0.0;
  110. for i:= 1 to No_turns do
  111.     begin
  112.     Sum:= 0.0;
  113.     aR:= Ro + (i-0.5)*(Cond_Wid + Spac_Wid);
  114.     for j:= 1 to No_turns do
  115.          begin
  116.          bR:= Ro + (j-0.5)*(Cond_WId + Spac_Wid);
  117.          k3:= sqrt(4*aR*bR/(sqr(2*Sub_thick) + sqr(aR + bR)));
  118.          Sum:= Sum + Uo*sqrt(aR*bR)*((2/k3-1)*Elp1(k3) - 2/k3*Elp2(k3));
  119.          end;
  120.     Sum1:= Sum1 + Sum;
  121.     end;
  122. Mr:= Sum1;
  123. writeln('               Ground Plane Effect  = -',Mr);
  124. writeln;
  125. writeln;
  126. writeln('                    Spiral Inductor Calculation Results ');
  127. writeln;
  128. writeln;
  129. writeln;
  130. writeln('            Spiral Inductor w/Ground Plane =   ',Mt+LSI-Mr);
  131. end.
  132.