You are on page 1of 17

HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCA

FACULTY of INTERNATIONAL EDUCATED

AUTOMATIC CONTROL SYSTEM IN PRACTICE


STUDENT REPORT
LESSON 5: Fuzzy simulation
Lecturer : Nguyen Tran Minh nguyet
Student’s name : Nguyen Duc Hieu- 21151416
Phan Quang Huy-21151016
5.4.1. Create a fuzzy controller for air-conditioner.
To build an fuzzy controller for air-conditioner, we need some components:
Temperature that we care about that’s from 0 to 50 degrees divided by 5 levels which
are very cold, cold, normal, hot, very hot.
Fan’s speed that we are going to design also has 5 levels of speed, which are zero,
slow, neutral, fast and very fast.
Fuzzy law in the table that’s given below here that based on excited temperature and
real temperature to calculate speed of motor of air-conditioner
Table 5.1: fuzzy law table for controlling speed of fan

Ti To Very cold Cold Normal Hot Very hot


Very cold Zero Zero Zero Slow Neutral
Cold Zero Slow Slow Neutral Fast
Normal Zero Slow Neutral Fast Max
Hot Slow Neutral Fast Max Max
Very hot Neutral Fast Max Max Max

We can build an fuzzy controller that has 2 inputs and 1 output:


For input: 1 is for excited temperature that we set on remote, 1 is for real temperature
measured by sensor of air-conditioner.
For output: based on 2 input, provide signal control fan’s speed of air-conditioner.
Then the fuzzy controller that we build on mathlab will have form like:

Figure 5.1. fuzzy controller design.


The input temperature means to the set temperature that we adjust on remote, and the
output one is what sensor measures. Velocity in the figure is fan’s speed.
We set for both both inputs same form with 5 level of temperature:
Figure 5.2a. and 5.2b. Set up for both inputs.
And with the output we set up speed signal for each level.

Figure 5.3. Set up for output.


In params we set the speed signal that start from 0 and increase by 150 per level.
It means that speed at zero level is 0, cham (slow) level is 150, Tb (neutral) level is
300 and also for Nhanh( fast) and max which are 450 and 600.
Then we will go to set up rules which is the most important when we set up 1 fuzzy
controller. To build these rules, we base on the table 5.1.

Figure 5.4a. and 5.4b. 25 rules is set up based on table 5.1.


After setting rule we will make an simulation for air-conditioner with fuzzy controller
that we made.

Figure 5.5. simulation for air-conditioner.

So after set the Ti as and T out is we get the speed of fan as 510
Figure 5.6. result of simulation with Ti and To
5.4.2. create a fuzzy controller for controlling rotation of DC motor.
We have transfer function of motor when operating at no-load condition:

When using motor at 3.7kW, 240V, 1750rpm, parameteres of motor will be:

We need to build the Fuzzy controller with 2 inputs, which are E (steady state error)
and DE (changing speed of steady state error) and 1 output which is U.

Figure 5.7. Main window of fuzzy control with 2 inputs and 1 output.
Then we setup inputs and output follow fuzzy law with 5 ranges which is
NB,NS,Z,PS,PB then 2 inputs and output will have the form look like:
Figure 5.8a,b,c Form to build for 2 inputs and 1 output in Fuzzy controller.
Then based on the sumary table of fuzzy law for output U with 2 inputs DE and E
below:
Table 5.2: Fuzzy law for system of controlling rotation of DC motor

We will set 25 rules in fuzzy controller follow the sumary table.


Figure 5.9a. and 5.9b. 25 rules in fuzzy controller based on sumary table of fuzzy
law.

Then after building fuzzy controller, we will simulate the system for speed controling
of DC motor in mathlab like this:

Figure 5.10. Simulation of model of controlling rotation of DC motor.


In DC motor block we declare parameters of transfer function.

Figure 5.11. Declaration in DC motor block.


And we need to declare these parameters in mathlab workspace to make the system
understand the sign of parameters.
Demand:
a. Choose K3=240 and K2=0 then we change K1 and determine parameters
like settling time, overshoot, rise time, steady state error.

1/500 1/300 1/200 1/100


(%) 87.93 91.12 94.19 99.25
(%) 0 0 0

(s) 0.64 0.52 0.43

(s) 62.47 76.98 103.89

