Microsoft Word - cet-01.docx CHEMICAL ENGINEERING TRANSACTIONS VOL. 46, 2015 A publication of The Italian Association of Chemical Engineering Online at www.aidic.it/cet Guest Editors: Peiyu Ren, Yancang Li, Huiping Song Copyright © 2015, AIDIC Servizi S.r.l., ISBN 978-88-95608-37-2; ISSN 2283-9216 ANFIS Control Double-Inverted Pendulum Peng Shen University of Science and Technology Liaoning, China. sp-1981@163.com For double inverted pendulum multivariable, strong coupling and nonlinear proposed adaptive fuzzy neural inference system (ANFIS) is applied inverted pendulum stabilization control process. Adaptive control algorithm, fully able to meet the requirements of double inverted pendulum control, ANFIS system after training, will be applied to the inverted pendulum system controller has better control accuracy and control performance, fully embodies the ANFIS system control nonlinear Advanced systems. 1. Introduction Over the past decade, these two areas began to integrate with each other, forming a promising control method - based Fuzzy Inference System (ANFIS) [44]. Because ANFIS fuzzy inference system can the concept of control and neural network together, not only has the advantage of neural networks, such as learning ability, the ability to optimize the connection structure and the control object model does not rely on, there are the advantages of fuzzy control system, If-Then rules as thought humanoid and easy placement expertise. Thus, we can lower the neural network learning and computing capabilities to fuzzy control system, but can also be advanced, thinking and reasoning mechanisms humanoid If-Then rules provided to the neural network fuzzy control system, which improves the system ability to learn and improve the skills of knowledge. Therefore, ANFIS inference system to achieve a certain human intelligence, is an atypical intelligent control, is very popular with people of attention research. 2. ANFIS structural description Takagi and Sugeno proposed in 1985 the TS fuzzy model T. Takagi (1985) reported, and later researchers called Sugeno fuzzy model. It is a non-linear model, it is appropriate to express the dynamic characteristics of complex systems, it is also commonly used fuzzy reasoning model. Sugeno fuzzy model of a typical fuzzy inference rules: if x is A , and y is B then ( )yxfz ,= As the premise of fuzzy numbers, ( )yxfz ,= the exact number of conclusions. Usually ( )yxf , is x and y polynomial. Model is called first-order Sugeno fuzzy inference system. Correspondingly first order Sugeno fuzzy model functional equivalent of fuzzy inference system based on adaptive neural network (ANFIS) Jyh-Shing (1993) reported, it is used to achieve the learning process Sugeno fuzzy model. ANFIS Sugeno fuzzy model can be considered as a neural network, the network is a multi-layer feed forward network structure as follows Li (2000) reported: Figure 1: ANFIS level schematic DOI: 10.3303/CET1546150 Please cite this article as: Shen P., 2015, Anfis control double-inverted pendulum, Chemical Engineering Transactions, 46, 895-900 DOI:10.3303/CET1546150 895 Figure 1 input vector, weights, and a normal value from the premise of the product obtained from the membership function, the output is a weighted average of the output of each rule, and the proportion of the total weight of the focuses for the rights. The same level of output nodes have the same functions. As shown in Figure 1, ANFIS model structure is divided into: fuzzy membership computer input of each rule applies for the degree of normalization, the output of each rule, the entire output of the fuzzy system and other five, the input layer directly the output value to the next level, the output fuzzy layer is a membership function, fuzzy reasoning it a prerequisite of basic fuzzy state corresponds to the fuzzy inference layer contact with the premise and the conclusion of the fuzzy inference, defuzzification layer let the system determine the output is given to perform. First layer: fuzzy layer, is responsible for the input signal fuzzy, node i having an output function: ( )xO Ai 1 1 μ= (1) among them x is the output of i , iA is the fuzzy set. 1 iO is Membership values of iA , representation x degree belong to iA . Usually choose ( )x iA μ bell-shaped function and has a maximum value 1, min 0. E.g: ( )               − −= 2 exp i i A a cx x i μ (2) or ( ) ii b i i A a cx x               − + = 2 1 1 μ (3) { }iii cba ,, are premise parameters, ia is the wide, ib is the slope , ic is the central location. By adjusting these parameters, the shape of the membership function with the change of these parameters change. In fact here is the membership function can take any piece wise continuous function, such as trapezoidal or triangular function function. Second layer: This layer is a layer of release intensity rule, this layer node is responsible for the input signal is multiplied. Such as: )()( yx ii BAi μμω ×= , 2,1=i (4) One representative of each output node reliability rules. Here “ × ” is the AND operator of T specification. By this calculation, to determine the activation strength of each fuzzy rule. Third layer: all the rules intensity normalization layer, the i node calculation the i rule normalized credibility: 21 ωω ω ω + = ii , 2,1=i (5) This layer node are circular nodes (fixed nodes), calculate the weights of fuzzy rules, fuzzy rules for the active strength of normalized operations. Fourth layer: output layer of fuzzy rules, the layer to calculate the output of the fuzzy rules, where each node is an adaptive node.the i node output is: )(4 iiiiiii ryqxpfO ++== ωω (6) The iω is the output of the third layer, ( )iii rqp ,, are the conclusions parameters. Fifth floor: defuzzification layer which has a circular node, its output is said to have the input signal and the result is that the fuzzy reasoning: i ii ii i l f fO ω ω ω Σ Σ == Σ5 (7) Thus, given the premise parameters (initial membership functions), the output ANFIS can be expressed as a linear combination of parameters conclusion: 222222111111 22112 21 2 1 21 1 )()()()( rqypxrqypx fffff ωωωωωω ωω ωω ω ωω ω +++++= += + + + = (8) Corollary seen, for having m the input variables, every input have k fuzzy sets of Sugeno fuzzy model, According to the method described above can be converted into neural network structure, which controls the total number of rules: mkn = (9) 896 3. ANFIS learning algorithm The main role of neuro-fuzzy controller is the application of neural learning techniques, adjusting parameters and structure neuro-fuzzy control system. Fuzzy controller requires two types of adjustments: Restructuring and parameter adjustment; structural adjustments include the number of variables, on the input and output variables of the domain partition number and other rules. Once you get a satisfactory structure, it is necessary to adjust the parameters. Parameter adjustment including parameters related to the membership functions, such as the center, width, slope, etc. adjustments. As the network structure has been determined, ANFIS learning algorithm parameters of the controller is really just to learn, only we need to adjust the parameters of the premise and conclusion parameters. 3.1 Updated four methods ANFIS parameters: (1) All parameters are updated with the gradient descent; (2) The initial conclusion parameters obtained by the least squares method, then gradient descent update all parameters; (3) Gradient descent and least squares method combined; (4) Only recurrence (approximate) method of least squares; Which method of selecting specific circumstances, should be considered complexity and performance to be achieved by calculation Jyh-Shing (1995) reported. 3.2 ANFIS learning process parameter optimization parameters into the premise and conclusion parameters learning learning Hybrid learning algorithm summarized as the following two steps: (1) Conclusion parameter learning: First, determine the initial value of the premise parameters, then the least squares method to calculate the concluding arguments. which is: XArqypxrqypxf ⋅=+++++= 222222111111 )()()()( ωωωωωω (10) In the formula, X conclusions column vector elements set of parameters { }222111 ,,,,, rqprqp . If have p set of input and output data, and the given premise parameters, the matrix A , X , F , the median p×6,6×1 and p×1. In general, the sample data is much larger than the number of the number of unknown parameters ( p >>6),Using the least squares method to obtain the minimum mean square error )(min fAX − Conclusion The best estimate of the vector in the sense of ∗x : fAAAX TT 1)( −∗ = (11) (2) Premise parameter learning: Given the premise parameters, output ANFIS can be expressed as a linear combination of the conclusion parameters, conclusions parameters calculated on a step error calculation, using an algorithm of the error from the output terminal inverted spread input decrease with the gradient method to update the premise parameters, thereby changing the shape of the membership function. 3.3 ANFIS structures and algorithms to establish learning as follows: (1) Extract fuzzy rules thenif − obtained by the experts at, Average divided input variable space (or according to expert opinion) to establish initial membership functions: the number includes rules, the shape of each membership function. General should meet ε completeness (usually: 5.0=ε ), that is a given value for any one of the input variables x . There must be a linguistic values A , make ( ) εμ ≥xA establishment. So far, the fuzzy inference system can provide value to the smooth transition from one language to another language values and sufficient overlap. (2) The hybrid learning algorithm adjusts the blur thenif − rules premise / conclusion parameters, in each cycle includes forward propagation and backward propagation two processes (see above). After learning the rules of linguistic premise does not necessarily guarantee ε completeness, but it may limit the gradient algorithm to obtain. (3) Output error learning process until it reaches a certain training sample requirements so far, thereby establishing a whole fuzzy inference system. Sugeno type FIS ANFIS use to describe the object model, but also with a feed-forward neural network to represent the Sugeno type FIS. On the one hand, using the error back-propagation algorithm combined gradient steepest descent method for nonlinear parameters Sugeno type FIS will be to identify, on the other hand, took advantage of the least squares method to identify Sugeno type FIS current parameters. ANFIS network includes specific antecedent parameters (membership function of various parameters), and the back piece parameters (output model each factor), through some kind of algorithm to train ANFIS, the indicators have been specified values of these parameters to achieve blur the purpose of modeling. 897 4. ANFIS control mode ANFIS can use a variety of different control methods Li (2001) reported, including imitation experience control, inverse control and other control methods: 4.1 imitate experience control Is to sum up the experience to control essentially mimic the experience of people, then people with the relevant experience ANFIS imitate, to achieve the controlled object control. 4.2 Neuron Fuzzy Inverse Control This control is divided into learning stage and the application stage. In the learning phase, random input set to give the corresponding controlled object output, ANFIS inverse for learning controlled object model. In the application stage, the inverse model of the controlled object as a controller directly on the controlled object. 4.3 Other control methods There are reference model adaptive control, feedback control, fuzzy control, gain scheduling control, stochastic methods to enhance learning method. Reference Model control is the solution to inverse control can not ensure that the entire system is the smallest error and proposed an improved method; linear and fuzzy feedback control for feedback linearization system can; gain scheduling control for the first-order Sugeno model; stochastic methods generally for complex control systems; the object model is not clear or is not a very effective method you can use to enhance learning S.M.Khazraee (2010) reported. Currently, the ANFIS adaptive function, which is widely used for function approximation, pattern recognition, prediction, fuzzy aspects of control, signal processing, etc Imad O.Bachi (2014) reported. 5. Based on ANFIS inverted pendulum control system simulation 5.1 Modeling Simulation Sugeno Fuzzy modeling including structure identification and parameter identification of two aspects JANG Jae Hoon (2012) reported. Structural identification to identify and divide the input space by a grid method or clustering method, preliminary design blur thenif − rules (Conditional expression after the order Sugeno model); parameter identification fuzzy rules to determine membership function parameters and input-output linear parameters (Sugeno fuzzy model polynomial coefficients) Chui (1994) reported. ANFIS model structure identification is not required, only the parameters on which the learning correction can be Chen (2000) reported. The above-mentioned grid method in 1985 proposed by Takagi and Sugeno, it will enter the space is divided into a number of uniform rectangles (or rectangular), using the data entered in each dimension maximum (small) values into space, and data distribution nothing to do. Chiu proposed fuzzy clustering and hybrid learning model based on the rule of recognition in 1994. Spatial clustering method to determine the number by the clustering radius, covering all subspace common input sampling data, can be used to model any number of dimensions Yurkovich, S (1996) reported. Sometimes we collected data with the noise signal, then these data may not be representative of all the typical features of the system, the modeling will not achieve good results. Thus, the effectiveness of the training process and the results of model testing is a very important step. We should choose to represent an ideal model system both need to simulate, but also with the training data sufficient difference (to avoid unnecessary check) the validation data. In addition, in order to avoid possible "model redundant" situation, should be used to check data set to control the training process. All of Matlab ANFIS modeling, the data are divided into three groups, the first group for the training model (training data), a second set of model checking (checking data) for the training process, and finally a set of model results test (testing data). Therefore, based on Matlab ANFIS modeling process Danial BEHNIA (2013) reported divided into the following six steps: (1) Generates training data, test data and test data, data sets is expressed as: [ ]yxtrndata ,= , [ ]11 , yxchkdata = , [ ]22 , yxtesdata = ; (2) Determine the type of input variables and the number of membership functions; the actual modeling, you should select the input and output data to match the membership function to reflect changes in the characteristics of the obtained data. This paper selects Gaussian membership functions Shareef Hussain (2014) reported. (3) FIS produce initial structure: for example, can use the function genfis1 (grid method), genfis2 (elimination clustering method) to produce official script function Sugeno type FIS initial value, the second paper, namely: ( )radiidataoutdataingenfisfismat ,,2= When given input data sets and data sets, genfis2 fuzzy clustering elimination generates a fuzzy inference system. When there is an output, you can use the first data elimination clustering method, using genfis2 898 produce an initial fuzzy inference system anfis the training process. gendis2 using a fuzzy rule extraction behavior modeling data to complete this work. datain matrix where each line contains a data point input values. dataout matrix, where each row contains the output value of a data point. For example, the text data dimension is 7 (ie datain of two, dataout is one), radii = [0.7,0.6,0.5,0.4,0.3,0.2,0.1] specify the cluster center in the first, second, ..., seventh-dimensional space is the scope of the data width of 0.7,0.6, ..., 0.1. If radii is a scalar, then all the data on use of the scalar value dimension, namely the scope of the center of each cluster is a spherical neighborhood for a given radius. (4) ANFIS training data set; training parameters include options vector trnopt (including number of batches of training, training error goal, the initial step length, etc.), display options vector dispopt (ANFIS result information), model validation data set name chkdata, membership function training methods optmathod (least squares method or the least square method and BP algorithm) and so on. (5) Training ANFIS; use anfis function training ANFIS, namely: [ ] ( )1,,,,,1,2,,,1 chkdatadispopttrnoptfismttrndataanfiserrorfismatstepsizeerrorfismat = Where: fismat1 structure according to FIS training error criterion obtained; error and root mean square error error1 were training data and test data; stepsize for the training process steps; fismat2 FIS structure is based on test error criterion is obtained. (6) to give the FIS performance test. FIS structure according to the training error criterion obtained using evalfis (fuzzy inference computing) function to calculate the output value or predicted and measured values are compared, FIS test the resulting performance. Complete fuzzy inference calculations are completed by the following formula: )2,( fismatinputevalfisoutput = Sugeno fuzzy model is necessary to enter very small space division, resulting in a sharp increase in the number of rules, systems large and difficult to understand Yu (2015) reported. 5.2 Double Inverted Pendulum simulation and real-time control Double inverted pendulum simulation process, the training data and test data from the solid high double inverted pendulum system diagram collection from, the sampling period is Matlab default. Among them, the former 100 data as training data, intermediate 50 as the test data, the remaining data as the test data. After the data input ANFIS, using the least squares with BP hybrid algorithm, training times to 300 times. After ANFIS training and testing is completed, the simulation results obtained the following: Figure 5: Training error curve (error: 0.078101) Figure 6: Comparing training data (average error: 0.0512) FIG error curve can be seen in Figure 5, the main train 200 steps forward, the smaller the output error identification of ANFIS inference system closer to the desired output. Figure 6 can clearly be seen that the output of ANFIS inference system is very close to the ideal output we want. Real-time system control Teng (2000) reported. Figure 7: Real-time control system Simulink Figure 8: Control rule change map You can clearly see the changes in the fuzzy control rules by Figure 8, the control system will help us to adjust the rules. Because of double inverted pendulum is highly nonlinear multivariable system, so during the time 899 control, we choose Control descending order of priority: two pendulum, level swing, car. Output response curve control system is as follows: Figure 9: ANFIS control double inverted pendulum Figure 10: system controlled amount of output curve In Figure 9, the first response curves that is the position of the car to the state. The initial position is not at zero. After adjusting ANFIS controller, three seconds later met the target required (zero) position. The second is that is an inverted pendulum angle curve. As can be seen from the figure, very small changes in the process of adjusting and super fast response, as the adjustment process is completed in less than 3 seconds. Article III of that is secondary angle curve inverted pendulum, its overshoot relatively smaller level swing angle, exactly in line with our control priority choice. The three curves in the static over Chengzhong Jing difference is almost zero. All control process substantially complete in less than three seconds from Fig. 10, and the static adjustment process, a small amount of change in control, able to meet the control requirements of the system. References Bachi I.O., Abdulrazzaq N., He Z. 2014. NEURO FUZZY MODEL FOR PREDICTING THE DYNAMIC CHARACTERISTICS OF BEAMS. Acta Mechanica Solida Sinica. Vol. 27. No. 1, pp. 86-96. DOI: 10.1016/S0894-9166(14)60019-7 Behnia D., Ahangari K., Noorzad A., Moeinossadat S.R. 2013. Predicting crest settlement in concrete face rockfill dams using adaptive neuro-fuzzy inference system and gene expression programming intelligent methods. Journal of Zhejiang University-Science A (Applied Physics & Engineering). Vol. 14. No. 8. pp: 589-602. DOI: 10.1631/jzus.A1200301. Chen W.J., Fang L., Cheang S.U., Lei K.K., Zhang F.Z. 2000. Personified intelligent control for an inverted pendulum system. Proceedings of the World Congress on Intelligent Control and Automation (WCICA). Vol. 3. pp: 1702-1706. Chui S. 1994. Fuzzy model identification based on cluster estimation. J of Intell&Fuzzy Syst. Vol. 2, No. 3. pp267-278. DOI: 10.3233/IFS-1994-2306 Hussain S., Saifulnizam A.K., Mohd S.H., Mohd M.W. 2014. Application of artificial intelligent systems for real power transfer allocation. Journal of Central South University. Vol. 2014. No. 21. pp: 2719-2730. DOI: 10.1007/s11771-014-2234-7. Jang J.H., Kwon S.H., Jeung E.T. 2012. Pendulation reduction on ship-mounted container crane via T-S fuzzy model. Journal of Central South University. Vol. 19. No. 1. pp: 163-167. DOI: 10.1007/s11771-012-0986-5 Jang J.S.R. 1993. ANFIS adaptive-Network-Based Fuzzy Inference System, Systems, Man and Cybernetics, IEEE Transactions on, Vol. 2, No. 3, pp. 665-685. DOI: 10.1109/21.256541 Khazraee S.M., Jahanmiri A.H. 2010. Composition Estimation of Reactive Batch Distillation by Using Adaptive Neuro-Fuzzy Inference System. Chinese Journal of Chemical Engineering. Vol. 18. No. 4. pp: 703-710. DOI: 10.1016/S1004-9541(10)60278-9 Lei Y., Zhao D.N., Cai H.B. 2015. Prediction of length-of-day using extreme learning machine. Geodesy and Geodynamics. Vol. 6. No. 2. pp: 151-159. Li H.G., Sun J.H., Zhang B., Zhang Y.S. 2001. ANFIS and Its Application in Control System. Journal of Jiangsu University of Science and Technology (Natural Science Edition). Vol. 15. No. 5. pp: 27-33. Li Z. 2000. Application of ANFIS prediction of bulk cargo capacity. Dalian Maritime University Master Thesis. pp: 38-48. Shing J., Jang R., and Sun C.T. 1995. Neuro-fuzzy modeling and control. Proceedings of the IEEE, Vol. 8, No. 3, pp. 378- 406. DOI: 10.1109/5.364486 Takagi T. and Sugeno M. 1985. Fuzzy Identification of Systems and Its Application to Modeling and Control. IEEE Trans. Syst., Man and Cybern. vol. 15, no.1. pp: 116-132. Teng F.C. 2000. Real-time control using Matlab Simulink. Proceedings of the IEEE International Conference on Systems, Man and Cybernetics. Vol 4. pp: 2697-2702. DOI: 10.1109/ICSMC.2000.884403 Yurkovich S., Widjaja M. 1996. Fuzzy controller synthesis for an inverted pendulum system. Control Engineering Practice. Vol. 4. No 4. pp: 455-469. DOI: 10.1016/0967-0661(96)00026-3 900