1 /* atlc - arbitrary transmission line calculator, for the analysis of
2 transmission lines are directional couplers.
4 Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB).
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.
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.
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,
21 Dr. David Kirkby, e-mail drkirkby at ntlworld.com
42 #include "exit_codes.h"
43 #include "definitions.h"
50 double aa, bb, cc, dd, hh, ww, DD, WW, HH, Er1, Er2;
51 int a, b, c, d, h, w, D, W, H;
54 int lowest=50, highest=100;
56 /* The following are only needed so that I can link in both
57 convert_create_bmp_for_circ_in_circ_dimensions_to_integers.c
58 and convert_create_bmp_for_rect_in_rect_dimensions_to_integers.c
62 int main(int argc, char **argv) /* Read parameters from command line here */
64 int bmp_size=DEFAULT_BMP_SIZE;
68 struct transmission_line_properties not_used;
70 filename=string(0,1010);
72 /* The following line just prevents a warning from the compiler (SGI's to
73 be precise). There is not reason to set W=1 */
76 while((q=get_options(argc,argv,"Cb:v")) != -1)
80 print_copyright((char *) "2002");
81 exit_with_msg_and_exit_code("",OKAY);
84 bmp_size=atol(my_optarg);
92 if(argc-my_optind == 5)
94 DD=atof(argv[my_optind]);
96 dd=atof(argv[my_optind+1]);
97 hh=atof(argv[my_optind+2]);
98 Er1=atof(argv[my_optind+3]);
100 exit_with_msg_and_exit_code("Error: The Inner conductor is larger than the outer conductor!!!", 1);
102 exit_with_msg_and_exit_code("Error: The inner and outer conductors are of the same size!!!", 1);
103 else if (dd/2 + hh >= DD/2)
104 exit_with_msg_and_exit_code("Error: The inner and outer conductors will touch!!!", 1);
105 filename=strncpy(filename, argv[my_optind+4],1000);
106 if( (image_data_fp=fopen(filename,"wb")) == NULL)
107 exit_with_msg_and_exit_code("Can't open file in create_bmp_for_circ_in_circ.c", CANT_OPEN_FOR_WRITING);
108 check_parameters_of_create_bmp_for_circ_in_circ();
109 convert_create_bmp_for_circ_in_circ_dimensions_to_integers(bmp_size);
110 write_bitmap(image_data_fp, not_used);
111 x=(double) (d*d+D*D-4*h*h)/(2*D*d);
112 Zo=59.9585*log(x+sqrt(x*x-1))/sqrt(Er1);
113 Zo=log(x+sqrt(x*x-1))/(1000*sqrt(EPSILON_0)*sqrt(Er1)*sqrt(10*M_PI));
117 printf("DD=%f dd=%f hh=%f x=%f\n",DD, dd, hh, x);
118 printf("D=%d d=%d h=%d x=%f\n",D, d, h, x);
119 printf("Zo is theoretically %f Ohms\n",Zo);
123 usage_create_bmp_for_circ_in_circ();
124 free_string(filename,0,1010);