0% found this document useful (0 votes)
182 views12 pages

Fuzzy Lab#2 Udara VER 1

1. The document describes the design of a fuzzy logic controller in Simulink to control a plant. 2. Key aspects of the fuzzy controller design include determining membership functions, developing a rule table, implementing fuzzification and defuzzification, and tuning controller gains. 3. Simulation results show that the uncompensated plant exceeds overshoot and settling time specifications, while the fuzzy logic controller is able to meet all specifications for step changes in reference input and disturbances.

Uploaded by

Yudara Almeida
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
182 views12 pages

Fuzzy Lab#2 Udara VER 1

1. The document describes the design of a fuzzy logic controller in Simulink to control a plant. 2. Key aspects of the fuzzy controller design include determining membership functions, developing a rule table, implementing fuzzification and defuzzification, and tuning controller gains. 3. Simulation results show that the uncompensated plant exceeds overshoot and settling time specifications, while the fuzzy logic controller is able to meet all specifications for step changes in reference input and disturbances.

Uploaded by

Yudara Almeida
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

School Of Electrical Engineering

Victoria University of Technology

VEA 4200- FUZZY CONTROL AND APPLICATIONS

LAB 2: Fuzzy Controller Design Using SIMULINK

Name: Udara Sampath Almeida


Student ID: 3771873
Supervisor: Dr. Juan Shi
Fuzzy Control and Applications
Laboratory Report 2

Contents

1. Objective..................................................................................................................3
2. Plant Description......................................................................................................3
3. Fuzzy Controller Design.............................................................................................4
4. Uncompensated Controller........................................................................................5
5. SIMULINK fuzzy controller design..............................................................................7
6. Conclusion..............................................................................................................12

2|Page
Fuzzy Control and Applications
Laboratory Report 2

1. Objective
For the plant given, design a unity feedback fuzzy control system such that it is stable and satisfies
the following specifications:

1. After a step change has occurred at the disturbance input of the plant, the control error
returns and remains within of 5% the disturbance magnitude in not more than 5 sec.
Eventually, the control error is to be completely eliminated.

2. For a step change in the reference input,

 The maximum overshoot at the output of the plant does not exceed its steady-value
by 40%.

 The output of the plant should not take more than 5 sec to settle within 5% of its
steady-state value.

2. Plant Description
The plant is described by the following block diagram:

D(S)

+
15 + 4 Y(S)
U(S) S 5 S

Figure 1: Plant to be controlled

Note that U(s) is the Laplace transform of the control input, D(s) is the Laplace transform of the
disturbance input, and Y(s) is the Laplace transform of the plant output.

3|Page
Fuzzy Control and Applications
Laboratory Report 2

3. Fuzzy Controller Design


A Sugeno type fuzzy logic controller where singletons are used for the output membership functions
must be designed. The fuzzy logic controller should be built using SIMULINK.
Note: The MATLAB Fuzzy toolbox is not allowed to be used in the creation of the fuzzy controller.

Figure 2: Fuzzy controller architecture

There are four main components the fuzzy controller is made up of;

1. The “rule-base”, which holds the knowledge which suits the best to control the system, in the
form of a set of rules.

2. The inference mechanism, which evaluates which control rules are suitable for the current
time and then decides the input for the plant.

3. The fuzzification interface, which simply modifies the inputs so that they can be interpreted
and compared to the rules in the rule-base.

4. The defuzzification interface, which converts the conclusions reached by the inference
mechanism into the inputs to the plant.

Fuzzification

Since we are using the Gaussian curve to represent our membership functions we must create this
function in Simulink by the use of a Function Block.
Function will aim to represent the Gaussian function;

2
1 u−c
f (x )=exp −( ( ))
2 σ
Where u represents the input, c represents the centre of the Gaussian curve and the σ represents
the width of the curve. The value of σ was obtained using the fuzzy logic tool box. (σ=0.2123)

4|Page
Fuzzy Control and Applications
Laboratory Report 2

Rule Table

The rule base holds all the information necessary to adequately control the system through a set of
rules. The rules act like a series of If then statements which need to be chosen correctly since it will
affect how the controller operates. To set up the rule the user must have experience with the system
and needs to know exactly how it must function.

Table 1: Rule Table

4. Uncompensated Controller
The uncompensated plant was built in Simulink to observe the behaviour so that later we can see the
improvements the fuzzy controller provides. The step inputs “Step1” and “Step2” are both set with a
final value of 1 and a sample time of 0. “Step1” is configured to step at time 5 while “Step 2” is
configured to step at time 0. Figure 3 shows the model.

Figure 3: Model of the uncompensated system

5|Page
Fuzzy Control and Applications
Laboratory Report 2

Figure 4: Uncompensated system output

From figure 4 it is evident that the second step response is raising the steady state to stabilize at a
value around 2. The maximum allowable overshoot is 40% and the steady state errors are within the
specified limit of 5%.

