본문 바로가기

카테고리 없음

Pid And Fuzzy Logic Toolkit User Manual



Apr 15, 2011  This video shows how to use the Fuzzy logic Toolbox from Simulink to implement a PID regulator. About This Manual The PID Control Toolset User Manual describes the new PID Control Toolset for LabVIEW. This toolset includes PID Control, Fuzzy Logic Control, and Advanced Control VIs. Organization of This Manual The PID Control Toolset User Manual is organized as follows: Part I, PID Control—This section of the manual describes the features.

Implement Fuzzy PID Controller in Simulink Using Lookup Table

This example shows how to implement a fuzzy inference system for nonlinear PID control using a 2-D Lookup Table block.

Overview

A fuzzy inference system (FIS) maps given inputs to outputs using fuzzy logic. For example, a typical mapping of a two-input, one-output fuzzy controller can be depicted in a 3-D plot. The plot is often referred to as a control surface plot.

For control applications, typical FIS inputs are the error (e(k)) and change of error (e(k)-e(k-1)), E and CE respectively in the control surface plot. The FIS output is the control action inferred from the fuzzy rules, u in the surface plot. Fuzzy Logic Toolbox™ provides commands and apps for designing a FIS for a desired control surface. You can then simulate the designed FIS using the Fuzzy Logic Controller block in Simulink®.

You can often approximate nonlinear control surfaces using lookup tables to simplify the generated code and improve execution speed. For example, you can replace a Fuzzy Logic Controller block in Simulink with a set of Lookup Table blocks, one table for each output defined in the FIS. You can compute the data used in the lookup table using the evalfis command.

For this example, you design a nonlinear fuzzy PID controller for a plant in Simulink. The plant is a single-input, single-output system in discrete time. The design goal is to achieve good reference tracking performance.

You also implement the fuzzy inference system using a 2-D lookup table that approximates the control surface and achieves the same control performance.

Fuzzy PID Controller Structure

The fuzzy controller in this example is in the feedback loop and computes PID-like actions using fuzzy inference. Open the Simulink model.

The fuzzy PID controller uses a parallel structure as shown in the Fuzzy PID subsystem. For more information, see [1]. The controller is a combination of fuzzy PI control and fuzzy PD control.

The fuzzy PID controller uses the change of the output -(y(k)-y(k-1)), instead of change of error e(k)-e(k-1), as the second input signal to the FIS. Doing so prevents the step change in reference signal from directly triggering the derivative action. The two gain blocks, GCE and GCU, in the feed forward path from r to u, ensure that the error signal e is used in proportional action when the fuzzy PID controller is linear.

Design Conventional PID Controller

The conventional PID controller in this example is a discrete-time PID controller with Backward Euler numerical integration in both the integral and derivative actions. The controller gains are Kp, Ki, and Kd.

Similar to the fuzzy PID controller, the input signal to the derivative action is -y(k), instead of e(k).

You can tune the PID controller gains manually or using tuning formulas. In this example, obtain the initial PID design using the pidtune Cub cadet src 621 user manual download. command from Control System Toolbox™.

Define the PID structure, tune the controller, and extract the PID gains.

Design Equivalent Linear Fuzzy PID Controller

By configuring the FIS and selecting the four scaling factors, you can obtain a linear fuzzy PID controller that reproduces the control performance of the conventional PID controller.

First, configure the fuzzy inference system so that it produces a linear control surface from inputs E and CE to output u. The FIS settings are based on design choices described in [2]:

  • Use a Sugeno style fuzzy inference system with default inference methods.

  • Normalize the ranges of both inputs to [-10 10].

  • Use triangular input membership functions that overlap their neighbor functions at a membership value of 0.5.

  • Use an output range of [-20 20].

  • Use constant output membership functions.

Construct the fuzzy inference system.

Define input variable E.

Define input CE.

Define output variable u with constant membership functions.

