What is fuzzy logic, and how does it work? It may seem vague or unclear, but its applications are quite precise.
I first encountered fuzzy logic over 20 years ago in a magazine article. Interestingly, the application highlighted wasn’t related to control systems. Instead, it focused on counting eggs as they traveled along a conveyor belt. At the time, the technology featured a limited number of expensive laser distance sensors strategically placed above the conveyor. By employing a series of fuzzy logic rules, the system was able to synthesize data from these sensors to accurately tally the passing eggs. Although I've searched for this article, it was published so long ago that it's likely not digitally archived. Nowadays, with the significantly reduced costs of sensors, there are likely more precise and cost-effective solutions for counting eggs on a conveyor. I believe this scenario illustrates one of the most effective uses of fuzzy logic: integrating limited data with well-defined rules to derive accurate values.
In my view, fuzzy logic is often misapplied in situations where a sufficiently effective control system is needed, largely due to its ease of implementation and configuration. When it comes to scholarly articles, it's wise to approach them with skepticism, as many are likely to be rehashed versions of earlier studies tailored to advance someone's academic agenda.
Unlocking the Power of Fuzzy Logic: An In-Depth Tutorial
Fuzzy logic has become a fascinating topic, often perceived as ambiguous and vague. But what exactly is fuzzy logic? It's crucial to explore this concept thoroughly. The initial section of this tutorial (pages 1-12) provides a solid foundation. As we delve deeper, on page 13, you'll encounter a transfer function with a gain value of 0.25—however, it raises the question: what units are we using here? In motion systems, gain typically refers to speed per unit of output, which I standardize to (mm/s)%.
In discussing modeling for a simple motor, note how the set point dramatically shifts from 0 to 1—without any ramping! Figure 13 offers useful insights, and importantly, the author maintains an objective stance towards PID controllers throughout the discussion. On page 18, the text contrasts PID with various membership functions and defuzzification methods, highlighting the distinctions across fuzzy logic algorithms while ensuring a balanced representation of PID.
In concluding remarks, the author asserts that fuzzy logic excels in managing non-linear systems and harnessing human expertise, yet does not provide a concrete example of modeling a non-linear system. While it's true that PID controllers involve only three adjustable parameters, sometimes only a PI controller is needed, or in certain cases, a second derivative gain can be beneficial. Notably, feedforward control, frequently employed in motion control scenarios, is not discussed.
My rebuttal can be found in the referenced document. On page 5 of 10, I demonstrate the use of pole placement to compute the PID gains based on the author's transfer function. A significant observation here is that my output shows how the system behaves. If the gain is 0.25 (mm/s)/%, the system wouldn’t achieve the speeds indicated in the author’s graphs or mine unless output limits are disregarded. I had to adjust the output to reach 1000% to achieve the desired speed—a common oversight in MATLAB and Simulink simulations by less experienced users who fail to display what the control output is achieving. They often neglect to illustrate the crucial output limits of +/- 100%. Initially, my simulation output was also constrained to +/- 100%, resulting in saturation—a scenario to avoid for accurate simulations.
When considering response times, my results demonstrate a response half as long as the author's findings. Regarding the ability to adjust PID gains dynamically, at Delta, our advanced training class teaches participants how to alter gains on-the-fly for effective system control. A brief video showcases an inverted load system that must surpass a critical point, utilizing a cam table to transform rotational movement into linear motion for the hydraulic actuator. As the hammer navigates the arc, the gains continuously change. We instruct attendees on utilizing auto-tuning functionalities to fine-tune gains at various positions along the arc, allowing for rapid gain adjustments every millisecond to ensure precise control.
This information is particularly pertinent given recent discussions on converting rotary motion into linear motion, which raises valid concerns regarding motion non-linearity. With the right control strategies and techniques, achieving smooth transitions should pose no problem. Several forum members have participated in our advanced training class and successfully implemented these concepts.
For further details, explore the materials and insights available at:
- [Fuzzy Logic vs PID PDF](http://deltamotion.com/peter/pdf/FLvsPID/FL%20vs%20PID%200.pdf)
- [Basic and Hammer Training Video](http://deltamotion.com/peter/NewHydraulicTrainingSystems/Basic%20and%20Hammer.mp4)
Engage with this content to deepen your understanding of fuzzy logic and PID controllers, and discover practical applications in motion control systems!
- 11-02-2025
- Peter Nachtwey
Fuzzy Logic emerged as a fascinating subject during my A.I. course in the 1980s, where we explored its application in managing a 4-way stoplight intersection. At this intersection, vehicle and pedestrian queues were classified as either completely empty or partially filled. By utilizing these "semi-boolean" states, we developed a logic framework to optimize the traffic light control system, all rooted in set theory principles.
Years later, I had the chance to apply these concepts in a practical setting, specifically in the operation of a shim selection machine responsible for assembling rear axles. In this scenario, components were measured and their dimensions summed or subtracted from a baseline, which in turn dictated the selection of an appropriate shim for adjusting gear lash. However, the available shim sizes didn't encompass every possible output. To tackle this problem, we created a "best-fit" shim calculation based on the thickness variations among the components. By employing a "fuzzy" approach, we enabled customers to fine-tune the selection criteria, resulting in a surprisingly effective solution.
While I don't consider myself an expert in Proportional-Integral-Derivative (PID) control, it seems that employing a Fuzzy Logic (FL) system can be comparable to using a screwdriver to drive in a nail—likely ineffective, as there are more suitable tools for such tasks. For me, Fuzzy Logic remains one of those tools nestled at the bottom of the toolbox, seldom utilized.
Interestingly, companies like Omron offered a fuzzy logic programmable logic controller (PLC), while Allen Bradley introduced fuzzy logic functionalities in their RSLogix 5000 software around version 16 in 2006, although this feature was later discontinued. I have yet to experiment with either.
By focusing on Fuzzy Logic applications and its practicality in the industry, this revision enhances the text’s SEO potential while maintaining its original intent.
User jstolaruk expressed the viewpoint that Fuzzy Logic (FL) should not be classified as true Artificial Intelligence (AI). He argues that genuine AI systems need to possess learning capabilities, while FL merely requires the modification of membership functions, rules, and defuzzification methods until satisfactory outcomes are achieved. Although some people associate Proportional-Integral-Derivative (PID) control in a similar manner, jstolaruk points out that he can develop auto-tuning programs that eliminate the need for trial-and-error adjustments.
Fuzzy logic enthusiasts often tout its ability to handle multiple inputs and two outputs. However, jstolaruk asserts that PID controllers can also accomplish this. He recalls a discussion from a few years back on this forum involving a user from Mauritius who aimed to manage water temperature for showers. The setup included two valves—one for hot water and another for cold—along with a tank that required consistent water levels. Jstolaruk addressed this challenge using two different methods: one with PI controllers and the other applying linear quadratic control to minimize a defined cost function. He retains the corresponding worksheets from that project and recalls that the original poster's supervisor, or teacher, overlooked a critical detail—the need for a recirculation line to prevent the tank from cooling when hot water wasn't being added.
Jstolaruk favors minimizing cost functions over employing Fuzzy Logic in such cases. He notes that companies like Omron and Allen-Bradley (AB) have recognized Fuzzy Logic as a temporary trend in the industry, citing the Omron FL demonstration that illustrated the balance of an inverted pendulum.
- 11-02-2025
- Peter Nachtwey
The FL study focused on the exploration of sets and the various operations applicable to them. This lesson was part of a series that ultimately introduced the programming language Prolog, which is known for its learning capabilities.
The following discussion highlights the challenges associated with tank level control. In my experience, I typically advise using a proportional band unless exact level regulation is necessary, in which case an integrator becomes essential. For a PLC-based PID controller, it's important to set the time constant to eliminate the error within five time constants, though this approach is somewhat arbitrary and lacks scientific rigor. While I could apply my pole placement technique, it tends to be excessive for standard tank level control applications.
A significant flaw in the referenced document is the overly simplified transfer function outlined in equation 12, which I suspect is incorrect. The situation only requires a PI controller, yet the author opts for a PID controller and Ziegler-Nichols (ZN) tuning, the least effective method for system tuning. It’s disappointing that the author claims to employ MATLAB and Simulink for tuning purposes, which can cast a negative light on PID control when executed poorly. Observations reveal that the control signal appears to nearly pull water out of the tank via a negative control signal instead of allowing for natural drainage. Ideally, the water level should decrease in a somewhat exponential manner.
Upon reviewing the conclusion, I found it lacking in substance. If it were up to me, the student would have received a failing grade. Interestingly, the work was presented at a conference, which I find quite embarrassing. For a point of comparison, I once assisted a student with a control project featured on LinkedIn. This project involved managing the water level in a second tank, supplied by a pump drawing from a first tank that drained through an orifice. The water would naturally flow out and recirculate.
Although my calculations were considered overly elaborate, I firmly believe that student education should not revolve solely around adjusting gain until satisfactory outcomes are reached. I carefully incorporated the fact that flow through the orifice varies with the square root of the water level and that the tank's surface area changes with level. I dynamically adjusted the gains to maintain the closed-loop poles in optimal locations. While this might seem excessive, accurate system design necessitates comprehensive modeling of expected behaviors. The height of tank 1 is crucial; if it isn’t sufficiently tall, the water won’t flow quickly enough to fill tank 2. If tank 1 has a small surface area, the level could fluctuate too rapidly, risking overflow or underflow. Poor system design can leave the PLC programmer with no options at all.
Despite my concerns, the student earned an A, while, in my opinion, he would have failed for not being able to formulate the initial two differential equations for tanks 1 and 2. The two-tank problem can indeed be managed with two proportional bands, provided that precise control of the second tank isn’t strictly necessary, making the situation somewhat fuzzy. The pump must ensure a sufficient water level in the first tank while also supplying enough water to maintain level in the second tank. This would involve calculating a weighted average based on the outputs from the two proportional bands, without using a fixed ratio for weighting.
To derive the weights, I would square the error for the ideal levels of tanks 1 and 2. The weight for tank 1 would be calculated by taking the squared error of tank 1 divided by the sum of the squared errors from both tanks. Conversely, the weight for tank 2 would be derived from the squared error for tank 2 divided by this total. As a result, the tank demonstrating the greatest error receives the highest weight. It's worth considering the complexities in implementing a similar strategy for feedforward control systems.
- 11-02-2025
- Peter Nachtwey