


OPTIMISE(1)              USER COMMANDS                OPTIMISE(1)



NAME
     optimise - YagiUda project antenna optimiser

SYNOPSIS
     optimise [ -Wchvdgw ] [ -fFBratio ] [ -bboom_extension  ]  [
     -rresistance  ]  [  -sswr  ]  [  -xreactance  ]  [  -ZZo ] [
     -Cweight_combined ] [ -Fweight_FB  ]  [  -Gweight_gain  ]  [
     -Sweight_swr   ]   [   -lpercent   ]   [   -eelements   ]  [
     -ooptimisation_criteria    ]    [    -ppopulation    ]     [
     -tlength_tolerance   ]  [  -Tposition_tolerance  ]  filename
     iterations

DESCRIPTION
     The program optimise is one of a number of  executable  pro-
     grams  that  forms  part  of a set of programs, collectively
     known as the Yagi-Uda project  ,  which  were  designed  for
     analysis  and  optimisation  of  YagiUda  antennas. optimise
     attempts to optimise the performance of a Yagi  antenna  for
     one  or  more parameters that are considered important, such
     as gain, F/B ratio, VSWR  etc.  It  does  this  by  randomly
     changing the lengths and positions, of one or more elements,
     then comparing the performance before and after the  change.
     Any   improvements   are   written  to  a  new  file  called
     filename.bes where filename  is  the  name  of  the  antenna
     description file created by input or first

     When Yagi's are designed on paper, or  using  this  program,
     its  possible  that they will be almost impossible to build,
     if their performance depends too critically  on  the  dimen-
     sions.  To  determine  if this is the case with a design, we
     run optimise with  just  the  options  't'  and  'T'.  These
     specify  the tolerance with which you can build the antenna,
     expressed as a standard  deviation  in  mm.  In  this  case,
     instead  of  trying to optimise a poor design, optimise will
     calculate the minimum gain, maximum  vswr,  and  minimum  FB
     ratio  of  a  number of designs, all slightly different from
     the input file. 99.7% of the components lie within 3  SD  of
     the  mean,  so if you think you can cut elements to with 1mm
     99.7% of the time, specify t0.33. If you can put them in the
     boom to within 3mm 99.7% of the time, specify T1.

OPTIONS
     -d   Print the  default  values  of  all  the  configureable
          parameters  to  stdout.  Typing  this  option  with any
          option  that  changes  a  parameter  (see  below)  will
          display the new value of the parameter, rather than the
          default.

     -h   Print a help message.

     -v   Print verbose status information.




version 1.06        Last change: 29 Oct 1994                    1






OPTIMISE(1)              USER COMMANDS                OPTIMISE(1)



     -w   Instead of  optimising  at  one  fixed  frequency  (the
          design frequency), this directs the program to optimise
          at 3 separate frequencies (lowest, design and  highest)
          then  to  average  data at all 3. This option is better
          for wideband antenna. Note  that  the  input  impedance
          printed is at the design frequency, *not* averaged over
          3 frequencies. Averaging an  impedance,  is  likely  to
          give  a very misleading impression. The impedance aver-
          aged over 3 frequencies can be 50+i0 Ohms, even if  the
          vswr  is  very poor over all 3 frequencies, as the fol-
          lowing 3 pieces of data show.

          Z=147 + i 300  VSWR=

          Z=2   + i 100  VSWR=

          Z=1   - i 400  VSWR=


     -g   Use a genetic algorithm. With  the  genetic  algorithm,
          the  program  does not take any account any of the ini-
          tial lengths/positions of  elements  specified  in  the
          input file. Rather it works by initialising a number of
          different antenna, then computing a 'fitness' value for
          each.  The better the gain, FB and vswr, the higher the
          fitness value. Antennas with a high fitness  value  are
          more likely to breed and make even better designs.

     -W   Try to get an antenna which is better  according  to  a
          weighted  combination of two or more parameters, rather
          than require them all to  improve.  Using  the  genetic
          algorithm   ('-g'  option),  always  uses  this  option
          without you specifying  it,  since  genetic  algorithms
          need  a  'fitness'  factor. By default, equal weight is
          placed on gain, FB ratio and SWR.

     -c   This option, which can only be used with either the  '-
          W'  or  '-g' options, tells the optimiser to use a fit-
          ness factor, in which rather than using  3  parameters,
          it  uses  just FB ratio and a combined gain/SWR parame-
          ter. The combined parameter increases in proportion  to
          the  amount of power radiated in the forward direction.
          If gain increases, but swr does too, the program deter-
          mines  if  the increase in gain will compensate for the
          fact   that  more  power  is  reflected   towards   the
          transmitter.

          So for example, consider the following  two  variations
          of the same antenna.

          Gain(dBi)  FB(dB)  SWR