Define the following fuzzy rules:

  1. If E is negative and CE is negative, then u is -20.

  2. If E is negative and CE is zero, then u is -10.

  3. If E is negative and CE is positive then u is 0.

  4. If E is zero and CE is negative, then u is -10.

  5. If E is zero and CE is zero, then u is 0.

  6. If E is zero and CE is positive, then u is 10.

  7. If E is positive and CE is negative, then u is 0.

  8. If E is positive and CE is zero, then u is 10.

  9. If E is positive and CE is positive, then u is 20.

While you implement your FIS from the command line in this example, you can alternatively build your FIS using the Fuzzy Logic Designer app.

Plot the linear control surface.

Determine scaling factors GE, GCE, GCU, and GU from the Kp, Ki, and Kd gains of by the conventional PID controller. Comparing the expressions of the traditional PID and the linear fuzzy PID, the variables are related as follows:

  • Kp = GCU * GCE + GU * GE

  • Ki = GCU * GE

  • Kd = GU * GCE

Assume that the maximum reference step is 1, and thus the maximum error e is 1. Since the input range of E is [-10 10], set GE to 10. You can then solve for GCE, GCU, and GU.

Implement Fuzzy Inference System Using 2-D Lookup Table

The fuzzy controller block has two inputs (E and CE) and one output (u). Therefore, you can replace the fuzzy system using a 2-D lookup table.

To generate a 2-D lookup table from your FIS, loop through the input universe, and compute the corresponding output values using evalfis. Since the control surface is linear, you can use a few sample points for each input variable.

View the fuzzy PID controller using 2-D lookup table.

The only difference compared to the Fuzzy PID controller is that the Fuzzy Logic Controller block is replaced with a 2-D Lookup Table block.

When the control surface is linear, a fuzzy PID controller using the 2-D lookup table produces the same result as one using the Fuzzy Logic Controller block.

Simulate Closed-Loop Response in Simulink

The Simulink model simulates three different controller subsystems, namely Conventional PID, Fuzzy PID, and Fuzzy PID using Lookup Table, to control the same plant.

Pid And Fuzzy Logic Toolkit User Manual Software

Run the simulation. To compare the closed-loop responses to a step reference change, open the scope. As expected, all three controllers produce the same result.

Design Fuzzy PID Controller with Nonlinear Control Surface

Once you have a linear fuzzy PID controller, you can obtain a nonlinear control surface by adjusting your FIS settings, such as its style, membership functions, and rule base.

For this example, design a steep control surface using a Sugeno-type FIS. Each input set has two terms (Positive and Negative), and the number of rules is reduced to four.

Construct the FIS.

Define input E.

Define input CE.

Define output u.

Define the following rules:

  1. If E is negative and CE is negative, then u is -20.

  2. If E is negative and CE is positive, then u is 0.

  3. If E is positive and CE is negative, then u is 0.

  4. If E is positive and CE is positive, then u is 20.

View the 3-D nonlinear control surface. This surface has a higher gain near the center of the E and CE plane than the linear surface has, which helps reduce the error more quickly when the error is small. When the error is large, the controller becomes less aggressive to avoid possible saturation.

Before starting the simulation, update the lookup table with the new control surface data. Since the surface is nonlinear, to obtain a sufficient approximation, add more sample points.

Run the simulation.

Compared with the traditional linear PID controller (the response curve with large overshoot), the nonlinear fuzzy PID controller reduces the overshoot by 50%. The two response curves from the nonlinear fuzzy controllers almost overlap, which indicates that the 2-D lookup table approximates the fuzzy system well.

Conclusion

You can approximate a nonlinear fuzzy PID controller using a lookup table. By replacing a Fuzzy Logic Controller block with Lookup Table blocks in Simulink, you can deploy a fuzzy controller with simplified generated code and improved execution speed.

References

[1] Xu, J. X., Hang, C. C., Liu, C. 'Parallel structure and tuning of a fuzzy PID controller.' Automatica, Vol. 36, pp. 673-684. 2000.

[2] Jantzen, J. Tuning of Fuzzy PID Controllers, Technical Report, Dept. of Automation, Technical University of Denmark. 1999.

See Also

Blocks

  • 2-D Lookup Table | Fuzzy Logic Controller

Related Topics

An Introduction to Fuzzy Logic Controllers in the LabView Environment.

William Green

Argonne National Laboratory

