4.
VPrefaceParticle swarm optimization (PSO) is a population based stochastic optimization tech-nique developed by Dr. Eberhart and Dr. Kennedy in 1995, inspired by social behavior ofbird flocking or fish schooling.PSO shares many similarities with evolutionary computation techniques such as GeneticAlgorithms (GA). The system is initialized with a population of random solutions andsearches for optima by updating generations. However, unlike GA, PSO has no evolutionoperators such as crossover and mutation. In PSO, the potential solutions, called particles,fly through the problem space by following the current optimum particles.This book represents the contributions of the top researchers in this field and will serve asa valuable tool for professionals in this interdisciplinary field.This book is certainly a small sample of the research activity on Particle Swarm Optimiza-tion going on around the globe as you read it, but it surely covers a good deal of what hasbeen done in the field recently, and as such it works as a valuable source for researchersinterested in the involved subjects.Special thanks to all authors, which have invested a great deal of time to write such inter-esting and high quality chapters.Aleksandar Lazinica

8.
1Novel Binary Particle Swarm OptimizationMojtaba Ahmadieh Khanesar, Hassan Tavakoli, Mohammad TeshnehlabandMahdi Aliyari ShoorehdeliK N. Toosi University of TechnologyIran1. IntroductionParticle swarm optimization (PSO) was originally designed and introduced by Eberhart andKennedy (Ebarhart, Kennedy, 1995; Kennedy, Eberhart, 1995; Ebarhart, Kennedy, 2001). ThePSO is a population based search algorithm based on the simulation of the social behavior ofbirds, bees or a school of fishes. This algorithm originally intends to graphically simulate thegraceful and unpredictable choreography of a bird folk. Each individual within the swarm isrepresented by a vector in multidimensional search space. This vector has also one assignedvector which determines the next movement of the particle and is called the velocity vector.The PSO algorithm also determines how to update the velocity of a particle. Each particleupdates its velocity based on current velocity and the best position it has explored so far;and also based on the global best position explored by swarm (Engelbrecht, 2005; Sadri,Ching, 2006; Engelbrecht, 2002).The PSO process then is iterated a fixed number of times or until a minimum error based ondesired performance index is achieved. It has been shown that this simple model can dealwith difficult optimization problems efficiently. The PSO was originally developed for real-valued spaces but many problems are, however, defined for discrete valued spaces wherethe domain of the variables is finite. Classical examples of such problems are: integerprogramming, scheduling and routing (Engelbrecht, 2005). In 1997, Kennedy and Eberhartintroduced a discrete binary version of PSO for discrete optimization problems (Kennedy,Eberhart, 1997). In binary PSO, each particle represents its position in binary values whichare 0 or 1. Each particles value can then be changed (or better say mutate) from one to zeroor vice versa. In binary PSO the velocity of a particle defined as the probability that aparticle might change its state to one. This algorithm will be discussed in more detail in nextsections.Upon introduction of this new algorithm, it was used in number of engineeringapplications. Using binary PSO, Wang and Xiang (Wang & Xiang, 2007) proposed a highquality splitting criterion for codebooks of tree-structured vector quantizers (TSVQ). Usingbinary PSO, they reduced the computation time too. Binary PSO is used to train thestructure of a Bayesian network (Chen et al., 2007). A modified discrete particle swarmoptimization (PSO) is successfully used based technique for generating optimal preventivemaintenance schedule of generating units for economical and reliable operation of a powersystem while satisfying system load demand and crew constraints (Yare &Venayagamoorthy, 2007). Choosing optimum input subset for SVM (Zhang & Huo, 2005),

9.
Particle Swarm Optimization2designing dual-band dual-polarized planar antenna (Marandi et. al, 2006) are two otherengineering applications of binary PSO. Also some well-known problems are solved usingbinary PSO and its variations. For example, binary PSO has been used in many applicationslike Iterated Prisoners Dilemma (Franken & Engelbrecht, 2005) and traveling salesman(Zhong, et. al. 17).Although binary PSO is successfully used in number of engineering applications, but thisalgorithm still has some shortcomings. The difficulties of binary PSO will be discussed, andthen a novel binary PSO algorithm will be proposed. In novel binary PSO proposed here,the velocity of a particle is its probability to change its state from its previous state to itscomplement value, rather than the probability of change to 1. In this new definition thevelocity of particle and also its parameters has the same role as in real-valued version of thePSO. This algorithm will be discussed. Also simulation results are presented to show thesuperior performance of the proposed algorithm over the previously introduced one. Thereare also other versions of binary PSO. In (Sadri & Ching, 2006) authors add birth andmortality to the ordinary PSO. AMPSO is a version of binary PSO, which employs atrigonometric function as a bit string generator (Pampara et al., 2005). Boolean algebra canalso be used for binary PSO (Marandi et al., 2006). Also fuzzy system can be used toimprove the capability of the binary PSO as in (Wei Peng et al., 2004).2. THE PARTICLE SWARM OPTIMIZATIONA detailed description of PSO algorithm is presented in (Engelbrecht, 2005; Sadri, Ching,2006; Engelbrecht, 2002). Here we will give a short description of the real- valued and binaryPSO proposed by Kennedy and Eberhart.2.1 Real-valued particle swarm optimizationAssume that our search space is d-dimensional, and the i-th particle of the swarm can berepresented by a d-dimensional position vector . The velocity of theparticle is denoted by . Also consider best visited position for theparticle is and also the best position explored so far is. So the position of the particle and its velocity is being updatedusing following equations:(1)(2)Where are positive constants, and are two randomvariables with uniform distribution between 0 and 1. In this equation, W is the inertiaweight which shows the effect of previous velocity vector on the new vector. An upperbound is placed on the velocity in all dimensions . This limitation prevents the particlefrom moving too rapidly from one region in search space to another. This value is usuallyinitialized as a function of the range of the problem. For example if the range of all is [—50,50] then is proportional to 50. for each particle is updated in each iterationwhen a better position for the particle or for the whole swarm is obtained. The feature thatdrives PSO is social interaction. Individuals (particles) within the swarm learn from eachother, and based on the knowledge obtained then move to become similar to their "better"

10.
Novel Binary Particle Swarm Optimization 3previously obtained position and also to their "better" neighbors. Individual within aneighborhood communicate with one other. Based on the communication of a particlewithin the swarm different neighborhood topologies are defined. One of these topologieswhich is considered here, is the star topology. In this topology each particle cancommunicate with every other individual, forming a fully connected social network. In thiscase each particle is attracted toward the best particle (best problem solution) found by anymember of the entire swarm. Each particle therefore imitates the overall best particle. So theupdated when a new best position within the whole swarm is found. The algorithmfor the PSO can be summarized as follows:1. Initialize the swarm X i , the position of particles are randomly initialized within thehypercube of feasible space.2. Evaluate the performance F of each particle, using its current position Xi (t).3. Compare the performance of each individual to its best performance so far:./4. Compare the performance of each particle to the global best particle: if5. Change the velocity of the particle according to (1).6. Move each particle to a new position using equation (2).7. Go to step 2, and repeat until convergence.2.2 Binary particle swarm optimizationKennedy and Eberhart proposed a discrete binary version of PSO for binary problems [4]. Intheir model a particle will decide on "yes" or " no", "true" or "false", "include" or "not toinclude" etc. also this binary values can be a representation of a real value in binary searchspace.In the binary PSO, the particles personal best and global best is updated as in real- valuedversion. The major difference between binary PSO with real-valued version is that velocitiesof the particles are rather defined in terms of probabilities that a bit will change to one.Using this definition a velocity must be restricted within the range [0,1] . So a map isintroduced to map all real valued numbers of velocity to the range [0,1] [4]. Thenormalization function used here is a sigmoid function as:(3)Also the equation (1) is used to update the velocity vector of the particle. And the newposition of the particle is obtained using the equation below:(4)Where is a uniform random number in the range [0,1].

