You are on page 1of 28

# MAK 664E HW ASSIGNMENT

## PART 1. INITIAL DESIGN

1) Design a Fuzzy-PD Controller. You may use 5 MFs or 7 MFs to describe the inputs as given
below.

nm n z p pm
1

0.8
Degree of membership

0.6

0.4

0.2

e

## Figure 1. Membership functions.

2) You may use a Rule-base similar to Table 1. Depending on the definition of error, negative
and pozitive direction may change.
Table 1. Rule base for PD type Fuzzy Logic Controller
e
U NM N Z P PM
NM NM NM N N Z
N NM N N Z N
de Z N N Z P P
P P Z P P PM
PM Z P P PM PM

3)After you complete the F-PD design using Fuzzy Logic Toolbox, select export to workspace
option before you insert the fis file into simulink.
4) My suggestion is that design the PD controller first and add the F-PD for comparison. You can
observe the response from scope initially. But for performace analysis you need to send the
results to a file to calculate the overshoot, rise time, steady-state error, etc.
5)You may choose any linear or nonlinear system to control. You may use transfer function
representation with a zero-order hold or discrete models if you like. The system model can be
chosen as given below by assigning numerical values.
K e  Ls
G (s) 
(T1s  1)(T2 s  1)
max 0.02933

MinMax Display2

1 0.5582
|u|
s
Abs Integrator Display

1 1
45 Scope1
Step Gain s2 +s+1
Gain2 Zero-Order Transfer Fcn1
Fuzzy Logic
Hold
Controller
du/dt .10

Derivative Gain1

Scope

1
PID hw3FPD.mat
s2 +s+1
PID Controller Zero-Order Transfer Fcn2
To File
Hold1

Scope2
1 0.9436
|u|
s
Abs1 Integrator1 Display1

max 0.0185

MinMax1 Display3

Figure 2. Simulink block diagram of the system controlled with both classical PD and F-PD

F-PD vs PD Controller
1.4
1.2
1
0.8
0.6
0.4
0.2
0 sec
0 1 2 3 4 5
Ref F-PD PD
Figure 3. The response after initial design for both classical-PD and PD-FC for linear system.
6) You may use a table to observe the performance for both controllers. You are required to
analyse the effect of sampling period. Type of performance measures are all optional. I can
suggest the following Performance Measures
Rise Time
Percent Overshoot
Sum of Absolute Errors

## Table 3. Simulation results for linear system (EXAMPLE)

T=0.02 s. T=0.02 s.
F-PD PD
MAXO= 1.00176 0.996
SAE= 5.71859 7.04014
SSE= 0.00094 0.00497
RT= 0.12 0.14

7)Since controllers can not be tuned to give exactly the same numbers, performances of both
controllers should be close enough initially. Then work with the global and local tuning
parameters to improve the performance of F-PD. Investigate the effect of scaling coefficients.

## PART 2. ROBUSTNESS ANALYSIS

disturbance. You may also increase/decrease the coefficient of transfer function as a parameter
change. Observe the effect of dead-time by changing L.
9) Compare the performance of both controllers. In every case plot the response of both
controllers on the same graph with legends.
10)Explain every case and write your conclusion and remarks.

NOTES:
1)Use export to workspace command from FL Toolbox before running simulink
2)Some of Matlab commands:
getfis(a)
showfis(a)
Plotfis(a)
plotmf(a,'input',1)

REFERENCE:

Z.Woo, H.Chung, J.Lin, “A PID type fuzzy controller with self-tuning scaling factors”, Fuzzy
Sets and Systems 115 (2000) 321–326.
2017 – 2018 SPRING TERM
INDUSTRIAL APPLICATIONS OF FUZZY LOGIC
MAK 664E

HOMEWORK - I

## İBRAHİM TUĞRUL ARDIÇ

508172005
PART _ ı

İNİTİAL DESİGN
PrOtla..3 {ss,^-q ]Lu orr\- lrrp +d^skr tt"a
na is, l l l fun.X.^ "f [at" ralory seNo
)

CıG) = s
4;
-,
Q-ro,ls)

4, a, co,^r*konal PD cnn\,olle-r
f". a closd-l.rç M ser,Jo lo3ive
?*3:
.Sry ti"^e to o :4 :"rr ,f O,r sea^J,. 7L. Jo""A İ7
:rr*-I^^al
' k' o.oun)' '5O".
p["ose-- ,."".r" .L...U

^u/n
:l4,8r} , &n -b,a 4 oJ
C> = tf G"- , J.^)
sisoLo( ( G )
R.ool Lac,s ğ"!tte,r (^, Ca, *T

It
l

L_
J
l
l
]

