Ball and Beam Control: Evaluating Type-1 and Interval Type-2 Fuzzy Techniques with Root Locus Optimization

ABSTRACT

The ball and beam system serves as a fundamental example in studying control systems' basic principles. System equations can be derived using Newtonian mechanics, showcasing that the results align with those obtained through the Lagrangian method [14]. Numerous authors have derived the ball and beam system equations using the Lagrangian method. However, some have used Newtonian mechanics for the same purpose but overlooked the rotating coordinate system's effect, leading to incomplete equations [15], [16].
PID control systems for the ball and beam have been extensively explored [17], [18], employing techniques such as quantitative PID controller [19], optimal PID-Like fuzzy logic controller [20], and hybrid optimization-based PID control [21]. The design of the root locus controller [6] serves as another foundation that simplifies the control system design and development, similar to PID control systems.
Fuzzy logic controller systems have gained widespread development and application in various fields, including the ball and beam system. Research studies have explored different fuzzy logic controller approaches, such as neural fuzzy control [22], hybrid fuzzy PID controller [23], and adaptive neuro-fuzzy techniques [24]. Fuzzy control systems consist of type-I and type-II fuzzy logic controllers, which are often compared to evaluate their performance in diverse applications. The primary distinction between type-I and type-II fuzzy logic controller systems is the processing stack. Type-II fuzzy logic controllers have an additional layer called the Footprint of Uncertainty values or FOU, which is smaller than the normal processing stack. For instance, self-balancing iBOT-like wheelchairs have been designed using both type-I and interval type-II fuzzy control [25], [26]. The simulated results revealed minimal differences, with the interval type II fuzzy control demonstrating marginally superior performance. In real-world testing, interval type II fuzzy control systems displayed improved stability across various terrains, indicating their ability to operate more broadly under different system conditions. Nonetheless, this study did not investigate the behavior of these controllers in other systems. To design fuzzy logic controllers for use in robotics, the membership function can be tuned by observing the system's behavior with a closed control system [27], [28].
This study investigates control system design, with a focus on PID, root locus, and fuzzy logic controllers, which are commonly used as starting points for motor control [29], [30], [31]. The aim is to determine the most suitable control system based on application requirements and environmental factors by evaluating their performance under diverse conditions. The research compares the effectiveness of type-1 Mamdani FLS and interval type-2 Mamdani FLS control systems, addressing a knowledge gap in their performance. Through simulations, the study assesses each control system's strengths and weaknesses in various environments and applications, providing valuable insights for practitioners and researchers in control systems engineering. The performance of control systems is evaluated in ideal and noisy conditions using step input and sine wave input functions, highlighting the importance of selecting the appropriate control system based on application requirements and environmental conditions. The findings contribute to the development of more effective control systems, benefiting educators, practitioners, and researchers in the field of control systems engineering.

Designing System
Membership function configuration is vital in designing a fuzzy logic control system. Tuning the membership function by observing the system behavior with a closed control system can address the challenges in this process. P. Chotikunnan et al. [27] explored optimizing membership function tuning for fuzzy control of robotic manipulators using PID-driven data techniques. The study employed a closed control system with a root locus controller to gather the information that was used to design function tuning for fuzzy control in type I and type II. The goal of the study was to apply these techniques to the ball and beam system. The study will investigate the design of a closed control system with a root locus controller, and the gathered information will be utilized to design function tuning for fuzzy control in type I and type II. By employing these techniques, the challenges associated with configuring membership functions in a fuzzy logic control system can be effectively addressed.

The Ball and Beam
The ball and beam systems are a widely used educational tool and experimental platform in control engineering, favored for their simplicity, versatility, and real-world relevance. Constructed from easily accessible materials like steel balls and wire, this system offers a straightforward way to build and test controllers, enabling students and researchers to quickly grasp its operation. The ball represents the object being controlled, while the beam serves as the controller, providing a clear visualization of the control system in action. Ideal for teaching and laboratory practice, the ball and beam systems have diverse applications, from industrial control systems to robotics and aircraft flight control systems. As a result, it plays a significant role in various engineering and technology fields, promoting a deeper understanding of system control.
In the ball and beam model, a ball is placed on a beam, allowing it to roll along its length with one degree of freedom. A lever arm connects to the beam at one end, while a servo gear attaches at the other end. When the servo gear rotates by an angle θ, the lever alters the beam's angle by α. As the angle deviates from the horizontal position, gravity causes the ball to roll along the beam. A controller will be designed to manipulate the ball's position in this system. Fig. 1 demonstrates a basic ball and beam structure with given system parameters. It is assumed that the ball rolls without slipping and that friction between the beam and the ball is negligible. The constants and variables for this example are defined in Table 1.  In the process of designing system equations, it is important to consider the effect of the second derivative of the input angle ( ) on the second derivative of . While this contribution can be ignored in certain cases, it should be taken into account when necessary. The Lagrangian equation of motion for the ball can be expressed as (1).
Linearizing this equation around the beam angle, = 0 , results in the following linear approximation of the system, which is expressed as (2).
The relationship between the beam angle and the gear angle can be approximated linearly using the following (3).