Mathematics and Computer Science Division

I:Background

Fuzzy Logic is a variation on set theory where a variable can partially be an element of a set.Fuzzy Logic was first developed in the state we know of now by LoftiZadeh in the 1960’s.Fuzzy Logic Controllers are intended to “think” like humans do, in this way they are helpful for problems that can not easily be set up mathematically, but can easily be expressed in words.

In traditional set theory, a variable is either an element of a set or it isn’t, essentially a Boolean 1/0 classification.However, in Fuzzy Logic, a variable can partially exist in sets.For instance, in the following picture, x is wholly in the sets A, B, and C in the traditional set theory.However, in Fuzzy Logic, we can say x is in A to a degree of 0.7, 0.4 in B and 0.5 in C.(Or essentially an value on [0,1].)

Fuzzy Logic thus allows a degree of set membership.For instance, say we have created a feedback controller that is based on the error of control.An error value of +8mm can exist partially in the set “Over Target”, partially in the set “Close to target”, and partially in the set “Slightly Over Target.”

Free kitchen appliance user manuals, instructions, and product support information. Find owners guides and pdf support documentation for blenders, coffee makers, juicers and more. Breville BFP800XL Food Processor User Manual. Of 97 BFP800XL. The Sous Chef ™. Breville sous chef 16 user manual. The Sous Chef BFP800XL Food Processor pdf manual download. Breville the Sous Chef BFP800XL Instruction Book. Page 12 ASSEMBLING yOUR BREvILLE SOUS CHEF™ Place the processing lid onto the NOTE processing bowl so the feed chute is The food processor will not start slightly right of the bowl handle and unless the large food pusher is the. View and Download Breville Sous Chef 16 Peel & Dice instruction book online. Sous Chef 16 Peel & Dice Kitchen Appliances pdf manual download. Also for: Bfp820. Whether you’re turning nuts into nut butter, perfectly slicing carrots or other chopping, shredding, or kneading, this workhorse delivers perfection every time. With 3 feed chute options and 8 precision tools the Sous Chef™ 16 Pro brings professional prep to any kitchen.

This should suffice to introduce the ideas behind Fuzzy Logic necessary to writing a LabView Fuzzy Logic Controller.For more information on Fuzzy Logic see:

[1]http://www.ni.com/pdf/manuals/321511a.pdf

II:Designing a Simple Fuzzy Logic Controller

First, one must determine the input variables and the desired output.The input variables are often referred to by “linguistic terms,” a way in which to describe the meaning of the variables.For instance, Error and Actual Position are two easily defined linguistic terms for use as input variables.The fuzzy output must then be utilized to control the system.

Now, we go to the LabView Fuzzy Logic Toolkit which is located in the Tools menu of the LabView programming environment.In true LabView style, the Fuzzy Logic Toolkit is a GUI, a Graphical User Interface.We must first open a new Controller from the File menu and select New.We name and define our variables by going to the Edit menu and selecting Set Editor.

For example, the first Fuzzy Logic Controller I designed was a simple controller to trace the data I collected of an analog channel on the DAQ box connected to my computer.I read the voltage off of a function generator that was generating either sine, square or triangle waveforms.

The output of the Fuzzy Controller I named “Fuzzy Position” and plotted versus “Wave Position,” the analog input.I then took the difference of the two and named it “Error” and made it the first Fuzzy Controller input variable.This controller would essentially only consider the Error term in calculating its output, though considering multiple terms is possible.

Next I had to define my Fuzzy Sets.You can define a maximum of 9 sets for each variable.For Error, I designated the sets “Far Under,” “Under,” “Mid Under,” “Slightly Under,” “Close,” “Slightly Over,” “Mid Over,” “Over,” and “Far Over.”Now, I had to decide the range of these variables.Since I was using a function generator whose waveforms spanned the range of ±1 volt, the maximum magnitude of error would be 2.Thus, I made the range of the error variable to be ±2.

Pid And Fuzzy Logic Toolkit User Manual Pdf

Similarly, I defined the response variable.The sets were named “Down Hard,” “Down,” “Slight Down,” “No Move,” “Slight Up,” “Up,” and “Up Hard.”I also used ±2 as the range of this variable as any correction to the error would have to lie in this range.

