Journal of Fuzzy Systems and Control, Vol. 1, No 3, 2023

Fuzzy Controller from Experts’ Rules for Middle Axis Ball and Beam

Minh-Quan Nguyen 1,*, Manh-Cuong Nguyen 2, Quang-Huy Trinh 3, Trung-Nghia Nguyen 4, Van-Thiet Ngo 5,

Huynh-Manh-Trien Phu 6, Pham-Minh-Duc Nguyen 7, Phu-Tan Nguyen 8, Van-Truong Le 9, Le-Hai-Duong Dinh 10,

Thuan-An Dam 11, Duc-Huy Nguyen 12, Van-Dong-Hai Nguyen 13

1,12 Faculty of Electronics and Electrical Engineering, Ho Chi Minh City of Technology and Education (HCMUTE), Vietnam

2,3,4,5,6,7,8,9,10,11 Faculty of High-Quality Training, Ho Chi Minh City of Technology and Education (HCMUTE), Vietnam

Email: 1 18151230@student.hcmute.edu.vn, 2 21119326@student.hcmute.edu.vn, 3 21119293@student.hcmute.edu.vn,

4 21142563@student.hcmute.edu.vn, 5 21119357@student.hcmute.edu.vn, 6 21161377@student.hcmute.edu.vn,

7 21161303@student.hcmute.edu.vn, 8 21161079@student.hcmute.edu.vn, 9 21161380@student.hcmute.edu.vn,

10 21161294@student.hcmute.edu.vn, 11 21119325@student.hcmute.edu.vn, 12 21119076@student.hcmute.edu.vn,

13 hainvd@hcmute.edu.vn.

*Corresponding Author

AbstractThe present study examined the nonlinear system of Ball and Beam, to design an intelligent controller for this dynamic system. The authors formulated a mathematical model for the system and performed simulation testing using MATLAB to control it. It is noteworthy that the mathematical model was exclusively used for simulation purposes and not for building the controller. The author's team then proceeded to develop a Fuzzy Controller for the simulation model of the Ball and Beam system. Subsequently, the team tested the Fuzzy controller on the actual Ball and Beam model. The primary objective of this study was to assess the feasibility of building and controlling an intelligent controller for a nonlinear object, without relying on its mathematical model. The findings of the study can be useful in designing and controlling complex systems that are difficult to model mathematically.

KeywordBall and Beam; The Intelligent Controller; Fuzzy

  1. Introduction

Fuzzy control [1]-[3] is an advanced control methodology that was first introduced by Professor Lotfi at the University of California, Berkeley, in 1965 [4]. This methodology has since undergone continuous development and has achieved milestones, making it a widely used algorithm in the field of control systems. One of the most notable advantages of the fuzzy logic algorithm is its ability to be constructed without requiring prior knowledge of the system's parameters or properties, [5]-[7]. This gives it an edge over other algorithms and makes it a preferred choice for complex systems [8]-[10].

However, one of the challenges faced by designers in utilizing this method is the requirement for design and system control experience [11]. To address this challenge, the authors conducted an in-depth research study on fuzzy algorithms in the Ball and beam (B&B) system. The B&B system is a classic model in the automatic control industry, known for its complex and nonlinear properties [12]-[14]. Despite being a SIMO system (single input, multiple outputs), it is still a straightforward model for solving critical problems such as balancing ships and aircraft wings during landing [15], [16].

In this article, the authors offer a comprehensive explanation of the process, methods, and discoveries on fuzzy logic controllers in the B&B system. The outcomes of this research can serve as a basis for designers to develop fuzzy algorithms on different systems or apply standardized fuzzy rules (designed by the authors) on comparable nonlinear/linear systems. This article is a good resource for designers and researchers seeking to enhance their knowledge and understanding of fuzzy control algorithms. Additionally, it provides a basis for designers to continue developing other algorithms on the B&B system before applying them to actual projects, such as ship balancing and aircraft wing balancing.

  1. Research Method

  1. Mathematical Model (MM) of B&B