11.
Particle Swarm Optimization42.3 Main problems with binary PSOHere two main problems and concerns about binary PSO is discussed the first is theparameters of binary PSO and the second is the problem with memory of binary PSO.a) Parameters of the binary PSOIt is not just the interpretation of the velocity and particle trajectories that changes for thebinary PSO. The meaning and behavior of the velocity clamping and the inertia weightdiffer substantially from the real-valued PSO. In fact, the effects of these parameters are theopposite of those for the real valued PSO. In fact, the effects of these parameters are theopposite of those for the real-valued PSO (Engelbrecht, 2005).In real-valued version of PSO large numbers for maximum velocity of the particle encourageexploration. But in binary PSO small numbers for promotes exploration, even if agood solution is found. And if = 0, then the search changes into a pure random search.Large values for limit exploration. For example if = 4, then = 0.982 isthe probability of to change to bit 1.There is also some difficulties with choosing proper value for inertia weight w . For binaryPSO, values of prevents convergence. For values of becomes 0 overtime. For which so for we have . If velocityincreases over time and so all bits change to 1. If thenso the probability that bits change to bit 0 increases.As discussed in (Engelbrecht, 2005) the inertia weight and its effect is a problem. Also twoapproaches are suggested there: First is to remove the momentum term. According to(Engelbrecht, 2005), as the change in particles position is randomly influenced by f/y , sothe momentum term might not be needed. This approach is unexplored approach althoughit is used in (Pampara et al., 2005), but no comparisons are provided there. The secondapproach is to use a random number for w in the range: (-1,1) . In fact inertia weight hassome valuable information about previously found directions found. Removing this termcant give any improvement to the binary PSO and the previous direction will be lost in thismanner. Also using a random number for win the range (-1, 1) or any range like this cant bea good solution. It is desired that the algorithm is quite insensible to the values selected forw. Also using negative values for w makes no sense because this term provides the effect ofprevious directions in the next direction of the particle. Using a negative value for thisparameter is not logical.b) Memory of the binary PSOConsidering equation (4) the next value for the bit is quite independent of the current valueof that bit and the value is solely updated using the velocity vector. In real-valued version ofPSO the update rule uses current position of the swarm and the velocity vector justdetermines the movement of the particle in the space.3. THE NOVEL BINARY PARTICLE SWARM OPTIMIZATIONHere, the and of the swarm is updated as in real-valued or binary version. Themajor difference between this algorithm and other version of binary PSO is theinterpretation of velocity. Here, as in real-valued version of PSO, velocity of a particle is therate at which the particle changes its bits value. Two vectors for each particle are introducedas: and . is the probability of the bits of the particle to change to zero while is

12.
Novel Binary Particle Swarm Optimization 5the probability that bits of particle change to one. Since in update equation of thesevelocities, which will be introduced later, the inertia term is used, these velocities are notcomplement. So the probability of change in j-th bit of i-th particle is simply defined asfollows:(4)In this way the velocity of particle is simply calculated. Also the update algorithm forand is as follows: consider the best position visited so far for a particle is and theglobal best position for the particle is . Also consider that the j-th bit of i-th bestparticle is one. So to guide the bit j-th of i-th particle to its best position, the velocity ofchange to one ( ) for that particle increases and the velocity of change to zero ( ) isdecreases. Using this concept following rules can be extracted:(6)Where are two temporary values, are two random variable in the range of(0,1) which are updated each iteration. Also are two fixed variables which aredetermined by user. Then:(7)Where is the inertia term. In fact in this algorithm if the j-th bit in the global best variableis zero or if the j-th bit in the corresponding personal best variable is zero the velocity ( )is increased. And the probability of changing to one is also decreases with the same rate. Inaddition, if the j-th bit in the global best variable is one is increased and decreases.In this approach previously found direction of change to one or change to zero for a bit ismaintained and used so particles make use of previously found direction. After updatingvelocity of particles, and , the velocity of change is obtained as in (5). A normalizationprocess is also done. Using sigmoid function as introduced in (3). And then the nextparticles state is computed as follows:(7)

13.
Particle Swarm Optimization6Where is the 2s complement of . That is, if then and ifthen . And is a uniform random number between 0 and 1.The meaning of the parameters used in velocity equation, are exactly like those for the real-valued PSO. The inertia weight used here maintains the previous direction of bits of particleto the personal best bit or global best bit whether it is 1 or 0. Also the meaning of velocity isthe same as meaning of the velocity in real-valued version of PSO which is the rate ofchange in particles position. Also as in real-valued PSO if the maximum velocity valueconsidered is large, random search will happen. Small values for maximum velocity causethe particle to move less. Here also the previous states of the bits of the particles are takinginto account. Using the equation (7) the previous value of the particle is taken into account,while in binary PSO just velocity determined the next value of particle. So, betterperformance and better learning from experiments in this algorithm is achieved.Experimental results in the next section support these complain. The algorithm proposedhere for the binary PSO can be summarized as follows:1. Initialize the swarm X i , the position of particles are randomly initialized within thehypercube. Elements of X i are randomly selected from binary values 0 and 1.2. Evaluate the performance F of each particle, using its current position Xi (t) .3. Compare the performance of each individual to its best performance so far: if if.4. Compare the performance of each particle to the global best particle::5. Change the velocity of the particle, and according to (6,7).6. Calculate the velocity of change of the bits, as in (5).7. Generate the random variable in the range: (0,1). Move each particle to a newposition using equation (8).8. Go to step 2, and repeat until convergence.4. EXPERIMENTAL RESULTSIn this section we will compare the performance of proposed binary PSO and the binaryPSO proposed by Kennedy and Eberhart in (Kennedy & Ebarhart, 1997) and the binary PSOused in (Tasgetiren & Liang,2007). In our experiments we investigated methods on theminimization of test functions set which is proposed in (Kennedy & Ebarhart, 1997). Thefunctions used here are: Sphere, Rosenbrock, Griewangk and Rastrigin which arerepresented in equations (9-12) respectively. The global minimum of all of these functions iszero. The expression of these test functions are as follows:

14.
Novel Binary Particle Swarm Optimization 7(9)(10)(11)(12)These functions have been used by many researchers as benchmarks for evaluating andcomparing different optimization algorithms. In all of these functions N is the dimension ofour search space. In our experiments the range of the particles were set to [-50 ,50] and 20bits are used to represent binary values for the real numbers. Also population size is 100 andthe number of iteration assumed to be 1000. The different values assumed in tests for N are3, 5,10, where N is the dimension of solution space. As it is shown in Table (1-8), the resultsare quite satisfactory and much better than the algorithms proposed in (Kennedy &Ebarhart, 1997) and (Tasgetiren & Liang,2007). As it was mentioned earlier, the methodproposed here uses the previous direction found effectively and velocity has the sameinterpretation as the real-valued PSO, which is the rate of changes. The method of selectinginertia weight in binary PSO proposed in (Kennedy & Ebarhart, 1997) is still a problem(Engelbrecht, 2005). But removing the inertia weight is also undesirable because theprevious direction is completely losses. In fact the previous velocities of a particle containsome information about the direction to previous personal best and global bests of theparticle and surely have some valuable information which can help us faster and better findthe solution. But in the proposed algorithm the effect of previous direction and also theeffect of previous state of the system is completely taken into account. The results obtainedhere quite support the idea.5. CONCLUSIONIn this study a new interpretation for the velocity of binary PSO was proposed, which is therate of change in bits of particles. Also the main difficulty of older version of binary PSOwhich is choosing proper value for wis solved. The previous direction and previous state ofeach particle is also taken into account and helped finding good solutions for problems. Thisapproach tested and returned quite satisfactory results in number of test problems. Thebinary PSO can be used in variety of applications, especially when the values of the searchspace are discrete like decision making, solving lot sizing problem, the traveling salesmanproblem, scheduling and routing.