Comment: When we increase the steady state error (E) the POT and settling time will
increase because when the bigger error is, the longer time it takes the system to be
stable. But when the overshoot increases, it will decrease the rise time of the system.
And when the system have input E big enough, the system will be unstable.
The grap of 4 cases when we put it on the same coordinate plane:
200
K1=1/500
180 K1=1/300
K1=1/200
160 K1=1/100

140

120

100

80

60

40

20

0 50 100 150 200 250


Time(s)

Figure 5.12. plot of 4 cases when setting K3=240, K2=0 and changing K1.

b. Choose K3=240 and K1=1/100 then we change K2 and determine


parameters like settling time, overshoot, rise time, steady state error.

1/300 1/200 1/100 1/50


12.24 0 0 0
0 0 0 0
0.56 0.8 2.01 7.77
1.83 1.28 3.72 4.32
Then we plot 4 cases in the same coordinate plane.

120
K2=1/300
K2=1/200
K2=1/100
100 K2=1/50

80

60

40

20

0
0 5 10 15 20 25 30 35 40 45 50
Time(s)

Figure 5. graph of 4 cases in the same coordinate plane.

Comment: when we increase K2 it means increase the derivative of error’s change


(the changing speed of error) the POT decrease but the system need more time to be
stable (rise time and setling time also increase when increasing K2)
Total point: we can see that if we consider on a PID controller then K1 is similar to
Kp and K2 is similar to Kd it means that when we increase K1, but it’s just similar not
equal to, the K1 have a little bit difference to Kp that when we increase Kp in PID
controller, system is likely to decrease steady state error, reduce rise time and make
the overshoot more bigger, the system will be unstable when we abuse increasing Kp.
While K1 in this case just makes the system reduce rise time and make the overshoot
bigger, beacause the steady state error always equal to 0, it also make the system
unstable when we increase to a level. Then K2 is have many similar point to Kd in
PID controller because when we increase Kp in PID controller, the system will be
more stable (decrease overshoot) and the rise time, settling time will increase.
5.5 Building fuzzy controller for thermal furnace
1. Block diagram and parameters.

Figure 5.13. block diagram of thermal furnace.

2. Building fuzzy controller.


a. Define parameters

We have

Find and :
Based on transfer function we can find the expected temperature that we want the
furnace to get to be.
Assume that the lowest temperature that furnace can be is 0 degree.

Then:

a little bit bigger than what we found and it’s divided by 4


range that each range separates to the next one 10 degrees
Take the same for derivative of error then

Diver of thermal furnace:


Min: Does not active: P=0%
Max: Operates with max power: P=100%

So we take the output


b. Fuzzication:
We set both inputs e and de alike similar.
Figure 5.14. 2 inputs’ setting for fuzzy controller of thermal furnace.
We devide both inputs to 4 range with 5 levels which are NB, NS,
Z ,PS ,PB that show the amplitude of the error and changing speed of it.

And the output we set from 0-1 which performs the power of thermal driver
operating at power of 0 to 100%.

Figure 5.15. Output of fuzzy controller of thermal furnace.


We also devide it to 4 range with 5 levels which are :
 Zero =0
 Low = 0.25
 Neutral = 0.5
 High = 0.75
 Max =1
Then based on experience, we set rules for ouput of fuzzy controller.

Table 5.3: table of rule for output based on 2 inputs.


e de NB NS Z PS PB
NB Z Z L L N
NS Z L L N H
Z L L N H H
PS L N H H MAX
PB N H H MAX MAX

Then our rules can be made:

Figure 5.16. Rules built by relying on table 1.

3. Simulation for testing.


a. Simulation.
After building fuzzy controller, we will simulate the system with transfer function
meantioned at the frist page.
Figure 5.17. simulation of thermal furnace system.
Where:
 Constant : Expected temperature
 Thermal furnace : Transfer function of thermal furnace
 Fuzzy block : Setting up of fuzzy controller
Inside fuzzy block:

Figure 5.18. Fuzzy controller setting.


Inside thermal furnace block:

Figure 5.19. transfer function of thermal furnace.


b. Some result of simulation.
250

200
Temperature

150

100

50
expected temperature
thermal furnace

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Time
Figure 5.20. Expected temperature is 250

160

140

120

100
Temperature

80

60

40

expected temperature
20
thermal furnace

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Time

Figure 5.21. Expected temperature is 150.


Comment: system still have a littile bit steady state error but we can confirm that
the bigger expected temperature is, the less overshoot is, and approach to be 0 with
specific value.

You might also like