=
(3) By substituting the linear approximation of the equation relating the beam angle and the gear angle to the previous (4).
The Laplace transform of the equation mentioned above results in the following equation, which is expressed as (5).
By rearranging the equation, the transfer function from the gear angle ( ( )) to the ball position ( ( )) can be determined. The transfer function is shown in (6).
It is important to note that the plant transfer function mentioned above is a double integrator. As a result, it is marginally stable and poses a challenging control problem. The transfer function has been transformed into the domain and is represented in (7).

Optimizing Membership Function Tuning
In a study conducted by P. Chotikunnan et al. [27], the design of membership function optimization was explored by utilizing data from a PID controller system. The obtained signals were then used to estimate the membership function table for use in the fuzzy logic controller.
In this study, the principles of the polynomial model and membership function tuning using the root locus method will be discussed. Additionally, the values of the membership function table will be calculated, which will be elaborated on in the subsequent section.

Polynomial models
Polynomial regression analysis is a regression analysis technique that is employed to investigate the correlation between one or more dependent variables ( ) and independent variables ( ). This relationship is expressed in the form of (8).
In polynomial regression analysis, the order of the polynomial is denoted by + 1, and the degree of the polynomial is represented by .
The purpose of this study is to determine the degree of the polynomial in = 3 and = 3. To achieve this, the robust technique of the Bisquare weights method is utilized to estimate the required data for solving the equation in the polynomial system. A regression model of degree 3, which is also known as a quadratic model, is used to represent the relationship between two variables, and . The regression model is expressed as (9).
( , ) = 0 + 10 + 01 + 11 + 20 2 + 02 2 + 21 2 + 12 2 + 30 The command function fit([x,y],z, 'poly33', 'Normalize', 'Bisquare') in the MATLAB program can be used to find the conditions where is the value of input I, is the value of input II, and is the value of the output to be estimated. The value of can be obtained from the fit function of the MATLAB program, which displays the parameters in the simulation results.

Membership function tuning
Training algorithms are used to determine the membership function of a system by employing data storage techniques in a control system. This allows the behavior of the system to be controlled effectively. The initial data is analyzed to design a suitable membership function system through the execution of a search process. In order to design the feedback control, MATLAB/Simulink program can be utilized, as depicted in Fig. 2. Fig. 2 showcases an example of the ball and beam system where a lead compensator was designed using the root locus method. Lead and lag compensators are crucial in control systems, as they can improve stability and response time and reduce steady-state errors. These compensators are usually designed for systems in transfer function form and can be used in various combinations depending on the desired effect. In this specific example, the compensator has a zero at -0.01, a pole at -6, and a gain of 31.9358, and the next step involves implementing it in Simulink to ensure system stability.
For enhancing the controller's performance in the ball and beam system, the membership function tuning was optimized in the design of both type I and type II fuzzy logic controllers. The root locus method controller was chosen as it demonstrated better stability than the PID controller in this system. The membership function was determined by collecting data from the feedback control using a program presented in Fig. 3. The program was used to collect data for determining the membership function by designing a smooth function signal with a setpoint. In Fig. 4, the parameter values for the sine wave function are specified. This signal is then provided to the control system that requires the membership function of fuzzy logic. Data is collected from the feedback control system, which includes the error ( ), the derivative of the error (), and the control input (̌).  Fig. 6 shows the signal values collected by the design multiple polynomial regression by Bisquare weight method tuned FLC. This process is used to perform the optimized membership function tuning, as described by P. Chotikunnan et al. [27], to obtain the value of the membership function in the ball and beam system.  These values are then substituted into (9) to obtain the value in the membership function table. The resulting membership function table is displayed in Table 2.

