457

74
Automatic Design of Planar Antennas Using Genetic Algorithms and the NEC Simulation Package Shu Wang Bachelor of Engineering (Telecommunication Engineering) May, 2010 SUPERVISOR: Dr Daniel Franklin

Transcript of 457

Page 1: 457

Automatic Design of Planar Antennas Using Genetic

Algorithms and the NEC Simulation Package

Shu Wang

Bachelor of Engineering

(Telecommunication Engineering)

May, 2010

SUPERVISOR: Dr Daniel Franklin

Page 2: 457

I

Abstract

An antenna is a transducer designed to transmit or receive electromagnetic waves [1].

Antennas are being used in communication systems such as radio and television

broadcasting, point-to-point radio communication, wireless LAN, radar, space

exploration and so on, whose purpose is to convert between circuit power, voltage and

current at the radio terminals, and radiated power carried in an electromagnetic wave.

Genetic Algorithm is a repeatable optimization process, based on the natural selection

and evolution principles. In recent years, the idea of using a genetic algorithm combing

with an electromagnetic simulator has been introduced into antenna design, and is

becoming increasingly popular. The genetic algorithm has been successfully used for

designing wire antennas, microstrip antennas and so on.

Numerical electromagnetic codes (NEC) are the method of moments (MoM) simulator

developed at Lawrence Livermore National Laboratory in the early 1980s [10]. NEC is

used to analyze random structure of antenna by dividing antennas into some straight

wires. Generated antennas by NEC, the characteristics of various antennas are easy to

be seen. In addition, it is common that output files of NEC are applied by others

software, such as QAntenna, to simulate the design antenna. Nowadays, NEC is

considered to be an effective and useful package, and is widely used in antenna

simulation and design.

The aim of this thesis is to design a number of high-gain 2.4 GHz microwave planar

antennas, which can be manufactured and tested with 802.11 radio hardware. the

structural parameters of designed antenna are optimized in an automated method, by

applying of the genetic algorithm (GA) in conjunction with numerical electromagnetic

codes (NEC).

Page 3: 457

II

Statement of Originality

I, Shu Wang, declare that this thesis, submitted as part of the requirements for the award

of Bachelor of Engineering, in the School of Electrical, Computer and

Telecommunications Engineering, University of Wollongong, is wholly my own work

unless otherwise referenced or acknowledged. The document has not been submitted for

qualifications or assessment at any other academic institution.

Signature:

Print Name:

Student ID Number:

Date:

Page 4: 457

III

Contents Abstract I

State of Originality II

List of Figures VI

List of Abbreviations and Symbols VIII

1 INTRODUCTION.................................................................................................................... 1

1.1 Overview................................................................................................................. 1

1.2 Objective................................................................................................................. 1

1.3 Key Achievement ................................................................................................... 2

1.31 Antenna Design................................................................................................. 2

1.32 Numerical electromagnetic codes..................................................................... 2

1.33 Generic Algorithm ............................................................................................ 3

1.4 Report Structure ...................................................................................................... 3

2 LITERATURE REVIEW........................................................................................................ 5

2.1 Overview................................................................................................................. 5

2.2 General topics ......................................................................................................... 5

2.21 EM Wave Propagation ..................................................................................... 5

2.2.2 Maxwell's equations......................................................................................... 6

2.3 Antenna ................................................................................................................... 7

2.31 Basic Antenna Parameters ............................................................................... 8

Page 5: 457

IV

2.32 Basic Models................................................................................................... 12

2.4 Genetic Algorithm ................................................................................................ 13

2.5 Numerical Electromagnetic Codes (NEC)............................................................ 17

2.51 Design Flow.................................................................................................... 17

2.52 NEC Reference................................................................................................ 18

2.6 Implementation Tools ........................................................................................... 19

2.7 Current Research and Result in this field ............................................................. 21

3 GENERAL DESIGN OF ANTENNA .................................................................................. 22

3.1 Overview of Planar Antenna................................................................................. 22

3.2 Generating Random bits ....................................................................................... 23

3.3 Create Patches....................................................................................................... 26

3.3.1 Create One Patch .......................................................................................... 26

3.3.2 Create all Patches by Bits.............................................................................. 28

3.4 Conclusion: ........................................................................................................... 30

4 GENETIC ALGORITHMS OPTIMIZING ANTENNA ................................................... 32

4.1 THE GENERAL WORKFLOW OF GENETIC ALGORITHM ........................................... 32

4.2 The Implementation of GA in Antenna Design .................................................... 33

4.2.1 Generate an Initial Population...................................................................... 34

4.2.2 Test Each Individual ...................................................................................... 34

4.2.3 Nature Selection............................................................................................. 36

4.2.4 Select Parents for Crossover ......................................................................... 36

4.2.5 Generate Offspring ........................................................................................ 37

4.2.5.1 Crossover ................................................................................................ 38

4.2.5.2 Mutation.................................................................................................. 39

4.2.6 Terminate the Operation................................................................................ 40

Page 6: 457

V

5 ANALYSING SIMULATION RESULTS ........................................................................... 41

5.1 Radiation Patter Comparison ................................................................................ 41

5.2 MSE Tendency Analysis....................................................................................... 43

6 CONCLUSION....................................................................................................................... 46

Appendix A: Thesis Project Specification 51

Appendix B: Project Timelines 53

Appendix C: Logbook summary signature 55

Appendix D: Script Files for Planar Antenna Design 57

Page 7: 457

VI

List of Figure

Figure 2.1 Forward uniform plane wave .......................................................................................................6

Figure 2.2 typically radio link .......................................................................................................................8

Figure 2.4 (b) Directional antenna’s radiation pattern on the horizontal and vertical plane.......................12

Figure 2.4 (a) Omni-directional antenna’s radiation pattern on the horizontal and vertical plane .............12

Figure 2.5, the structure of Genetic Algorithm[ 26]....................................................................................16

Figure 2.6 Segments and Tags of antenna...................................................................................................18

Figure 3.1 the stucture of patch antenna......................................................................................................23

Figure 3.2 an example of 4 x 4 patch antenna.............................................................................................24

Figure 3.2 an example of 4 x 4 patch antenna.............................................................................................25

Figure 3.3.1 an example of one patch .........................................................................................................26

Figure 3.3 photograph of a patch antenna ...................................................................................................28

Figure 3.3.2 planar antenna with 3 patches .................................................................................................29

Figure 3.4.1 4 x 4 patch antenna simulated by QAntenna .......................................................................31

Figure 3.4.2 4 x 4 patch antenna with radiation pattern ............................................................................31

Figure 4.1 Genetic Algorithms flowchart [25]. ...........................................................................................33

Figure 4.2.2 an example of NEC Output File..............................................................................................35

Figure 4.2.3 basic implementation from current generation to the next generation [26]............................36

Page 8: 457

VII

Figure 4.2.5.2 two-point crossover..............................................................................................................38

Figure 4.2.5.1 single-point crossover ..........................................................................................................38

Figure 5.1 (a) the radiation of iteration 0 ....................................................................................................41

Figure 5.1 (b) the radiation of iteration 3 ....................................................................................................42

Figure 5.1 (c) the radiation of iteration 6 ....................................................................................................42

Figure 5.1 (d) the radiation of iteration 9 ....................................................................................................42

Figure 5.2 (a) Average MSE .......................................................................................................................43

Figure 5.2 (b) Best MSE..............................................................................................................................44

Figure 5.2 (c) Worst MSE ...........................................................................................................................44

Page 9: 457

VIII

List of abbreviations and Symbols EM Electromagnetic

RF Radio Frequency

GA Genetic Algorithms

NEC Numerical Electromagnetics code

MoM Method of Moments

CIS Communication and Information system

MICs Microwave Integrated Circuits (MICs)

MSE Mean Square Error

Page 10: 457

1

Chapter 1

Introduction

1.1 Overview

Communications and information systems (CIS) are used to support collecting,

processing, and exchanging information. In the radio frequency system, the essential

components are Antenna, Amplifier, Filter and Mixer. Antenna as one of the most

important element, its purpose is to convert electricity into electromagnetic waves and

radiate those waves into a medium, such as air and free space. In theory, antenna is a

device transforming wire-propagated waves into space-propagated waves. Basically,

antennas receive electromagnetic waves and transfer them to the receivers; in addition,

they could transmit electromagnetic waves produced by a transmitter. In last few years,

the booming of wireless communications has fostered increasingly significant concern

about antenna design.

1.2 Objective

The aim of this thesis is to design a number of high-gain 2.4 GHz microwave planar

antennas, which can be manufactured and tested with 802.11-radio hardware. To

Page 11: 457

2

achieve respectable results, the structural parameters of designed antenna are optimized

in an automated design, by applying of the genetic algorithm (GA) in conjunction with

numerical electromagnetic codes (NEC). The project starts with the background reading

about antenna design, familiar with the basic information about antenna; antenna design

software, GA and Perl programming language. The next step is to create an initial

prototype antenna, and than utilize NEC expresses and generates it. And besides, GA is

applied to optimize the results. After improving the antenna, we could obtain the best

radiation pattern result, which is the closest to the reference pattern. At last, simulate

