1 #ifdef HAVE_STDLIB_H
2 #include <stdlib.h>
3 #endif
4 #include <stdio.h>
5 #include <math.h>
6 #include <string.h>
7 #include <ctype.h>
8 #include "yagi.h"
9 
10 extern struct performance_data max;
11 
optimising_for(struct flags flag)12 void optimising_for(struct flags flag)
13 {
14 	int choice;
15 	if(flag.gflg)
16 	{
17 		printf("Will optimise using a genetic algorithm\n");
18 		choice=flag.gflg;
19 	}
20 	else if(flag.Wflg)
21 	{
22 		printf("Will optimise using a weighted combination of parameters\n");
23 		choice=flag.Wflg;
24 	}
25 	else if(flag.wflg)
26 	{
27 		printf("Will optimise over a wide band\n");
28 		choice=flag.wflg;
29 	}
30 	else
31 	{
32 		printf("Will optimise insisting all selected parameters improve.\n");
33 		choice=flag.oflg;
34 	}
35 	if((choice&GAIN)==GAIN)
36 		printf("Optimising for maximum possible gain.\n");
37 	if((choice&FB)==FB && (choice&REASONABLE)==0)
38 		printf("Optimising for maximum possible FB ratio.\n");
39 	if((choice&FB)==FB && (choice&REASONABLE)==REASONABLE)
40 		printf("Optimising for FB ratio to a maximum of %.3fdB.\n",max.fb);
41 	if((choice&RESISTANCE)==RESISTANCE && (choice&REASONABLE)==0)
42 		printf("Optimising for an input resistance as close as possible to Z0.\n");
43 	if((choice&RESISTANCE)==RESISTANCE && (choice&REASONABLE)==REASONABLE)
44 		printf("Optimising for an input resistance of Z0 +/- %.3f Ohms\n",max.r);
45 	if((choice&REACTANCE)==REACTANCE && (choice&REASONABLE)==0)
46 		printf("Optimising for an input reactance as close as possible to zero.\n");
47 	if((choice&REACTANCE)==REACTANCE && (choice&REASONABLE)==REASONABLE)
48 		printf("Optimising for an input reactance of 0 +/- %.3f Ohms\n",max.x);
49 	if((choice&VSWR)==VSWR && (choice&REASONABLE)==REASONABLE)
50 		printf("Optimising for an input VSWR of less than %.3f:1\n",max.swr);
51 
52 	if((choice&VSWR)==VSWR && (choice&REASONABLE)==0)
53 		printf("Optimising for an input VSWR as low as possible\n");
54 
55 	if((choice&SIDE_LOBE_LEVEL)==SIDE_LOBE_LEVEL && (choice&REASONABLE)==0)
56 		printf("Optimising for the most significant side to be as small as possible.\n");
57 	if((choice&SIDE_LOBE_LEVEL)==SIDE_LOBE_LEVEL && (choice&REASONABLE)==REASONABLE)
58 		printf("Optimising for the most significant sidelobe to be at least %.3f dB down\n",max.sidelobe);
59 }
60 
61