Fuzzy Controller
Fuzzy logic controllers are intelligent control systems that are well-suited for controlling complex and nonlinear systems. The design of a fuzzy controller involves several steps, including identifying input and output variables, defining linguistic variables, creating fuzzy rules, using the fuzzy inference engine to process rules and generate outputs, and defuzzification to convert the fuzzy outputs to crisp outputs. Fuzzy controllers have been successfully applied in various industries, including air conditioning, traffic control, robotics, washing machines, and financial modeling. Additionally, research in this area includes developing adaptive fuzzy systems, fuzzy PID controller systems [32]- [35], optimal control [36]- [41], and adaptive sliding mode [42]- [47] for applications in motors and robotic arms.
One example of the application of fuzzy logic controllers is in controlling the stability and mobility of a ball and beam system. A feedback system is designed using a fuzzy logic system to control the ball's pitch angle and stop its motion while maintaining stability on the ball and beam. The block diagram used in the system is shown in Fig. 7. This example demonstrates the effectiveness of fuzzy controllers in handling complex systems with uncertain and imprecise information. The block diagram shown in Fig. 7 depicts the application of a fuzzy logic system for controlling the stability and mobility of a Ball and Beam system. Several parameters are employed in the diagram, including KFI set to 0.2, KFO set to 100, saturation_e and saturation_de set to ±0.1, and saturation_Output set to ±100. These parameter values can be determined through the optimized membership function tuning method or manually adjusted to attain optimal performance. KFI is the signal gain value of the input signal, while KFO is the signal gain value of the output signal. It is worth noting that while KFO is usually set to 100, which represents the maximum signal that the system can send to control the ball and beam system, its value may differ based on the specific design requirements of the system. Sections 2.4.1 and 2.4.2 provide an introduction to two types of Mamdani fuzzy logic control, type-1 fuzzy logic control and interval type-2 fuzzy logic control. These fuzzy logic control systems are utilized in the block diagram presented in Fig. 7, which is responsible for controlling the ball and beam system. Additionally, both the upper and lower blocks of the diagram employ the same type of fuzzy logic control to compare and evaluate the effectiveness of the type-1 fuzzy logic control and interval type-2 fuzzy logic control designs.

Type-1 Mamdani FLS
This section analyzes two input type-1 Mamdani models, with a rule base of 5 rules in input 1 and input 2 and output 9 rules, as shown in Fig. 8 and Fig. 9, respectively. Table 2 illustrates the rules employed in these models. To estimate the fuzzy system, the equation given in (10) is used, where 1− represents the centroid defuzzification. The centroid defuzzification returns the center of gravity of the fuzzy set along the x-axis, which can be computed using the following formula, where ( ) is the membership value for point in the universe of discourse.

Interval Type-2 Mamdani FLS
In this section, an interval type-2 Mamdani model with the same rules and number of antecedents as the type-1 model is considered. The primary memberships of the inputs containing the uniformly shaded FOUs in the fuzzy sets are different from the type-1 model, as shown in Fig. 10 and Fig. 11. In Fig. 10 and Fig. 11, the FOU is 0.2.
To obtain the final crisp output value for the inference process, the aggregate type-2 fuzzy set is first reduced to an interval type-1 fuzzy set, which is a range with a lower limit and upper limit . This interval type-1 fuzzy set is commonly referred to as the centroid of the type-2 fuzzy set. In theory, this centroid is the average of the centroids of all type-1 fuzzy sets embedded in the type-2 fuzzy set. In practice, it is not possible to compute the exact values of and . Instead, iterative type-reduction methods are used to estimate these values. For a given aggregate type-2 fuzzy set, the approximate values of as shown in (11) and as shown in (12) are the centroids of the following type-1 fuzzy sets.
The interval set is defuzzified using the average of (13).
The variable represents the number of samples taken across the range of the output variable. The variable represents the ith output value sample. The upper membership function is denoted as , and the lower membership function is denoted as . The switch points and are estimated using various type-reduction methods.

