2 atlc - arbitrary transmission line calculator, for the analysis of
3 transmission lines are directional couplers.
5 Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB).
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either package_version 2
10 of the License, or (at your option) any later package_version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 Dr. David Kirkby, e-mail drkirkby at ntlworld.com
27 /* coax finds the properties of a standard coaxial cable - useful as a test for atlc */
43 #define MU_0 4*M_PI*1e-7
44 #define EPSILON_0 8.854187817e-12 /* Data taken from NPL */
48 #define PI 3.141592653589793238462643383279502884197169399375105
52 extern char *my_optarg;
54 int get_options(int argc, char **argv, const char *opts);
58 int main (int argc, char **argv)
60 double d, D, er, zo, x;
65 while((q=get_options(argc,argv,"O:")) != -1)
68 offset=atof(my_optarg);
74 if(argc-my_optind != 3)
76 d=atof(argv[my_optind]);
77 D=atof(argv[my_optind+1]);
78 er=atof(argv[my_optind+2]);
80 fprintf(stderr,"Sorry, the diameter of the inner conductor (d) must be\n");
81 fprintf(stderr,"less than the inner diameter of the outer conductor (D)\n");
85 fprintf(stderr,"Sorry, the permittivity of the dielectric Er must be >=1");
88 if(D/2.0 <= d/2 + offset){
89 fprintf(stderr,"The offset between the inner and outer conductors is too large; the\n");
90 fprintf(stderr,"inner and outer conductors will touch!!\n");
94 x=(double) (d*d+D*D-4*offset*offset)/(2*D*d);
95 zo=(1/(2*PI))*sqrt(MU_0)*log(x+sqrt(x*x-1))/sqrt(EPSILON_0*er);
96 printf("Zo = %16f Ohms\n", zo);