version 1.06        Last change: 29 Oct 1994                    2






OPTIMISE(1)              USER COMMANDS                OPTIMISE(1)



          10.00      30.00   1.5:1 (means   5%  reflected  power)
          11.10      30.00   3.0:1 (means 25% reflected power)

          The top set of data is assumed to be equivalent to 9.5W
          put  into a perfectly matched isotropic antenna. Since:
          10dB is a factor of 10, 5% reflected is  95%  transmit-
          ted, and 10*0.95 = 9.5.

          The bottom set of data is assumed to be  equivalent  to
          9.66W  put  into a perfectly matched isotropic antenna.
          Since: 11.1dB is a factor of 12.88,  25%  reflected  is
          75% transmitted power and 12.88*.75=9.66W.

          Hence  the  bottom  antenna  would  be  considered   an
          inprovement over the top one, using the '-c' option. It
          should be noted that some of the reflected  power  will
          probably  be  re-radiated,  but  the  fraction that is,
          depends  on  the  match  between  the  source  and  the
          transmission  line.  The  program,  with the -c option,
          assumes all reflected power is absorbed by the  sourfce
          and is not radiated.


     -fFBratio
          When optimising  an  antenna,  consider  any  FB  ratio
          greater than FBratio dB to be equal to FBratio dB. This
          avoids optimising to a very high  FB  ratio,  which  is
          impracticable,  as  the  bandwidth  over  which this FB
          ratio will be maintained is very small  and  mechanical
          considerations  will  prevent  you from constructing it
          with such a high FB  ratio  anyway.  If  this  was  not
          prevented, you might just happen to get an antenna with
          100dB FB ratio, but poor gain and swr. Since by default
          all  parameters  must improve, the optimisation routine
          will most likely never being able  to  improve  on  the
          100dB  FB  ratio,  so  no improvement will result. Most
          people would prefer to get a few extra dB of gain, even
          if the FB ratio dropped to 30dB.

     -fresistance
          When optimising an antenna, consider any  input  resis-
          tance  closer  to  Zo (usually 50 Ohms) than resistance
          Ohms to be acceptable. This  avoids  optimising  to  an
          input  resistance too close to Zo, which is impractica-
          ble, as the bandwidth over which the  input  resistance
          could  be  maintained is very small and mechanical con-
          siderations will  prevent  you  from  constructing  the
          antenna  with  such  an ideal input resistance. If this
          was not prevented, you might  just  happen  to  get  an
          antenna with an input resistance of 50.000001 Ohms, but
          poor gain, FB and possibly even  a  poor  swr,  if  the
          antenna  is  well away from resonance. Since by default



version 1.06        Last change: 29 Oct 1994                    3