5. SIMULINK fuzzy controller design

6|Page
Fuzzy Control and Applications
Laboratory Report 2

The basic block outline for the interface mechanism is shown in figure 5. It takes two inputs, error
and change in error.

Figure 5: Interference mechanism

The Fuzzification involves taking the error and change in error of the membership functions and
assigning each one of them it’s appropriate Gaussian function. Each one of the error and change in
error membership functions are represented by the function blocks. Expressions for each
membership function are then entered to the function blocks as mentioned in table 2 below.

Table 2:
Membership Function Centre Expression f(u)

NB Negative Big -1 (u<-1)*1+(u>=-1)*exp(-0.5*((u+1)/sigma)^2)


NS Negative Small -0.5 exp(-0.5*((u+0.5)/sigma)^2)
Z0 Zero 0 exp(-0.5*((u)/sigma)^2)
PS Positive Small 0.5 exp(-0.5*((u-0.5)/sigma)^2)
PB Positive Big 1 (u>1)*1+(u<=1)*exp(-0.5*((u-1)/sigma)^2)

Figure 6 shows the Gaussian membership functions those we get from the equations mentioned in table
2. There are five membership functions for error and there are five membership functions for change in
error. Altogether they make up 25 rules, for each combination of the rules the errors are multiplied as
shown in figure 7.

Figure 6: Membership functions

7|Page
Fuzzy Control and Applications
Laboratory Report 2

Figure 7: Inside the subsystem

Five outputs are created using constant blocks which contain the weights of each of the linguistic
variables as per the figure 8.

8|Page
Fuzzy Control and Applications
Laboratory Report 2

Figure 8: Weightings for the linguistic variables

The rule base block has to follow the rule table as shown before in table 1. The Defuzzification
interface takes the value which is most suited at the time and takes the dot product of the rule-base
and the interference mechanism.
Sugeno defuzzification method is used for defuzzification and the equation for that as follows;
R
∑ bi μi
y= i=1R
∑ μi
i=1
Figure 9 shows the Simulink block which represents the above equation.

Figure 9: Sugeno defuzzification method

9|Page
Fuzzy Control and Applications
Laboratory Report 2

PD Fuzzy Controller Design

The PD model of the fuzzy controller is shown in figure 10. Three gains are introduced represented
by gain1, gain2 and gain3. Adjusting these gains is vital in achieving the required specifications.

Figure 10: PI Fuzzy Controller

Figure shows the optimal gain settings to achieve the most stable output within the required
specifications. The following values were used for the gains. gain1=1, gain2=1 and gain3=5. Once
the simulation was completed the following graph was produced.

Figure 11: PD type controller

10 | P a g e
Fuzzy Control and Applications
Laboratory Report 2

According to the figure 11, it shows that the system never exceeds the maximum allowable
overshoot of 40% even when there is a disturbance. And also the settling time is well below 5
seconds after the disturbance. But there is one more requirement left to be achieved, that is the
steady state error requirement. In order to compensate or the steady state error, we need to have a
PI type fuzzy controller and in this case we combine both PD and PI to make a PID type fuzzy
controller.

PID Fuzzy Controller Design

The PID type controller is shown in figure 12. This is the final controller which is the most effective
solution. Adjustment of the gains was done until an acceptable output is achieved.

Figure 12: PID Fuzzy Controller

The gains for the PI controller were selected in order get the minimum steady state error and the
gains obtained for the PD controller from the previous design were kept unchanged.

11 | P a g e
Fuzzy Control and Applications
Laboratory Report 2

Figure 13: PID Fuzzy controller response

Figure 13 depicts that the PID fuzzy controller design is met all the requirements. The maximum %
overshoot seems to be 34.5% and it is well below the maximum allowable margin of 40%. Also the
output of the plant only takes less than 5 seconds to settle within ±5% of its steady state value after
the disturbance. This is 2.5 seconds.

6. Conclusion
This laboratory helped me gain a better understanding of how a fuzzy controller works through the
focus on its development from scratch. The design of two different types of controllers PI and PID
helped me understand the effect that the fuzzy controller has on the effect of the plant. The following
pictures show PI and PID controllers respectively.
It is evident that the fuzzy controller in PD configuration is effective by making the response faster.
Gain1 mentioned in the PD controller in the text increases the proportional gain and the Gain2
increases the derivative gain and the Gain3 increases the overall output.
A PI controller was also added to make the steady state error minimum (zero).
Since we used only 25 rules in this controller it was required to play around with all the three gains in
each PI and PD controllers to get the optimum results. However if we used 49 rules instead of 25, it
would have been easier to get the optimum output.

Note-:
It is necessary to check the sampling time of the ‘unit delay’ and the ‘discrete time
integrator’ to 0.1seconds for a better sampling rate. (Nyquist rate)

12 | P a g e

You might also like