Fuzzy Logic Controller for Mechatronics and Automation

Primary suspension is the term used for suspension components connecting the wheel assemblies of a vehicle to the frame of the vehicle (Fig.1). This is in contrast to the suspension components connecting the frame and body of the vehicle, or those components located directly at the vehicle’s seat, commonly called the secondary suspension. Usually a vehicle contains both primary and secondary suspension system but primary suspension is chosen for control. There are two basic types of elements in conventional suspension systems. These elements are springs and dampers. The role of the spring in a vehicle’s suspension system is to support the static weight of the vehicle. The role of the damper is to dissipate vibrational energy and control the input from the road that is transmitted to the vehicle. Primary suspensions are divided into passive, active and semi active systems [Miller 1990], as will be discussed next, within the context of this study.


Introduction
Conventional car suspensions systems are usually passive, i.e have limitation in suspension control due to their fixed damping force.Semi-active suspension system which is a modification of active and passive suspension system has been found to be more reliable and robust but yet easier and cheaper than the active suspension system.

Vehicle primary suspensions
Primary suspension is the term used for suspension components connecting the wheel assemblies of a vehicle to the frame of the vehicle (Fig. 1).This is in contrast to the suspension components connecting the frame and body of the vehicle, or those components located directly at the vehicle's seat, commonly called the secondary suspension.Usually a vehicle contains both primary and secondary suspension system but primary suspension is chosen for control.There are two basic types of elements in conventional suspension systems.These elements are springs and dampers.The role of the spring in a vehicle's suspension system is to support the static weight of the vehicle.The role of the damper is to dissipate vibrational energy and control the input from the road that is transmitted to the vehicle.Primary suspensions are divided into passive, active and semi active systems [Miller 1990], as will be discussed next, within the context of this study.

Passive damping
A passive suspension system is one in which the characteristics of the components (springs and dampers) are fixed.A passive control system does not require an external power source.Passive control devices impart forces that are developed in response to the motion of the wheel hop.

Active damping
An active control system is one in which an external source of energy to control actuator(s) that apply forces to the suspension system and the schematic diagram of typical active suspension systems arrangement are shown in Fig 2 .The force actuator is able to both add and dissipate energy from the system, unlike a passive damper, which can only dissipate energy.

Semi active damping
In semi active damping, the damper is adjustable and may be set to any value between the damper-allowable maximum and minimum values.Semi active control systems are a class of active control systems for which no external energy is needed like active control systems.b , are attached between the vehicle body and tire, and the stiffness of the tire is represented by 2 k .The relative velocity across the suspension damper of this model is defined by

Modeling of quarter car model
Before modeling an automatic suspension system, a quarter car model (i.e.model for one of the four wheels) is used to simplify the problem to a one-dimensional (only vertical displacement of the car is considered) spring-damper system.The reason for choosing the quarter car model is to analyze and control the suspension for each wheel separately and accurately.The schematic diagram of a quarter car system is shown in Figure 4 Fig. 4. Modeling of quarter-car suspension system The parameters used for the system are shown in Table 1.

116
In this system, 1 k represents the spring constant of the suspension system, w represents the road disturbances, and x represents the unsprung mass displacement.1 b , 2 k and y represent damping constant of suspension, value of tyre stiffness and the sprung mass displacement respectively.Control force ( MV ) is the force from the controller which will be applied to the suspension system.
From Figure 5, applying Newton's law, the following differential equations are obtained 11 1

Fuzzy logic controller for the suspension system
Typically a fuzzy logic controller is composed of three basic parts; (i) input signal fuzzyfication, (ii) a fuzzy engine that handles rule inference and (iii) defuzzification that generates a continuous signal for actuators such as control valves.The schematic diagram is shown in Figure 6.

Fig. 5. Schematic diagrams for a typical fuzzy logic controller
The fuzzification block transforms the continuous input signal into linguistic fuzzy variables such as small, medium, and large.The fuzzy engine carries out rule inference where human experience can easily be injected through linguistic rules.The defuzzification block converts the inferred control action back to a continuous signal that interpolates between simultaneously fired rules.