OPTIMISE(1)              USER COMMANDS                OPTIMISE(1)



          all parameters must improve, the  optimisation  routine
          will get most likely never being able to improve on the
          antenna, whereas we might be happier with a few more dB
          gain,  if  the  input  resistance went to 50.1 Ohms. It
          should be noted that the default  optimisation  routine
          never  uses  the input resistance directly (only vswr),
          so this option cant be used without the '-o' option  to
          optimise  for  other than the default parameters (gain,
          vswr and FB ratio).

     -sswr
          When optimising an antenna, consider any SWR less  than
          swr to be equal to swr This avoids optimising to a very
          low swr, which is impracticable, as the bandwidth  over
          which  such a low swr could be maintained would be very
          small and mechanical considerations  will  prevent  you
          from  constructing  such  an antenna anyway. If this is
          was not prevented, you might  just  happen  to  get  an
          antenna with an swr of 1.000000000001:1, but poor gain,
          FB ratio. Since by default all parameters must improve,
          the  optimisation  routine will most likely never being
          able to improve on the antenna, even though in practice
          you would like to get a few extra dB of gain if the SWR
          would rise to 1.02:1. The default was equivalent  to  -
          s1.1  but run optimise -d to display this and any other
          defaults.

     -bboom_extension
          Generally speaking, the gain of a Yagi  increases  with
          boom length. Hence the optimiser would often give you a
          Yagi with a much longer boom than the input file.  This
          may  not  be what you desire due to space restrictions.
          The default limits the  antenna  to  10x  the  original
          length, which means effectively there is no boom length
          limitation.  You can adjust the percentage  by  setting
          boom_extension  to  whatever you wish.  -b30 will limit
          the boom to no more than 30%  more  than  the  original
          length.

     -ZZo
          Zo is the characteristic impedance used when evaluating
          the VSWR, reflection coefficient and other similar cal-
          culations. The optimiser usually  tries  to  bring  the
          input impedance of the antenna to this value. It is set
          by default to 50 Ohms, so the default is equivalent  to
          -Z50 but may be set to any positive number. Set to 12.5
          Ohms if you are going to feed the antenna  with  a  4:1
          balun.  Generally  speaking,  the gain of a Yagi can be
          higher for low input impedances,  but  of  course  such
          antennas are more difficult to feed.

     -Gweight_gain



version 1.06        Last change: 29 Oct 1994                    4






OPTIMISE(1)              USER COMMANDS                OPTIMISE(1)



          is the floating point number (usually 0 to 100)  speci-
          fying  the  weight to attach to the gain of the antenna
          when using the '-W' option.  This is used  in  conjunc-
          tion  with  the  options  '-S'  and '-F' to specify the
          weights for SWR and FB ratio. The default behaviour was
          -WG33.33G33.33S33.33  or  -W  -G33.33  -F33.33  -S33.33
          (both are equivalent), but you should run  optimise  -d
          to  be  sure  of knowing the current default. It is not
          necessary for them to sum to 100 -  the  program  takes
          care  of  it, so you could use -W -G.6 -F.1 -S.3 if you
          wanted to put  60% weight on gain, 10% on FB ratio  and
          30%  on  VSWR.  If you do not specify a parameter it is
          not set to zero, but to its  default  value.  Hence  to
          design  an antenna where you have no interest in its FB
          ratio, you might use -W -G.9 -F0.0 -S.1
          *Warning*, if you specify one or two parameters of G, F
          and  S, but use the default for the other, remember the
          defaults are 33.33. If you specify -W  G.6  -F.1,  this
          will  be  equivalent to -W -G.6 -F.1 -S33.33, which for
          all practicable purposes would optimise for  vswr,  but
          ignore  gain  and  FB  ratio, as their weights would be
          negligibly small.

          The 'fitness' of the antenna uses a  parameter  propor-
          tional  to  the  true gain, not that in dB. Hence going
          from 10 dBi gain  to  13  dBi  gain  is  considered  as
          increasing  the gain part of the fitness by a factor of
          2, not 30%.

     -Sweight_swr
          An obvious change from the '-G' option.

          It should be noted that the 'fitness'  of  the  antenna
          uses  tau, the transmission coefficient rather than the
          SWR. This is because it seemed more logical  to  use  a
          paramter  (tau^2) that increses in direct proportion to
          the power reaching the antenna, rather than  SWR  which
          shows  non-linear behaviour. Hoverver, since most radio
          hams use SWR, I've called the option weight_swr.

     -Fweight_FB
          An obvious change from the '-G' option.

          The 'fitness' of the antenna is uses a  parameter  pro-
          portional  to  the true FB, not that in dB. Hence going
          from 20dB FB to 30 FB is considered as  increasing  the
          FB part of the fitness by a factor of 10, not 1.5.

     -Cweight_combined
          This is similar to the flags -G, -F and -S, but instead
          of  being  used  with the standard fitness function for
          the antenna, it  uses  the  FB  ratio  and  a  combined



version 1.06        Last change: 29 Oct 1994                    5