aimed antennas and comparing and analysing the data results.

1.3 Key Achievement

1.31 Antenna Design

Even though the antenna is one of the most complicated parts of RF design, it is also

considered as the most ignored part in an RF design [1]. Antennas give effect to the

range and performance of an RF connection directly and critically. Important factors for

antenna design are its gain, shape, placement and orientation. In general, the length of

an antenna is directly related to the wavelength, while the antenna’s efficiency is

directly relative to its volume. During the design process, the common problem is that

the antenna usually occupies insufficient free space around it.

1.32 Numerical electromagnetic codes

Numerical electromagnetic codes (NEC) is a method of moments simulator for wire

antennas, which is developed by Lawrence Livermore National Laboratory in the early

1980s[2]. In the last decades, it has been applied in antenna simulation and design

Page 12: 457

3

broadly, as it is easy to write, read and calculate an antenna effectively. NEC software is

used to analyze the electromagnetic response of the random structure of antenna,

including wires and surfaces, in free space or over a ground plane. The analysis method

is based on the numerical solution of integral equations for induced currents. This

approach not only avoids many problems caused by other solution methods such as

simplifying assumptions, but also provides a highly accurate and flexible tool for

electromagnetic analysis.

1.33 Generic Algorithm

The GA is a repeatable optimization process, whose principle of operation imitates the

adaptation and evolution of organism birth. GA is well known that it is ranged under a

special category of optimization methods, which are robust stochastic search schemes

grounded on the principles of natural selection. Basically, the GA concurrently

processes a population of points in the optimization space. Random operators transit

selected points from one generation to the next generation, leading to reduce the

probability of solution blocked in local limitations. In terms of electromagnetic

problems, the GA has found to a variety of applications, especially the antenna design,

such as wire antennas, patch antennas, and antenna arrays.

1.4 Report Structure

This report consists of 5 Chapters, references and appendix. Chapter 1 provides an

introduction of this thesis. Chapter 2 provides the literature review, which covers the

basic information about antenna design, methodologies and implements such as

software and programming languages, utilized in this thesis. Chapter 3 provides the

general design of the planar antenna, which covers different approaches for antenna

Page 13: 457

4

random bits. Chapter 4 provides the workflow of Genetic Algorithms optimizing

antenna. Chapter 5 aims to analyse simulation results, at last Chapter 6 is as conclusion

summarizing the entire thesis.

Page 14: 457

5

Chapter 2

Literature Review

2.1 Overview This chapter provides a review of every major element, related to the task of antenna

design for this project. It also contains the brief and concise analysis of the major

factors, according to background reading and preparatory research. In addition, this

section also introduces some useful implementation tools, such as software and

programming languages, which can be used in this project.

2.2 General topics

2.21 EM Wave Propagation

The simplest form of electromagnetic waves is uniform plane wave, which is

propagating along some fixed direction. In general, we set the fixed direction as z-

direction. Basically, when a current flows a simple wire, it generates a magnetic field

(H) and an electrical field (E). Both fields are at a 90-degree angle between each other

and also with respect to the wire. Referring to the antenna, the surface generated by the

Page 15: 457

6

electrical field (E) supplies the reference for the polarization’s direction. The following

figure depicts the case of a forward propagating wave (figure 2.1) [3].

Figure 2.1 Forward uniform plane wave

Hand rules are used to indicate the sense of circular polarization. The sense is defined

by which hand would be used in order to point that thumb in the direction of

propagation and point the fingers of the same hand in the direction of rotation of the

Electric-E field vector.

Left Hand Circular Polarization (LHCP) is used, when thumb is pointed in the

direction of propagation and the rotation is counterclockwise looking in the

direction of travel.

Right Hand Circular Polarization (RHCP) is used, when the rotation is

clockwise.

2.2.2 Maxwell's equations

Maxwell's equations are a set of four partial differential equations, which defines the

properties of the electric and magnetic fields, and also involve them with their sources,

charge density and current density [16].

Page 16: 457

7

The first equation is Faraday’s law of induction; the second is Ampère’s law corrected

and advanced by Maxwell, which is including the displacement current ∂D/∂t; the third

and fourth equations stands for Gauss’ laws used for the electric and magnetic fields.

The electric and magnetic field intensities are represent by quantity E and H

respectively. E is measured in units of volt/m, whereas, H is measured in units of

ampere/m. The displacement current ∂D/∂t in Ampère’s law is important in predicting

the existence of propagating electromagnetic waves. The quantity D is the electric flux

density, in units of coulomb/m2. B represents magnetic flux density, also called the

magnetic induction, which is in units of coulomb/m2. The volume charge density of any

external charges is presented by the quantity ρ, besides J is electric current density. ρ

and J are qualified in units of coulomb/m3 and ampere/m2, respectively. The zero in the

fourth equation means there are no magnetic monopole charges.

2.3 Antenna

In any telecommunication system, all radios require some kind of antenna, regardless of

transmitting or receiving [19]. The purpose of antenna is to convert between circuit

power, voltage and current at the radio terminals, and radiated power carried in an

electromagnetic wave. The antenna collects power from the transmitter and sends off it

Page 17: 457

8

into space as an electromagnetic or radio wave. At the receiving terminal, a similar

antenna gathers energy from the passing electromagnetic wave and transforms it into a

variable electric current or signal, so that the receiver can detect. A radio link consists of

seven components, which are transmitter, power supply, transmission lines, transmitting

antenna, propagation path, receiving antenna, and receiver (figure 2.2) [4]. Whether a

communication system is reliable and quality, it is directly effected by how well

antennas launch and collect electromagnetic waves; therefore antenna designing plays a

critical role in the information explosion age.

Figure 2.2 typically radio link

2.31 Basic Antenna Parameters

There are several crucial antenna parameters directly determining an antenna's

performance, which should be considered when choosing an antenna for a given

application.

Page 18: 457

9

• Bandwidth: The bandwidth of an antenna measures the range of frequencies

over which the antenna is in effect, which is usually centered on the resonant

frequency. The bandwidth of an antenna may be improved by a number of

techniques and methods, such as using thicker wires, taking the place of wires

with cages to simulate a thicker wire, making antenna components taper, and

combining various antennas into a single assembly, applying the natural

impedance to choose the proper antenna and so on.

• Gain: Gain as a parameter is used to measure the directional efficiency of an

antenna. Specifically, The gain of an antenna is defined as the ratio of the power

input for a lossless reference antenna, and the power input needed to supply the

given antenna so that it will provide the same field strength in a given distance

and direction as the reference antenna [15]. Generally, an antenna with a low

gain transmits or receives radiation power equally in all directions, whereas an

antenna with high-gain will tend to radiate in particular directions with priority.

• Radiation patterns: The radiation pattern is the geometric pattern of the

relative field powers of the field radiated by the antenna, which is typically

indicated by a three dimensional graph, or polar plots of the horizontal and

vertical cross sections. Antenna radiation patterns are usually represented by the

elevation pattern and the azimuth pattern forms. The elevation pattern is a graph

of the energy emitted from the antenna looking at it from the side as shown in

Figure 2.3a, whereas, the azimuth pattern is a graph of the energy radiated from

the antenna looking at it from directly above the antenna as indicated in Figure

2.3b. Combining two graphs above, the radiation pattern will be shown as 3-D

form (Figure 2.3c)[5].

Page 19: 457

10

• Polarization: The polarization of an antenna, determined by the physical

structure of the antenna and its orientation, is the direction of the electric field

(E-plane) of the radio wave relating to the Earth's surface. They are two main

categories linear and circular, linear includes Vertical, Horizontal and Oblique,

while circular, which comprises, Circular Right Hand (RHCP); Circular Left

Hand (LHCP), Elliptical Right Hand and Elliptical Left Hand. Polarization is

one of the most critical parameters affecting the performance from the antennas

greatly.

• Impedance: When an electro-magnetic wave passes through the different parts

of the antenna system, such as radio, feed line, antenna, free space and so on, it

may encounter differences in impedance (E/H, V/I, etc). When an antenna and

feed line do not match impedances well, some of the electrical energy cannot be

transferred from the feed line to the antenna. Energy, which is not transferred to

the antenna, is reflected back to the transmitter. It is the interaction of these

reflected waves with forward waves, which causes standing wave patterns.

Reflected power leads to Radio Frequency energy losses increase, distortion on

transmitter, damage to the transmitter and so on. SWR (standing wave ratio) is

Page 20: 457

11

used to measure the wave’s ratio of maximum power to minimum power, which

is also named as VSWR.

VSWR

VSWR = (1 + ρ) / (1 - ρ)

With ρ , reflection coefficient magnitude defined as

ρ = √( Power reflected/ Power forward)

Minimizing impedance differences at each interface and improving impedance

matching will reduce VSWR and increase power transfer through each part of

the antenna system.

• Resonant frequency: Resonant frequency is associated to the electrical length

of an antenna, which is usually the wire’s physical length divided by its velocity

factor (the ratio of the speed of wave in the wire to the speed of light in a

vacuum). In general, an antenna is tuned for a specific frequency, and is in effect

for limited frequencies, that are usually in the range concentrated on that