18.
2Swarm Intelligence Applications in ElectricMachinesAmr M. Amin and Omar T. HegazyPower and Electrical Machines Department, Faculty of Engineering – Helwan UniversityEgypt1. IntroductionParticle Swarm Optimization (PSO) has potential applications in electric drives. Theexcellent characteristics of PSO may be successfully used to optimize the performance ofelectric machines in many aspects.In this chapter, a field-oriented controller that is based on Particle Swarm Optimization ispresented. In this system, the speed control of two asymmetrical windings induction motoris achieved while maintaining maximum efficiency of the motor. PSO selects the optimalrotor flux level at any operating point. In addition, the electromagnetic torque is alsoimproved while maintaining a fast dynamic response. A novel approach is used to evaluatethe optimal rotor flux level by using Particle Swarm Optimization. PSO method is amember of the wide category of Swarm Intelligence methods (SI). There are two speedcontrol strategies will demonstrate in next sections. These are field-oriented controller(FOC), and FOC based on PSO. The strategies are implemented mathematically andexperimental. The simulation and experimental results have demonstrated that the FOCbased on PSO method saves more energy than the conventional FOC method.In this chapter, another application of PSO for losses and operating cost minimizationcontrol is presented for the induction motor drives. Two strategies for induction motorspeed control are proposed in this section. These strategies are based on PSO and calledmaximum efficiency strategy and minimum operating cost Strategy. The proposedtechnique is based on the principle that the flux level in a machine can be adjusted to givethe minimum amount of losses and minimum operating cost for a given value of speed andload torque.In the demonstrated systems, the flux and torque hysteresis bands are the only adjustableparameters to achieve direct torque control (DTC) of induction motors. Their selectiongreatly influences the inverter switching loss, motor harmonic loss and motor torqueripples, which are the major performance criteria. In this section, the effects of flux andtorque hysteresis bands are investigated and optimized by the particle swarms optimizationtechnique. A DTC control strategy with variable hysteresis bands, which improves thedrive performance compared to the classical DTC, is presented.Online Artificial Neural Networks (ANNs) could be also trained based on PSO optimizeddata. Here the fast response of ANN is used to optimize the operating conditions of themachine.