OPTIMISE(1)              USER COMMANDS                OPTIMISE(1)



          gain/SWR  parameter.  This option sets the weight given
          to the combined gain/SWR. This option must be  used  in
          conjunction  with  either  the  genetic algorithm ( - g
          option) or the -W (weighted). The default value of this
          option is 66.666666.

     -ooptimisation_criteria
          is an integer between 1 and  63,  which  specifies  the
          criteria  for the program deciding a revised antenna is
          better than the original. The  currently  defined  cri-
          teria are:
           1 -  Assume better if the gain has increased.
           2 -  Assume better if the  front  to  back  ratio  has
           improved.
           4 -  Assume better if  the  real  part  of  the  input
           impedance  is closer to the value that the program was
           compiled for, or set using the '-Z' option. This  will
           usually  be  50  Ohms, but you may wish to set this to
           12.5 Ohms if you use a 4:1 balun.  Generally  you  can
           get  higher  gain  from  a Yagi if you allow the input
           impedance to fall, but of course  feeding  it  becomes
           more difficult.
           8 -  Assume better if the magnitude  of  the  reactive
           component  of  the  input  impedance is lower (ie. the
           antenna is nearer resonance).
           16 - Assume better if the VSWR is lower.
         The optimisation_criteria may be formed from  a  logical
         AND  of these numbers, so for example choosing -o19 will
         only consider a revised antenna better than  the  previ-
         ous, if the VSWR, gain and F/B ratio have all simultane-
         ously improved.
         By adding 32 to the criteria, the program will  consider
         a  revised antenna better than the previous, even if one
         or more of the parameters actually worsens, as  long  as
         it  is  still  considered acceptable. Clearly an antenna
         which originally had 12dB gain and 1.01:1 VSWR but  then
         changes to 20dB gain @ 1.02:1 VSWR, would to most people
         be better, even though the VSWR has increased.  By  run-
         ning  optimise  with no arguments, the program will list
         the limits of acceptability. These  might  be  typically
         F/B ratio > 25dB, VSWR < 1.1:1, magnitude of input reac-
         tance less than 5 Ohms and the real part  of  the  input
         impedance   within   5   Ohms   of   Zo.  Choosing  -o51
         (32+16+2+1=51) will  optimise  for  gain,  VSWR  and  FB
         ratio,  but  would  consider  a higher gain and FB ratio
         antenna better than a previous one,  even  if  the  VSWR
         rose,  as  long  as it stayed below 1.1:1 (or as was set
         during compilation). The default behaviour (no  options)
         is  equivalent  to  -o51  but this may be changed at any
         time, so type optimise -d to check the current settings.

     -lpercent



version 1.06        Last change: 29 Oct 1994                    6






OPTIMISE(1)              USER COMMANDS                OPTIMISE(1)



          is a parameter (floating point number) which  specifies
          the  maximum  percentage  change  in  the  positions or
          lengths of an elements at each iteration. Its  best  to
          start  by putting percent a relatively large value (say
          5%) then gradually reducing it to a small  values  (say
          0.001%).  The  default  was fixed at 0.1%, but this may
          change if recompiled, so type optimise -d to  determine
          the default.

     -eelements
          is an integer which specifies the type of elements that
          are changed in the optimisation cycle.  Possible values
          are:
           1 - alter only the driven element(s) (useful to  bring
           to resonance)
           2 - alter only the parasitic elements(s)    (generally
           the best choice)
           3 - alter both the driven and parasitic elements.
           The  default is equivalent to -e2 which  only  changes
           the parasitic elements (the driven element is fixed).

     -ppopulation
          This determines the initial population used   with  the
          genetic algorithm.

     -tlength_tolerance
          length_tolerance is the standard deviation in mm of the
          accuracy  with  which you can cut elements. Since 99.7%
          of elements will be with 3 standard deviations  of  the
          mean length (stats theory says this), set -t0.2 if vir-
          tually  all  (well  99.7%)  of  elements   are   within
          3x0.2=0.6mm  of  the correct length. This option *must*
          be used with the '-T'  option and can't  be  used  with
          any other options apart from

     -tposition_tolerance
          position_tolerance is the standard deviation in  mm  of
          the  accuracy  with  which  you can cut elements. Since
          99.7% of elements will be with 3 standard deviations of
          the  correct position (stats theory says this), set -T2
          if virtually all (well 99.7%) of  elements  are  within
          3x2=6mm  of  the correct position.This option *must* be
          used with the '-t'  option and can't be used  with  any
          other options apart from

     filename
          This is the name of the  file  containing  the  antenna
          description.  It  is expected to be in a format created
          by either input or first - two other  programs  in  the
          YagiUda project. This is an ASCII text file.

     iterations