_]
' lZroü-
Jilş"]
Lour'6,
ts
tru a\$o'ProL
ü,efne
ğk/ir-,"-.

## llt_ J".-& (r-..koto.ko..

--> ,l-oJo^) ,r.t .er,ır^."
Ll
?bıA". ı
4
Arykkde t

|tll
0,L Dıı* g6 b/g 4 4,L l,ç -lT;^e
. .ulllao {i-e}o . -
P-L|.^L
q,1o.{,Jr.r..
vefle..
) J"'
55 ErıL

Pl"l
!p*
S3slj"ıs
CLo.a"kn].h.s
l(ulli*,&J Jr,7,
ı- 1,1rJ3",n*
Lıse
-
11
hıvıe_
SF."f,j =l"|e

## S"Itlr3,{i-.'o +LIil,Lt"^ so..ırğ .? resrongL

3*r5i
Lu şelilk 3*lrjo-

fur

0,6 Ti*c

## ArJ,;or, pro]Ie,, Jg L*h.{l{ea " .u.Hh.., tl^e" Loşulunu ,aj","-V-

seH{.1 1T^o ıçir,, "P.+
)
L-.". E4*", (,, O7"n l_,İ' 3."ft5;*
I

üUJ.,,u,^=
3dT =5

n*5
e 6-f,f^ J,-o^nJ,. HiL"

Delek_ ?"Ie l Z_e.ro

l_
l ]

__ __ .*J I
kJ,nlo" Pn,ş,^,zo alltqtı SeL.r<k S"}H3 T-e {
3<len
d.r*,« jii3or,,ıa;
----l
}.- D.'!" ?ı.Tt.-^e^t ı
-l rEl [x] l

EJı*o"
B
l
r:l '}' *,r J'-^f:i;"
{>u
S].-J:f^j,,^?,
<--=. 5tı.ı

a6,ı
ü,