The structure of the proposed B&B system is shown in Fig. 1. Whereas its parameters value is listed in Table 1.

  1. B&B system

Consider the system with O (0; 0): center of rotation, Potential energy landmark at O, p: the position of the ball relative to O (m), : angle of deviation of beam b from the horizontal (rad), : torque generated by the engine (Nm). The detailed parameters of the system [16] are selected. According to [16], the B&B mathematical model is as follow.

  1. Parameters of B&B system

STT

Sign

Mean

Value

Unit

1

Constant torque of the motor

0.0649

N

2

Back EMF

0.0649

V/rad/s

3

Motor resistance

6.8357

4

Ball mass B

0.045

Kg

5

Beam mass b

0.35

Kg

6

Ball radius B

0.011

m

7

Beam length b

0.34

m

(1)

(2)

Where: : moment of inertia of the beam when rotating around its center, : moment of inertia of the ball when rotating around its center, g = 9.81 (m/): gravitational acceleration.

The system is often controlled by adjusting the voltage supplied to the motor. Therefore, the authors performed an additional step of converting the MMM of the system to the motor voltage. Consider the motor with structure:

The moment generated by the engine is calculated by the formula: Where Fig. 2: e (V): the voltage supplied to the motor,  (rad/s): angular velocity. Substituting (3) into (2), the MMM of the system is rewritten: Substituting (6) into (4), and (5); the MMM of the system is rewritten:

  1. The motor structure

(3)

(4)

(5)

(6)

(7)

(8)

(9)

(10)

Fig. 3 shows the proposed B&B system in MATLAB/ Simulink which can be described as : Matlab Fcn blocks, to represent equations (7), (8), (9), (10), Random Number: the authors are investigating the influence of e on the states of the B&B system, Scope: to view output values as a graph over time.

The authors conducted many surveys using the above method to accumulate experience in controlling the B&B system. The e values can be Constant, Sine Waves, Random, Line Function.

Ảnh có chứa biểu đồ, Kế hoạch, Bản vẽ kỹ thuật, sơ đồ

Mô tả được tạo tự động

  1. Simulink diagram to survey  when changing
  1. Built to Fuzzy Controller

  1. Choose Input and Output Variables

Choose 4 input variables of the Fuzzy Controller including ball position p (m), ball speed  (m/s), beam deflection angle  (rad), and angular velocity  (rad/s). Beam b has a length of 0.3m, so  < 0.15m. Therefore, the authors’ team choose a range for p of [-0.5; 0.5]. In ideal conditions, considering the case where ball B freely falls a distance equal to the length of beam b, we have the maximum velocity of ball: . In the case of the B&B system, the maximum velocity of ball B must be less than . Therefore, the authors choose the range of v to be [-3; 3]. Due to rotation limitations, the maximum deflection angle of beam b is 1.571 rad. The authors choose the range of  as [-2; 2]. The selected motor has a maximum rotation speed of 200 rpm. Therefore, the maximum angular velocity that beam b can achieve is 20.91 rad/s. The authors choose the range of  as [-21; 21]. Choose 1 output of the Fuzzy Controller as the power supplied to the PWM (motor control pulse chopper). The authors chose an output range is [-100; 100].

  1. Standarization

Standardization is not a mandatory step when building a Fuzzy Controller. However, people often do it to increase the reusability of that Fuzzy Controller or to be able to program PLCs, microprocessors later. Inputs and outputs are normalized to the value range [-1; 1]. Therefore, preprocessing values  and postprocessing  are required. Chosen K values that come from experimentation. In the initial step, the authors choose based on the estimated range. Choose ,.

  1. Fade Input and Output

For each input, two triangular membership functions are considered for simplicity. In Fig. 4, the variable i ranges from 1 to 4, representing the membership function of input 1, 2, 3, and 4. The team of authors opted for the output of the Fuzzy Controller with 10 membership functions, where each membership function has a constant form Fig. 5.

  1. Fuzzy Rules