version 1.06        Last change: 29 Oct 1994                    7






OPTIMISE(1)              USER COMMANDS                OPTIMISE(1)



          is an integer specifying the number of  iterations  for
          the  optimiser  to  perform  to  try  to  get  the best
          antenna. Time will limit the number  you  choose.  1000
          iterations of a 1ele yagi takes about 5 seconds, a 6ele
          approximately 60 seconds, an 11 element 350 seconds,  a
          20 element 1030 seconds, a 33ele 2440 seconds, a 50ele-
          ment 5400 seconds, 100ele 21320 seconds all on  an  old
          25MHz 486 PC with no external cache.

          When using the '-t' and '-T' options, iterations speci-
          fies  the  number  of  iterations  to  attempt to get a
          poorer design, to check the sensitivity of  the  design
          to small manufacturing tolerances.

EXAMPLES
     Here are a number of examples of using optimise.

     1) optimise 5ele 1000

     Here the file 5ele will be optimised using the default  sys-
     tem  for  1000  iterations.  The default is to require a new
     design to improve in gain, FB ratio and  VSWR,  but  not  to
     over-optimise any one parameter. Only the parasitic elements
     will be changed to optimise the antenna.

     2) optimise -b30 -f50 -s2 5ele 1000

     This is similar to above, but the boom  can  not  extend  by
     more  than  30%  from  its  original length, FB ratios above
     50dB are considered acceptable, as are SWR's less than  2:1.
     The  optimised resultant antenna is likely to have better FB
     ratio, but poorer SWR than in (1) above.

     3) optimise -o1 5ele 1000

     This will simply optimise 5ele for maximum forward gain. The
     resultant  antenna may have a poor FB ratio and is likely to
     have an unacceptably low  input  impedance  and  hence  high
     VSWR.

     4) optimise -W -l7 5ele 10000

     This will optimise the file 5ele using for 10000 iterations.
     It will require that the weighted performance of the antenna
     in three important  parameters  (gain,  FB  ratio  and  SWR)
     improves  from one design to the next. One or two parameters
     can actually get worst from one design to the next, but  the
     weighted  performance  is  better. The positions of the ele-
     ments or lengths of elements will not change by more than 7%
     in each iteration.





version 1.06        Last change: 29 Oct 1994                    8






OPTIMISE(1)              USER COMMANDS                OPTIMISE(1)



     5) optimise -g -S.3 -G.5 -F.2 -p1500 5ele 10000

     This will optimise the file 5ele using a genetic  algorithm.
     1500  antennas will be randomly designed. The performance of
     each of these will  measured  using  a  'fitness'  function,
     weighted  30%  to  SWR, 50% to gain and 20% to FB ratio. The
     probability of breading from a pair of antennas  is  propor-
     tional to the fitness function.

     6) optimise -w atv_antenna 10000

     This will optimise the file atv_antenna for a  best  average
     performance  over  a  wide band. The progrram caluclates the
     gain, FB and SWR at  three  frequencies,  then  computes  an
     average  (mean)  performance of the antenna over the band. N
     iterations will take 3x as long to execute as  N  iterations
     on the same antenna without the '-w' option.

     7) optimise -t0.1 -T1  good_design 100

     This will take the file good_design and make  100  different
     antennas from it, to simulate the effects of building toler-
     ances. Each element is assumed to be cut so  that  the  mean
     error  of  all elements is 0 mm, but a standard deviation of
     0.1mm, so 68.4% of element lengths are within  0.1mm,  95.4%
     within  0.2mm and 99.7% with in 0.3mm. The accuracy of plac-
     ing elements along the boom is much lower, so here  we  have
     specified  a  standard  deviation of 1.0mm, so 68.6% of ele-
     ments are placed within 1mm of the correct  position,  95.4%
     within  2mm  of  the correct position etc.  The program will
     report the *worst* performances achieved. If the performance
     dips too mush, then you either need to build them better, or
     get a design that's less critical!