Design of fuzzy controller for the suspension system
The basic process of designing a fuzzy logic controller for the suspension systems involves 5 steps: a. Formulating the problem and selecting the input and output variables state.For this suspension system, the inputs to the fuzzy controller are the velocity of sprung mass (car body) at any time, and the velocity of unsprung-mass.The manipulated variable is produced and sent to the actuating valve for controlling the suspension.b.Selecting the fuzzy inference rules.This generally depends on human experience and trial-and error.The interference rule is selected based on the open loop response of the suspension system.Typically; trial-and-error approach is done to obtain better result.c.Designing fuzzy membership functions for each variable.This involves determining the position, shape as well as overlap between the adjacent membership function, as these are major factors in determining the performance of the fuzzy controller.d.Performing fuzzy inference based on the inference method.Smoothness of the final control surface is determined by the inference and defuzzification methods.The use of a universe of discourse requires a scale transformation, which maps the physical values of the process state variables into a universe of discourse.This is called normalization.Furthermore, output de-normalization maps the normalized value of the control output variables into their respective physical universe of discourse.In other words, scaling is the multiplication of the physical input value with a normalization factor so that it is mapped onto the normalized input domain.De-normalization is the multiplication of the normalized output value with a de-normalization factor so that it maps onto the physical output domain.Such scale transformation is required both for discrete and continuous universe of discourse.The scaling factors which describe a particular input normalization and output denormalization play a role similar to those of the gain coefficients in a conventional controller.In other words, they are of utmost importance with respect to controller performance and stability related issues, i.e., they are a source of possible instability, oscillation problems and deteriorated damping effects.e. Selecting a defuzzification method to derive the actual control action.The choice of the defuzzification method determines to a large extent the "quality" of control as well as the computational cost of the controller and hence must be chosen carefully.In this case defuzzification is done by using gain block to minimize the disturbance.Fuzzy quantization level basically determines the number of primary fuzzy sets.The number of primary fuzzy sets determines the smoothness of the control action and thus, can vary depending on the resolution required for the variable.The choice of quantization level has an essential influence on how fine a control can be obtained (Lee, 1990a).A coarse quantization for large errors and finer quantization for small errors are the usual choice in the case of quantized continuous domains.According to different input conditions, the actuating valve will open from -100% to +100% for smooth control of suspension.In this work, scaling for both two inputs is set from -8 to +8 with an increment of 2 from the lowest value and that for output is set from -100 to 100% with increment of 25% is the from lowest value.

Fuzzy controller performance for suspension control
The performance of the controller is investigated through various studies involving nominal operating condition and also when the set point is fixed to zero and the input disturbance are changes in different modes.However to be more realistic, various types input disturbances are applied into the system, such as sinusoidal, square wave, saw-tooth input disturbances in order to observe the performances of the Fuzzy controller.Since road disturbances do not have a particular pattern, different types input disturbances such as sinusoidal and random signals are used so that the controller can control all type road disturbances.The responses of suspension system using fuzzy controller for square wave, sinusoidal, and saw-tooth input disturbances are shown in Figure 10 to 13 respectively.In Figure 10, sine wave input disturbance with amplitude of 1(cm) and frequency of 1 Hz is used, the controller action and output response are also shown.In Figure 11, square wave input disturbance with amplitude of 1 (cm) and frequency of 1 Hz is used, the controller action and output response are also shown.In Figure 12, sawtooth input disturbance with output values [0 2] (disturbance changing from 0 to 1) and frequency of 0.5 Hz is used, the controller action and output response are also shown.In Figure 13, random number input disturbance with variance of 1, mean value of 0, initial speed of 0 and sampling time 0 is used, the controller action and output response are also shown.Four types of input disturbances are used to observe the controller action with respect to input and the responses of the suspension output.Both controller action and output response seemed to be satisfactory, since more than 85% disturbances are rejected in all cases.