resonant frequency. Antennas can be made resonant at harmonic frequencies,

which are multiples of the target frequency [6].

• Directivity: There are two fundamental types of antenna directional patterns,

based on specific three-dimensional plane.

Omni-directional (radiates equally in all directions)

Directional (radiates more in one direction than in the other)

The Omni-directional antenna, as its name, radiates and receives signals at

almost 360o on the horizontal plane; whereas, the directional antenna usually

refers to one focusing a narrow beam in a specific direction [10].

Page 21: 457

12

2.32 Basic Models

There are several different types of antennas. Below are some antenna models, which

are the most relevant to antenna designing.

• Isotropic radiator: It is hypothetical antenna that radiates equally in all

directions. It is considered as a point neither magnitude nor mass, so this kind of

antenna is inexistent in practical application. While, it is a theoretically idea

model used to comprising with other antennas.

• Dipole antennas: A dipole antenna is the most useful kind of antennas, to

Figure 2.4 (b) Directional antenna’s radiation pattern on the horizontal and vertical plane

Figure 2.4 (a) Omni-directional antenna’s radiation pattern on the horizontal and vertical plane

Page 22: 457

13

transmit and receive signals from the broadside of the antenna. The dipole

antenna is simple and inexpensive, which is two wires arranged in opposite

directions either horizontally or vertically. One end of wires is connected to the

radio, and the other end points into free space. All dipole antennas have a

general radiation pattern. The antennas work evenly well in a complete 360

degrees around the antenna, namely the dipole antenna that is not a directive

antenna splits its power equally through 360 degrees around the antenna.

Physically, dipole antennas are usually fed through an input at the bottom of the

antenna, and it also can be fed into the center of the antenna

• Yagi-Uda antenna: A Yagi-Uda Antenna known as “Yagi antenna” or “Yagi” ,

is a directional type of antenna, which is made up of an array of a dipole and

extra closely coupled parasitical factors, such as a reflector and a director [8]. A

Yagi-Uda antenna is usually used for finding direction and log distance

communication system, as it is with better directionality and higher gain.

• Random wire antenna: The random wire antenna is a very long wire, which is

more than one quarter of its wavelength. One end of the antenna is connected to

the radio, and the other is in free space. It is arranged arbitrarily for the most

space available. Normally, if a random wire antenna is used in a properly turned

network, it could be used to transmit electromagnetic waves on various

nonlinearly frequency [9].

2.4 Genetic Algorithm

A genetic algorithm (GA) is a powerful search technique to find correct or approximate

solutions, to optimize and search issues by computing [10]. Genetic algorithm (GA) is

random searching method, based on the natural selection and evolution principles. In

Page 23: 457

14

recent years, the idea of using a genetic algorithm combing with an electromagnetic

simulator has been introduced into antenna design, and it is becoming more and more

popular. The genetic algorithm has been widely applied to design wire antennas and

microstrip antennas. Using genetic algorithms takes many advantages for antenna

design, such as it could immediately provide the accurate, and reliable solutions for

antenna structures, in addition, it could filter obvious worse designs, even to

experienced specialists [17]. The main considerations of Genetic Algorithm as follows:

• Initialization: at first, an initial population consists of many individual

solutions, which are randomly generated by tradition. The initial population size

typically contains several hundreds or thousands of feasible solutions, depending

on specific problems. Conventionally, initial population is generated randomly,

however it should cover the whole range of possible solutions in the search area.

In spite of the broad range, optimal solutions are likely to be found rarely.

• Selection: In order to breed a new generation, after each successive generation,

a fraction of the existing population is selected to breed a new generation.

Individual solutions are measured and selected by a fitness function, where fitter

solutions are more likely to be selected as a rule. The fitness function is a

specific and objective function, which is used for quantifying the best

chromosome from the optimality solution in a genetic algorithm. The fitness

function makes sure the particular best fitting chromosome is arranged other

than all the other chromosomes. Optimal chromosomes (at least chromosomes,

which are more optimal) are allowed to breed and mix up their datasets through

various techniques, creating a new generation that will be even better. Certain

selection methods value each solution’s fitness, and preferentially pick the best

solutions, which could be effective to avoid time-consuming [10].

Page 24: 457

15

• Reproduction: After selection and generation the first breed population, the

next step is to generate a second-generation population of solutions from those

selected by crossover and mutation. For each new solution to be produced, a pair

of parent solutions is selected for breeding, which are chosen from the pool

(where fitter solutions are gathered). In order to produce an offspring solution,

the methods of crossover and mutation are applied, and a new solution is

created, which normally succeeds a number of the characteristics from its

"parents". New parents are selected for breeding child of next generation; at last

process operator is terminated, when a termination condition has been reached.

In general, the average fitness will rise by this produce for the population, since

only the best genes and a few less-fit solutions from the previous generation are

inherited by the new generation [10].

• Termination: The generational process is repeated ceaselessly, before a

termination condition is achieved. In common, terminating conditions are as

below:

1. Minimum criteria is satisfied by a solution, which is found

2. Fixed number of generations is reached

3. Allocated budget is reached, such as money, time.

4. The highest ranking solution's fitness is reaching or has reached the

highest satisfaction level, no longer need find better results

5. Manual inspection

Page 25: 457

16

Figure 2.5, the structure of Genetic Algorithm[ 26] The figure above, it indicates the whole working process of Genetic Algorithm. At first,

a random generation of initial population is produced. Following is the step to select

and decode chromosome. Then the antenna is constructed. Analyzing parameters of

antenna and calculating of the cost function values for every chromosome are executed.

Based on the fitness function of Genetic Algorithm, chromosomes are ranked and

selected. Crossover is the process of exchanging pieces of the chromosomes within

every pair of the parents, which are arbitrarily selected, and establishment of new

Page 26: 457

17

chromosomes like progeny. In this case, the chromosomes with the better fitness will

have more chances of randomization. Mutation leads to selected bit(s) of the

corresponding chromosomes is reversed at random, while very occasionally a gene may

be mutated. In this way, the construction of next population with better fitness is

executed. After verification of the optimization conditions, the process is completed or

repeated, for the sake of producing the new population. The entire optimization

completes after several rounds of duplication process, or when optimization condition is

satisfied.

2.5 Numerical Electromagnetic Codes (NEC)

Numerical Electromagnetic Codes (NEC) are a Method of Moments (Mom) simulator

used for wire antennas. It was developed at the Lawrence Livermore National

Laboratory in the early 1980s [2]. For each simulation, an input file is first required,

which illustrates the geometry of the conducting elements in the antenna design. This

also includes how each element is interconnected, the excitation source and other

simulation parameters. After the simulation takes place, an output file is generated,

containing the numerical results of the simulation. NEC is considered to be an effective

and useful package, and it is broadly used in antenna simulation and design.

2.51 Design Flow

The analysis of an antenna is presented generally step by step as follows:

1. Divide antenna design into some straight wires.

2. Each wire is generated a list of segments, which are to be utilized in the GW

command. Generally, each segment equals to roughly 0.05 wavelengths long.

3. Introduce excitation specifications such as frequency and voltage.

Page 27: 457

18

4. Designate which analysis to achieve.

5. Execute nec2c and interpret the terribly unreadable and confusion results.

2.52 NEC Reference

• Antenna Geometry Syntax is presented in GW command. num_segments measures

the resolution of the simulation. For instance,

GW tag_number num_segments x0 y0 z0 x1 y1 z1 wire_radius

The coordinates x0 y0 z0 indicate the start of straight length of wire, whereas, the

coordinates x1 y1 z1 imply the end of wire (figure 2.5) [13].

Figure 2.6 Segments and Tags of antenna

• The wire conductivity is demonstrated following LD and providing various types of

load impedences on the antenna. For exmaple:

LD 5 tag_number 0 0 cond 1

tag _number is the tag of the wire of interest. The cond is the conductivity in

Siemens. The 0 0 before the conductivity is just applied for other unrelated

functions of the LD directive.

Page 28: 457

19

• Voltage sources is designated by the EX command. The source_segment is the

segment number of the wire that is to be driven. source_tag is the tag number of the

wire, which was chosen in the antenna geometry.

• Frequency specifications follow FR and are displayed in MHz, n _freq parameter is

set as 1.

• Radiation pattern is presented in RP command. n_theta and n_phi specify the

number of steps in these directions (zenith and azimuth), the theta_0and phi_0

specify the starting angles, and theta_step and phi_step indicate the size of each

increment in angle in each direction [13].

2.6 Implementation Tools

At present, there are a great many of tools and software successfully applied for antenna

design. In this part of the report, some of the most popular and valuable tools will be

introduced, such as 4NEC2, QAntenna, EZNEC, Antenna maker and Perl language.

4NEC2: 4nec2 is a completely free Nec2, Nec4 and windows based tool for creating,

viewing, optimizing and checking 2D and 3D style antenna geometry structures and

generate, display and/or compare near/far-field radiation patterns for both the starting

and experienced antenna modeler [11]. 4NEC2 is with a number of useful features, such

as Graphical 2D and 3D visualization of Far- and Near-field data and Geometry

structures, Line-chart visualization for freq-sweep Gain, F/B, F/R, SWR and impedance

