Design of fractional - order PID controller based on genetic algorithm
Lingxin Wang1, Chunyang Wang2 , Li Yu3,Yonghua Liu4,Jingxue Sun5
   1. School of Electronic and Information Engineering, Changchun University of Science and Technology, Changchun,130022,China
                                                      E-mail: 1203620712@qq.com
   2. School of Electronic and Information Engineering, Changchun University of Science and Technology, Changchun,130022,China
                                       E-mail: wangchunyang19@163.com(Corresponding Author)
   3. School of Electronic and Information Engineering, Changchun University of Science and Technology, Changchun,130022,China
                                                      E-mail:yuli_works@163.com
   4. School of Electronic and Information Engineering, Changchun University of Science and Technology, Changchun,130022,China
                                                       E-mail: 626941720@qq.com
   5. School of Electronic and Information Engineering, Changchun University of Science and Technology, Changchun,130022,China
                                                      E-mail: 1612851955@qq.com
         Abstract: Aiming at the characteristics that dynamic systems can be described by integral and differential equations
         involving non-integer orders, this tool is also introduced into fractional-order controllers, that is, controllers with
         fractional integral and differential. A modified genetic algorithm The integer order PID controller and the fractional
         order controller are used to simulate and compare the controller parameters of the integer and fractional order systems
         respectively by using the genetic algorithm, The results show that the fractional-order controller is better than the
         integer-order PID controller in the same parameter tuning range.
         Key words: genetic algorithm; fractional order PID; parameter tuning
          1    INTRODUCTION                                        code string of length n , the total number of
                                                                   codes that can be generated is 2n , and the
          The genetic algorithm is a kind of method which          encoding and coding method of the parameter is:
          can solve the problem by searching for the
                                                                                   "
                                                                                   000 	 
 = ymin
                                                                                         000
          solution space by simulating the most suitable                               n
                                                                                                             (1)                                                                                          
 = ymin + δ
          process of the biological organism in the natural                        000 " 001                                                                                   	
          evolution process of the organism. The variable                                   n
                                                                                           
 = ymax
          value in the domain of the problem to be solved
                                                                                      "
                                                                                      111 111
                                                                                         	
          is the object of study. Optimization Method for                                  n
          Optimal Solution. The advantage is not too much          Where δ indicates the accuracy of the
          dependent on other auxiliary conditions, but only        encoding, and the length of the code or the
          need to ensure that there is a suitable fitness          number of bits n , the value is:
          function, in a sufficient number of populations
                                                                                         ymax − ymin
          and the number of iterations case, for different                             δ=                   (2)
          problems can be the optimal solution or                                          2n − 1
          suboptimal Solution, independent of the specific         For a parameter value y , if y contains a
          problem areas.                                           fractional part and has a precision of m bits,
          2   PRINCIPLES OF GENETIC                                the binary code string shall satisfy:
          OPTIMIZATION ALGORITHM                                                2 n −1 < y − ymin < 2n − 1          (3)
                                                                   The process of converting the true value
          As the application of genetic algorithm is quite
          extensive, coding methods are also varied. At             y − ymin into a binary number for a point y
          present, there is not a set of strict and complete       in the interval is the binary coding process of the
          convincing guidance theory and standards to              parameter.
          design appropriate coding methods, commonly              For binary digital code string x decoding
          used coding methods are:                                 mode of operation is to set its decimal number is
          Binary coding: is the most basic encoding, the            demical ( x) :
          mathematical          symbol     set    is    binary
                                                                                      y max − y min
          symbols0and1binary symbol set {0,1}, the                      y = y min +       demical ( x ) (4)
          length of the code string need to solve the                              2n − 1
          problem according to the accuracy and                    Therefore, for a parameters, the encoding
          complexity of the problem determine. Assuming            length of each parameter is        n j , j = 1, 2," , a
          that the parameter has a spatial range of
                                                                   to be optimized, then all parameters are binary
          [ ymin , ymax ] , coding the parameter with a binary     coded into a binary code whose total length is:
978-1-5090-4657-7/17/$31.00 2017
                            c     IEEE                           808
             N = n1 + n2 + " + na              (5)      probability of the way the father of individual
                                                        selection to the offspring. Commonly used
Floating-Point      Coding:     Each     individual
                                                        methods are roulette methods, random
corresponds to a different floating-point number
                                                        competition, the best choice to retain, no
within the solution space. The number of
                                                        playback random selection , this selection of
floating-point numbers is equal to the number of
                                                        roulette methods.