Summary
The designed fuzzy logic controller and hybrid controller were applied to a car Active suspension system.Since the road model is almost irregular therefore different type disturbances are applied to the system.Fuzzy logic controller was applied to car suspension system with different type disturbances.While the sinusoidal input is applied to the suspension system, fuzzy controller eliminates 75% of the disturbances during first 4 sec.and about 90% for the rest period.In the case of square wave disturbances, average 50% disturbances were rejected from the system during whole period.For the saw-tooth wave disturbances, 15-20% disturbances are present during all over the period.For random disturbances, fuzzy controller is able to eliminate the disturbances entirely.

Fuzzy logic controller for rotary crane system automation 2.1 Introduction
The main purpose of controlling a Rotary crane is transporting the load as fast as possible without causing any excessive sway at the final position.Active sway angle control of Rotary crane consists of artificially generating sources that absorb the energy caused by the unwanted sway angle of the rope in order to cancel or reduce their effect on the overall system.
In Rotary Crane System, two main objectives are to be achieved that is the positioning and at the same time avoiding the swinging of the hooked object.These two functions are depending on the speed of the crane motion.Usually the crane is handled manually by human operator and the balancing control is also done by him/her.The balancing control is depending on the skills/experiences of the human operator to move the payload safely and www.intechopen.comFuzzy Inference System -Theory and Applications 122 accurately.However, human skills are not always accurate at all time.This may due to the fatigue error that the human faces during the time of operation.Thus, new controller for this application is required for controlling the positioning and anti swing process.Fuzzy logic has the capability to provide the human like control and suitable in designing the new controller for both processes.
Wahyudi et.al [2] designed the adaptive fuzzy-based feedback controllers for gantry crane system.

Modeling of the rotary crane
The modeling of the rotary crane system is done based on the Euler-Lagrange formulae.Considering the motion of the rotary crane system on a two-dimensional plane, the kinetic energy of the system can thus be formulated as The potential energy of the beam can be formulated as To obtain a closed-form dynamic model of the rotary crane, the energy expressions in ( 4) and ( 5) are used to formulate the Lagrangian L=T −U .Let the generalized forces corresponding to the generalized displacements q = {x,θ} be F ={Fx ,0} .Using Lagrangian's equation (6) the equation of motion is obtained as below, cos sın cos sin In order to eliminate the nonlinearity equation in the system, a linear model of rotary crane system is obtained.The linear model of the uncontrolled system can be represented in a state-space form as shown in equation ( 6) by assuming the change of rope and sway angle are very small.Table 4. Positioning perfomances Table 5. Anti-swing performances Fuzzy Controllers show more satisfied result as compared to PID controller where the percentage overshoot and Settling Time were greatly improved.With lower settling time obtained by using the FLC, the performance of the rotary crane system is more stable than with the PID controller.

Fuzzy lozic controller for point to point position control 3.1 Introduction
Point-to-point position control is one of the motion control systems that concern much the precision and speed in its performance.Nevertheless, to develop such a high precision and speed controller is quite complicated because of the nonlinearity function in the system such as friction and saturation.Both conditions cannot be compensated or modeled simply by using the linear control theory.Thus, an alternative controller should be developed to overcome this nonlinearity system.
In the motion control system, two main sources are identified to be the parameters variations that cause the nonlinearity condition.There are frictions and inertia variations.The variations of the inertia occur because of numbers of different payload.The different payload at the same time would also cause the different Coulomb friction variations.Both variations are the main parts that need to be solved to improve the performance of the system.
PID controller is one of the most used techniques in motion control system due to its simplicity and performances.However, PID controller could only be used effectively in linear system and does not work well with the nonlinearity system.Even if the model of the system is to be developed with PID controller, it would be complicated and this may affect the performance speed of the hardware.
Again, fuzzy approach is the most suitable technique in developing the control algorithm that relates with the nonlinearity function.With its capability in simplifying the model of the system, it can realize the high speed high precision of the system.M. M. Rashid et.al [5] in his article proposed a design of PID controller with added fuzzy logic controller (FLC) of fuzzy-tuned PID controller.With the addition of the FLC, the PID controller can adapt, learn or change its parameters based on the conditions and desired performance.
In this design, fuzzy logic is used to determine the PID controller gains, Kp, Ki, Kd as the function of error and error rate as illustrated in the following block diagram Since there are three gains to be produced, there would be 3 fuzzy tuners to be designed.Each of them has two inputs (error and error rate) and one output (gain).Different membership functions and rules are constructed in each fuzzy tuner.8. Rules constructed for gain Ki.
Finally, the gain Ki is defuzzified by using the COA as well to obtain the crisp value of integral gain Ki.The fuzzy-tuned PID controller is tested with rotary positioning system for nominal object and increased inertia as visualized in the following figures.
As listed in the table above, F-PID controller shows better performance with the improvement of the settling time and accuracy.Less error in F-PID controller indicates the high robustness of the controller and thus proving the capability of the fuzzy approach in this system.