data. Furthermore, Genetic Algorithms based optimizer is build-in.

QAntenna: is a freeware antenna analyzer for Linux. QAntenna is a FLOSS software,

which is used to view and analyze antennas especially, in terms of the radiation pattern.

Page 29: 457

20

It provides the user with a 3D view of the models. QAntenna is also capable of zooming,

rotating, and so on [12]. The popularity of QAntenna gets much benefits from

free/Libre/Open Source, multiplatform and 3D viewing of models. In addition,

QAntenna is with the special function of Snapshot generation.

EZNEC: EZNEC and EZNEC+ are powerful but very easy-to-use programs for

modeling and analyzing nearly any kind of antenna in its actual operating environment.

EZNEC plots azimuth and elevation patterns; calculate gain, feedpoint impedance,

SWR, and current distribution; finds and reports beamwidth, 3-dB pattern points, f/b

ratio, takeoff angle, sidelobe characteristics, and so on. EZNEC outlines the antenna

(and other nearby structures if desired) as a group of straight conductors. Using this

method, users could quickly analyze Yagis, quads, phased arrays, towers, loops- almost

all kinds of antenna. The most excellence of this software is displaying on multiple

patterns, which makes compare and analyze antenna data easily.

Ansoft Designer: is a flexible, easy-to-use software which is good at simulation

technologies, HFSS, Q3D Extractor, and SIwave, according to its schematic capture and

layout editing, netlist generation and sophisticated data visualization and analysis tools.

Ansoft Designer is the foundation for a highly accurate design flow. Users are allowed

to accurately shape and simulate complex analog, RF, and mixed-signal applications

and perform signal-integrity analysis and system verification of high-performance

IC/package/board designs. Ansoft Designer technology targets to variable design needs

and applications, and different product contents are available in application product

suites, such as Signal Integrity Analysis, RF and microwave design[21].

Antenna Maker: It is a freeware based one dos program, and developed by John

Agrelius in early 90's but still very useful and actual [14]. It is dedicated to quickly

compute antenna’s dimensions, including Quads antennas, Yagi antenna, Inverted vees

antennas as well as J-poles and Traps to extend dipoles band coverage.

Page 30: 457

21

Matlab: Matlab is a powerful tool used for computing, with a scripting language and

toolboxes. It is the best characterized by number of variables and fitness function are

user- defined, in the window of genetic algorithm setting tool.

Perl: Perl is an advanced, general, interpreted, and dynamic programming language

[18]. The language provides powerful text processing skills in facilitating easy

manipulation of text files. It needs database to access and CGI programming on the

Web. Perl programming is also applied for graphics programming, system

administration, network programming, and applications [18]. In this thesis, Perl as a

flexible programming language arranges and organizes all the individuals, ensure they

are running in a planned order.

2.7 Current Research and Result in this field

NASA (The National Aeronautics and Space Administration) is an American research

agency, exploring and advancing the space technology successfully. ST5-3-10 and ST5-

4W-03 are best antennas evolved by GA, with the advantages of less power

requirement, more uniform coverage and shorter design cycles and so on.

Besides NASA, various types of antennas that are implemented by applying GA and

NEC has gained a huge success, such as “Crooked-wire” genetic antenna, Broadband

Yagi , High-gain Yagi, three-dimensional fishbone antenna and so on. .

Page 31: 457

22

Chapter 3

General Design of Antenna

This chapter illustrates the technical design of planar antenna. Section 3.1 provides the

overview of planar antenna design. Section 3.2 describes the methods of generating bits.

Section 3.3 introduces techniques how to create patches.

3.1 Overview of Planar Antenna

In this project, a number of high-gain 2.4 GHz microwave planar antennas are to be

designed. The most popular planar antenna for many applications is the ‘’patch’’ or

‘’panel’’ antenna. The patch antenna gains its name based on the fact that it basically

consists of radiating patches, which are bonded on one side of the dielectric substrate.

On the other side of the dielectric usually is a ground plane layer such as the PC board.

In general, the patch material is the sort of conducting material, for example copper,

gold. Any possible shape of the patch can be applied, which is generally square,

rectangular, circular, triangular, elliptical and any other common shape. For microwave

frequencies, through making arrays of patches to form a phased array, it is the easy way

to get antennas, which have gain, directivity, and the ability to incorporate

beamfrorming and steering [7]. Figure 3.1 below shows the basic structure of the patch

antenna.

Page 32: 457

23

A microstrip or patch antenna has a number of advantages over other types of antennas:

inexpensive and economical, low weight and volume, Low profile planar configuration

(can be easily made conformal to host surface), supporting both linear and circular

polarization, integrated with microwave integrated circuits (MICs) easily, capable of

dual and triple frequency operations, etc. Whereas compared with the conventional

antenna, the patch antenna suffers from a number of drawbacks, such as narrow

bandwidth, low efficiency and low Gain, extraneous radiation from feeds and junctions,

poor end fire radiator except tapered slot antennas, low power handling capacity,

surface wave excitation and so on.

Figure 3.1 the stucture of patch antenna

3.2 Generating Random bits

As mentioned above, patch is one of the most significant components of Microstrip

patch Antenna. Therefore the patch design is also a critical step in the whole process of

planar antenna design. Referring to Geometry of the patch, a series of geometric shape

could be used, including rectangles, hexagons, lines, circles and so on. Any type of

regular shape is possible to be constructed from a long string of binary bits. By using

Page 33: 457

24

these bits, it reduces the difficulty of programming to some extend. Next, some

approaches for generating random bits will be introduced.

Based on the antenna frequency is 2.4GHZ, the wavelength is computed as 12.5cm. We

assume the square patch planer antenna is ¼ wavelength antenna. The whole planar

antenna is occupying 1m x 1m in area. The patches are attached on back-filled grids,

and all the patches are the same size.

• Method A

It is the simplest method to generate the bit strings. In basic, the theory of this method is

that bit 1 means having a patch, bit 0 means no patch. In other words, the length of the

bit string depends on the number of the patch grids. Taking the 4 x 4 patch antenna for

an example, this planar antenna consists of 8 patches, which are indivated as P1, P2, P3,

P4, P5, P6, P7 and P8 respectively. It is worthy to be mentioned that normally we get

start from the leftmost column, and the order of grids description is from the bottom of

the column up to the top. Finally, it finishes at the rightmost column. According to the

rules of method A, we got the results, shown as below:

Figure 3.2 an example of 4 x 4 patch antenna

Patch number: 8

Bit string: 1010010110100101

Page 34: 457

25

• Method B

Taking the same 4 x 4 patch antenna as an example, in the case of this method, we sign

every grid on this planar surface by a 6 bits of binary string. Based on this antenna is 4 x

4, every patch obtains log24 = 2 bits on both vertical direction and horizontal direction.

Combining two direction bits together gets a 4-bit string, which represents the gird

location. Each patch’s bit string is linked, generating a long bit string, which indicates

the all the patches locations on this planar antenna. According to this rule, we generate

all the patches on the planar antenna. Results are shown as below:

Figure 3.2 an example of 4 x 4 patch antenna

Patches numbers: 8

Patches Locations: P1 (0001) P2 (0011) P3 (0100) P4 (0110)

P5 (1001) P6 (1011) P7 (1100) P8 (1110)

Bit string: 00010011010001101001101111001110

According to the methods above, locations of patches are denoted by binary-bit strings.

In the other words,any random bit sequence is capable of generating patches with

relative locations by encoding.

Page 35: 457

26

3.3 Create Patches

In order to create whole planar patch, the best and easiest way is to build one patch first.

And then, we could use the same way to finish the entire planar antenna construction.

3.3.1 Create One Patch

An example of one patch is shown as Figure 3.3. We define h stands for the height of

the patch, and w stands for the width of the patch. The coordinates of the patch centre

point are (x0, y0). Point A (xa, ya) and point B (xb, yb) are two corner points.

According to the NEC design flow, the antenna is divided into some straight wires. The

patch are divided by m segments on the width direction, whereas, the wires on the

height direction are broken up into n tiny segments, hence one patch is considered as

number (m+1) and number (n+1) wires on the vertical and horizontal directions.

According to above, each patch consists of (m+1+n+1) wires and divided into the (m*

n) segments. In addition, Dv represents the length of divided wire on horizontal

direction, while Dh stands for divided wire’s length on the vertical direction.

Figure 3.3.1 an example of one patch

In order to apply the NEC generating the antenna, the coordinates of each divided wire

are required, especially the start point and end point. For point A, its coordinates on x-

w =Width

h = Height

Dv = W/m

Dh = H/n

Page 36: 457

27

axis is (x0 – w/2), and the coordinates on y- axis is (y0 – h/2). The coordinates of point

B are (x0 + W/2) and (y0 + H/2) respectively.

• Generate the vertical wire segments

As shown in Figure 3.3, generating the vertical wire segments also means to

generate the wire from x= xa to x= xb. For this patch, the start point of leftmost

wire is A (x0 – w/2, y0 – h/2), whereas the coordinates of the wire’s endpoint are

(x0 – w/2, y0 + h/2). It is obvious that each wire on the vertical is with the same