variables to be solved. The coding method is
                                                        The Roulette Wheel Selection method is the
mainly used to solve some multidimensional and
                                                        operation of selecting the current solution in a
high precision continuous function optimization
                                                        put-back fashion according to the randomly
problems. The advantage of this method is that it
                                                        generated probability after converting the
can maintain better population diversity in
                                                        existing solution to probability. Assuming that
crossover operation and mutation operation,
especially in the larger solution space. , And the      the population of the current solution is N and
higher the accuracy of the lower complexity.            the fitness value of the i th individual is F (i ) ,
Specific steps are as follows:                          the probability of the individual being selected
(1) The parameters are encoded                          is:
From the solution space of the problem to be                                                  F (i)
solved, N initial values are randomly selected as                                 Pi =     N
                                                                                                                            (7)
the parent and constitute the initial population. In                                      ¦ F (i )
                                                                                           i =1
order to avoid the time occupation and precision
                                                        The N probability values are arranged in order
loss caused by the conversion between binary
and floating point (decimal), this paper adopts         from small to large. In the selection process,
the floating-point encoding method to encode the        randomly generated numbers between [0,1] are
                                                                       M +1               M
N initial values with easy-to-implement binary
encoding and floating-point encoding method.            between        ¦i =1
                                                                               pi and    ¦ p , (M < n) ,
                                                                                          i =1
                                                                                                  i                 then the
(2) Select the appropriate fitness function
Since the probability of choosing the parent to         Mth individual is selected to the next generation
the next generation is related to the individual        until N individuals are selected until. The
fitness value, it is also a probabilistic problem.      number of groups is limited and the random
Therefore, this method can not guarantee that           selection of the solution operation and other
individuals with high fitness values can select         reasons, each solution in the actual operation
the next generation, and individuals with low           was selected to the next generation of the
fitness values Can not be selected for the next         number of its selected number of times between
generation. The fitness function has a great                                                              n
influence on the optimization ability and               the expected value of n * F (i ) / ¦ F (i ) there is
                                                                                                         i =1
computation time of the genetic algorithm, and it
                                                        a certain error, This error is relatively large, the
needs to transform the fitness function in
                                                        result is even more adaptable individuals are not
different stages according to the needs. In the
                                                        necessarily selected, should find a way to solve
control theory, a commonly used fitness function
                                                        this loss because the optimal solution can not be
is often a combination of system error, control of
                                                        the optimal solution of the plight.
the form, one of the forms shown below, is also
                                                        Finally, you need to determine the location of the
used in this paper.
         ∞                                              intersection. Crossover operations include
                     2                                  pairing of individuals, determining the location
    J = ³ ( w1 e(t ) + w2u 2 (t ))dt + w3tr (6)         of the intersection and the number of crossovers.
         0
                                                        For a population of N individuals, a total of
Where    e(t ) is the error of the system and           [ N / 2] pairs can be dubbed, and [ X ] is the
 u (t ) is the controller quantity. The weighted        largest integer that does not exceed X . Many
integrals of these two items reflect the energy of      scholars have proposed various methods for
the system, to a certain extent, the stability of the   crossover operation, such as a single point of
system, w1 , w2 is the weight, representing the         intersection, multi-point crossover, etc., which
                                                        are well suited for binary coding cross operations,
error and the controller The importance of output       and arithmetic crossover for floating point
to affect the outcome. tr represents the rise           encoding.
                                                        A= (aa
                                                             1 2a3"aa i i+1 | ai+2ai+3 "aN )   A= (aa
                                                                                                    1 2a3"aa i i+1 | bi+2bi+3 "bN )
time of the system, and w3 is the                                                            →
                                                        B = (bbb
                                                              1 2 3 "bb
                                                                      i i+1 | b   b
                                                                               i+2 i+3 "bN )  B = (bbb
                                                                                                    1 2 3 " i i+1 | ai+2ai+3"aN )
                                                                                                           bb
