Fuzzy Application Library/Technical Applications/Truck Speed Limiter
Truck Speed Limiter Control by Fuzzy Logic
by Constantin von Altrock, Bernhard Krause, Eric Nield, Mike Lord, and Alexander Baker
Citation Reference: This paper was published at the Fuzzy Logic '94 Conference held in San Francisco in September 1994. The Fuzzy Logic Application Note series is published by Inform Software Corporation on its Internet server to promote the use of fuzzy logic technologies in applications.
In Europe, commercial trucks in compliance with European legislation, which have a maximum load of more than 12 tons, are required to be equipped with a speed limiter that limits their maximum speed to 53.3 mph (86 km/h). This case study focuses on the electro-pneumatic design of such a speed limiter. In this design, a pneumatic cylinder mechanically limits the throttle opening angle of the fuel pump arm. The cylinder pressure is controlled by a pulse proportional electromechanical valve. This valve is connected to an electronic control unit that uses a microcontroller to drive the valve according to the actual speed of the truck. The design of an algorithm for this control problem proved to be difficult, since the same speed limiter device is used in a variety of different trucks which exhibit different behaviors. In addition to this, the dynamic behavior of a truck differs very much depending on whether it is fully loaded or empty. Conventional control algorithms, such as PID controls, assume a linear model of the process under control and can hence not be used for a solution. A solution using a mathematical model of the truck is first laborious to build and second of prohibitive computational effort for a low-cost 8-bit microcontroller. Hence, fuzzy logic control was used to design the control algorithm.
1. Speed Limiter Requirements and Conventional Control
Figure 1 exemplifies the function of a truck speed limiter. When the truck approaches the maximum velocity, the pneumatic valve reduces the throttle opening angle of the fuel pump arm so that the maximum velocity vs is not surpassed. If the driver pushes down the accelerator pedal even more, the speed limiter has to ensure a smooth ride at the maximum velocity.
However, due to the dead time and non-linearities involved with this control action, an actual overshoot and hunting occurs when using a proportional or on-off controller. Adding a differential and integral part yields a PID controller model. A PID controller generates the command value as a linear combination of the error (P), the derivative of the error with respect to time (D) and the integral of the error with respect to time (I). To tune a PID controller, the combined weights of these three (3) components must be chosen, so that they approximate the nonlinear behavior of the process under control at its operating point. While this works with most processes that are at only one operating point, it fails when the operating point moves. With a truck speed limiter, the operating point moves because of the different load situations, such as driving uphill or downhill, as well as driving empty or with a full load. Furthermore, the characteristic of the pneumatic valve and the truck fuel injection are highly non-linear and vary from one truck to another.
|Figure 1: The function of a Speed Limiter is to stop the truck from driving faster than the maximum allowed speed (vs) (large)|
Hence, if a PID control algorithm is used in a truck speed limiter, it can only be tuned well for one operation point and one type of truck. For other operation points and different truck types, overshoot and hunting occurs. The European legislation hence allows operation of the speed limiter within a certain tolerance. Figure 2 shows an example of this. When reaching the maximum speed, an initial overshoot of 5 km/h is tolerated. After this, the speed must be kept constant within an interval of ± 1.5 km/h. Even though this overshoot and hunting is tolerated by the European legislation, it causes annoying speed fluctuations when driving.
|Figure 2: Tolerances for the operation of the Speed Limiter (large)|
2. Mechanical Design of the Speed Limiter
Figure 3 sketches the outline of the mechanical design of the speed limiter. An electronic control unit (ECU) compares the digital pulse signal from the speedometer with the maximum speed value pre-set in the device. Based on this, it computes the command value for the pulse proportional valve (PPV) that controls the air pressure in the cylinder. The air stems from the vehicle's pressured air system. In a non-linear but proportional ratio, the cylinder shortens the arm linking the accelerator pedal to the fuel pump so that the fuel pump is throttled.
|Figure 3: Mechanical Design of the Speed Limiter (large)|
3. Design of the Speed Limiter Electronic Control Unit
The electronic control unit itself is designed as a mixed digital and analog circuit. Speedometer signal processing, the fuzzy logic control algorithm, and diagnosis functions are computed by a PIC 8-bit microcontroller (MCU). The MCU uses an external E²PROM to store parameters of the truck and speedometer, the maximum velocity, and diagnosis variables.
The MCU also generates a pulse-width modulated signal (PWM) that is amplified by a power stage to drive the PPV. The analog part is responsible for the preprocessing and filtering of the speedometer signal. Figure 4 shows a photo of the unit.
|Figure 4: The Electronic Control Unit of the Speed Limiter using a PIC 8-bit Microcontroller (large)|
4. The Fuzzy Logic Controller
Fuzzy logic is an innovative technology to design solutions for multi-parameter and non-linear control problems. It uses human experience and experimental results rather than a mathematical model for the definition of a control strategy. As a result, it often delivers solutions faster than conventional control design techniques. In addition, fuzzy logic implementations on microcontrollers are very code space and execution speed efficient. For further details on fuzzy logic, refer to [3, 4, 5].
|Figure 5: Structure of the Fuzzy Logic Speed Limiter Controller (large)|
The entire fuzzy logic algorithm was developed, tested and optimized using the software tool fuzzyTECH®. This integrated design environment features automatic assembly code generation on all PIC microcontroller families [1, 2]. Figures 5 - 7 all show screen shots of the fuzzy logic speed limiter design in various editors and analyzers of fuzzyTECH. Figure 5 displays the Project Editor featuring the structure of the fuzzy logic system. On the left side, two input interfaces fuzzify the two input variables "Acceleration" and "Speed_Error". The rule block in the middle contains all the fuzzy logic rules that represent the control strategy of the system. On the right side, the output variable "PMV_Set_Value" is defuzzified in an output interface.
|Figure 6: Definition of the Linguistic Variables and the Rule Table (large)|
Figure 6 shows more details of the fuzzy logic system. Each linguistic variable is displayed in a variable editor window and the rules are displayed in the Spreadsheet Rule Editor window. Each linguistic variable contains five (5) terms and membership functions. They are connected by a total of 12 fuzzy logic rules. All membership functions are of Standard types [3, 4]. As a defuzzification method, the Center-of-Maximum (CoM) method is used. For more details on the fuzzy logic methods used, refer to [3, 4].
All rules in the fuzzy logic system now let the designer define the best reaction (output variable value) for a given situation. The situation is described by the combination of the input variables. After such a control strategy has been defined by the designer, a number of different analyzer tools can be used to verify the system's performance. Figure 7 shows the 3D Plot as an example. In the 3D Plot, the two horizontal axes show the two input variables "Acceleration" and "Speed_Error". The vertical axis plots the output variable, "PWM_Set_Value", the set value for the PWM unit on the microcontroller. Rule 1, as shown in Figure 6, indicates:
IF Speed_Error = much_2_slow THEN PWM_Set_Value = HIGH_DEC
This rule represents the engineering knowledge that if the truck is way under the speed limit, no pressure should be applied to the cylinder. The membership function of the term "much_2_slow" is shown also in the respective variable editor in Figure 6. The 3D Plot in Figure 7 plots the transfer characteristic as a result of this. In the front part of the curve, the value of the output variable is very low (color of surface light). As you proceed to the left along the Acceleration axis, the output variable value gets higher. This is a result of Rule 6 that defines:
|Figure 7: Debugging of the Fuzzy Logic System - Transfer Characteristics of the Fuzzy Logic Controller under testing (large)|
IF Acceleration = HIGH_ACC AND Speed_Error = much_2_slow THEN PWM_Set_Value = HIGH_INC
This rule represents the engineering knowledge that if in the same general case of the truck being way slower than the limit, the special case of a high acceleration should result in medium pressure on the cylinder. This ensures that the cylinder is already filled with some pressure if the truck reaches the limit quickly. If this rule would not have been formulated, a speed overshoot would occur as sketched in Figure 2.
5. Optimization and Implementation
A fair deal of optimization was accomplished off-line on the PC since fuzzyTECH can simulate the fuzzy logic system without the target hardware. However, final optimization and verification of the system was conducted on real trucks.
Figure 8 shows the test and optimization setup. The target system, the MCU of the electronic control unit, is mounted in the truck and connected to the development PC (notebook in the truck's cabin) by a serial cable. Such serial connection allows for modification of the running fuzzy logic controller "on-the-fly". This development technique is very efficient because it allows for the developer to analyze how a certain behavior of the fuzzy logic controller is caused by the membership function definition and the rules. Also, since modifications can be done in real time, the effects can be "felt" on the truck instantly.
|Figure 8: Cross Optimization of the running Fuzzy Logic Controller by a Serial Link (large)|
One way to enable "on-the-fly" debugging is to link the fuzzyTECH RTRCD Module (real-time remote cross debugger) to the fuzzy logic controller that runs on the MCU and connect it to a serial driver. The RTRCD Module consumes about ½ Kbytes of ROM, a few Bytes of RAM, and some computing resources to serve the serial communication on the MCU.
Since the PIC16 MCU used in this application cannot provide such resources, the serial debug mode of fuzzyTECH was used rather than the RTRCD Module. In serial debug mode, the values of the input variables are sent from the MCU to fuzzyTECH running on the development PC via the serial cable and the results are sent back. fuzzyTECH shows the entire fuzzy logic computation in its editor and analyzer windows, and allows for "on-the-fly" modifications. To support serial communication, a piggyback board containing a MAX232 driver IC was mounted on the speed limiter board shown in Figure 4.
The advantage of using the serial debug mode of fuzzyTECH over the RTRCD Module is that code size and computation effort that previously was required for the fuzzy logic computation on the MCU are now saved and can thus be used for the serial communication. The disadvantage of the serial debug mode of fuzzyTECH is that it computes the systems' results on the PC where real-time response cannot be guaranteed. Also, any crash of MS-Windows, the PC, or the serial communication will halt computation in serial debug mode. The RTRCD Module, in contrast, is not affected by this.
After optimization of the fuzzy logic rule strategy on different trucks and various load conditions, the speed limiter showed a response curve as shown in Figure 9. The fuzzy logic controller achieves a much smoother response, does not show overshoot behavior, and provides a higher accuracy of keeping the speed limit compared to a conventional controller.
|Figure 9: Speed Limiter Performance of the Fuzzy Logic Controller (large)|
The final fuzzy logic system was compiled to PIC16 assembly code by the fuzzyTECH MP-Edition and required 417 words of ROM space and 32 bytes of RAM. The RAM space can be used for other computation tasks such as preprocessing and filtering while the fuzzy logic system is not running. The entire fuzzy logic system needs less than 2 milliseconds to compute on the PIC16 MCU.
 N.N., "fuzzyTECH 4.0 MP-Edition Manual", INFORM GmbH Aachen / Inform Software Corp., Chicago (1995).
 N.N., "fuzzyTECH fuzzyLAB Manual", Microchip Technologies, Arizona (1994).
 von Altrock, C., "Fuzzy Logic - Die Technologie" (German language translation of ), Oldenbourg Verlag (1993), ISBN 3-486-22673-8.
 von Altrock, C., "Fuzzy Logic and NeuroFuzzy Applications Explained", (1995), Prentice-Hall, ISBN 0-1336-8465-2.
 Zimmermann, H.-J., "Fuzzy Set Theory -- and its Applications", Second Revised Edition (1991), Boston, Dordrecht, London, ISBN 0-7923-9075-X.