The authors proposed a table of 16 fuzzy rules Table 2. based on the control experience with the B&B system. In Table 2, P is positive, and N is negative. In Fig. 6, The authors present 16 cases corresponding to the 16 rules.

Ảnh có chứa hàng, biểu đồ, Sơ đồ, Song song

Mô tả được tạo tự động

  1. Input membership function

Ảnh có chứa hàng, biểu đồ, Song song, Sơ đồ

Mô tả được tạo tự động

  1. Output membership function
  1. Table of fuzzy rules

STT

Output

1

N

N

N

N

P2

2

N

N

N

P

N3

3

N

N

P

N

N2

4

N

N

P

P

N5

5

N

P

N

N

P4

6

N

P

N

P

P1

7

N

P

P

N

P1

8

N

P

P

P

N3

9

P

N

N

N

P3

10

P

N

N

P

N1

11

P

N

P

N

N1

12

P

N

P

P

N4

13

P

P

N

N

P5

14

P

P

N

P

P2

15

P

P

P

N

P3

16

P

P

P

P

N2

  1. Inference Method And Defuzzification Method

Choose the Max-Prod inference method. Choose the centroid defuzzification method (COA). The fuzzy map is built according to the Takagi-Sugeno fuzzy model.

  1. Built Fuzzy Controller on Matlab

Using the “Fuzzy Logic Designer” tool in MATLAB, create a Fuzzy Logic Controller using the Sugeno method. The results obtained are shown in Fig. 7, Fig. 8.

Ảnh có chứa biểu đồ, văn bản, hàng, nghệ thuật gấp giấy origami

Mô tả được tạo tự động

  1. 16 cases corresponding to the 16 rules

Ảnh có chứa văn bản, ảnh chụp màn hình, màn hình, phần mềm

Mô tả được tạo tự động

  1. Fuzzy rules

Ảnh có chứa ảnh chụp màn hình, văn bản, biểu đồ, phần mềm

Mô tả được tạo tự động

  1. Fuzzy surface
  1. Result and Discussion

  1. Simulation Results

To confirm the efficiency of a 16-rule Fuzzy controller, the author simulated its control of the B&B system by using MATLAB Simulink. Unfortunately, the results of the first simulation using the selected preprocessing-postprocessing coefficients were unsuccessful and unstable. The authors then retested the coefficients to better match reality. After investigation, they found that the post-processing coefficient was too small, resulting in a control signal that was also too small. The authors decided to increase the post-processing factor by ten times, . Then, they re-simulated using the new coefficients.

In Fig. 9, Ball and beam Model: The subsystem block describes the B&B system's MMM, Fuzzy Logic Controller – 16 Rules: Fuzzy Controller 16 rules, : The pre-processing block has been selected,: The post-processing block has been selected, Scope: to view system stability results over time.

The simulation result is depicted in Fig. 10. To be more specific, we considered the stability criteria as steady-state error (), settling time (), and overshoot (POT) in Table 3. Based on the outcome of the simulation, the authors' team has determined that the 16-rule Fuzzy Controller, which was designed based on control experience, is capable of effectively stabilizing the B&B system.

Ảnh có chứa biểu đồ, Bản vẽ kỹ thuật, Kế hoạch, sơ đồ

Mô tả được tạo tự động

  1. Simulate the control of the B&B system using the 16-rules fuzzy controller

Ảnh có chứa văn bản, hàng, biểu đồ, Sơ đồ

Mô tả được tạo tự động

  1. The results stabilize the B&B system over time
  1. Evaluation table of stability criteria

POT

0 m

1.75 s

-0.0014 m

0 rad

1.75 s

-0.033 rad

  1. Test Results on Actual Models

The authors used the B&B model of C205B laboratory, Ho Chi Minh City University of Technology and Education shown in Fig. 11, where:

Ảnh có chứa mạch điện, Kỹ thuật điện, đồ điện tử, kỹ thuật

Mô tả được tạo tự động

  1. Real model of B&B system

(1) The 24V Power, (2) The Kit STM32F407 Discovery, (3) The Encoder, (4) The DC motor, (5) The Wiring resistance sensor, (6) The Beam, (7) The CP2021 UART, (8) The H Bridge, (9) The ball.

The authors experimented to test the efficacy of the Fuzzy Controller on a real B&B model. The initial control results, obtained using the selected preprocessing-postprocessing coefficients in the simulation, were observed to be unstable. Upon retesting, the authors discovered that the preprocessing factor was unsuitable, leading to distortion of the input signal to the Fuzzy Controller. As a result, the authors decided to modify the preprocessing coefficients to enhance performance.

The authors have opted to modify the preprocess coefficients, effecting the following changes: . The authors executed practical control utilizing a new set of coefficients which was implemented with the aid of the MATLAB Simulink application that was combined with the Waijung Blockset library to embed the control program for the STM32F407VG microcontroller. The control experiment was performed thrice, and the stable results obtained from the experiment are presented in Fig. 12, Fig. 13, and Fig. 14.

Ảnh có chứa văn bản, Sơ đồ, ảnh chụp màn hình, hàng

Mô tả được tạo tự động

  1. 1st Stable results

Ảnh có chứa văn bản, Sơ đồ, hàng, biểu đồ

Mô tả được tạo tự động

  1. 2nd Stable results

Ảnh có chứa văn bản, Sơ đồ, hàng, biểu đồ

Mô tả được tạo tự động

  1. 3rd Stable results

To be more specific, we considered the stability criteria as steady-state error (), settling time (), and overshoot (POT) in Table 4. Control results show that the 16-rule Fuzzy Controller can stabilize the B&B system well.

  1. Evaluation table of stability criteria

Time

POT