coordinates on the y- axis at start point and end point as well. In terms of the x –

axis coordinates, the wires coordinates are calculated by adding a length Dv to

the right adjacent wire, which equals to w/m (W is patch width, and m is

number of wire segments on the width direction). By utilizing this method, all

the vertical wires could be generated with the coordinates.

• Generate the horizontal wire segments

Compared with the method of generating vertical wire, the difference is that

wires are with the same x- axis a coordinates instead of y- axis, at the start point

and the end point. Describing the horizontal wires from y= ya to y= yb, the x-

axis coordinates is (x0 – w/2) for the start points of all the horizontal wires,

while the end point coordinates is (x0 + w/2) on the x- axis. Referring to y

coordinates, the wires are calculated by adding a length Dh to the adjacent wire.

The value of Dh is calculated as h/n. H means the height of the patch, and n is

the number of the divided wire segments on horizontal. In this way, all the

Page 37: 457

28

horizontal wires segments are expressed. The coordinates of wires start and end

points are also useful, when applying the NEC generates radiation patterns.

3.3.2 Create all Patches by Bits

Figure 3.3 photograph of a patch antenna

One complete planar antenna may be constituted by only one patch, but most of patch

antennas are composed of several patches. Figure 3.3 is the photograph of a patch

antenna. Based on the method of creating one patch, which is supposed to generate the

wire segments from vertical and horizontal, all the patches could be generated in

required locations by the bit strings, and we expect each antenna string to be of a certain

fixed length. As we mentioned in chapter 3.2, a random binary bit string is considered

as the measure, which indicates the location of the patch. As shown, figure 3.3.2 is an

example planar antenna with 3 patches. Compared with figure 3.3.1, the W indicates the

width of the antenna, and H is the whole height of the antenna, whereas, w and h are

patch width and patch height respectively. Patches are located in the shadow grid. The

centre point of each patch is the connected point. The next section will explain the

question, which is how to generate and draw the patches on the planar surface by the

random bits.

Page 38: 457

29

Figure 3.3.2 planar antenna with 3 patches

In the first instance, the new set of reference frame (i, j reference frame) is introduced

into the program. The starting value is 0 for both i and j, and the value of i, j is only

integer. Decimals is not existing in this reference frame. In terms of point C, (i, j )

equals to (1, 1). For point D, (i, j) is (1,3). According to i, j reference frame, the i, j

array is generated. For one random bits string, at first split up the input string of zeros

and ones into individual bits, and then put them in the i, j array. The order of putting

individual is start from the column i =0 going along the direction, which is value of j

increasing. When the first column is filled up, turn around to the second column j=2, the

bits are assigned by the same order as the first column. In this way, all the individual

bits are assigned into i, j array. This process is terminal, when both i and j reaching the

maximums. At last any individual bit gains the coordinates by i, j reference system,

regardless bit 1 or bit 0. The coordinates of 1s are recorded, preparing to generate patch.

A random bits string contains several 0s and 1s. When the bit 1 emerges, one patch is

created. As mentioned before, one patch could be supposed as a number of vertical and

horizontal wires. In order to construct patches, the location of each patch is required,

namely, the coordinates of each patch is a critical factor in the entire process of antenna

design. From the part of “creating one patch”, it is known that location of center point

of target patch is needed to generate vertical and horizontal wires. When the bit is 1,

Page 39: 457

30

draw the patch, whose coordinates of center point by x, y reference frame is shown as

following:

In formulas above, w and h indicate the width and height of a patch. The center point

coordinates of the patch (i, j) =(0,0) is x0, y0, while the values of x0, y0 are related to

the number of patches at x, y direction, and the total length, width of the planar antenna.

3.4 Conclusion:

By the methods above, the planar antenna is constructed. Referring to this project,

inputting 16 binary bits in patch.pl, the binary bits are converted into decimal numbers

instantly,which are needed by generating NEC files. And then Simulated by NEC

simulator, the relative output files are produced, which are composed of antenna

characteristics. At last, applying QAntenna software simulates the generated NEC files.

The following Figure 3.4.1 shows the example of 4 x 4 patch antenna simulated by

QAntenna, and Figure 3.4.2 is the same antenna with radiation pattern.

x = (i+0.5) * w +x0

y = (j+0.5) * h +y0

Page 40: 457

31

Figure 3.4.1 4 x 4 patch antenna simulated by QAntenna

Figure 3.4.2 4 x 4 patch antenna with radiation pattern

Page 41: 457

32

Chapter 4

Genetic Algorithms Optimizing Antenna

From the chapter 3, any random bit strings could be generated by NEC and simulated

by QAntenna. In the chapter 4, section 4.1 introduces the general workflow of Genetic

Algorithm, and section 4.2 illustrates the implementation of GA in antenna design.

4.1 The General Workflow of Genetic Algorithm

Based on traditional local search algorithms, genetic algorithm (GA) provides a more

optimal algorithm, which is inspired by the biological nature processes of genetics and

evolution. Evolution is close conjunction with genetics, which leads to genetic

alterations through natural selection, genetic drift, mutation, and migration. A new

population is optimized by genetics and evolution; namely, it is better adapted to thrive

in its environment [20].

GA is quite simple and powerful. The whole process of genetic algorithm is considered

as the following 7 steps:

1. Generate an initial population of random chromosomes.

2. Test each individual, according to the fitness function.

Page 42: 457

33

3. Invoke natural selection.

4. Select parents for crossover.

5. Generate offspring.

6. Mutate selected members of intermediate generation

7. Terminate the operation

Figure 4.1 Genetic Algorithms flowchart [25].

4.2 The implementation of GA in Antenna Design

Based on the basic information about GA, utilizing GA optimizes the designed antenna,

which has been created by the approaches illustrated in Chapter 3.

$population_size = 100;

$bit_mutation_probability = 0.08;

$nbits = 16;

$iterations = 400;

In the program of this project, we set population as 100 and the probability of mutation

occurs is 0.08. The number of bit is denoted as 16 and the iteration is 400. It means the

whole process is carried out 400 times and one time generating 100 random16-bit

strings. Basically, the progress begins with randomly choosing 100 individuals as the

Page 43: 457

34

first generation, and then every individual is tested by the fitness, which is with

radiation pattern as reference condition. Calculating the mean square error of each

individual with reference antenna. The testing results MSE are sorted from the best to

the worst. Strings with high quality are produced a number of replications, which give

priority to be chosen as the parents to reproduce next generation. By crossover and

mutation of the parents (two higher fitness antennas), the further generation is produced.

When processes above going through 400 iterations, the entire program is terminated.

4.2.1 Generate an Initial Population

The first step of GA is that generate an initial population of random individuals. Each

individual is represented by a 16 bits binary number,which suggests the patch number

and patch location on the planar antenna. And then the 16- bit umber is converted into

decimal number. Generate a random number between 0 and 65535 (2^16) and store the

individuals into an array (population) of hashes. The hash element that we initialize is

called 'value'. Arbitrarily choose 100 individuals, which are considered to constitute the

initial population.

4.2.2 Test Each Individual

In order to go through all individuals in the current population, simulate each individual

member using NEC2++. NEC simulator generates NEC files, which consists of wires

coordinates, conductivity, voltage source, frequency, radiation pattern and so on.

Extract radiation patterns data from the generated NEC output file, which is needed to

calculate of MSE (mean square error). It is @sorted = sort { ${$a}{'mse'} <=>

${$b}{'mse'} } @population that ranks the results of individuals from the lowest mse to

the highest one in the list.

Page 44: 457

35

Figure 4.2.2 an example of NEC Output File

For this project, the program nec2plot is used to compute MSE and the operating

principle is presented as following. It scans through the entire generated NEC output

file and extracts the radiation patter, print it to standard output, and then we can redirect

this to a file to save the output. In Octave or Matlab this file can be read to plot in polar

coordinates. To compute the mean squared error between two radiation patterns, run the

NEC simulations for each, using a different filename each time, and then load the

results into Octave or Matlab. To obtain the MSE, Each random 16-bit is calculated by

comparing with the reference antenna. For example:

Program statements above will provide the mean square error of radiation pattern on

vertical.

GW 1 21 ‐0.5 ‐0.5 0 ‐0.5 ‐0.25 0 0.001 

GW 1 21 ‐0.416666666666667 ‐0.5 0 ‐0.416666666666667 ‐0.25 0 0.001 

GW 1 21 ‐0.333333333333333 ‐0.5 0 ‐0.333333333333333 ‐0.25 0 0.001 

GW 1 21 ‐0.25 ‐0.5 0 ‐0.25 ‐0.25 0 0.001 

GW 1 21 ‐0.5 ‐0.5 0 ‐0.25 ‐0.5 0 0.001 

GW 17 21 ‐0.5 ‐0.6 0 0.5 ‐0.6 0 0.001 

……… 

GE 0 

FR 0 1 0 0 2400 

EX 0 17 10 0 12 

RP 0 90 2 0000 0 0 1 90 

EN 

# load vertical_reference.dat 

# load vertical_test.dat 

# mean ((vertical_test (:, 3) ‐ vertical_reference (:, 3)) .^ 2) 

 