Next, I had to designate the rules by which the Fuzzy Logic Controller would take in inputs “fuzzify” them, determine their set memberships,defuzzify” them and determine the appropriate response.Complete step-by-step details for the LabView Fuzzy Logic Controller Design environment can be found in [1] Chapter 5.

Essentially, you pick a response for each combination of inputs.Here, Wave Position was a non-factor in how the Controller should respond to the waveform.Notice the column labeled “DoS,” this is the weighting factor.This will modify how the Defuzzification process will work, it will weight responses to give you slightly better results if used properly.

The Fuzzy Logic Controller will then take in the input variables match them up with your linguistic variables, and determine how the input should be converted to the appropriate output.It can do this by one of three “Defuzzification” methods, Center-of-Gravity, Center-of-Maximum or Mean-of-Maximum.

The different Defuzzification methods produce different results, but for now, we don’t need to worry about these differences.It suffices to say that for simple controllers the outputs from the different controllers are similar enough that simply trying out the three methods and determining which one best suits your needs is the most effective way to choose a Defuzzification method.

Next I set up the VI to properly handle the data and the built-in capabilities of LabView did the rest of the work.The following trace is the result of the Fuzzy Controller responding to an inputted analog sine wave.The white line is the analog input while the red is the fuzzy logic output.

III:Designing a More Complicted Fuzzy Logic Controller

To design a more complicated Fuzzy Logic Controller, one simply has to generalize the ideas from setting up a simple controller to a more complicated system.Probably the most difficult part will be incorporating multiple variables.There is a wonderful example of a 2 variable Fuzzy Logic Controller that is included with the PID control toolset of LabView, for more details see [1] Chapter 5 and the VI included in the PID toolset.

When controlling actual instruments, one must first test how the Fuzzy Logic Response generalizes to your specific equipment.For instance, a fuzzy logic response of 20 is how much you want to change a given parameter, not necessarily the voltage or amperage you want to output to the instrument.Test the response to a small test step increase in voltage and determine the necessary output levels and avoid instrument damage.It is always a good idea to have a simulation to test your controller and controller software on before using your actual equipment.Errors in software are easier to rectify if you’ve damaged a simulator program rather than an expensive instrument.

When creating more complicated VIs that utilize the Fuzzy Logic Controller be sure to have routines that will stop the VI if an error occurs.The Fuzzy Logic Controller does not always respond well to errors in other parts of the VI, this can easily cause instrument damage.

Fuzzy Logic Downers Grove

IV:Summary

The Fuzzy Logic Controller is a powerful tool in controlling instruments and equipment.Using Fuzzy Logic can quickly lead to more efficient, precise and accurate controls.For instance, the Fuzzy Logic Waveform Tracer described in Section II has since been modified to create a control for an ANCO shake table located in Argonne National Laboratory.The Fuzzy Logic Controllers are easily adapted, a few slight changes in range of the variables and finding a conversion factor appropriate for the equipment and I was ready to write software to control the table.

Pid And Fuzzy Logic Toolkit User Manual Free

The benefits of Fuzzy Logic Controllers are simple; they can be more accurate and more precise than their PID counterparts.For example, the Fuzzy Logic controller on the ANCO shake table was used in a program to simulate a trace of the Sylmar earthquake of 1971.The Fuzzy Logic Controller cut down the effective error by nearly half compared to the PID control, but more impressively cut down the standard deviation of the error by 60-70%, thus creating a far more precise control.Further, there is better control on the overshoot that often occurs on large jumps in the earthquake trace as well as considerably less “ringing.”

Pid And Fuzzy Logic Toolkit User Manual

LabView provides a powerful toolkit for setting up these Fuzzy Logic Controllers.Essentially all the hard work of Fuzzy Logic is done internally by the LabView program, the user merely needs to go through a Graphical Interface and set up a few picture guided screens to create a powerful, highly effective tool for controlling instruments.The Fuzzy Logic Controllers are more precise and accurate than their PID predecessors, and are actually easier to learn to a beginner.