This action might not be possible to undo. Are you sure you want to continue?
Fuzzy, Neural and Neuro-Fuzzy Controllers for an Inverted Pendulum
Esteban Salazar (353869), Ernesto León (808770)
Abstract—This paper presents the design of a fuzzy logic, artificial neural network (ANN) and neural-fuzzy (ANFIS) controllers for the inverted pendulum-cart system. The dynamic nonlinear equations are used to model the system. Fuzzy logic controller is one of the most important applications using the expert knowledge to control the system. Artificial Neural Networks has similar properties to Fuzzy systems but it includes a learning stage that allows to combine both strategies to implement a Neuro-Fuzzy controller which results in the optimization of fuzzy logic and ANN behavior. The simulation results of each controller are compared. Index Terms—Fuzzy Control; Artificial Neural Control; ANFIS Control; Inverted Pendulum.
b is the friction of the cart resisting motion, L is the length of the pendulum to its center of mass, I is the inertia of the pendulum, u(t) is the force applied to the cart, x represents the cart position coordinate and is the angle of the pendulum measured from the vertical.
HE inverted pendulum is a multivariable and nonlinear system that is commonly used to test control strategies. The inverted pendulum may simulate natural phenomena such as the walking motion, missile guidance, biomechanical devices, etc. This paper contains the comparison of Fuzzy logic, artificial neural network and a synergy of both strategies responses in the control of the inverted pendulum using the non-linear equations. The approach of Passino  is used for the fuzzy rule database and then an ANN is trained with the Fuzzy Controller dynamics to emulate it and control the pendulum system. Finally a neuro-fuzzy controller is implemented.
Fig.1. Diagram of the inverted pendulum-cart system. Using the non-linear equations the system uses the parameters of Table I.
TABLE I INVERTED PENDULUM PARAMETERS.
II. MODELING THE SYSTEM A. Non-Linear Dynamics. The diagram of the inverted pendulum is shown in Fig. 1. The dynamic non-linear equations of the inverted pendulum system are as follows:
Parameters M m b L I g
Value 0.5 kg 0.2 kg 0.1 N/(m/s) 0.3 m 0.006 kg m 9.8 m/ s
M m bx mLcos mL 2 sin u x
I mgL sin mL cos x
Where M is the mass of cart, m is the mass of the pendulum,
The simulation of the controller was performed in Simulink MATLAB, this software allows to implement the model of the system using the non-linear dynamics equations in the form of block diagrams using a subsystem function. After substituting the parameters of the Table I into the equations, the resulting system is shown in Fig. 2.
For the change in the error the negative sentence means that the pendulum direction is closing to the vertical position and for a positive change in error represents that the pendulum is moving away the vertical position. Fuzzy sets for error and change in error for theta.3. Fig. B. Fuzzy sets for error and change in error for cart position. Fuzzy sets for controller manipulation. III. an artificial neural network is trained to simulate the fuzzy controller behavior using the back-propagation algorithm in MATLAB. From . The inverted pendulum system has two variables for controlling: (i) the angle of the pendulum with respect of the vertical position and (ii) the position of the cart. The cart where the pendulum is mounting. N. From Fig. where the range of values is [-10 10]. First.4. 4 the range is [-5 5].L. 3 it is possible to observe that fuzzy sets for error and chance in error is the range [-3 3] and from Fig. (ii) the statement “error is negative small” can represent the situation where the pendulum is just slightly to the right of the vertical but not close to the vertical to justify quantifying it as zero and far from negative large and (iii) the statement “error is zero” represents the situation where the pendulum is near the vertical position. 4. 5. Inverted pendulum non-linear system.5. The fuzzy sets that describes the membership functions of the error and the change in error for the theta angle of the pendulum are the same form for both and is shown in Fig. where the manipulation fuzzy sets of the controller is shown in Fig. it moves in straight direction to compensate the changes in the angle variations.2. Fig. Mexico 2 controller to the plant. The statements that quantifies the configuration of the inverted pendulum proposed by Passino  are: (i) the statement “error is positive large” can represent the situation where the pendulum is at a significant angle to the left of the vertical. 4 meanwhile the error and the change in error is shown in Fig. . ANN and ANFIS. Monterrey. FUZZY LOGIC CONTROLLER The fuzzy logic controller is known as knowledge based system . This block represents the plant that the control system will perform the manipulation. Control Strategies The strategies used in this paper to control the inverted pendulum-cart system are Fuzzy logic. the fuzzy rules for the error and the change of the error are in the form of fuzzy sets that describes the relation of the actual position with the desired.Intituto Tecnológico y de Estudios Superiores de Monterrey. 3. For the cart position controller the manipulation fuzzy sets are the same from Fig. Fall 2011. The Fuzzy controller is designed to automate how a human expert who is successful at this task would control the system. Once the fuzzy controller is properly tuned. Fig. Intelligent Controll. where the knowledge of an expert about a system behavior is pass on the form of if… then rules to a data base of fuzzy rules that determines the manipulation of the fuzzy Fig. the information of the expert is collected in linguistic descriptions at the form of if… then rules.
It can be observed that the ANN is able to approximate the behavior of the manipulation signal of the Fuzzy Controller successfully (see Fig. Then the response of the system to a change in the desired position and angle disturbances is shown in Fig.Intituto Tecnológico y de Estudios Superiores de Monterrey. Positive Large) for each case of these. Intelligent Controll. V. Once the desired goal is specified. Block diagram of the controller simulation. 6. Mexico Using the approach from section II. next the manipulation for the plant or the subsystem and finally the actual position is provided for the feedback. Training the ANFIS Controller The training process of the ANFIS controller was performed in the ANFIS MATLAB Toolbox. IV.01 is set before the training process. NL PL PL PL PS Z NS PL PL PS Z NS Z PL PS Z NS NL PS PS Z NS NL NL PL Z NS NL NL NL The fuzzy controller for the angle of the pendulum and the cart position are implemented using a Simulink block. The training data (see Fig 8) is a matrix that consists in the Error. using this data the toolbox generates a Sugeno-type fuzzy inference system that fixes the parameters of the fuzzy sets with an hybrid optimization algorithm. The hybrid method is a combination of the least-square method and the back-propagation gradient descent method for training the FIS membership function parameters to emulate a given training data set . change in error) and five linguistic values (Negative Large. The simulation process is shown in Fig. Fig. The objective of the training is that the ANN has to adjust the bias and its weights using the backpropagation algorithm and the MSE (Mean Square Error) method to calculate the error each iteration of the regression process. B.7. Positive Small. ANFIS CONTROLLER A. TABLE II THETA AND CART POSITION RULE DATABASE de e NL NS Z PS PL 3 process to ANN architecture. The learning process finishes if the number of epochs Fig. A value of desired minimum error of 0. 6 to simulate the system response. where the designed controllers are embedded. a change in the desired position from 0 to 3 meters of the cart (see Fig. change in error and the output of the fuzzy controller. then calculation of the error and change in error that are the inputs for the fuzzy controller. 14) and a disturbance of 10 degrees in the angle of the pendulum (see Fig 17).L.B and the fuzzy sets from above the rule bases can be defined. Negative Small. 15 and Fig. the block diagram consist in a desired position using a constant. The ANN controller is then incorporated to the block diagram of the Fig. For the pendulum problem there are two inputs (Error. Basic Principles of ANFIS An alternative of controlling is the ANFIS (Adaptive Network Fuzzy Inference System) Controller that uses a routine for Sugeno-type fuzzy inference systems with a hybrid learning algorithm to identify parameters of the Sugeno-type fuzzy inferences. A neural network can learn from the dynamics of other controllers by adding a training . 7). the design of the controller is dictated by the knowledge about the plant and the data available . To test the performance of the system two disturbances are added to the system. Zero. The rule table for the inverted pendulum for controlling the angle and the cartposition is shown in Table II. Output data of the Fuzzy Controller versus the learning ANN response. Fall 2011. 18 respectively.6. to the train the ANN. there are at most 52 = 25 possible rules. NEURAL NETWORK CONTROLLER Controlling a dynamical system means forcing it to behave in some desired way. The training process of the ANN in this paper used the data of the manipulation or output of the Fuzzy Controller and the two input vectors that correspond to the error and change in error. N. Monterrey.
11. SIMULATION RESULTS The structure of the inverted pendulum system by Simulink is shown in Fig.L.12. ANFIS controller training data. 19 respectively. 4 Fig. 12 and Fig. Sugeno fuzzy sets resulting from ANFIS cart position controller training for the change in Error. 16 and Fig. Sugeno fuzzy sets resulting from ANFIS cart position controller training for the Error.6.Intituto Tecnológico y de Estudios Superiores de Monterrey. Fig.13. .10. Fall 2011. The simulations consist in two tests: (i) first a change in reference is added to the desired of the cart position and the (ii) second is a disturbance in the angle of the pendulum and the cart reference position remains in a value of zero. 9 it is possible to see that the ANFIS training reaches the desired error in a less number of epochs than ANN learning. 6 to simulate the system response. Fig. In Fig. N. 9.2 and the parameters given in Table I. The ANFIS controller training for the angle of the pendulum inputs are shown in Fig. ANFIS controller successfully training. Mexico selected for trained or while the desired error are reached (Fig. Sugeno fuzzy sets resulting from ANFIS Theta controller training for Error. Monterrey. Then the response of the system to a change in the desired position and angle disturbances is shown in Fig. 11 respectively. Fig.8. Fig. 13 respectively. Intelligent Controll. VI. 9) the toolbox adjusts the Sugeno-type fuzzy inference system with two inputs for the error and change in error and the manipulation that consist in Sugeno functions. Fig.10 and Fig. Then for the cart position controller the process is the same and the resulting fuzzy sets for Error and change in error is shown in Fig. The ANFIS controller is then incorporated to the block diagram of the Fig. applying the dynamic model of the inverted pendulum using the non-linear equation shown in Fig. Sugeno fuzzy sets resulting from ANFIS training for the change in Error.
Fuzzy controller response to a change in the desired reference where the solid line represents the theta position and the dotted represents the cart position. meanwhile the ANFIS manipulation of the cart position has no overshooting.18. ANN controller response to a disturbance in the pendulum where the solid line represents the theta position and the dotted represents the cart position.19. Fuzzy controller response to a disturbance in the pendulum where the solid line represents the theta position and the dotted represents the cart position. N. which is around 15 to 16.14. .14. ANFIS controller response to a change in the desired reference where the solid line represents the theta position and the dotted represents the cart position. The test of changes in reference of Fig.17. but the Fuzzy has lower oscillation levels in the manipulation of the cart position than the Fuzzy controller. Fig. Monterrey. Fig. Fuzzy and ANN controlled cart position in similar time. meanwhile the ANFIS controlled in lower time. Fig.16 shows that the ANN and Fuzzy controllers has similar responses. Fig. ANN controller response to a change in the desired reference where the solid line represents the theta position and the dotted represents the cart position. Fig.L. Mexico 5 Furthermore. Fall 2011.15.15. Intelligent Controll. Fuzzy controller response to a disturbance in the pendulum where the solid line represents the theta position and the dotted represents the cart position.Intituto Tecnológico y de Estudios Superiores de Monterrey.16. which is a value around 4 to 5. Fig.
REFERENCES     Passino K. From the experimentation it is possible to conclude that the ANFIS has the best performance due to the lower rate of changes in the angle of the pendulum and the time that the controller requires to stabilize both systems is smaller than the Fuzzy and the ANN controllers. Driankov D. meanwhile the ANFIS controller has higher overshooting in the range of 10 and -10.” Boca Raton.Intituto Tecnológico y de Estudios Superiores de Monterrey. which are certain of 2 and -2. Mexico The test of disturbances in the angle of the inverted pendulum of Fig. Mathworks. “A first course in fuzzy and neural control. pp 26-33.L. but this changes in the angle allows the ANFIS to control in lower time than Fuzzy and ANN. Hung T.19 shows that the ANN and Fuzzy controller has similar responses in the angle theta overshoot value. 23-40. “Advanced Fuzzy Inference Techniques: ANFIS.” [Online] Matlab Documents [Access on date Dec 1. c1996. pp. http://www.17.:Addison-Wesley. Intelligent Controll. c1998.html 6 . CONCLUSION This work presents the design of a Fuzzy.” Menlo Park. M. “Fuzzy Control. Then it is possible to conclude that the ANFIS training methodology obtain the best characteristics of both controllers (Fuzzy and ANN) to optimize the system performance. The ANN and Fuzzy controlled in time equal to 30 and the ANFIS controlled approximately at time 15. Nguyen. it is possible to conclude that the three controllers can successfully stabilize the inverted pendulum and also controls the cart at the desired positions.” Berlin: New York: Springer..”An introduction to fuzzy control. c2003. These responses are shown in section VI. Monterrey. N. A non-linear model of the system has been considered to develop the controllers. FL: Chapman & Hall/CRC Press.mathworks. Fall 2011. Calif.18. Neural and ANFIS controllers for an inverted pendulum-cart system. VII. The response of the system with each controller has been compared.com/help/toolbox/fuzzy/anfis. 2011]. From the simulation results.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.