STOPPING
     Optimise will stop after the number of iterations  specified
     in  the  parameter  iterations.  It will also stop if a file
     stop exits in the current directory of the executable optim-
     ise  This  file can of course only be created using a multi-
     tasking operating system such as Unix. It is *not* advisable
     to  stop  the  program  by  hitting  the  DEL  key (Unix) or
     CONTROL-C (DOS), as one of the files  may  be  open  at  the
     time, resulting in an empty file. Files are not open for any
     longer than necessary (they  are  closed  immediately  after
     writing  to  them),  so this is not a likely occurrence, but
     can still occur.

LIMITATIONS
     I'm not aware of any limitations, apart from that filenames,
     including full path, can't exceed 90 characters.




version 1.06        Last change: 29 Oct 1994                    9






OPTIMISE(1)              USER COMMANDS                OPTIMISE(1)



FILES
     filename           Antenna description, created by input or first.
     filename.up    Update file, listing achievements of optimise.
     filename.bes       Best file, containing the best design to date.

SEE ALSO
     first(1), input(1), output(1), yagi(1).


PLATFORMS
     Both DOS and Unix versions have been built. The DOS  version
     as  distributed requires a 386 PC with a 387 maths coproces-
     sor.

     Although I have altered the source to make it more  compati-
     ble  with DOS (reduced file name lengths etc), my wish is to
     build a decent program, rather than fit the  program  to  an
     outdated  operating  system.  If there is a *good* reason to
     use code that is incompatible with DOS, this will be done.
     Since optimise takes  a while to optimise an  antenna  (I've
     optimised  one design for a week), it is obviously more sen-
     sible to build this program under a multi-tasking  operating
     system, as otherwise a PC can be tied up for days.

BUGS
     Bugs should be reported  to  davek@medphys.ucl.ac.uk.   Bugs
     tend  actually to be fixed if they can be isolated, so it is
     in your interest to report them in such a way that they  can
     be easily reproduced.

     The program will dump core (crash) if asked  to  optimise  a
     1ele  beam,  without  any arguments.  This is because a 1ele
     beam has no parasitic elements and by  default  the  program
     only changes parasitic elements.

     Some of the options are not  checked  for  sensible  values,
     although  most are now checked and report if they are out of
     range.

     If the user specifies very large manufacturing errors  using
     the  '-t'  and  '-T'  options,  its possible for elements to
     overlap or for element lengths to become negative. This will
     cause numerical errors. Any reasonable values will not cause
     this.

     Two options mentioned in the man page are not yet  currently
     implemented. These are both connected with the genetic algo-
     rithm ( -g and -p ).


     On long Yagi's (50 elements) optimise can go a bit silly. It
     can  optimise say a 1296MHz Yagi to get 20dB at 1296MHz, but



version 1.06        Last change: 29 Oct 1994                   10






OPTIMISE(1)              USER COMMANDS                OPTIMISE(1)



     less than 0dB at only 1MHz away. Needs some thought!

     All those I don't know about.


COPYING
     This program is public domain,  but 4 of the source routines
     are copyrighted.  In order to build, you will need to obtain
     the routines cisi.c, complex.c, lubksb.c  and  ludcmp.c  for
     the  book 'Numerical Recipes in C', 2nd edition, by Press et
     al, Cambridge University Press, (1992).

     You may copy the sources (less those 4) and  executables  to
     anyone  you wish in the usual unix tradition, as long as you
     let people know they can get the sources and don't make  any
     profit from it. You may charge a *small* distribution fee.



AUTHORS
     Dave Kirkby G8WRB (davek@medphys.ucl.ac.uk).  with help with
     converting     to     DOS     from     Joe     Mack     NA3T
     (mack@fcrfv2.ncifcrf.gov)
































version 1.06        Last change: 29 Oct 1994                   11



