Ejemplo de Un Control Difuso
-
Upload
erick-poumian-palomec -
Category
Documents
-
view
225 -
download
0
Transcript of Ejemplo de Un Control Difuso
-
7/30/2019 Ejemplo de Un Control Difuso
1/14
EjemplodeunControlDifusoSistemadeNiveldeLquido
-
7/30/2019 Ejemplo de Un Control Difuso
2/14
We will look at the control of a water tank.
This water tank has a pipe flowing in and a pipe flowing out.
The input flow rate is variable by a control valve.
The output flow rate is dependant on the amount of water in the
tank.
-
7/30/2019 Ejemplo de Un Control Difuso
3/14
The water will drain out of the tank faster when there is more
water in the tank and slower when there is less water in the tank.
The goal of the control system is to take a set value and change
the input valve so that the inflow rate will compensate for the
outflow.
The tank can be represented in Simulink using the followingblock:
-
7/30/2019 Ejemplo de Un Control Difuso
4/14
-
7/30/2019 Ejemplo de Un Control Difuso
5/14
The desired water level is set using the constant input and the max
inflow is also set using a constant.
The inflow max is in place since a given pipe can only provide a
limited amount of water.
The paramaters for the water tank are shown below:
-
7/30/2019 Ejemplo de Un Control Difuso
6/14
Now that the simulink model has been made the fuzzy control
system needs to be designed. In MATLAB, open the FIS Editor to
develop a new fuzzy system.The default FIS has only one input, however the system we will be
using has two inputs so we need to add another input.
To do this click: Edit > Add Variable... > Input. This will addanother input variable to the system. These two inputs can be
named 'error' and 'rate' and the output can be named 'valve'.
The system should now look like this:
-
7/30/2019 Ejemplo de Un Control Difuso
7/14
The membership functions used for this system now need to be
defined for each input and for the output. The functions for each
can be seen in the following images.
The error input will be in the range of -1 to 1 and the rate input
will be in the range of -0.1 to 0.1 while the valve output will be in
the range of 0 to 1.
-
7/30/2019 Ejemplo de Un Control Difuso
8/14
There are three membership functions for the error input, negative,
okay, and positive.
The negative function is a trapezoidal membership function whichhas the following paramaters: [-1.27 -1.13 -0.8 0].
The okay membership function is triangular with the following
paramaters: [-0.6667 0 0.6667].The positive membership function is trapezoidal and it has
paramaters: [0 0.8 1.11 1.77].
-
7/30/2019 Ejemplo de Un Control Difuso
9/14
The rate input also has three membership functions: negative, none and positive.
The negative membership function is trapezoidal with params:
[-0.172 -0.11 -0.06 0].
The none membership function is triangular with params:
[-0.07067 0 0.07067].
The positive membership function is trapezoidal with params:
[-0.07067 0 0.07067].
This set of membership functions act on the rate input of the controller.
-
7/30/2019 Ejemplo de Un Control Difuso
10/14
There are five output membership functions for the valve output on
the system:
close_fast, close_slow, no_change, open_slow, and open_fast.
They are all triangular functions with the following paramaters:close_fast: [-1 -0.9 -0.8]
close_slow: [-0.6 -0.5 -0.4]
no_change: [-0.1 0 0.1]
open_slow: [0.4 0.5 0.6]
open_fast: [0.8 0.9 1]
-
7/30/2019 Ejemplo de Un Control Difuso
11/14
With all of the input and output membership functions defined the
rule base needs to be defined.
For this system we want to increase water in when the error ispositive, but we don't want to be putting in too much water if the
error is moving towards zero rapidly otherwise the water level will
overshoot.So if the error is okay we want to open or close the valve slowly,
but if the error is negative or positive we want to open or close
fast. The rules then that we will use in the rule editor are shown
below:
-
7/30/2019 Ejemplo de Un Control Difuso
12/14
Rules 4 and 5, as seen above, use the AND operator to combine the
error and rate membership functions, this AND is the fuzzy
connective AND, which is the product of the two membershipfunctions at the input values.
This process of combination was previously explained. The secondand third rules lay down the course of action in the case that the error
is large, regardless of rate.
The first rule is the steady state position, when the error is okay the
valve stays the same.
The overlap in these functions ensures a mix of all of them until the
error is at zero and the rate is zero, the the only rule that will befiring will be the first rule.
Another way to visualize the rules is to look at the rules surface for
the system. This can be accomplished by clicking on View > Surfacein the FIS Editor.
-
7/30/2019 Ejemplo de Un Control Difuso
13/14
The rule surface shows the output value for any combination of the
two input values.
Now that all of the rules have been defined and all of themembership functions have been defined the FIS can be exported to
the workspace. To do this click: File > Export > To Workspace... and
then enter in the a workspace variable, for this example you can use'tank'. Now in the Simulink model double click the Fuzzy Logic
Controller and enter 'tank' for the 'FIS matrix' paramater. This is
important or else the Simulink model will now know where to look
for the fuzzy control system.
-
7/30/2019 Ejemplo de Un Control Difuso
14/14
The Simulink model can now be simulated for 10 seconds with all of the previous
water tank paramaters and the FIS matrix imported to the workspace.
The resulting water level for the system can be seen through a scope on the
output:
The tank begins with a water level of 0.5 and then begins to drain when the
fuzzy controller picks up and opens the valve rapidly and then slows downopening and closes it a little as the tank approaches the desired level of 1 where
the system reaches steady state.