# mean ((vertical_test (:, 3) ‐ vertical_reference (:, 3)) .^ 2)

Page 45: 457

36

4.2.3 Nature Selection

According to the natural selection, only the healthiest members of the population are

allowed to survive to the next generation. The most common way to invoke natural

selection is to keep healthy chromosomes and abandon the rest.

Figure 4.2.3 basic implementation from current generation to the next generation [26]

It is helpful to suppose the execution of the GA as a two main parts. It starts with the

current population. To create an intermediate population from current population,

selection is invoked. Then recombination and mutation are applied to the intermediate

population. The strings with high fitting faculty are generated a number of duplications.

The individual with higher fitness value has higher percent chance of being the parents

to produce next generation.

4.2.4 Select Parents for Crossover

In this case, the fitness of individual is the MSE between simulated radiation pattern

and reference pattern. After evaluating 100 individuals, the fitness results are sorted

from the best to the worst. The higher fitness individuals are chosen to store in the

Page 46: 457

37

mating pool, where strings are duplicated, and constituting intermediate generation. In

addition, duplications of strings are assigned in slots randomly, preparing to crossover.

Duplication methods are roughly classified by Roulette Wheel, Tournament Selection.

Based on Roulette Wheel, Monte Carlo Wheel theory has been most broadly used in

practical applications [23]. The basic theory is the number of offspring reproduced by a

chromosome is proportional to the chromosome’s fitness grade. Hypothetically, the

population size is n and the fitness value of chromosome Ai is ƒ (Ai). P (Ai) is the

probability of chromosome selected as a parent; therefore the expression of P (Ai) is

shown as:

In terms of Tournament Selection method, the main idea is that randomly choose k

(normally k equals to 20) chromosomes from the entire population, and the

chromosome with the highest fitness grade is reproduced. Repeat this process until the

number of chromosome reproductions reaches the default size of intermediate

generation.

Comparing and contrasting with two ways of duplication, the Tournament Selection

method is adopted, as by Roulette Wheel even though the high fitness chromosomes

generate reproductions with the higher probability, while the lower fitness

chromosomes still have possibility to be reproduced as the parents of the next

generation. Therefore the advantages of Tournament Selection are that this method not

only guarantees offspring chromosomes have better dispersion in solution space, but

also ensures all the offspring chromosomes are with splendid fitness.

4.2.5 Generate Offspring

With the Genetic Algorithms operation, crossover and mutation are applied to the

intermediate population, and then new population is generated.

Page 47: 457

38

4.2.5.1 Crossover

Crossover is classified into three main types: single-point crossover, two-point

crossover and uniform crossover. A single-point crossover operator uses one randomly

chosen crossover point. Two selected strings exchange all the bits behind the crossover

point. In contrast, two-point crossover randomly specifies two crossover points, and

strings swap the bits that fall between these two points. Figures below illustrate two

types of crossover.

Compared with the first two ways of crossover, the uniform crossover is the most

general procedure for binary chromosomes. Instead of crossover point, selector is

applied to determine the swap bits. A mask that is the random range of 0s and 1s has the

same number of bits as the parent chromosomes. For uniform crossover,

mask=round(rand(1,nvar*nbit)).

Rules of Uniform Crossover:

If mask= 1

Parent A → offspring A,

Parent B → offspring B.

If mask= 0

Parent A → offspring B,

Figure 4.2.5.1 single-point crossover Figure 4.2.5.2 two-point crossover

Page 48: 457

39

Parent B → offspring A.

In MATLAB code, this process indicates as:

Offspring A=mask.*Parent A+not (mask).*Parent B

Offspring B=not (mask).*Parent A+mask.*Parent B Taking the 16-bit mask (1100011010010101) for the example, two random patch

antennas are illustrated by 1010101010100011 and 1111110000000011, respectively. Parent A = [1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 1]

Parent B = [1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1]

Mask = [1 1 0 0 0 1 1 0 1 0 0 1 0 1 0 1]

then the offspring are:

offspring A=[1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 1]

offspring B=[1 1 1 0 1 1 0 0 0 0 1 0 0 0 1 1]

It is worthy to mention that in some reference research, the crossover rate is defined as

the ratio of the number of offspring produced in each generation to the population size

[23]. Overall, the rate should be high about 80% to 90%. Whereas some papers point

that for some problems crossover rate about 60% is the best.

4.2.5.2 Mutation

For binary chromosomes, mutation that is bits inversing a one to a zero or a zero to a

one, causes to random variations in the population [24]. More precisely, mutation is

aimed at changing gens in offspring generation, and it prevents the chromosomes of

omitting of important information or falling into local optimal solution in the process of

reproducing and mating. Compared with crossover; the mutation rate is much lower.

According to some research, it suggests that mutation rate about 0.5% to 1% is the best.

Page 49: 457

40

4.2.6 Terminate the Operation

Iteration is denoted as 400, therefore the generational process is repeated until the

number of iterations reaches 400 terminating the operation.

For a general problem, besides set number of iteration, common terminating conditions

are that set time achieved, fitness value of population falls lower than an acceptable

minimum, the best solution gets stuck after a set number of iterations, etc.

Page 50: 457

41

Chapter 5

Analysing simulation results

Basically, this chapter aims to analyze the simulation results produced by combined

application of chapter 3 and chapter 4 from two aspects, which are radiation patter

comparison and MSE tendency analysis.

5.1 Radiation Patter Comparison

Using monitor_results.m and results_file.dat monitors results synchronously. Octave

plots the radiation pattern of reference pattern and best patter in current population. It is

manifest from the figure 5.1. (a), (b), (c), (d) that radiation patterns of generated antenna

become gradually close to the reference patterns from horizontal and vertical, as the

best chromosomes from the preceding generation are selected for breeding the next

generation.

Figure 5.1 (a) the radiation of iteration 0

Page 51: 457

42

Figure 5.1 (b) the radiation of iteration 3

Figure 5.1 (c) the radiation of iteration 6

Figure 5.1 (d) the radiation of iteration 9

Page 52: 457

43

5.2 MSE Tendency Analysis

The evaluation results that are MSE values of individuals are stored in

$population[$i]{'mse'}, while the results of the population are stored in results_file.dat,

in which every content line is expressed by the fixed format: run number of iteration,

average MSE, best MSE, worst MSE, and code of the best antenna. Using Gnuplot

plots the results of average MSE, best MSE and worst MSE respectively. In these

figures, X-axis denotes the number of iteration, whereas Y-axis indicates the value of

MSE of current population.

Figure 5.2 (a) Average MSE

Page 53: 457

44

Figure 5.2 (b) Best MSE

Figure 5.2 (c) Worst MSE

As can be seen from the Figure 5.2(a), 5.2(b) and 5.2(c) that even though the average

MSE of population seems to be a little bit faulty, the tendency of the best MSE and

worst MSE are goodish. To be more exact, three values of MSE all sink dramatically in

Page 54: 457

45

a few generations at first. However, the value of average MSE fluctuates markedly in

the continued generations. Referring to the best MSE, it tends to drop with substantial

fluctuations at first, but after reaching the bottom, it shoots up immediately. At last, it

stabilizes at 20 approximately. In terms of the worst MSE, even though it fluctuates

significantly in the first generations, the value is level off at the lowest point finally.

At last, it is worth considering that the results should be variable by changing the

mutation rate, population size, the number of iteration and so on.

Page 55: 457

46

Chapter 6 Conclusion Overall, the original plan for the project is achieved. The start-up of the project is

background reading about antenna, NEC simulation and Genetic Algorithms; and

familiar with Linux system, programming language and software used for antenna

design. The following progress is general design of a planar antenna, by generating

patches from vertical segments and horizontal segments, which could be generated by

NEC simulator and simulated by QAntenna. Using 16-bit sequence decodes the location

of each patch. At last, utilizing Genetic Algorithms optimizes the result. The workflow

is as following: randomly generate 100 16-bit strings, evaluate 100 individuals,

according to MSE, which is obtained by comparing the simulated radiation pattern with

reference patter. Rank the mse of each individual in the population, and then select the

individuals with high fitness to crossover for generating offspring. After mutating of

selected members in intermediate generation, the new generation is produced. Generally

the average fitness of individuals will increase, since only the best chromosomes from

the preceding generation are inherited for breeding. Repeating the processes above, the

radiation pattern of generated antenna is more and more close to the reference pattern.

Therefore the original aim is realized, which is Automatic Design of Planar Antennas

Using Genetic Algorithms and the NEC Simulation Package.

Page 56: 457

47

Bibliography [1] Ch. Bach. ANTENNA BASICS –Basic Antenna Design Information, September

2003, available URL www.enocean.com. [Accessed on 25/08/09]

[2] X. Chen, K.Huang & X.B.Xu, Automated Design of a Three-Dimensional Fishbone

Antenna Using Parallel Genetic Algorithm and NEC, IEEE ANTENNAS AND

WIRELESS PROPAGATION LETTERS, VOL. 4, 2005.

[3] S. J. Orfanidis. Electromagnetic Waves and Antennas, Rutgers University,

November 2002.

[4] Field Antenna handbook, Washington D C, June, 1999.

[5] N.J. Koliaset. , Antennas, Available URL: http://www.engnetbase.com.