Mobile autonomous robot system 4.1 Introduction
Mobile robots are generally those robots which can move from place to place across the ground.Mobility give a robot a much greater flexibility to perform new, complex, exciting tasks.The world does not have to be modified to bring all needed items within reach of the robot.The robots can move where needed.Fewer robots can be used.Robots with mobility can perform more natural tasks in which the environment is not designed specially for them.These robots can work in a human centred space and cooperate with men by sharing a workspace together [9].

Mechanism
A mobile robot needs locomotion mechanism s t h a t e n a b l e i t t o m o v e u n b o u n d e d throughout its environment.There is a large variety of possible ways to move which makes the selection of a robot's approach to locomotion an important aspect of mobile robot design.Most of these locomotion mechanisms have been inspired by their biological counterparts which are adapted to different environments and purposes.[9], [10] Many biologically inspired robots walk, crawl, slither, and hop.
In mobile robotics the terms omnidirectional, holonomic and non holonomic are often used, a discussion of their use will be helpful.[9] The terms holonomic and omnidirectional are sometimes used redundantly, often to the confusion of both.Omnidirectional is a poorly defined term which simply means the ability to move in any direction.Because of the planar nature of mobile robots, the operational space they occupy contains only three dimensions which are most commonly thought of as the x, y global position of a point on the robot and the global orientation, θ, of the robot.Whether a robot is omnidirectional is not generally agreed upon whether this is a twodimensional direction, x, y or a three-dimensional direction, x, y, θ.In this context a non holonomic mobile robot has the following properties:


The robot configuration is described by more than three coordinates.Three values are needed to describe the location and orientation of the robot, while others are needed to describe the internal geometry.


The robot has two DOF, or three DOF with singularities.(One DOF is kinematically possible but is it a robot then?)  In this context a holonomic mobile robot has the following properties:  The robot configuration is described by three coordinates.The internal geometry does not appear in the kinematic equations of the abstract mobile robot, so it can be ignored.


The robot has three DOF without singularities.


The robot can instantly develop a wrench in an arbitrary combination of directions x, y, θ.  Non holonomic robots are most prevalent because of their simple design and ease of control.By their nature, non holonomic mobile robots have fewer degrees of freedom than holonomic mobile robots.These few actuated degrees of freedom in non holonomic mobile robots are often either independently controllable or mechanically decoupled, further simplifying the low-level control of the robot.Since they have fewer degrees of freedom, there are certain motions they cannot perform.This creates difficult problems for motion planning and implementation of reactive behaviours. Holonomic however, offer full mobility with the same number of degrees of freedom as the environment.This makes path planning easier because there aren't constraints that need to be integrated.Implementing reactive behaviours is easy because there are no constraints which limit the directions in which the robot can accelerate.
In general, the mobile robot deals with the environment that is not certain and unknown.
The environment may consist of several obstacles and paths which the robot has to go through.At the same time, the robot has to maintain its stability when changing direction if it faces the obstacles.This would definitely require the good control of the robot to make it reach to the desired points.With the limited information obtained during its operational, the fuzzy control is the best method to optimize its time consuming and energy consumption while reaching its goal.Harmeet Singh [4] in his work mentioned that the fuzzy control technique is the most suitable method to deal with the variability and unknown parameters in the given system.He also listed the constraints of the mobile robots that can be fulfilled with the fuzzy control techniques.There are:-1.Difficulty in deriving the mathematical model of the environment.Even if it is simplified, the model could be very complex to be implemented with the hardware.2. Sensors that are equipped on the mobile robot could be different and varies.The model of the conventional controller may not considering certain data obtained from the sensors which might lead to the instability of the robot.3. Need of the real-time operation.Thus, the robot requires fast responds and operations.
Complicated robot controller will lead to slow and undesired performance.
Generally, a mobile robot is built with wheels, motors and controller.The controller is designed in two types of control method.The open loop control and closed loop feedback control types [5].In open loop control, the inputs are provided beforehand to make the robot reach the goal.This involves certain known parameters such as the acceleration or torque of the motor, the turning point and stop point, and time operation where the robot needs to stop or make a turning, and the angle of turning.This type of methods would only suitable for the known environment and paths.For the closed loop strategies, the sensors are equipped with the robots and the robot will respond to the certain data obtained through sensors.The robot will act in a way that the controller was designed beforehand.For instant, the robot is programmed to move to the right direction if it faces any obstacle in front.

