Imported Upstream version 4.6.0
[debian/atlc] / src / non_gui / calculate_impedance_for_create_bmp_for_symmetrical_stripline.c
1 /* atlc - arbitrary transmission line calculator, for the analysis of
2 transmission lines are directional couplers. 
3
4 Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB).
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either package_version 2
9 of the License, or (at your option) any later package_version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
19 USA.
20
21 Dr. David Kirkby, e-mail drkirkby at ntlworld.com 
22
23 */
24
25 /* This routine calaculates the impedance exaclty for the case of two
26 infinity wide conductors sepparated a distance H, with between them
27 placed centrally a conductor of width w and infinitely thin. 
28
29 i.e.
30 ******^***********************************************************************
31       |
32       |
33       H                    ----------w----------
34       |
35       |
36 ******Vij***********************************************************************
37
38 It uses the method given in "Filed Theory of Guided Waves, Colen R.E.,
39 2nd edition, pp 259-273, IEEE Press, (1990). */
40
41 #include "config.h"
42
43
44 #ifdef HAVE_MATH_H
45 #include <math.h>
46 #endif
47
48 #include "definitions.h"
49 #include "exit_codes.h"
50
51 extern int verbose;
52
53 double calculate_symmetrical_stripline_impedance(int H, int w)
54 {
55   double Zo;
56   double mu=4*M_PI*1e-7, x0, v0,  c, l, k;
57   x0=pow(cosh(M_PI*w/(2.0*H)),2.0);
58   if (verbose >=2)
59     printf("w=%d H=%d w/H=%f xo=%g\n",w,H,(double)w/H,x0);
60   if((double) w / (double) H > 226.369458)
61     exit_with_msg_and_exit_code("Bitmap is written fine, but can't compute impedance", THE_WIDTH_w_DIVIDED_BY_THE_HEIGHT_H_IS_TOO_LARGE);
62   k=1.0/sqrt(x0);
63   v0=K_over_Kdash(k);
64   c=4*EPSILON_0/v0;
65   l=mu*EPSILON_0/c;
66   Zo=sqrt(l/c);
67   return(Zo);
68 }
69
70