[6] Harmonic. Wikipedia website, available URL: http://en.wikipedia.org/wiki/

harmonic.[Accessed on 20/08/09]

[7] Patch antenna. Wikipedia website, available URL:

http://en.wikipedia.org/wiki/Patch_antenna.[Accessed on 30/08/09]

[8] Passive radiator. Wikipedia website, available URL:

http://en.wikipedia.org/wiki/Parasitic_element.[Accessed on 02/09/09]

Page 57: 457

48

[9] Straw, R. Dean (2003). The ARRL Antenna Book, 20th Edition. Newington,

Connecticut, USA: pp. 944.

[10] Genetic Algorithm, Wikipedia website, available URL:

http://en.wikipedia.org/wiki/Genetic_algorithm [Accessed on 30/08/09]

[11] 4NEC2. Dxzone website, available URL: http://www.dxzone.com/cgi-

bin/dir/jump2.cgi?ID=6997.

[12] Qantenna. Sourceforge website, available URL: http://qantenna.sourceforge.net/

[Accessed on 28/09/09]

[13] D. R. Franklin. ECTE 465/ECTE965- wireless communications laboratory notes,

University of Wollongong, 2007.

[14] Antenna maker. The website available URL:

http://www.iw5edi.com/hamradio/?antenna-maker,44%5B, [Accessed on 03/10/2009].

[15] Gain. Website available URL: http://www.its.bldrdoc.gov/fs-1037/dir-

003/_0317.htm [Accessed on 25/08/09]

[16] E. E. Altshuler & D. S. Linden, Wire-Antenna Designs Using Genetic Algorithms,

US air force, IEEE Antennas and Propagation Magazine, Vol. 39, No. 2, April 1997.

[17] G. G. Chavka and N. Litwinczuk, DESIGN OF WIRE ANTENNAS WITH USING

OF GENETIC ALGORITHM. International Conference on Antenna Theory and

Techniques, 17-21 September 2007.

[18] Perl. Wikipedia website available URL:http://en.wikipedia.org/wiki/perl.[

Accessed on 02/09/09]

Page 58: 457

49

[20] R. L. Haupt, D. H. Werner, (2007) Genetic Algorithms in Electromagnetics

Published by John Wiley & Sons, Inc., Hoboken, New Jersey, Canada. pp 29.

[21] Ansoft designer. Ansoft website, available URL:

http://www.ansoft.com/products/hf/ansoft_designer/. [Accessed on 15/04/10]

[22] W. Darrel A Genetic Algorithm Tutorial published by Computer Science

Department_ Colorado State University.

[23] S.J Chen, Foundations of Genetic Algorithm.ppt, Taiwan public union university [24] R. L. Haupt, D. H. Werner, (2007) Genetic Algorithms in Electromagnetics

Published by John Wiley & Sons, Inc., Hoboken, New Jersey, Canada. pp 42. [25] W. Darrel A Genetic Algorithm Tutorial published by Computer Science

Department_ Colorado State University. pp 5. [26]R. L. Haupt, D. H. Werner, (2007) Genetic Algorithms in Electromagnetics

Published by John Wiley & Sons, Inc., Hoboken, New Jersey, Canada. pp 31 [27]G. G. Chavka and N. Litwinczuk, DESIGN OF WIRE ANTENNAS WITH USING

OF GENETIC ALGORITHM. IEEE Xplore: International Conference on Antenna

Theory and Techniques, 17-21 September 2007.

Page 59: 457

50

Appendix A: Thesis Project Specification

Project Title: Automatic design of planar Antennas using Genetic Algorithms

the NEC Antenna Simulation Package

Student: Shu Wang

Student ID: 3438570

Major: Telecommunication engineering

Supervisor: Dr Daniel R. Franklin

Project background:

Telecommunication is the assisted transmission over a distance for the purpose of

communication. In modern times, telecommunication typically involves the use of

electronic devices such as the telephone, television, radio or computer. While a

telecommunications system antenna is a transducer designed to transmit or receive

electromagnetic waves. Antennas have practical uses for the transmission and reception

of radio frequency signals such as radio and television. Generally, basic antenna models

are isotropic radiator, dipole antenna, yagi-Uda antenna, random wire antenna, Horn,

patch antenna and so on.

Project Plan:

Project outcomes:

The main objective for this project is to design a number of high-gain 2.4 GHz

microwave antennas which can be manufactured and tested with 802.11 radio

hardware to demonstrate that GA-based antenna designs work well in the real

Page 60: 457

51

world. Though this project, the student will be expected to develop practical skills

in programming with NEC Simulator, Qantenna, and Octave Octave tools.

Project tasks:

• Familiarise with the software NEC Simulator, Qantenna, and Octave Octave

• Modify bits2nec.m to support new antenna geometries

• Designing antenna for 2.4GHZ, a 3-dimensional reference pattern is to be

used rather than only a horizontal and vertical slice, allowing greater control

of the overall shape of the radiation pattern.

• A number of different sets of design constraints will be tested, including

two-dimensional planar patch arrays with various geometric shapes and

reflective backplanes, with an emphasis on ease of manufacture.

Project Resources

The following resources will be required to complete the project.

• A PC to be used for web server and programming and to dedicated personal

computer to test the design.

• Microsoft office is used for editing the document paper work

• NEC simulator: a software of calculating and simulating antennas structure

• Qantenna: FLOSS software used to viewing and analyzing antennas and

their 3D radiation patterns.

• Octave Octave: both a programming language and interpreter, which is used

to execute defined functions written in Octave code.

• A number of material is for being manufactured

Page 61: 457

52

Appendix B: Project Timelines

1st session plan

Week 1 2 3 4 5 6 7 8 9 10 11 12

Project proposal

Literature survey

Familiar the software

Modify bits2nec.m

Design a simple antenna

Prepare Spring session report

Prepare poster and seminar abstract

Prepare seminar presentation

Page 62: 457

53

2nd session plan

1 2 3 4 5 6 7 8 9 10 11 12

Revise project proposal

Familiar with program

Develop the simple antenna

Simulation

Test the outcome

Analyse the data Prepare Spring session report Prepare poster and seminar abstract Prepare seminar presentation

Page 63: 457

54

Appendix C: Logbook summary signature

Page 64: 457

55

Page 65: 457

56

Appendix D: Script Files for Planar Antenna Design

1. patch.pl  

#!/usr/bin/perl -w

# If you want to make (say) a 4x4 patch array occupying 1m x 1m area, define the parameters below as

# $patches_x = $patches_y = 4, $width = $height = 1;

# Then run the program as ./patch.pl 010100100101010....1010 (a total of 16 zeros and ones).

$patches_x = 4;

$patches_y = 4;

$width = 1;

$height = 1;

$wstep = $width / $patches_x;

$hstep = $height / $patches_y;

$x0 = -$width / 2;

$y0 = -$height / 2;

$z = 0;

$n_horizontal = 3;

$n_vertical = 3;

$diameter = 0.001;

# Example usage: $n = str2num ("10101100101010");

sub str2num {

my ($str) = @_;

my ($num, $i, $len);

Page 66: 457

57

$len = length $str;

for ($num = 0, $i = 1; $i <= $len; $i++) {

$num += (substr $str, -$i, 1) * (1 << ($i - 1));

}

return $num;

}

sub create_patch {

my $delta = 1e-7;

my ($x0, $y0, $width, $height, $fh) = @_;

my ($x, $y);

## Generate vertical wire segments

for ($x = $x0 - $width/2; $x <= $x0 + $width/2 + $delta; $x += $width/$n_horizontal) {

print $fh "GW $n 21 $x " . ($y0 - $height / 2) . " $z $x " . ($y0 + $height / 2) . " $z

$diameter\n";

}

## Generate horizontal wire segments

for ($y = $y0 - $height/2; $y <= $y0 + $height/2 + $delta; $y += $width/$n_vertical) {

print $fh "GW $n 21 " . ($x0 - $width / 2) . " $y $z " . ($x0 + $width / 2) . " $y $z

$diameter\n";

}

# print "SP 0 1 " . ($x0 - $width / 2) . " " . ($y0 - $height / 2) . " 0 " . ($x0 + $width / 2) . " " . ($y0 -

$height / 2) . " 0\n";

# print "SC 0 1 " . ($x0 + $width / 2) . " " . ($y0 + $height / 2) . " 0\n";

$n++;

}

# Each input argument constitutes one possible antenna design. Go through

# each of them and generate an antenna design and write it out.

# We expect each antenna string to be of a certain fixed length.

$ant = 0;