1st (Innit at -0.075m; -0.07rad

0.001m

5s

0.005m

0.078rad

5s

0.022rad

2nd (Innit at 0.14 m; 0.12 rad)

0.0006m

7s

-0.025m

0.078rad

7.5s

-0.12rad

3rd (Innit at -0.11m; -0.1rad

0.0005m

6s

0.005m

0.078rad

6s

0.025rad

  1. Conclusion

The authors' team has successfully designed a 16-rule Fuzzy controller, which has demonstrated its effectiveness in stabilizing the B&B system both in simulation and experiment. This achievement highlights the viability of constructing a fuzzy controller for a complex system with unknown parameters or properties. Additionally, the Fuzzy Controller 16 rules have shown their flexibility in various conditions, remaining responsive despite differences between simulation and experiment. These promising results serve as a solid foundation for further research on the B&B system. Furthermore, the standardized 16-rule Fuzzy Controller can be adopted for similar systems, facilitating researchers' understanding of fuzzy algorithms and simplifying the design of fuzzy logic controllers.

Acknowledgment

The link video of the system's operation is shown at: https://www.youtube.com/watch?v=uCyq7vytVI4. 

Reference
  1. G. Cansever and O. F. Ozguven, “Application of fuzzy set theory to stabilization of an inverted pendulum by high-speed fuzzy logic controller” Proceedings of MELECON '94. Mediterranean Electrotechnical Conference, vol. 3, pp. 1085-1088, 1994, https://doi.org/10.1109/MELCON.1994.380881.
  2. X. -X. Zhang, H. -X. Li and S. -Y. Li, “Analytical Study and Stability Design of a 3-D Fuzzy Logic Controller for Spatially Distributed Dynamic Systems” IEEE Transactions on Fuzzy Systems, vol. 16, no. 6, pp. 1613-1625, 2008, https://doi.org/10.1109/TFUZZ.2008.2005934.
  3. P. N. Lamkhade, B. J. Parvat and C. B. Kadu, “Design and implementation of fuzzy logic controller for level control” 2015 International Conference on Energy Systems and Applications, pp. 475-479, 2015, https://doi.org/10.1109/ICESA.2015.7503395.
  4. L. A. Zadeh, “Fuzzy logic” Computer, vol. 21, no. 4, pp. 83-93, 1988, https://doi.org/10.1109/2.53.
  5. C. C. Lee, “Fuzzy logic in control systems: fuzzy logic controller. II” IEEE Transactions on Systems, Man, and Cybernetics, vol. 20, no. 2, pp. 419-435, 1990, https://doi.org/10.1109/21.52552.
  1. N. V. D. Hai, N. T. Van and N. M. Tam, “Application of Fuzzy and PID Algorithm in Gantry Crane Control” Journal of Technical Education Science, no. 44A, pp. 48-53, 2017, https://jte.edu.vn/index.php/jte/article/view/370.
  2. N. C. Tran, M. T. Nguyen, T. T. H. Le, V. D. H. Nguyen, “Comparison Between PID and Fuzzy Logic Controller in Speed Control System of DC Motor” International Journal of Robotica & Management, vol. 23, no. 1, 2018, https://search.ebscohost.com/login.aspx?direct=true&profile=ehost&scope=site&authtype=crawler&jrnl.
  3. B. H. Nguyen, M. P. Cu, M. T. Nguyen, M. S. Tran, H. C. Tran, “LQR and Fuzzy Control for Reaction Wheel Inverted Pendulum Model” Journal of Robotica & Management, vol. 24, no. 1, pp. 19-23, 2019, http://robotica-management.uem.ro/index.php?id=704.
  4. V. Nguyen et al., “A Method of PD-Fuzzy Control for Acrobot”, International Journal of robotica and Management” vol. 26, no. 2, pp. 28-34, 2021, https://doi.org/10.24193/rm.2021.2.5.
  5. M. Ivanescu, N. Van Dong Hai and N. Popescu, “Control algorithm for a class of systems described by TS fuzzy uncertain models” 2016 20th International Conference on System Theory, Control and Computing (ICSTCC), pp. 129-133, 2016, https://doi.org/10.1109/ICSTCC.2016.7790653.
  1. D. Qian, J. Yi and D. Zhao, “Hierarchical sliding mode control for a class of SIMO under-actuated systems” Control and Cybernetics, vol. 37, no. 1, pp. 159-175, 2008, https://bibliotekanauki.pl/articles/971008.pdf.
  2. S. Latif, E. Muhammad and U. Naeem, “Implementation of ball and beam system using classical and advanced control techniques” 2019 International Conference on Applied and Engineering Mathematics (ICAEM), pp. 74-79, 2019, https://doi.org/10.1109/ICAEM.2019.8853822.
  3. A. I. Isa, M. F. Hamza, A. Y. Zimit and J. K. Adamu, “Modelling and Fuzzy Control of Ball and Beam System” 2018 IEEE 7th International Conference on Adaptive Science & Technology (ICAST), pp. 1-6, 2018, https://doi.org/10.1109/ICASTECH.2018.8507132.
  4. M. Amjad, M. I. Kashif, S. S. Abdullah and Z. Shareef, “Fuzzy logic control of ball and beam system” 2010 2nd International Conference on Education Technology and Computer, pp. V3-489-V3-493, 2010, https://doi.org/10.1109/ICETC.2010.5529494.
  5. T. Hoang et al., “A Method of Fuzzy Algorithm in Controlling Ball and Beam through Simulation and Experiment” Robotica & Management, vol. 26, no. 2, pp. 03-08, 2021, https://doi.org/10.24193/rm.2021.2.1.
  6. V. Pham et al., “GA-PID Control for Ball and Beam: Simulation and Experiment” Robotica & Management, vol. 27, no. 2, pp. 29-35, 2022, https://doi.org/10.24193/rm.2022.2.5.

Minh-Quan Nguyen, Fuzzy Controller from Experts’ Rules for Middle Axis Ball and Beam