Controller design
In the real system, the obstacles or paths are not the ideal and vary in shapes and locations.If the robot is set to turn right when facing the obstacles, it does not mean the robot must turn 90 degree to the right.The controller should be designed in a way that it still approaching the desired target.Otherwise, it may turn back to its original point and that would not only consume time but waste energy as well.Thus, a good control must have very details conditions and settings to optimize the performance of the robot.The conventional type of control that is already designed is P, PI and PID control.However, the model becomes more complicated and difficult to implement with.Another alternative is by www.intechopen.comFuzzy Logic Controller for Mechatronics and Automation 131 using the fuzzy algorithm.Fuzzy logic is becoming more popular among the control method in designing the complex system as it is approved in many researches that it can simplify a complex model.Furthermore, fuzzy logic drives the controller to think like human in optimizing the performance.In this application where the robot needs details output such as how right it should turn or how fast it should accelerate, fuzzy approach could overcome these constraints.
Hairol Nizam [6] in his work explained the design of fuzzy algorithm for robot in approaching the desired destination.In this case, the distance between the destination point and the robot is determined with the destination position, , and destination angle, .
With the rules constructed, the mobile robot could be guided to the direction of the destination point with minimum movement.

Fig. 13 .
Fig. 13.Block diagram of FLC rotary crane system with position control and anti swing control.

13 Fig. 14 .Table 2 .
Fig. 14.Membership functions for both FLCs for position and anti-swing control.The following tables show how the rules are constructed based on the knowledge of the skillful operators.

Fig. 15 .
Fig. 15.Structure of the Fuzzy-tuned PID controller In developing the fuzzy-tuned PID controller, two design stages are used as follows: 1. Nominal values for PID controller gains are designed based on the linear model 2. Based on the current PID controller gains, the fuzzy tuner is designed to produce Kp, Ki and Kd.

Fig. 23 .
Fig. 23.Autonomous Robot with parameters definedThe figure shows two angles assigned as linguistic variables.The and will be compared with to obtain the linguistic values.The following table shows how the rules are constructed.

Table 1 .
Parameters of the active suspension system www.intechopen.comFuzzyInference System -Theory and Applications

Table 10 .
table shows how the rules are constructed.Fuzzy Rules for Autonomous Robot From the table, the rules can be constructed as listed below Rule 1; IF θs is Large and θr is Large, Then direction is Right Rule 2; IF θs is Large and θr is Equal, Then direction is Right Rule 3; IF θs is Large and θr is Small, Then direction is Right Rule 4; IF θs is Equal and θr is Large, Then direction is Right Rule 5; IF θs is Equal and θr is Equal, Then direction is forward Rule 6; IF θs is Equal and θr is Small, Then direction is Right Rule 7; IF θs is Small and θr is Large, Then direction is Left Rule 8; IF θs is Small and θr is Equal, Then direction is Left Rule 9; IF θs is Small and θr is Small, Then direction is Left www.intechopen.comFuzzyInference System -Theory and Applications