19.
Particle Swarm Optimization12It is very important to note that, these applications were achieved without any additionalhardware cost, because the PSO is a software scheme. Consequently, PSO has positivepromises for a wide range of variable speed drive applications.2. Losses Minimization of Two Asymmetrical Windings Induction MotorIn this section, applying field orientation based on Particle Swarm Optimization (PSO)controls the speed of two-asymmetrical windings induction motor is the first application ofPSO. The maximum efficiency of the motor is obtained by the evaluation of optimal rotorflux at any operating point. In addition, the electro-magnetic torque is also improved whilemaintaining a fast dynamic response. In this section, a novel approach is used to evaluatethe optimal rotor flux level. This approach is based on Particle Swarm Optimization(PSO). This section presents two speed control strategies. These are field-orientedcontroller (FOC) and FOC based on PSO. The strategies are implemented mathematicallyand experimental. The simulation and experimental results have demonstrated that the FOCbased on PSO method saves more energy than the conventional FOC method.The two asymmetrical windings induction motor is treated as a two-phase induction motor(TPIM). It is used in many low power applications, where three–phase supply is not readilyavailable. This type of motor runs at an efficiency range of 50% to 65% at rated operatingconditions [1, 2].The conventional field-oriented controller normally operates at rated flux at any values withits torque range. When the load is reduced considerably, the core losses become so highcausing poor efficiency. If significant energy savings are required, it is necessary tooptimize the efficiency of the motor. The optimum efficiency is obtained by the evaluation ofthe optimal rotor flux level . This flux level is varied according to the torque and the speedof the operating point.PSO is applied to evaluate the optimal flux. It has the straightforward goal of minimizingthe total losses for a given load and speed. It is shown that the efficiency is reasonably closeto optimal.2.1 Mathematical Model of the MotorThe d-q model of an unsymmetrical windings induction motor in a stationary referenceframe can be used for a dynamic analysis. This model can take in account the core losses.The d-q model as applied to TPIM is described in [1, 2]. The equivalent circuit is shown infig. 1. The machine model may be expressed by the following voltage and flux linkageequations :Voltage Equations:qsqsmqs pirv λ+= (1)dsdsads pirv λ+= (2)qrdrrqrr pkir λλω +−= *)/1(0 (3)

21.
Particle Swarm Optimization14Dynamic equation is given as follows:rmrml BpjTTe ωω +=− (12)2.2 Field-Oriented Controller [FOC]The stator windings of the motor are unbalanced. The machine parameters differ from the daxis to the q axis. The waveform of the electromagnetic torque demonstrates the unbalanceof the system. The torque in equation (11) contains an AC term; it can be observed that twovalues are presented for the referred magnetizing inductance. It is possible to eliminate theAC term of electro-magnetic torque by an appropriate control of the stator currents.However, these relations are valid only in linear conditions. Furthermore, the model isimplemented using a non-referred equivalent circuit, which presumes some complicatedmeasurement of the magnetizing mutual inductance of the stator and the rotor circuits [3].The indirect field-oriented control scheme is the most popular scheme for field-orientedcontrollers. It provides decoupling between the torque of flux currents. The electric torquemust be a function of the stator currents and rotor flux in synchronous reference frame [6].Assuming that the stator currents can be imposed as:1dsdsssii = (13)1qssqssiki = (14)Where: k= Msrd / Msrq[ ]qrdrsdsssdrsqsssqrre iMiMLPT λλ −=2(15)By substituting the variables ids, and iqs by auxiliary variables ids1, and iqs1 into (15) thetorque can be expressed by[ ]qrdsdrqsssssrsdre iiLMPT λλ 112−= (16)In synchronous reference frame, the electromagnetic torque is expressed as :[ ]qrdsdrqseeeersdre iiLMPT λλ 112−= (17)[ ]rqseersdre iLMPT λ12= (18)

22.
Swarm Intelligence Applications in Electric Machines 15sdrredseMiλ=1(19)1*qserrsdrre iMλτωω =− (20)2.3 Model with the Losses of two asymmetrical windings induction motorFinding the losses expression for the two asymmetrical windings induction motor withlosses model is a very complex. In this section, a simplified induction motor model withiron losses will be developed [4]. For this purpose, it is necessary to transform all machinevariables to the synchronous reference frame. The voltage equations are written inexpanded form as follows:)(emdmdesdlaeeqmmqeqslmeqsmeqs iLiLdtdiLdtdiLirv ++++= ω (21))(emqmqesqlmeedmmdedslaedsaeds iLiLdtdiLdtdiLirv +−++= ω (22))(0 edmmdedrlRsleqmmqeqrlreqrr iLiLkdtdiLdtdiLir ++++=ω(23))(*0 eqmmqeqrlrsledmmdedrlRedrR iLiLkdtdiLdtdiLir +−++= ω (24)eqmeqfeeqreqs iiii +=+ (25)edmedfeedreds iiii +=+ (26)Where:dfeedmedfeqfeeqmedfeRvi;Rvi ==eqsrmqslreedm iLLLvω−= (27)

24.
Swarm Intelligence Applications in Electric Machines 17Where:Friction power losses = F ∗ωr2 , andOutput power (Po) = TL∗ωr.The equation (31) is the cost function, which depends on rotor flux (λr) according to theoperating point. Figure 2 presents the distribution of losses in motor and its variation withthe flux. As the flux reduces from the rated value, the core losses decrease, but the motorcopper losses increase. However, the total losses decrease to a minimum value and thenincrease again. It is desirable to set the rotor flux at the optimal value, so that the efficiencyis optimum.Figure 2. Losses variation of the motor with varying fluxThe function of the losses minimization of the motor problem can be formulated as follows:Minimize Total Losses which are a function of λ , Te , and ωr• The losses formula is the cost function of PSO. The particle swarm optimization (PSO)technique is used for minimizing this cost function.• The PSO is applied to evaluate the optimal rotor flux that minimizes the motor losses atany operating point. Figure 3 presents the flowchart of the execution of PSO, whichevaluates the optimal flux by using MATLAB /SIMULINK.

25.
Particle Swarm Optimization18Areall possible operatingconditions optimizedvarying the rotorflux level using PSORun the Simulik model of two asymmetricalwindings induction motor with lossesDetermination of the newoperation conditions(speed and torque)Read motor parametersStartcalculation of the costfunctionIsthe value ofthe costfunction isminimum?Noset this value as optimum pointand record the correspondingoptimum values of the efficiencyand the rotor flux loadEndYesNoYesCalculation of motor currentsFigure 3. The flowchart of the execution of PSO

26.
Swarm Intelligence Applications in Electric Machines 19The optimal flux is the input of the indirect rotor flux oriented controller. The indirect field-oriented controller generates the required two reference currents to drive the motorcorresponding to the optimal flux. These currents are fed to the hysteresis current controllerof the two-level inverter. The switching pattern is generated according to the differencebetween the reference current and the load current through the hysteresis band. Figure 4shows a whole control diagram of the proposed losses-minimization control system.PSOM/CParamertersTl NrFOTe*ϕ*iqs*=ia ref.ids*= ib ref.Four SwitchInverter[FSI]Rotormainauxib actualia actualHysteresis-bandcurrent controlflux optimalVdc VdcFigure 4. Proposed losses minimization control system2.4 Simulation study with FOCThe motor used in this study has the following parameters, which were measured byusing experimental tests . The FOC module is developed with closed loop speed control.The input of the FOC module is the reference speed and the rated rotor flux. The field–oriented controller generates the required reference currents to drive the motor as shown infig.5. These currents are based on the flux level, which determines the value of directcurrent, and the reference torque, which determines the value of quadrature current. Thereference torque is calculated according to the speed error. In this section, six-cases ofmotor operation with FOC are presented.FOTe*ϕ*iqs*=iaref.ids*= ibref.FourSwitchInverter[FSI]Rotormainauxib actualia actualHysteresis-bandcurrent controlVdcFigure 5. Block diagram of indirect rotor flux oriented control of the motor

27.
Particle Swarm Optimization20Figure 6 shows the performance of the motor at case (1), where the motor is loaded by0.25p.u. The control technique based on the PI controller has been developed. Theproportional (Kp) and integral (Ki) constants of PI controller are chosen by trial and error.The speed-time curve for the motor is shown in fig. 6a. It is noticed that the speedoscillations are eliminated when the FOC is applied to the drive system.Figure 6b illustrates the developed torque-time curve of the motor. In this figure, thepulsating torque is eliminated.(a)(b)

29.
Particle Swarm Optimization22It is clear that, the indirect field-oriented controller with a rated rotor flux generally exhibitspoor efficiency of the motor at light load. If significant energy savings need to be obtained,it is necessary to optimize the efficiency of the motor. The optimum efficiency of the motoris obtained by the evaluation of the optimal rotor flux level.2.5 Losses minimization control schemeAs swarm intelligence is based on real life observations of social animals (usually insects), itis more flexibility and robust than any traditional optimization methods. PSO method is amember of the wide category of swarm intelligence methods (SI). In this section, PSO isapplied to evaluate the optimal flux that minimizes the motor losses. The problem can beformulated as follows:Minimize Total Losses which are a function of λ , Te , and ωr• The motor used as a two-asymmetrical windings induction motor. The parameters usedare shown in Table 2 [10].Parameters ValuePopulation size 10Max. iter 50c1 0.5c2 0.5Max. weight 1.4Min. weight 0.1r1 [ 0,1]r2 [ 0,1]Lbnd 0.2upbnd 2Table 2. PSO Algorithm ParametersA simplified block diagram of the proposed speed control scheme is shown in fig.7.PSOM/CParamertersTl NrFOTe*ϕ*iqs*=ia ref.ids*= ibref.Four SwitchInverter[FSI]Rotormainauxib actualia actualHysteresis-bandcurrent controlflux optimalVdcFigure 7. Proposed losses minimization control system

30.
Swarm Intelligence Applications in Electric Machines 23A Four-Switch Inverter (FSI) feeds the two-asymmetrical windings induction motor. Theoptimal flux is fed to the indirect rotor flux oriented control. The indirect field-orientedcontrol generates the required reference current to drive the motor corresponding to thisflux2.6 Simulation results with FO based on PSOThe optimal rotor flux provides the maximum efficiency at any operating point, next theprevious six-cases are repeated by using FOC based on PSO. PSO will evaluate the optimalrotor flux level. This flux is fed to the FOC module. Figure 8 shows the performance of themotor at case (1), when PSO is applied side-by-side FOC.(a)(b)

32.
Swarm Intelligence Applications in Electric Machines 25It is noticed that, the PSO implementation increased the efficiency of the motor to 46.11% athalf the rated speed. The six-cases are summarized in Table 3.Torque load(TL) p.uSpeed (N) Optimal flux(p.u) Efficiency (%)0.25 0.5 Nrated 0.636 46.110.375 0.5 Nrated 0.6906 49.150.5 0.5 Nrated 0.722 57.110.6125 0.5 Nrated 0.761 62.340.75 0.5 Nrated 0.8312 65.311 0.5 Nrated 0.8722 68.15Table 3. The summary of the six-cases at optimal fluxIn practical system, the flux level based on PSO at different operating points ( torque andspeed) is calculated and stored in a look up table. The use of look up table will enable thesystem to work in real time without any delay that might be needed to calculate the optimalpoint. The proposed controller would receive the operating point (torque and speed) andget the optimum flux from the look up table. It will generate the required reference current.It is noticed that, the efficiency with the FOC based on PSO method is higher than theefficiency with the FOC method only.2.7 Experimental ResultsTo verify the validity of the proposed control scheme, a laboratory prototype is built andtested. The basic elements of the proposed experimental scheme are shown in fig. 9 and fig.10. The experimental results of the motor are achieved by coupling the motor to an eddycurrent dynamometer. The experimental results are achieved using two control methods:• Field-Oriented Control [FOC], and• Field-Oriented Control [FOC] based on PSO.The reference and the actual motor currents are fed to the hysteresis current controller. Theswitching pattern of the two-level four-switch inverter [FSI] is generated according to thedifference between the reference currents and the load currents. Figure 11 shows theexperimental results of the motor with FOC at case (1), where the motor is loaded by Tl =0.25 p.u.The measured input power of the motor is about 169 watts, and then the efficiency iscalculated about 44.92 %, whereas the efficiency with FOC is 32.30 %. It is noticed that, thePSO implementation increased the efficiency of the motor by 12.62 %. The cases aresummarized in Table 4 as follows.FOC FOC with PSOCasesFluxp.uPowerInputη(%)Fluxp.uPowerInputη(%)(1) 1 235 32.3 0.636 169 44.92(2) 1 323 35.2 0.690 243 47.06Table 5 the summary of the two-cases

33.
Particle Swarm Optimization26The improvement of the efficiency in case (1) is around 12.62 % when PSO is applied. Theimprovement of the efficiency in case (2) is around 11.84 %, where the motor is loaded by Tl= 0.375 p.u. These results demonstrate that, the FOC based on PSO method saves moreenergy than conventional FOC method. Thus, the efficiency with PSO is improved than itsat FOC.PIIndirectField-Orienteddq-->abtransfor-mePSOHystersiscurrentcontrollerInverterTwo dc-supplyM/cparamatersRotorωrefNrTlT*eφ*isqsisdsSwitchingPatterniaib4IaactIbactShaftencoderIa_refIb_refωactualINTER-FACE+-ωactualFigure 9. Block diagram of the proposed drive systemG1 G2EdcEdcDSDSDSDSidsiqsauxrotormainRsCsRsCsRsCsRsCsD2D1D3 D4S1 S2G2S2G4S4Figure 10. The power circuit of Four Switch inverter [FSI]

35.
Particle Swarm Optimization28The measured total input power of the motor is 235 watts. The efficiency is calculated fromequation (33). The efficiency is found to be equal to 32.30 %. Figure 11 shows theexperimental result of the motor with FOC based on PSO at case (1).(a)(b)Figure 11. Experimental results of FOC method based on PSO. (a) The reference and actualcurrent in q-axis, (b)The reference and actual current in d-axis3. Maximum Efficiency and Minimum Operating Cost of Induction motorsThis section presents another application of PSO for losses and operating cost minimizationcontrol in the induction motor drives. In this paper, two strategies for induction motorspeed control are proposed. Those two strategies are based on PSO and called Maximum

36.
Swarm Intelligence Applications in Electric Machines 29Efficiency Strategy and Minimum Operating Cost Strategy. The proposed technique isbased on the principle that the flux level in the machine can be adjusted to give theminimum amount of losses and minimum operating cost for a given value of speed andload torque. The main advantages of the proposed technique are; its simple structure and itsstraightforward maximization of induction motor efficiency and its operating cost for agiven load torque. As will be demonstrated, PSO is so efficient in finding the optimumoperating machines flux level. The optimum flux level is a function of the machineoperating point.Simulation results show that a considerable energy and cost savings are achieved incomparison with the conventional method of operation under the condition of constantvoltage to frequency ratio [5, 6].It is estimated that, electric machines consume more than 50% of the world electric energygenerated. Improving efficiency in electric drives is important, mainly, for two reasons:economic saving and reduction of environmental pollution. Induction motors have a highefficiency at rated speed and torque. However, at light loads, the iron losses increasedramatically, reducing considerably the efficiency. The main induction motor losses areusually split into 5 components: stator copper losses, rotor copper losses, iron losses,mechanical losses, and stray losses.The efficiency that decreases with increasing losses can be improved by minimizing thelosses. Copper losses reduce with decreasing the stator and the rotor currents, while the corelosses essentially increase with increasing air-gap flux density. A study of the copper andcore losses components reveals that their trends conflict. When the core losses increase, thecopper losses tends to decrease. However, for a given load torque, there is an air-gap fluxdensity at which the total losses is minimized. Hence, electrical losses minimization processultimately comes down to the selection of the appropriate air-gap flux density of operation.Since the air-gap flux density must be variable when the load is changing, control schemesin which the (rotor, air-gap) flux linkage is constant will yield sub-optimal efficiencyoperation especially when the load is light. Then to improve the motor efficiency, the fluxmust be reduced when it operates under light load conditions by obtaining a balancebetween copper and iron losses.The challenge to engineers, however, is to be able to predict the appropriate flux values atany operating points over the complete torque and speed range which will minimize themachines losses, hence maximizing the efficiency. In general, there are three differentapproaches to improve the induction motor efficiency especially under light-loadconditions.a. Losses Model Controller (LMC)This controller depends on a motor losses model to compute the optimum flux analytically.The main advantage of this approach is its simplicity and it does not require extra hardware.In addition, it provides smooth and fast adaptation of the flux, and may offer optimalperformance during transient operation. However, the main problem of this approach isthat it requires the exact values of machine parameters. These parameters include the corelosses and the main inductance flux saturation, which are unknown to the users and changeconsiderably with temperature, saturation, and skin effect. In addition, these parametersmay vary due to changes in the operating conditions. However, with continuing

37.
Particle Swarm Optimization30improvement of evolutionary parameter determination algorithms, the disadvantages ofmotor parameters dependency are slowly disappearing.b. Search Controller (SC)This controller measures the input power of the machine drive regularly at fixed timeintervals and searches for the flux value, which results in minimum power input for givenvalues of speed and load torque [5]. This particular method does not demand knowledge ofthe machine parameters and the search procedure is simple to implement.However, some disadvantages appear in practice, such as continuous disturbances in thetorque, slow adaptation (7sec.), difficulties in tuning the algorithm for a given application,and the need for precise load information. In addition, the precision of the measurementsmay be poor due to signal noise and disturbances. This in turn may cause the SC method togive undesirable control performance. Moreover, nominal flux is applied in transient stateand is tuned after the system reaches steady state to an optimal value by numerousincrements, thus lengthening the optimization process. Therefore, the SC technique may beslow in obtaining the optimal point. In addition, in real systems, it may not reach a steadystate and so cause oscillations in the air gap flux that result in undesirable torquedisturbances. For these reasons, this is not a good method in industrial drives.c. Look Up Table SchemeIt gives the optimal flux level at different operating points. This table, however, requirescostly and time-consuming prior measurements for each motor . In this section, a newcontrol strategy uses the loss model controller based on PSO is proposed. This strategy issimple in structure and has the straightforward goal of maximizing the efficiency for a givenload torque. The resulting induction motor efficiency is reasonably close to optimal. It iswell known that the presence of uncertainties ,the rotor resistance, for instance makes theresult no more optimal. Digital computer simulation results are obtained to demonstrate theeffectiveness of the proposed method.3.1 Differences between PSO and Other Evolutionary Computation (EC) TechniquesThe most striking difference between PSO and the other evolutionary algorithms is that PSOchooses the path of cooperation over competition. The other algorithms commonly use someform of decimation, survival of the fittest. In contrast, the PSO population is stable andindividuals are not destroyed or created. Individuals are influenced by the bestperformance of their neighbors. Individuals eventually converge on optimal points in theproblem domain. In addition, the PSO traditionally does not have genetic operators likecrossover between individuals and mutation, and other individuals never substituteparticles during the run. Instead, the PSO refines its search by attracting the particles topositions with good solutions. Moreover, compared with genetic algorithms (GAs), theinformation sharing mechanism in PSO is significantly different. In GAs, chromosomesshare information with each other. So the whole population moves like a one group towardsan optimal area. In PSO, only Gbest (or Pbest) gives out the information to others. It is a one-way information sharing mechanism. The evolution only looks for the best solution. In PSO,all the particles tend to converge to the best solution quickly, comparing with GA, even inthe local version in most cases [7, 8].

38.
Swarm Intelligence Applications in Electric Machines 313.2 Definition of Operating StrategiesThe following definitions are useful in subsequent analyses. Referring to the analysis of theinduction motor presented in [3], the per-unit frequency is(34)The slip is defined by(35)The rotor current is given by(36)The electromagnetic torque is given by(37)The stator current is related to the air gap flux and the electromagnetic torque as:(38)WhereThe air gap flux is related to the electromagnetic torque as:(39)

39.
Particle Swarm Optimization32The efficiency is defined as the output power divided by the electric power supplied to thestator (inverter losses are included):(40)3.1.1 Maximum Efficiency StrategyIn MES (Maximum Efficiency Strategy), the slip frequency is adjusted so that the efficiencyof the induction motor drive system is maximized.The induction motor losses are the following:1. Copper losses: these are due to flow of the electric current through the stator and rotorwindings and are given by:(41)2. Iron losses: these are the losses due to eddy current and hysteresis, given by(42)3. Stray losses: these arise on the copper and iron of the motor and are given by:(43)4. Mechanical losses: these are due to the friction of the machine rotor with the bearingsand are given by(44)5. Inverter losses : The approximate inverter loss as a function of stator current is givenby:(45)Where: K1inv, K2inv are coefficients determined by the electrical characteristics of a switchingelement where: K1inv= 3.1307e-005, K2inv=0.0250.The total power losses are expressed as:(46)

40.
Swarm Intelligence Applications in Electric Machines 33The output power is given by:(47)The input power is given by:(48)The efficiency is expressed as:(49)The efficiency maximization of the induction motor problem can be formulated as follows:(50)The maximization should observe the fact that the amplitude of the stator current and fluxcannot exceed their specified maximum point.3.2.2 Minimum Operating Cost StrategyIn Minimum Operating cost Strategy (MOCS), the slip frequency is adjusted so that theoperating cost of the induction motor is minimized. The operating cost of the inductionmachine should be calculated over the whole life cycle of the machine. That calculation canbe made to evaluate the cost of the consumed electrical energy. The value of average energycost considering the power factor penalties can be determined by the following stages:1. If 0 ≤ PF < 0.7(51)

41.
Particle Swarm Optimization342. If 0.7 ≤ PF ≤ 0.92, If PF ≥ 0.9, PF = 0.9(52)3. If 0.9 ≤ PF ≤ 1, If 0.95 ≤ PF ≤ 1, PF = 0.95(53)If the average energy cost C is calculated, it can be used to establish the present value oflosses. The total cost of the machine is the sum of its initial cost plus the present worth valueof losses and maintenance costs.(54)Where:PWL = present worth value of lossesC0 = energy cost (L.E/KwH), L.E is the Egyptian PoundC = modified energy cost (L.E/KwH)T = running time per year (Hrs / year)N = evaluation life (years)Pout = the output power (Kwatt)η = the efficiencyThe operating cost minimization of the induction motor problem can be formulated as follows:(55)The optimization in each case should observe the fact that the amplitude of the statorcurrent and flux cannot exceed their specified maximum.3.3 Simulation ResultsThe simulation is carried out on a three-phase, 380 V, 1-HP, 50 Hz, and 4-pole, squirrel cageinduction motor. The motor parameters are Rs=0.0598, Xls=0.0364, Xm=0.8564, Xlr=0.0546,Rr=0.0403, Ke=0.0380, Kh=0.0380, Cstr =0.0150, Cfw=0.0093, S1=1.07, S2=-0.69, S3=0.77. Forcost analysis, the following values were assumed: C0=0.05, N=15, T=8000. Figure 12 showsthe efficiency variation with respect to the rotor and slip speed at various levels of loadtorque. At certain load torque and rotor speed, a certain value of slip frequency at whichthe maximum efficiency occurs is optimal. The task of PSO controller is to find that value ofslip at which the maximum efficiency occurs. At certain load torque and rotor speed, thePSO controller determines the slip frequency ωs at which the maximum efficiency andminimum operating cost occur. The block diagram of the optimization process based on

42.
Swarm Intelligence Applications in Electric Machines 35PSO is shown in fig.13. In the proposed controller, the PSO algorithm receives the rotorspeed, load torque, and the fitness function (efficiency equation).The PSO determines the slip frequency at which the maximum efficiency or minimumoperating cost occurs at that rotor speed and load torque. Figures (14) and (15) show theefficiency of the machine as a function of the load torque and rotor speed under constantvoltage to frequency ratio strategy and field oriented control strategy. From these figures itis obvious that, the efficiency decreases substantially when either the torque or rotor speedis small. On the other hand, fig. 16 shows the efficiency versus the load torque and rotorspeed using the proposed technique (MES). This figure shows a great improving inefficiency especially at light loads and small rotor speed. To observe the improvements inefficiency using the suggested PSO controller, fig. 17 shows the efficiency of the selectedmachine for all operating conditions using conventional methods (constant voltage tofrequency ratio, field oriented control strategy) and using the proposed PSO controller atdifferent rotor speed levels, Wr = 0.2 PU, and Wr = 1 PU respectively. This figure shows thata considerable energy saving is achieved in comparison with the conventional method (fieldoriented control strategy and constant voltage to frequency ratio). Table (1) shows theefficiency comparison using few examples of operating points.Figure 12. Efficiency versus rotor speed and slip speed at load torque TL = 1 PUFigure 13. The proposed drive system based on PSO

44.
Swarm Intelligence Applications in Electric Machines 37Table 1. Some examples of efficiency comparison under different Load torque levelsand Wr = 1 PUFigure (10) compares the efficiency of the induction motor drive system under themaximum efficiency strategy with the minimum operating cost strategy at Wr = 0.2 PU andWr = 1 PU, respectively. It is obvious from the figure that the efficiency is almost the samefor both strategies for all operating points. On the other hand, fig. 11 shows the percentageof the operating cost saving for the two strategies for Wr = 0.2 and Wr = 1 PU respectively.The percentage of the operating cost saving is calculated according to the followingequation:(56)Where: PWlMES is the present worth value of losses under MES, and PWlMOCS is the presentworth value of losses under MOCS. It is obvious from fig (11) that the saving has anoticeable value especially at light loads and rated speed that can as high as 11.2 %. It isclear that the PWL using the minimum operating cost strategy is less than the PWL usingthe maximum efficiency strategy. This difference in operating cost is shown in table (2). Thereason for that difference is due to the difference in their power factor values. The differencein power factor values is shown in fig.12.

48.
Swarm Intelligence Applications in Electric Machines 41Figure 12. The Power factor of the induction motor using the maximum efficiency strategycompared with the Power factor using minimum operating cost strategy for different rotorspeed levels, (a) Wr = 0.2 PU, (b) Wr= 1 PUFinally, this section presents the application of PSO for losses and operating costminimization control in the induction motor drives. Two strategies for induction motorspeed control are proposed. Those two strategies are based on PSO and called MaximumEfficiency Strategy and Minimum Operating Cost Strategy. The proposed PSO-controlleradaptively adjusts the slip frequency such that the drive system is operated at the minimumloss and minimum operating cost. It was found that the optimal system slip changes withvariations in speed and load torque. When comparing the proposed strategy with theconventional methods field oriented control strategy and constant voltage to frequencyratio), It was found that a significant efficiency improvement It was found that a significantefficiency improvement is found at light loads for all speeds. On the other hand, smallefficiency improvement is achieved at near rated loads. Finally, when comparing the MOCSwith MES, it was found that, the saving in PWL using the MOCS is greater than that of theMES, especially at light loads and rated speed.

