Skip to main content

Belajar Fuzzy Logic Sederhana

FUZZY LOGIC

Soal:
Sebuah mobil mempunyai kecepatan diantara range 60-180 km/jam. Untuk mengendalikan mobil terhadap suatu rintangan (obstacle), maka kecepatan mobil dapat diatur dengan memberikan tekanan pada rem (brake). Tekanan pada rem berkisar antara 0-80 bar. Sedangkan jarak terhadap obstacle ditentukan dari 100-300 meter.

Disainlah sistem diatas dengan menggunakan fuzzy logic, dan tentukan berapa bar tekanan pada brake jika kecepatan mobil adalah 90 km/jam dan jarak terhadap obstacle adalah 240 meter.

Determine using fuzzy logic controller (use Mamdani method) how much the pressure of the brake if distance of the two car is 240km and velocity of the green car is 90km/hr.














  


Jawab:
Commonly, fuzzy system is like this figure.






Define how much input and output??
2 variable as input are: speed and distance of obstacle.
1 variable as output is: brake’s pressure



From the system above, we follow the rule of Fuzzy system as the procedures bellow:
1.      Fuzzification/ Membership Function
Speed Input.
Divide the Speed range into 3 categories of “low”, “middle” and “high”. I can divide the speed range more than three or less, depend on assumption. The definition of “low”, “middle”, and “high” are depend on my assumption too. I can choose a triangle or trapezium or gauss or sigmoid or other function as the shape of membership function. In this case, I choose trap MF as a “low” and a “high”, and tri MF as a “middle”. This figure bellow shows the complete result of three categories of 3 membership function. 



Obstacle’s Distance Input.
Divide the distance range into 3 categories of “near”, “middle” and “far”. (According the assumption, it’s can be divided less or more than 3).






Brake Pressure Output.
Divide the brake pressure range into 3 categories of “no”, “light” and “strong”. (According the assumption, it’s can be divided less or more than 3).















2.      Rules/ Inference
Define a look-up table from membership function as:




3.      Defuzzification



The speed of 90 will cross the low line at 0.67 and cross the middle line at 0.25. The distance of 240 will cross the middle line at 0.47 and cross the far line at 0.2.
In this case I use and operation to determine the value of output. ( Speed and Obstacle à Result is Brake Pressure).


From the figure above we can define the table bellow.

No
Rule
Speed(MF)
Operator
Obstacle(MF)
Sp Op Ob
Result
Out
1
Rule 1
Mhigh
AND
Mnear
0 AND 0
0
S
2
Rule 2
Mhigh
AND
Mmiddle
0 AND 0.47
0
S
3
Rule 3
Mhigh
AND
Mfar
0 AND 0.2
0
L
4
Rule 4
Mmiddle
AND
Mnear
0.25 AND 0
0
S
5
Rule 5
Mmiddle
AND
Mmiddle
0.25 AND 0.47
0.25
L
6
Rule 6
Mmiddle
AND
Mfar
0.25 AND 0.2
0.2
N
7
Rule 7
Mlow
AND
Mnear
0.67 AND 0
0
L
8
Rule 8
Mlow
AND
Mmiddle
0.67 AND 0.47
0.47
N
9
Rule 9
Mlow
AND
Mfar
0.67 AND 0.2
0.2
N
Note : Out are S, L and N from rule (look up table)

No
Rule
Sp Op Ob
Result
Out
Res*Out
1
Rule 1
0 AND 0
0
S
0*80 = 0
2
Rule 2
0 AND 0.47
0
S
0*80 = 0
3
Rule 3
0 AND 0.2
0
L
0*40 = 0
4
Rule 4
0.25 AND 0
0
S
0*80 = 0
5
Rule 5
0.25 AND 0.47
0.25
L
0.25*40 = 10
6
Rule 6
0.25 AND 0.2
0.2
N
0.2*0 = 0
7
Rule 7
0.67 AND 0
0
L
0*40 = 0
8
Rule 8
0.67 AND 0.47
0.47
N
0.47*0 = 0
9
Rule 9
0.67 AND 0.2
0.2
N
0.2*0 = 0

From Fuzzy Logic controller above is determined for pressure is


Comments