Y .,v,aıji
qiry iı,ze_i.,e ıd*n- {*Ey..
E"
L1.1 |Z-oŞtJlLr Sa.llq:labılt<vı d
ş,ı{, .5,1*Yıl,n-,
Lrş,-r{, ..ql"ÜLıl,-<-, 4l", ^..,ar*n
|çTa, --l
arafl.n^ .so(
,^Çrr1
1-,.r..l, ,l"^j!"'ı,|55_
ı !,l
qJ*
a.
",'^ 4eı
' ..Yo'
3? ;l"X
:'r' ?,:',
.,l.,-,,İn 'a!(, 4

"LJ"^"lljla.

/
-g-
2"*( ar-is

## " Loo+ Lo'us EJi{.,'" eAe-uL-,se_ a?ajltj

J.orrrro'r-u.J ,;uı 3*4uıt,tlı.,
C-n|-olS3sla-l@l Vl"*,

## N XOğ +3? '0'.' se^L.lJ sğl,,,çr vc_ seçlun-o,LJ "2,ot

Lnru, EAiLr" oğf;şi..,.h. , -liain sol Lrn ,iloL
'-J
{od, ol^,-.,o,, 'olo'} ,L|;l"J A+Si,^L;
J;. 3lti L;r^
3JrJ^ü^,., "Jlli1,. i
l(
\/
P.,.f 'Lo.us Çhlor f"" l_-r7 Tr".sf*. _ C

u ;?1
,/ /l
,,=, l
,/ .JI
'"' ,'|
/.,,}
ıX ı x ,"' ,}

./ _i

,[ı l .,,İl
D

(
B" ,"fiLleLT "O " ,n ve iUj f..* LaL-ü" lle- o14a5- ra4Iü l6Li)
71zrle.i
ve
Ö
?, *o3T^)'Jğu,;^i 50"
1rrğ
f-tno İ_=' ^r,.::,3"!:^"^ ^A tY-,.
c,.ı1-

3a§rnne^r. Je-ceJcı3or.
v
"r-r" n.,., ,4e6 -
J,j"Jo4aglacotL Ü L;L |
..ı,ıe,ie
at*]Jo toort-._*Jçt'+
,, ıı ile._
q_ * _
çTt[
1o,i
5h"tl5-,.J9
se,c,ıe-
p'..^,. A.ta3i-n g. 5o- ,,*.i,r;;::5.-:*-'lı-e
3-o"l Lo-us EJcloc Ary].__ŞE kr*
I

a-
I

l,

o/
l
1*, +..*,
-|oo 5o q,
i+ı;tru .;H.ff* f;p.*til{ fş
Ze^l Axis
§'' ff
6,5 'ı,, olh.a Jiş+; - ı/
*İğ phase Aarqia G."15; ise .*şoQ,Jati
* {16 oau pr.,Llg,y,lq_ i-.le^e.,
P
J
[.^o." }-b,-Ş.. \ı So-' Loşr(,^ '..3l_İ.. i

--l

l hqse_
Qz,l

PM: Ç0. ı/

ı Faeo,-.en..a
1oa 4o' CJa/*)-
-T-ü""
t' Tıl.^"ler {o-o.-(o^.[|.}an :,o..ra.ı C_-*pensalor Çh*r)^ {,Lt"o.aL"
O1Fv^o* q !e_ Zo Jğ* Lu]ıA.ni-,

## r' L,i T:P:-

|2ool
Lo....' il'F:.',
9' ,..ofq; ize6,",e jJ^.uUfore;^
S«J t,ılo^uına hLJ.,)r ve şa L; ,.L_,,,"'_ r}l,İ,

!J-.

B"L
trı@
Pa" / 2u,.
L^ ,et^rte seçTlir,

Pr:t=
'EJrl Co*te^st-| .elr^esTnu {, lrJ^^Jr!-+r^ so^(ğ apa3,J^tl .*,e. L.ş,*,.o +L*
Co^y*r:r#.r EJi|-or
&""1.n s o|o.
C = llçZı-.1^ (4 t o,ozs )
4

|la"/ z-"L
D3aan.-,
l oc,a,lioa
:1-g,L
" EJrü- Co-p"nro{-r." seL*esi,'Le L.o2,c,nç|.,nn (3.-,' to*
lJr-_Jo =1J, ,{-o", I.{e"e-
L.lkr. Ç]." ' FJr+- C,ı>.,7en o+r.' s.Ü.=1., J"L- J"j.Ae, alğıJ^Li
şeLdJ" AJz^l"oeLl|i. ı

C*,1Xnvt . EJİo.

(a + QoZ-s)
1

D9 n a,,ti<_s
Tııçe L_o.o..ko"' Da-fınq trec,

## ?eal ze^ -Ço 1 ,D

L r-l A l l l
trcl-it SeJec[eJ D1.,a,ri6
J

Lr.a{.;,", 1-51-_1

## C- 1+(1 r- O .)Lr) r r-;

r.
ı. , -''
tıC,r<,ı[ (3cıırı l

n
,

)
Ç

## ,O,|duluAo2 J"i /" Lu/nnJuruloroL, oÜn, =k{o,

S,m"uli'L\ IL t"sir{on-aL iskairse 1

P= 4+ \

f) ı O/2g /
) ol"^lc_
3Tal-,.lrJrc
Fuzzy Lo6ıc coNrROLLER (wırıı § ıe'r)

Fı..,
)
l-
ı-o_Jı<--

C"ntoll"r

efrbr*(e)

NM NM N N Z -4

N/4 N N Z N -4§

N
t:
Z P P 0
Je 1Je,i""S"" 4)
{'\j d+ \ 41rof /

P L P P P/4 q§
r
Z P ? ?u PM 1
r^

aUTPUT FÜZZY
5ET

-L _1
(wıTH ;ı /4Fs)

L{ror.(e-)

96366 4

NB
t
z
NB NİB NB NA Ns Z0 @

I
\6

Z0
§r\
NB NB NB N/4 N5 Ps
G
R
\$
NB NB NM N5 Z0 P5 Pl4
(^)
t^'
td
Z

Ng Nı N5 Z0 P5 Plq PB 9 =cbf,ak,ıe
/ oi e-ıaı^
Je'
70
ş(, § E
NM Ns P5 PA Pg PB (^ı
ül
(ı,

NJ Z0 P5 PA ?B PB PB
o.
ç\
§\
§\

Z0 Ps pü4 PB PB PB PB
(

ouTPu r Fü7 -Y
SET

}
MEMBERSHIP FUNCTIONS FOR 5MF’s CASE
MEMBERSHIP FUNCTIONS FOR 7MF’s CASE
INFERENCE RULE SURFACE FOR 5MF’s CASE

## INFERENCE RULE SURFACE FOR 7MF’s CASE

FUZZY INFERENCE SYSTEM RULES (FOR 5 MF’S)
1. If (e is nm) and (de/dt is NM) then (Δu is NM)
2. If (e is nm) and (de/dt is N) then (Δu is NM)
3. If (e is nm) and (de/dt is Z) then (Δu is N)
4. If (e is nm) and (de/dt is P) then (Δu is P)
5. If (e is nm) and (de/dt is PM) then (Δu is Z)
6. If (e is n) and (de/dt is NM) then (Δu is NM)
7. If (e is n) and (de/dt is N) then (Δu is N)
8. If (e is n) and (de/dt is Z) then (Δu is N)
9. If (e is n) and (de/dt is P) then (Δu is Z)
10. If (e is n) and (de/dt is P) then (Δu is Z)
11. If (e is z) and (de/dt is NM) then (Δu is N)
12. If (e is z) and (de/dt is N) then (Δu is N)
13. If (e is z) and (de/dt is Z) then (Δu is Z)
14. If (e is z) and (de/dt is P) then (Δu is P)
15. If (e is z) and (de/dt is PM) then (Δu is P)
16. If (e is p) and (de/dt is NM) then (Δu is N)
17. If (e is p) and (de/dt is N) then (Δu is Z)
18. If (e is p) and (de/dt is Z) then (Δu is P)
19. If (e is p) and (de/dt is P) then (Δu is P)
20. If (e is p) and (de/dt is PM) then (Δu is PM)
21. If (e is pm) and (de/dt is NM) then (Δu is Z)
22. If (e is pm) and (de/dt is N) then (Δu is N)
23. If (e is pm) and (de/dt is Z) then (Δu is P)
24. If (e is pm) and (de/dt is P) then (Δu is PM)
25. If (e is pm) and (de/dt is PM) then (Δu is PM)
BLOCK DIAGRAM OF CEONVENTIONAL PD AND FUZZY PD CONTROLLER
(WITH 5 MFs)
COMPARISION OF THE PERFORMANCES OF CLASSICAL PD AND FUZZY PD
(5 MFs) CONTROLLERS

Conventional PD Fuzzy PD
Overshoot (%) 21.341 % 13.068 %
Undershoot (%) 2.210 % 3.043 %
Rise time 81.489 ms. 117.768 ms.
Settling time 416.423 ms. 308.542 ms.
Peak value 1.211 1.132

Comment: As can be seen from the figure and table above, PD type Fuzzy Controller is
significantly more efficient than Conventional PD controller. The overshoot (%) value and
settling time diminished considerably when PD type Fuzzy Controller is preferred instead of
Conventional PD controller. Besides, peak value of the response decreased, while rise time
slightly increased in case PD type Fuzzy Controller is utilized in the system.
EFFECT OF NUMBER OF MEMBERSHIP FUNCTION ON THE PERFORMANCE OF
FUZZY CONTROLLER (5 MF’s – vs – 7 MF’s)

## Fuzzy PD (5 MFs) Fuzzy PD (7 MFs)

Overshoot (%) 13.068 % 19.880 %
Undershoot (%) 3.043 % 3.125 %
Rise time 117.768 ms. 70.868 ms.
Settling time 308.542 ms. 284.845 ms.
Peak value 1.132 1.199

Comment: As can be seen from the figure and table above, increasing the discretization level
of the domain, in other words, increasing the number of membership functions of both input
and output domain has negatively effect on the performance of the Fuzzy PD controller for this
case. While overshoot rate (%) and peak value are both rising up, rise time and settling time
decreases with the increasing the number of the membership function from 5 to 7.
EFFECT OF SCALING COEFFICIENTS ON THE PERFORMANCE OF FUZZY PD
CONTROLLERS

1) Effect of K p :

## FLC (Kp= 22) FLC (Kp= 18) FLC (Kp= 14)

Overshoot (%) 13.068 % 13.068 % 13.068 %
Undershoot (%) 2.570 % 2.991 % 3.043 %
Rise time 96.549 ms. 105.321 ms. 117.768 ms.
Settling time 241.922 ms. 273.793 ms. 308.542 ms.
Peak value 1.132 1.132 1.132

Comment: As can be seen from the figure and table above, proportional gain has not any effect
on the percentage of overshoot of the system. For this control system, increasing of the K p
parameter causes to decrease of the percentage of undershoot, rise time and settling time.
Whereas, peak value of the response remains constant with the increasing level of the K p
parameter.
1) Effect of Td :

## FLC (Td= 0.04) FLC (Td= 0.03) FLC (Td= 0.02)

Overshoot (%) 2.577 % 6.989 % 13.068 %
Undershoot (%) 1.974 % 1.999 % 3.043 %
Rise time 162.783 ms. 139.531 ms. 117.768 ms.
Settling time 186.779 ms. 208.843 ms. 308.542 ms.
Peak value 1.032 1.070 1.132

Comment: As can be seen from the figure and table above, derivative gain significantly effects
the percentage of overshoot, percentage of undershoot, rise time, settling time and peak values.
As a result of interpreting the above graph and table, the output of the system can be tuned to
the desired level by changing the system's derivative gain.
EFFECT OF SAMPLING RATE ON THE PERFORMANCE OF FUZZY PD
CONTROLLERS

Comment: For determining the effect of the sampling rate, rate transition parameter is added
the block diagram of the system. As can be seen from the figure above, selecting 0.001 of the
output sample rate, system responses properly and behave as expected. When output sample
rate is selected above the 0.05, system responses abruptly and aliasing is observed.
PART – II

ROBUSTNESS ANALYSIS
EFFECT OF BACKLASH ON THE CONVENTIONAL PD AND FUZZY PD CONTROLLER
Effect of the Backlash

Conventional PD Fuzzy PD
Overshoot (%) 24.375 % 13.068 %
Undershoot (%) 2.718 % 3.043 %
Rise time 79.206 ms. 117.657 ms.
Settling time 699.073 ms. 897.468 ms.
Peak value 1.231 1.141

Comment: From the figure and table above, Fuzzy PD type controller is more robust than
Conventional PD type controller under the backlash effect. The percentage of overshoot (%),
rise time and settling time values of the Fuzzy PD controller is lower than the Conventional PD
type, while the peak value of the Conventional PD type controller is higher than the Fuzzy PD
controller.
EFFECT OF THE DEADBAND WIDTH OF THE BACKLASH ON THE FUZZY PD
CONTROLLER

Width= 1 Width= 2 Width= 3
Overshoot (%) 13.068 % 22.840 % 29.221 %
Undershoot (%) 6.820 % 3.879 % 4.285 %
Rise time 117.444 ms. 107.976 ms. 102.728 ms.
Settling time 997.533 ms. 911.431 ms. 970.016 ms.
Peak value 1.153 1.175 1.202

Comment: From the figure and table above, increasing in the deadband width of the backlash
has significantly effect on the system. By increasing the deadband level of the backlash, while
percentage of overshoot (%) and peak value increase, rise time of the system continuously
decreases. Additionally, settling time of the system doesn’t behave smoothly, whereas it
decreases by the increasing the deadband width from 1 to 2, it increases between the deadband
widths 2 and 3.
EFFECT OF THE NOMINATOR OF THE TRANSFER FUNCTION ON THE FUZZY PD
CONTROLLER

## Overshoot (%) 13.068 % 13.068 % 13.068 %

Undershoot (%) 3.043 % 2.917 % 2.310 %
Rise time 117.768 ms. 103.054 ms. 93.298 ms.
Settling time 308.542 ms. 266.264 ms. 227.241 ms.
Peak value 1.132 1.132 1.128

Comment: From the figure and table above, increasing in the numerator of the transfer function
of the system has no effect on the percentage of overshoot (%). It can also be seen from the
table that when the numerator has lower value, rise time and settling time of the system
decreases. Additionally, percentage of undershoot diminished by the increasing in the
numerator. The peak value of the system has not affected by changing the numerator of the
system from 1.85 to 2.50, meanwhile, it slightly increases when the numerator is increased to
3.15.
EFFECT OF WHITE NOISE ON THE FUZZY PD CONTROLLER

## without noise with noise

Overshoot (%) 13.068 % 10.556 %
Undershoot (%) 3.043 % 4.515 %
Rise time 117.768 ms. 115.407 ms.
Settling time 308.542 ms. 345.321 ms.
Peak value 1.132 1.108

Comment: From the figure above, it can be seen explicitly that the stability of the Fuzzy PD
controller is distorted by the inclusion of the white noise in the block diagram. Steady state
error is emerged on the system by adding the white noise. Besides, while percentage of
overshoot (%) and peak value decrease by including white noise, percentage of undershoot (%)
and settling time increases in this case.