49.
Particle Swarm Optimization424. Particle Swarm Optimized Direct Torque Control of Induction MotorsThe flux and torque hysteresis bands are the only adjustable parameters in directtorque control (DTC) of induction motors. Their selection greatly influences the inverterswitching loss, motor harmonic loss and motor torque ripples, which are major performancecriteria. In this section, the effects of flux and torque hysteresis bands on these criteriaare investigated and optimized via the minimization, by the particle swarm optimization(PSO) technique, of a suitably selected cost function. A DTC control strategy with variablehysteresis bands, which improves the drive performance compared to the classical DTC, isproposed. Online operating Artificial Neural Networks (ANNs) use the offline optimumvalues obtained by PSO, to modify the hysteresis bands in order to improve theperformance. The implementation of the proposed scheme is illustrated by simulationresults [9].In this section, the effects of flux and torque hysteresis bands on inverter switching loss,motor harmonic loss and motor torque ripple of induction motor are investigated. To reducespeed and torque ripples it is desirable to make the hysteresis band as small as possible,thus increasing the switching frequency, which results in reduced efficiency of the drive byenlarging the inverter switching and motor harmonic losses. Hence, these hysteresis bandsshould be optimized in order to achieve a suitable compromise between efficiency anddynamic performance. In order to find their optimum values at each operating condition, acost function combining losses and torque ripples is defined and optimized. A DTC controlstrategy with variable hysteresis bands is proposed, such that the optimum hysteresis bandvalues are used at each operating condition. The proposed method combines the emergingParticle Swarm Optimization (PSO) for offline optimization of the cost function and theANN technique for online determination of the suitable hysteresis band values at theoperating point.4.1 DTC Performance Cost Function OptimizationThe design of the DTC involves the selection of suitable hysteresis band. In this section, thehysteresis band is selected so that it results in an optimal performance cost function. Sincethe optimal hysteresis bands depend on the operating conditions, the optimizationprocedure is implemented via PSO at several operating conditions that covers the possibleworking conditions of the drive system [9, 10, 11]. Fig. 13 shows the flow chart of theoptimization method. A computer model of the overall drive system has beendeveloped using MATLAB/SIMULINK software. The simulations have beenperformed for a 10 Hp induction motor (the motor parameters are given in the appendix).The cost function is expressed as follows:(57)Where:ΔTe: is the torque hysteresis band,Δλs : is the flux hysteresis band,PIL: is inverter switching loss,PC: is core loss, andWi : is a designer specified weighting factor.