corresponding weight.                                                    Figure 1 Single point crossover
(3) genetic manipulation process
Selection operation, also known as reproduction
operation, according to each generation of the
fitness function value converted to the
                   2017 29th Chinese Control And Decision Conference (CCDC)                                                           809
      A = (a1a2 a3 " ai ai +1 | ai + 2 ai +3 " ak −1 | ak ak +1 " aN )   Due to the certainty of mutation manipulation, it
       B = (b1b2b3 " bi bi +1 | bi + 2bi +3 " bk −1 | bk bk +1 " bN )    is possible to destroy the best gene, so a
                                                                         relatively low probability of mutation is used for
      →                                                                  the best gene and a higher probability of
      A = (a1a2 a3 " ai ai +1 | bi + 2bi +3 " bk −1 | ak ak +1 " aN )    mutation for a gene of lower fitness in order to
       B = (b1b2b3 " bi bi +1 | ai + 2 ai +3 " ak −1 | bk bk +1 " bN )   expect a better Of the gene. In this paper, we do
                      Figure 2 Two-point crossover                       not use the fixed mutation probability, but adopt
      In the above two figures, ai , bi (i < n) represents               the method of probability linear decreasing.
      a binary number of 0 and 1, and a vertical line                    3 DESIGN OF INTEGER ORDER
      (" | ") represents a cross position. Multipoint                    CONTROLLER
      crossover is similar to this. For a single-point
                                                                         The general structure of an integer-order PID
      crossover operation, each code has N − 1
                                                                         controller is as follows:
      cross-point, if you need two-point crossover,
      each lattice encoding ( N − 1)( N − 2) / 2 cross
                                                                                                   kp
                                                                              r        e                          u              y
      points. For a single point of intersection, the                                              ki                    p( s)
      method of operation is, for a string of code,                                -
                                                                                                   kd
      resulting in a probability of random Pc ∈ [0,1] ,
      then N * Pc represents the location of the cross,
                                                                                  Figure 3 integer order PID controller structure
      until the N individual operation is completed.                     The control law is:
      Two-point crossover and multipoint crossover                                                                    de(t )
      are similar to this method except that the                            u (t ) = k p e(t ) + ki ³ e(t ) dt + kd                  ˄10
      corresponding number of probabilities need to be                                                                 dt
      generated to determine the position at which to                                                        ˅
      cross.                                                             4  DESIGN OF FRACTIONAL
      For paired chromosomes A, B that encode                            ORDER CONTROLLER
      parameters as floating-point numbers, pairs of
                                                                         The structure of the fractional-order controller is
      pairs of chromosomes are often manipulated
                                                                         shown below:
      using arithmetic crossovers
                       Ai +1 = α B i + (1 − α ) A i
                                                                                                   kp
                                                                   (8)
                       B i +1 = α Ai + (1 − α ) B i                           r         e
                                                                                                  ki s − λ
                                                                                                                  u
                                                                                                                         p(s)
                                                                                                                                    y
      Where Ai , Bi is the crossed chromosome i ,
                                                                                                 kd s μ
      Ai +1 , B i +1 is the chromosome           i+1 , α ∈ (0,1)
      can be set as a constant or set to a random value
      as needed.                                                                       Figure 4 FOPID controller structure
      Mutation operation itself is a random operation                    The mathematical expression of fractional order
      algorithm. One method of floating-point                            controller is:
      encoding variant operations is:                                      u(t ) = k p e(t ) + ki I −λ e(t ) + kd D μ e(t ) (11)
              A = Amin + ( Amax − Amin ) × α     ˄9˅
                                                                         5       PARAMETER TUNING
      Where Amin , Amax denotes the minimum and
                                                                         ALGORITHM    OF   INTEGER
      maximum values of the code and α ∈ (0,1) is a
                                                                         ORDER COTROLLER BASED ON
      random number.
      Genetic algorithm in the probability of                            GENETIC ALGORITHM
      occurrence of mutation operation is very low,                      First, we should determine the appropriate
      which is similar to the biological variation in                    fitness function, the fitness function selected in
      nature, so the mutation operator usually values                    this paper for the type (6), the parameters taken
      between 0.001 to 0.1, far below the probability
                                                                         in this paper ω1 = 0.9 ˈ ω2 = 0.1 ˈ ω3 = 2 .The
      of crossover operation.
      It should be noted that, although the probability                  parameter           range         is      limited    to
      of mutation is too large, the mutation probability                  k p ∈ [0,100], k d ∈ [0, 50], ki ∈ [0,50] . Population
      may cause the system to converge to the local                      size = 40. The crossover probability Pc = 0.7 ,
      optimum instead of the global optimum, and the                     and the mutation probability is linearly
      smaller the crossover, the mutation probability is                 decreasing. Pm = 0.1 − [Size : −1 : 1]* 0.01/ Size ,
      likely to cause the slow convergence of the
      algorithm, therefore, must be reasonable Select                    where the constant 0.01 can have high mutation
                                                                         probability, but not 0, the parameter can be set as
      crossover, mutation probability.
810                                2017 29th Chinese Control And Decision Conference (CCDC)
needed, you can also make Pm = 0.1 , this time
for a fixed probability of mutation, the following
procedures are used in the method.
Let MinX (1) = 0 be the lower limit of K p ,
 MinX (1) = 0 be the lower limit of K i , and
MinX (1) = 0 be the lower limit of Kd .
MinX (1) = 100 is             the   upper limit    of
Kp  , MinX (1) = 50           is  the    upper  limit
of Ki , MinX (1) = 50 is the upper limit of K d .
Then the initial value is set to random value                                     Figure 7 Controller parameter curve
matrix:                                                               Figure 5 fitness curve, abscissa 400 is the
K pid (:,1) = MinX (1) + (MaxX (1) − MinX (1)) * rand (Size,1)        number of genetic algorithm cycle, we can see
                                                                      that with the increase in the number of cycles,
,
K pid (:,2) = MinX ( 2) + ( MaxX ( 2) − MinX ( 2)) * rand ( Size,1)
                                                                      the fitness curve decreased rapidly, while the
                                                                      control parameters of the controller is gradually
,                                                                     increased, the fitness value of the final trend At
K pid (:,3) = MinX (3) + ( MaxX (3) − MinX (3)) * rand ( Size,1)
                                                                      0.468241307735691, the internal subgraph is the
.                                                                     local magnification. Step response from the
The fitness function controls the response of the                     system diagram, you can see in a very short
object with these three variables as the controller                   period of time, the output signal reaches a steady
parameters. When the input is the step-over                           state, the final value of 0.996887643653813, the
signal, it is the step response of the system. The                    error is small. The final parameter values are
same is true for future fitness functions. The                         K p = 39.625679938736, K i =12.2521791402685,
simulation results are as follows:
                                                                      K d =6.99889953738961.
                                                                      6     PARAMETER   TUNING
                                                                      ALGORITHM OF FRACTIONAL-
                                                                      ORDER COTROLLER BASED ON
                                                                      GENETIC ALGORITHM
                                                                      For the fractional-order controller, the parameter
                                                                      range is k p ∈ [0,100] , k d ∈ [0,50] ,
                                                                       k i ∈ [0,50] , λ ∈ [0,1.2], μ ∈ [0,1.2] ,the
                                                                      population Size=40, the crossover probability is
         Figure 5 GA algorithm integer fitness curve                   Pc = 0.7 , and the mutation probability is
                                                                       Pm = 0.1 . Using the above
                                                                       MinX (1) = zeros (1), MaxX (1) = 100 * ones (1) is the
                                                                      range of K p ,
                                                                       MinX ( 2) = zeros (1), MaxX ( 2) = 50 * ones (1) is the
                                                                      range of K i ,
                                                                       MinX (3) = zeros (1), MaxX (3) = 50 * ones (1) is the
                                                                      range of K d ,
                                                                       MinX ( 4) = zeros (1), MaxX (4) = 1.2 * ones (1) is the
                                                                      range of λ ,
                                                                       MinX (5) = zeros (1), MaxX (5) = 1.2 * ones (1) is the
                                                                      range of μ .
                Figure 6 System step response
                                                                      Using the random value of the way, the initial
                                                                      value is:
                                                                       K pid (:,1) = MinX(1) + (MaxX(1) − MinX(1))* rand(Size,1)
                                                                      ,
                                                                      K pid (:,2) = MinX (2) + (MaxX(2) − MinX (2)) * rand(Size,1)
                                                                      ,
                                                                      K pid (:,3) = MinX (3) + (MaxX (3) − MinX (3)) * rand( Size,1)
                                                                      ,
                        2017 29th Chinese Control And Decision Conference (CCDC)                                                       811
      K pid (:,4) = MinX(4) + (MaxX(4) − MinX(4)) * rand(Size,1)           μ = 0.997339567500875 . The results of the two
      ,                                                                    runs have been very close.
      K pid (:,5) = MinX (5) + (MaxX (5) − MinX (5)) * rand(Size,1)
                                                                           7 SIMULATION RESULTS AND
      The simulation results are as follows:
                                                                           ANALYSIS
                                                                           The following is a simulation of fractional-order
                                                                           PI λ D μ  controller and integer-order PID
                                                                           controller simulation, the object is a
                                                                           second-order transfer function:
                                                                                                     400
                                                                                            G(s) = 2
                                                                                                    s + 50
                                                                           The following simulation results are obtained:
          Figure 8 GA algorithm to set the fractional fitness curve
                                                                                     Figure 11 Integer order controller step response
                                                                                     rin,yout
                       Figure 9 System step response
                                                                               Figure 12. Step response of a fractional-order controller
                                                                           The simulation results show that the fractional
                                                                           order control system can effectively improve the
                                                                           stability of the system when the rise time is too
                                                                           long, and it has greater stability margin than the
                                                                           ordinary integer PID control system.
                                                                           8     CONCLUSION
           Fig.10 Curve of parameter change of fractional-order
                               controller                                  The simulation results show that the fractional
      The      final   output     of     the    system                     order PI λ D μ controller can obtain better
      0.997036230395526, than the integer order
                                                                           control effect than the IOPID controller in the
      controller error is smaller, the curve changes
                                                                           fractional order system with the same parameter
      smoothly, because the reading is too small, it is
                                                                           setting range.
      difficult to show in the figure, but in the work
      space is easy to see, the controller five
      parameters for the final                                             REFERENCES
                             θ K = 0.00597103 51306280
      K p = 0.8617945068335              i
                                                                               [1]              T.Chen, H.Chen, and R.W.Liu Approximation
                                                                                                Capacity in C(R’’) by Multi-layer. Feeforward
      K d = 0.3890132244544 , λ = 0.06887152 8007198                                            Networks and Related Problems. IEEE Trans.
                                                                                                On Neural Netwoks,1995,6(1):185-198
      μ = 0.99803365 4616245 .                                                 [2]              Moshe Leshno Multilayer Feedforward
      When        running       again,       the   parameter          is                        Networks with a Non-polynomial Activation
      k p = 10.4275955530907, ki = 3.19069507743074e − 18                                       Function Can Approximate Any Function.
                                                                                                Neural Network,1993,6:861-867
      kd = 0.446679521273282
                                    , λ = 0.36087396 4601034                   [3]              Chen TianPing, Chen Hong Approximation
                                                                                                Theory Capability to Function of several
812                               2017 29th Chinese Control And Decision Conference (CCDC)
     Variables, Nonlinera Functions and Operators               fractional capacitor (1 / s )
                                                                                           1/ n
                                                                                                 by a regular
     by Radial Basis Functional Neural Networks.
     IEEE           Trans.         On          Neural           newton process [J], IRE Transactions on
     Network,1995,6(4):904-910                                  Circuit Theory, 1964, 2:201-213
[4] A. Monje · YangQuan Chen, Blas M.                    [11]   Oustaloup A. Systèmes asservis linéaires
     Vinagre · Dingyü Xue · Vicente Feliu.                     d'ordre fractionnaire: théorie et pratique[M],
     Fraction     order     system    and     control           Editions Masson, Paris, 1983
     Fundamentals and Applications [M] Springer          [12]   Xue Dingyu, Zhao Chunna and Chen
     2010:7-8                                                   Yangquan. A Modified Approximation
[5] Lubich Ch. Discretized fractional calaulus.                 Method of Fractional Order System[C]. IEEE
     SIAM J. Math. Anal., 1986,17:704~719                       ICMA2006,pp:         1043-1048.      Luoyang,
[6] I.Podlubny.         Fractional       Differential           China,2006
     Equation[M]. Academic Press,1999:41-117             [13]   Tseng C-C, Pei S-C, Hsia S-C. Computation
[7] Oldham K B,Spanier J. The fractional                        of fractional derivatives using Fourier
     calculus:theory       and     application     of           transform and digital FIR differentiator.
     differentiation and Integration to arbitrary               Signal Processing,2000,80:151-159
     order[M]. Pieesburgh:Academic Press 1974            [14]   Oustaloup A, Levron F ˈ Nanot F ˈ et al.
[8] Oldham K B,Spanier J. The Fractional                        Frequency band complex non integer
     Calculus[M].         New        York:Academic              differentiator: characterization and synthesis.
     Press,1974.10-90                                           IEEE Transactions on Circuits and System I:
[9] B.RossˊA brief history and exposition of the                Fundamental              Theory            and
     fundamental theory of fractional calculusˈ                 Applications,2000,47(1):25-40
                                                         [15]   Gorenflo R. Fractional calculus: some
     Vol.457, New York˖Spring-Verlay, 1975
                                                                numerical methods [J], CISM Lecture
[10] Calson G E, Halijak C A. Approximation of                  notes,1996,Italy
                        2017 29th Chinese Control And Decision Conference (CCDC)                                  813