Results and Discussion
To develop a system testing approach for evaluating the performance of three control systems, the root locus control system, the type-1 Mamdani FLS, and the interval type-2 Mamdani FLS, a test simulation is designed using Simulink. The test focuses on assessing the controller performance in both noise-free and noisy ball and beam systems.
The three control systems include the root locus control system depicted in Fig. 12, the type-1 Mamdani FLS and the interval type-2 Mamdani FLS, both illustrated in the control system design structure in Fig. 13. The interval type-2 Mamdani FLS is designed with Footprint of Uncertainty (FOU) values of 0.1, 0.2, and 0.3 to examine the system's behavior.  Four tests are conducted as part of the systematic evaluation, as shown in Fig. 14. Test 1 assesses a 0.8-meter step input in an ideal system without white noise signals. Test 2 examines a 0.8-meter step input in the presence of white noise signals. Test 3 evaluates the sine wave function in an ideal system, both with and without white noise signals. Lastly, Test 4 investigates the sine wave function in a system with white noise signals. The sine wave function parameters are provided in Fig. 15, and the white noise signal parameters can be found in Fig. 16. The first simulation result, illustrated in Fig. 17, compares the responses of the five control systems. According to the simulation, the root locus method-designed control demonstrated the most favorable response. Although the type-2 Mamdani FLS appeared to exhibit a quicker initial response, their settling time did not significantly differ from the type-1 Mamdani FLS. Consequently, in this test, the performance of type-1 Mamdani FLS and type-2 Mamdani FLS remained relatively similar. In the second simulation result, the control systems' performance was evaluated using white noise signals, as depicted in Fig. 18 and Fig. 19. The results show that the root locus method-based control exhibits a quick rise time and reaches the setpoint swiftly, albeit with increased overshooting. type-2 Mamdani FLS with FOU values of 0.1 and 0.2 demonstrate a more effective response, achieving the settling time promptly and displaying less overshoot. In contrast, type-1 Mamdani FLS and type-2 Mamdani FLS with a FOU value of 0.3 exhibits a longer time to reach the settling time but with similarly minimal overshoot. These findings emphasize the enhanced performance of type-2 Mamdani FLS in noisy environments compared to the root locus method and type-1 Mamdani FLS. However, using excessive FOU values in type-2 Mamdani FLS may lead to reduced performance.  Table 3 and Table 4 present an analysis of the signals generated in Fig. 17 and Fig. 18, respectively. The settling time was fixed at ±5%, and the highest or lowest value of the signal after the control system's rise time was considered as %OS. The results showed that for noisy ball and beam systems, the type II fuzzy logic controller (FOU=0.1) performed the best on average, while the root locus controller had the best average control performance for a noise-free ball and beam systems. The root locus controller may be the best option for a noise-free ball and beam systems. In the third simulation result, depicted in Fig. 20, the system was tested using a sine wave input, revealing that type-1 Mamdani FLS and type-2 Mamdani FLS exhibited similar responses. Conversely, the root locus control method demonstrated a slower response signal and was not as effectively controlled as in the first simulation.
In the fourth simulation result, the control system's performance was assessed using white noise signals, as depicted in Fig. 21 and Fig. 22. The findings show that the control system designed with the root locus method experienced overshoot and signal delay in the system response. During the 0-4 second time interval, the type-2 Mamdani FLS with FOU values of 0.1 and 0.2 demonstrated a more effective response, reaching the settling time promptly and with less overshoot. Conversely, type-1 Mamdani FLS and type-2 Mamdani FLS with a FOU value of 0.3 took longer to achieve the settling time but exhibited similarly minimal overshoot. After 5 seconds, the performance of the type-1 Mamdani FLS and type-2 Mamdani FLS resembled that of simulation 2 in terms of response to the setpoint.   The overall results of the simulation study comparing the root locus method, type-1 Mamdani FLS, and interval type-2 Mamdani FLS indicate that each control system has its strengths and weaknesses, depending on the specific test conditions. In an ideal environment without noise, the root locus method delivers the best response. However, when faced with noisy environments, type-2 Mamdani FLS with FOU values of 0.1 and 0.2 performed better in terms of achieving the settling time and managing overshoot. In sine wave input scenarios, type-1 Mamdani FLS and type-2 Mamdani FLS had similar responses, while the root locus method showed a slower response signal.
These findings highlight the importance of selecting the appropriate control system based on the specific application requirements and environmental conditions. While the root locus method excels in ideal conditions, type-2 Mamdani FLS with specific FOU values demonstrates a more robust performance in noisy environments.

Conclusion
This educational research offers a comprehensive comparison of three control systems, namely the root locus method, type-1 Mamdani FIS, and interval type-2 Mamdani FIS, under various conditions. The study highlights the importance of selecting the appropriate control system based on specific application requirements and environmental circumstances. For instance, in real-world scenarios such as industrial automation or robotics, where noise-free environments are rare, the type-2 Mamdani FIS with selected FOU values might provide more robust performance. On the other hand, in scenarios where ideal conditions prevail, the root locus method could offer superior control. The results of this research can be applied to these situations, helping practitioners and researchers make informed decisions about the most suitable control systems. However, there may be potential limitations to this research, such as the need for further investigation into the scalability and adaptability of these control systems in more complex or dynamic environments. Additionally, exploring the impact of varying the FOU values in the type-2 Mamdani FIS control system could provide valuable insights into optimizing its performance under different conditions. In summary, this study presents important insights into the field of control systems engineering, which can benefit practitioners, researchers, and educators. Based on the findings, the type-2 Mamdani FIS control system has demonstrated superior capabilities compared to the type-1 Mamdani FIS for design support purposes. However, when working in an open environment, there is a difference in the system's control performance. These insights can be utilized in various applications, such as motor systems, robot motion systems, and decision support systems. In the future, further research is necessary to explore the diverse applications of these control systems to other systems.
Author Contribution: All authors contributed equally to the main contributor to this paper. All authors read and approved the final paper.
Funding: Research Institute, Academic Services Center, and College of Biomedical Engineering, Rangsit University.