50.
Swarm Intelligence Applications in Electric Machines 43The weighting terms are selected to be W1 = 0.2, W2 = 0.2 and W3 = 0.6. The reduction oftorque ripples is the most important objective of the optimization. In the thirty-six differentoperating conditions, corresponding to the combination of six different speed and sixdifferent load torque values, are considered. The harmonic spectrum of the motor stator fluxis calculated up to 30th harmonic and the Simulink model is run for 2.5 seconds. For PSO,the following parameters are used: Size of the swarm = 10, maximum number ofiterations = 100, maximum inertia weight’s value = 1.2, minimum inertia weight’s value =0.1, C1 =C2 = 0.5 ,lower and upper bound for initial position of the swarm are 0 and 20respectively maximum initial velocities value = 2 and the weight vary linearly from 1.2 to0.1. Table 1 presents the optimum torque and flux hysteresis bands (TB, and FBrespectively) obtained by PSO.Table 3. The optimum hysteresis bands obtained by PSO optimization process4.2 Neural Network Controller For DTCIn the previous section, PSO is used as an offline optimization technique that determines theoptimal values of the hysteresis bands. These bands depend on loading conditions. Toensure keeping the drive system running at the optimal performance cost function, thehysteresis band must be changed online depending on the current operating conditions.Neural networks (NNs) have good approximation ability and can interpolate andextrapolate its training data. Hence, to achieve the online selection of the hysteresis bands,two neural networks are trained by the offline optimum results obtained by PSO for fluxand torque bands respectively. The inputs of these NN are the desired motor speed and thedesired load torque.The two considered NNs are Feed-forward type networks. Each NN has two inputs, oneoutput, and two layers. The flux neural network has 8 neurons in the input layer and oneneuron in the output layer. The torque neural network has 9 neurons in the input layer andone neuron in the output layer. The activation function of the hidden layer is log sigmoidwhile the output layer is linear. For both networks, the Neural Network Matlab Toolbox isused for the training. The training algorithm selected is Levenberg-Marquarbt backpropagation, the adaptation learning function is "trains" sequential order incrementalupdate, and the performance function is the sum-squared error.