foreach (@ARGV) {

Page 67: 457

58

# Validate each argument: must be the right number of zeros and ones!

die (sprintf ("$0: error: argument '$_' should be %i characters long and only contain 0s and 1s\n",

$patches_x * $patches_y)) if (length ($_) ne $patches_x * $patches_y || $_ !~ /[0|1]+/);

# Split up the input string of zeros and ones into individual bits and put them in an array called @bits

@bits = split / */;

$n = 1;

open SIMF, ">/tmp/antenna_$ant.nec";

$ant++;

# This generates the patches in the required locations

for ($i = 0; $i < $patches_x; $i++) {

for ($j = 0; $j < $patches_y; $j++) {

if ($bits [$j + $i * $patches_y] == '1') {

# Draw the patch

$x = ($i + 0.5) * $wstep + $x0;

$y = ($j + 0.5) * $hstep + $y0;

create_patch ($x, $y, $wstep, $hstep, *SIMF);

# Draw a wire from the centre of the patch to just beyond the edge of the antenna

print SIMF "GW $n 21 $x $y $z $x " . ($y0 - 0.1) . " $z $diameter\n";

$n++;

}

}

}

# Now print out common parts of the NEC file which are independent of the number and location of patches

print SIMF "GW $n 21 $x0 " . ($y0 - 0.1) . " $z " . ($x0 + $width) . " " . ($y0 - 0.1) . " $z

$diameter\n";

print SIMF "GE 0\n";

print SIMF "FR 0 1 0 0 2400\n";

print SIMF "EX 0 $n 10 0 12\n";

print SIMF "RP 0 360 2 0000 0 0 1 90\n";

print SIMF "EN\n";

Page 68: 457

59

close SIMF;

}

 

2. crossover_shu

#!/usr/bin/perl -w

use POSIX;

$population_size = 100;

$bit_mutation_probability = 0.08;

$nbits = 16;

$iterations = 400;

# Generate an initial population of random individuals. Each individual is

# represented by a 16-bit number.

for ($i = 0; $i < $population_size; $i++) {

# Generate a random number between 0 and 65535 (2^16) Store the individuals

# into an array (population) of hashes. The hash element that we initialise

# is called 'value'.

for ($n = $nbits - 1; $n >= 0; $n--) {

$population[$i]{'value'}[$n] = floor (0.5 + rand (1));

print STDERR "$population[$i]{'value'}[$n]";

}

print STDERR "\n";

}

for ($N = 0; $N < $iterations; $N++) {

print STDERR "Iteration: $N\n";

# Go through all individuals in the current population. Simulate and calculate MSE.

$str = "";

for ($i = 0; $i < $population_size; $i++) {

# Generate NEC files to calculate horizontal and vertical radiation patterns

Page 69: 457

60

for ($j = 0; $j < $nbits; $j++) {

$str .= $population[$i]{'value'}[$j];

}

$str .= ' '

}

`patch.pl $str`;

for ($i = 0; $i < $population_size; $i++) {

# Generate NEC files to calculate horizontal and vertical radiation patterns

# Simulate these using NEC

# Extract radiation patterns for calculation of MSE

# Calculate MSE (both horizontal and vertical)

$str = sprintf ('nec2++ -i /tmp/antenna_%i.nec ; nec2plot /tmp/antenna_%i.out >

/tmp/antenna_%i.dat ; calc_mse.m /tmp/antenna_%i.dat ~/reference/reference.dat', $i, $i, $i, $i);

$mse = `$str`;

# Remove trailing newlines

chomp $mse;

# print STDERR "Mean squared errors (h, v) = $h_mse, $v_mse\n";

# Store result in $population[$i]{'mse'}

$population[$i]{'mse'} = $mse;

print STDERR "Evaluated " . ($i + 1) . " of $population_size\n";

}

@sorted = sort { ${$a}{'mse'} <=> ${$b}{'mse'} } @population;

$rank = 1;

$new_pop_size = 0;

print STDERR "Current lowest MSE = $sorted[0]{'mse'}\n";

$average_mse = 0;

foreach (@sorted) {

${$_}{'rank'} = $rank++;

${$_}{'rank fitness'} = 2 * ($population_size - ${$_}{'rank'}) / ($population_size - 1);

${$_}{'copies'} = floor (${$_}{'rank fitness'} + rand (1));

Page 70: 457

61

# print STDERR "${$_}{'mse'}, copies = ${$_}{'copies'}\n";

$average_mse += ${$_}{'mse'};

for ($j = 0; $j < ${$_}{'copies'}; $j++) {

$intermediate[$new_pop_size++] = ${$_}{'value'};

}

}

# foreach (@intermediate) {

# @code = @$_;

# foreach (@code) {

# print $_

# }

# print "\n";

# }

$average_mse /= $population_size;

for ($i = 0, $best_code = ""; $i < $nbits; $i++) {

$best_code .= $sorted[0]{'value'}[$i];

}

# Print out run number, average mse, best mse, worst mse, code of the best

print $N . "\t" . $average_mse . "\t" . $sorted[0]{'mse'} . "\t" . $sorted[$population_size - 1]{'mse'} .

"\t" . $best_code . "\n";

# print STDERR "Intermediate population is now $new_pop_size\n";

$i = 0;

foreach (@intermediate) {

@partner1 = @$_;

@partner2 = @{$intermediate[floor (rand ($new_pop_size))]};

# foreach (@partner1) {

# print $_

# }

# print "\n";

Page 71: 457

62

# foreach (@partner2) {

# print $_

# }

# print "\n";

# Now we have two individuals selected from this list; $_ and $partner. We

# need to combine these using a crossover method

# Generate random number

for ($j = $nbits - 1; $j >= 0; $j--) {

$selector = floor (0.5 + rand (1));

$new_population[$i]{'value'}[$j] = ($selector & $partner1[$j]) + (~$selector &

$partner2[$j]);

}

$i++;

}

# print "New population:\n\n";

# foreach (@new_population) {

# @code = @{${$_}{'value'}};

# foreach (@code) {

# print $_;

# }

# print "\n";

# }

# Now randomly mutate bits in individuals

for ($n = 0; $n < $new_pop_size; $n++) {

# print STDERR ("Before: $new_population[$n]{'value'}, After: ");

# For each bit, there is a certain probability that the bit will be inverted

for ($i = 0; $i < $nbits; $i++) {

if (rand (1) < $bit_mutation_probability) {

$new_population[$n]{'value'}[$i] = 1 - $new_population[$n]{'value'}[$i];

}

Page 72: 457

63

}

}

# print "After mutation\n";

# foreach (@new_population) {

# @code = @{${$_}{'value'}};

# foreach (@code) {

# print $_;

# }

# print "\n";

# }

@population = @new_population;

$population_size = $new_pop_size;

}

3. calc_mse.m

#!/usr/bin/octave -qH

% If the number of command-line arguments is not equal to 2, then quit with

% an error message

if (nargin ~= 2)

fprintf (stderr, 'Usage: calc_mse file_1 file_2\n');

exit (-1);

end

data1 = load (nth (argv, 1));

data2 = load (nth (argv, 2));

mse = mean ((data1 (:, 3) - data2 (:, 3)) .^ 2);

printf ('%f\n', mse);

Page 73: 457

64

4. monitor_results.m

#!/bin/sh

# To make a shell program under Linux, you should create a text file which

# starts with a line that says #!/bin/sh ONLY. Then you can put the commands

# that you want to run in the text file. After you save the file, you need

# to make it executable. You can do this using the command

# chmod u+x nec2plot

# You only need to do this once. Now you can run your script as follows:

# ./nec2plot

# This program reads the output files generated by NEC, and extracts the

# radiation pattern, printing it to standard output. You can then redirect

# this to a file (just run ./nec2plot with no arguments to see an example)

# to save the output. In octave or Matlab you can then read this file and

# plot it in polar coordinates - or manipulate the data in any way that you

# wish. For example:

# load results.dat

# polar (results (:, 1) * pi / 180, 10 .^ (results(:, 3) / 10))

# To compute the mean squared error between two radiation patterns, run the

# NEC simulations for each, using a different filename each time, then load

# the results into Octave or Matlab. For example:

# load vertical_reference.dat

# load vertical_test.dat

# mean ((vertical_test (:, 3) - vertical_reference (:, 3)) .^ 2)

# This will give you the mean squared error.

# How it works:

# Scan through the entire output file and find the line number which

# contains "RADIATION PATTERNS"

# $1 is a shell variable which refers to the first command-line argument

Page 74: 457

65

# echo $1

# Test to see if the user has specified a command-line argument

if [ x$1 = x ] ; then

echo "Usage: $0 file.out > results.dat"

echo "results.dat can then be read by Matlab or Octave."

exit

fi

# If so, test to see if the file exists

if [ ! -e $1 ] ; then

echo "Error: file does not exist"

exit

fi

# If it exists, do we have read access to the file?

if [ ! -r $1 ] ; then

echo "Error: file not readable"

exit

fi

# grep -n prints out the line of text containing 'RADIATION PATTERNS' with a

# line number. cut -f 1 -d ':' splits up the input text around the ':'

# delimiter, and prints out the first field. The result is just the line

# number for the text which contains 'RADIATION PATTERNS'

LINE=`grep -n 'RADIATION PATTERNS' $1 | cut -f 1 -d ':'`

# We want to start five lines after that point, so we eliminate the text

# header for that section - so calculate LINE = LINE + 5

LINE=`expr $LINE + 5`

# Now we take all text AFTER that line, and of that text, everything BEFORE

# the last 8 lines, and pipe the result to awk - in this case awk just

# prints out the first, second and fifth columns.

tail -n +$LINE $1 | head -n -8 | awk '{ print $1,$2,$5 }'