52.
Swarm Intelligence Applications in Electric Machines 454.3 Comparison Between Classical and the Neural Network Controller for DTCSimulations have been performed for the above mentioned 10 Hp induction motor tocompare between the classical and the neural network controller for direct torque controlledIM. For classical DTC the results have been obtained for flux and torque hysteresis bandamplitude equal to 2 %. In neural network Controller the above flux and torque neuralnetworks are used to set the optimal hysteresis bands. Fig. 14 and Fig. 15 show thesimulation results for the classical and the neural network controller respectively for a testrun that covers wide operating range. It is clear that, the proposed scheme achieves aconsiderable reduction in inverter switching loss, motor harmonic loss, and motor torqueripple of the direct torque controlled induction motor drives compared to theClassical DTC. Table 4 shows the comparison between classical DTC and NN DTCTable 4. Comparison between classical and NN controller for DTCFigure 14. The classical direct torque controlled IM simulation results

56.
3Particle Swarm Optimization for HW/SWPartitioningM. B. Abdelhalim and S. E. –D. HabibElectronics and Communications Department, Faculty of Engineering - Cairo UniversityEgypt1. IntroductionEmbedded systems typically consist of application specific hardware parts andprogrammable parts, e.g. processors like DSPs, core processors or ASIPs. In comparison tothe hardware parts, the software parts are much easier to develop and modify. Thus,software is less expensive in terms of costs and development time. Hardware, however,provides better performance. For this reason, a system designers goal is to design a systemfulfilling all system constraints. The co-design phase, during which the system specificationis partitioned onto hardware and programmable parts of the target architecture, is calledHardware/Software partitioning. This phase represents one key issue during the designprocess of heterogeneous systems. Some early co-design approaches [Marrec et al. 1998,Cloute et al. 1999] carried out the HW/SW partitioning task manually. This manualapproach is limited to small design problems with small number of constituent modules.Additionally, automatic Hardware/Software partitioning is of large interest because theproblem itself is a very complex optimization problem.Varieties of Hardware/Software partitioning approaches are available in the literature.Following Nieman [1998], these approaches can be distinguished by the following aspects:1. The complexity of the supported partitioning problem, e.g. whether the targetarchitecture is fixed or optimized during partitioning.2. The supported target architecture, e.g. single-processor or multi-processor, ASIC orFPGA-based hardware.3. The application domain, e.g. either data-flow or control-flow dominated systems.4. The optimization goal determined by the chosen cost function, e.g. hardwareminimization under timing (performance) constraints, performance maximizationunder resource constraints, or low power solutions.5. The optimization technique, including heuristic, probabilistic or exact methods,compared by computation time and the quality of results.6. The optimization aspects, e.g. whether communication and/or hardware sharing aretaken into account.7. The granularity of the pieces for which costs are estimated for partitioning, e.g. granulesat the statement, basic block, function, process or task level.8. The estimation method itself, whether the estimations are computed by specialestimation tools or by analyzing the results of synthesis tools and compilers.

57.
Particle Swarm Optimization509. The cost metrics used during partitioning, including cost metrics for hardwareimplementations (e.g. execution time, chip area, pin requirements, power consumption,testability metrics), software cost metrics (e.g. execution time, power consumption,program and data memory usage) and interface metrics (e.g. communication time oradditional resource-power costs).10. The number of these cost metrics, e.g. whether only one hardware solution isconsidered for each granule or a complete Area/Time curve.11. The degree of automation.12. The degree of user-interaction to exploit the valuable experience of the designer.13. The ability for Design-Space-Exploration (DSE) enabling the designer to comparedifferent partitions and to find alternative solutions for different objective functions inshort computation time.In this Chapter, we investigate the application of the Particle Swarm Optimization (PSO)technique for solving the Hardware/Software partitioning problem. The PSO is attractivefor the Hardware/Software partitioning problem as it offers reasonable coverage of thedesign space together with O(n) main loops execution time, where n is the number ofproposed solutions that will evolve to provide the final solution.This Chapter is an extended version of the authors’ 2006 paper [Abdelhalim et al. 2006]. Theorganization of this chapter is as follows: In Section 2, we introduce the HW/SWpartitioning problem. Section 3 introduces the Particle Swarm Optimization formulation forHW/SW Partitioning problem followed by a case study. Section 4 introduces the techniqueextensions, namely, hardware implementation alternatives, HW/SW communicationsmodeling, and fine tuning algorithm. Finally, Section 5 gives the conclusions of our work.2. HW/SW PartitioningThe most important challenge in the embedded system design is partitioning; i.e. decidingwhich components (or operations) of the system should be implemented in hardware andwhich ones in software. The granularity of each component can be a single instruction, ashort sequence of instructions, a basic block or a function (procedure). To clarify theHW/SW partitioning problem, let us represent the system by a Data Flow Graph (DFG) thatdefines the sequencing of the operations starting from the input capture to the outputevaluation. Each node in this DFG represents a component (or operation). Implementing agiven component in HW or in SW implies different delay/ area/ power/ design-time/time-to-market/ … design costs. The HW/SW partitioning problem is, thus, anoptimization problem where we seek to find the partition ( an assignment vector of eachcomponent to HW or SW) that minimizes a user-defined global cost function (or functions)subject to given area/ power/ delay …constraints. Finding an optimal HW/SW partition ishard because of the large number of possible solutions for a given granularity of the“components” and the many different alternatives for these granularities. In other words,the HW/SW partitioning problem is hard since the design (search) space is typically huge.The following survey overviews the main algorithms used to solve the HW/SW partitioningproblem. However, this survey is by no means comprehensive.Traditionally, partitioning was carried out manually as in the work of Marrec et al. [1998]and Cloute et al. [1999]. However, because of the increase of complexity of the systems,many research efforts aimed at automating the partitioning as much as possible. Thesuggested partition approaches differ significantly according to the definition they used to

58.
Particle Swarm Optimization for HW/SW Partitioning 51the problem. One of the main differences is whether to include other tasks (such as schedulingwhere starting times of the components should be determined) as in Lopez-Vallejo et al [2003]and in Mie et al. [2000], or just map components to hardware or software only as in the workof Vahid [2002] and Madsen et al [1997]. Some formulations assign communication events tolinks between hardware and/or software units as in Jha and Dick [1998]. The system to bepartitioned is generally given in the form of task graph, the graph nodes are determined by themodel granularity, i.e. the semantic of a node. The node could represent a single instruction,short sequence of instructions [Stitt et al. 2005], basic block [Knudsen et al. 1996], a function orprocedure [Ditzel 2004, and Armstrong et al. 2002]. A flexible granularity may also be usedwhere a node can represent any of the above [Vahid 2002; Henkel and Ernst 2001]. Regardingthe suggested algorithms, one can differentiate between exact and heuristic methods. Theproposed exact algorithms include, but are not limited to, branch-and-bound [Binh et al 1996],dynamic programming [Madsen et al. 1997], and integer linear programming [Nieman 1998;Ditzel 2004]. Due to the slow performance of the exact algorithms, heuristic-based algorithmsare proposed. In particular, Genetic algorithms are widely used [Nieman 1998; Mann 2004] aswell as simulated annealing [Armstrong et al 2002; Eles et al. 1997], hierarchical clustering[Eles et al. 1997], and Kernighan-Lin based algorithms such as in [Mann 2004]. Less popularheuristics are used such as Tabu search [Eles et al. 1997] and greedy algorithms [Chatha andVemuri 2001]. Some researchers used custom heuristics, such as Maximum Flow-MinimumCommunications (MFMC) [Mann 2004], Global Criticality/Local Phase (GCLP) [Kalavade andLee 1994], process complexity [Adhipathi 2004], the expert system presented in [Lopez-Vallejoet al. 2003], and Balanced/Unbalanced partitioning (BUB) [Stitt 2008].The ideal Hardware/Software partitioning tool produces automatically a set of high-qualitypartitions in a short, predictable computation time. Such tool would also allow the designer tointeract with the partitioning algorithm.De Souza et al. [2003] propose the concepts of ”quality requisites” and a method based onQuality Function Deployment (QFD) as references to represent both the advantages anddisadvantages of existing HW/SW partitioning methods, as well as, to define a set of featuresfor an optimized partitioning algorithm. They classified the algorithms according to thefollowing criterion:1. Application domain: whether they are "multi-domain" (conceived for more than one orany application domain, thus not considering particularities of these domains and beingtechnology-independent) or "specific domain" approaches.2. The target architecture type.3. Consideration for the HW-SW communication costs.4. Possibility of choosing the best implementation alternative of HW nodes.5. Possibility of sharing HW resources among two or more nodes.6. Exploitation of HW-SW parallelism.7. Single-mode or multi-mode systems with respect to the clock domains.In this Chapter, we present the use of the Particle Swarm Optimization techniques to solve theHW/SW partitioning problem. The aforementioned criterions will be implicitly consideredalong the algorithm presentation.3. Particle swarm optimizationParticle swarm optimization (PSO) is a population based stochastic optimization techniquedeveloped by Eberhart and Kennedy in 1995 [Kennedy and Eberhart 1995; Eberhart and

59.
Particle Swarm Optimization52Kennedy 1995; Eberhart and Shi 2001]. The PSO algorithm is inspired by social behavior ofbird flocking, animal hording, or fish schooling. In PSO, the potential solutions, calledparticles, fly through the problem space by following the current optimum particles. PSOhas been successfully applied in many areas. A good bibliography of PSO applications couldbe found in the work done by Poli [2007].3.1 PSO algorithmAs stated before, PSO simulates the behavior of bird flocking. Suppose the followingscenario: a group of birds is randomly searching for food in an area. There is only one pieceof food in the area being searched. Not all the birds know where the food is. However,during every iteration, they learn via their inter-communications, how far the food is.Therefore, the best strategy to find the food is to follow the bird that is nearest to the food.PSO learned from this bird-flocking scenario, and used it to solve optimization problems. InPSO, each single solution is a "bird" in the search space. We call it "particle". All of particleshave fitness values which are evaluated by the fitness function (the cost function to beoptimized), and have velocities which direct the flying of the particles. The particles flythrough the problem space by following the current optimum particles.PSO is initialized with a group of random particles (solutions) and then searches for optimaby updating generations. During every iteration, each particle is updated by following two"best" values. The first one is the position vector of the best solution (fitness) this particle hasachieved so far. The fitness value is also stored. This position is called pbest. Another "best"position that is tracked by the particle swarm optimizer is the best position, obtained so far,by any particle in the population. This best position is the current global best and is calledgbest.After finding the two best values, the particle updates its velocity and position according toequations (1) and (2) respectively.)xgbest(rc)xpbest(rcwvv ikk22iki11iki1k −+−+=+(1)i1kiki1k vxx ++ += (2)where ikv is the velocity of ith particle at the kth iteration, ikx is current the solution (orposition) of the ith particle. r1 and r2 are random numbers generated uniformly between 0and 1. c1 is the self-confidence (cognitive) factor and c2 is the swarm confidence (social)factor. Usually c1 and c2 are in the range from 1.5 to 2.5. Finally, w is the inertia factor thattakes linearly decreasing values downward from 1 to 0 according to a predefined number ofiterations as recommended by Haupt and Haupt [2004].The 1st term in equation (1) represents the effect of the inertia of the particle, the 2nd termrepresents the particle memory influence, and the 3rd term represents the swarm (society)influence. The flow chart of the procedure is shown in Fig. 1.The velocities of the particles on each dimension may be clamped to a maximum velocityVmax, which is a parameter specified by the user. If the sum of accelerations causes thevelocity on that dimension to exceed Vmax, then this velocity is limited to Vmax [Haupt andHaupt 2004]. Another type of clamping is to clamp the position of the current solution to acertain range in which the solution has valid value, otherwise the solution is meaningless[Haupt and Haupt 2004]. In this Chapter, position clamping is applied with no limitation onthe velocity values.

60.
Particle Swarm Optimization for HW/SW Partitioning 53Figure 1. PSO Flow chart3.2 Comparisons between GA and PSOThe Genetic Algorithm (GA) is an evolutionary optimizer (EO) that takes a sample ofpossible solutions (individuals) and employs mutation, crossover, and selection as theprimary operators for optimization. The details of GA are beyond the scope of this chapter,but interested readers can refer to Haupt and Haupt [2004]. In general, most of evolutionarytechniques have the following steps:1. Random generation of an initial population.2. Reckoning of a fitness value for each subject. This fitness value depends directly onthe distance to the optimum.3. Reproduction of the population based on fitness values.4. If requirements are met, then stop. Otherwise go back to step 2.From this procedure, we can learn that PSO shares many common points with GA. Bothalgorithms start with a group of randomly generated population and both algorithms havefitness values to evaluate the population, update the population and search for the optimumwith random techniques, and finally, check for the attainment of a valid solution.On the other hand, PSO does not have genetic operators like crossover and mutation. Particlesupdate themselves with the internal velocity. They also have memory, which is important tothe algorithm (even if this memory is very simple as it stores only pbesti and gbestk positions).