- Back to Home »
- Nukilan Nurani »
- Wahai AnakBulan Jangan Malas-malas
iWM- 3rd Phase codding
Option Explicit
'Load'
Dim X0, X1, X2, X3 As Integer
Dim load As Single
'Dirt'
Dim Y0, Y1, Y2, Y3 As Integer
Dim dirt As Single
'define r as row and c as column'
Dim r, c, counter As Integer
'variable for FAM Table
Dim minValues(1 To 3, 1 To 3) As Integer
'Variable for dimensional array
Dim minValue(1 To 9) As Double
Dim loaded(1 To 9), dirts(1 To 9) As Double
Dim cvLight, cvMedium, cvHeavy, cvLess_Dirty, cvDirty, cvVery_Dirty As Double
'Variable Declaration for subroutine fuzzy_defuzzyfication
Dim rule(1 To 9) As String
Dim actual_time(1 To 9) As Double
Private Sub Command1_Click()
If Combo1.Text = "" Then
MsgBox "Please choose your 'Load' for your cloth in kg"
Combo1.SetFocus
Exit Sub
End If
If Combo2.Text = "" Then
MsgBox "Please choose your 'Dirt' for your cloth in degree"
Combo2.SetFocus
Exit Sub
End If
'Fuzzification for Load'
Call Fuzzification_Load
'Fuzzification for Dirt'
Call Fuzzification_Dirt
'for call Famtable'
Call FamTable1
'for call defuzzyfication
Call Fuzzy_defuzzyfication
End Sub
Private Sub Fuzzification_Load()
'define Combo1.Text as Load'
'VALUE FOR MEMBERSHIP FUNCTION GRAPH OF LOAD'
X0 = 4
X1 = 6
X2 = 8
X3 = 10
'Zone 1
If load < cvlight =" 1" cvmedium =" 0" cvheavy =" 0">= X0 And load < cvlight =" (X1" cvmedium =" (load" cvheavy =" 0">= X1 And load < cvlight =" 0" cvmedium =" 1" cvheavy =" 0">= X2 And load < cvlight =" 0" cvmedium =" (X3" cvheavy =" (load" text =" cvLight" text =" cvMedium" text =" cvHeavy">= X3 Then
cvLight = 0
cvMedium = 0
cvHeavy = 1
Text1.Text = cvLight
Text2.Text = cvMedium
Text3.Text = cvHeavy
End If
End Sub
Private Sub Fuzzification_Dirt()
'define Combo2.Text as Dirt'
dirt = Val(Combo2.Text)
'VALUE FOR MEMBERSHIP FUNCTION GRAPH OF DIRT'
Y0 = 20
Y1 = 30
Y2 = 70
Y3 = 80
' Zone 1
If dirt < cvless_dirty =" 1" cvdirty =" 0" cvvery_dirty =" 0">= Y0 And dirt < cvless_dirty =" (Y1" cvdirty =" (dirt" cvvery_dirty =" 0">= Y1 And dirt < cvless_dirty =" 0" cvdirty =" 1" cvvery_dirty =" 0">= Y2 And dirt < cvless_dirty =" 0" cvdirty =" (Y3" cvvery_dirty =" (dirt">= Y3 Then
cvLess_Dirty = 0
cvDirty = 0
cvVery_Dirty = 1
End If
End Sub
Private Sub Command2_Click()
Combo1.Text = ""
Combo2.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Text20.Text = ""
Text21.Text = ""
End Sub
Private Sub FamTable1()
'read from input'
Text7.Text = Text1.Text
Text8.Text = Text2.Text
Text9.Text = Text3.Text
Text10.Text = Text4.Text
Text11.Text = Text5.Text
Text12.Text = Text6.Text
Text7.Text = cvLight
Text8.Text = cvMedium
Text9.Text = cvHeavy
Text10.Text = cvLess_Dirty
Text11.Text = cvDirty
Text12.Text = cvVery_Dirty
'need one array to hold confidence value for Load'
loaded(1) = cvLight
loaded(2) = cvMedium
loaded(3) = cvHeavy
'need one array to hold confidence value for Dirt'
dirts(1) = cvLess_Dirty
dirts(2) = cvDirty
dirts(3) = cvVery_Dirty
'looping to calculate min for row and column'
counter = 0
For r = 1 To 3
For c = 1 To 3
counter = counter + 1
minValues(r, c) = Min(loaded(r), dirts(c))
Next c
Next r
minValue(1) = Min(dirts(1), loaded(1))
minValue(2) = Min(dirts(2), loaded(1))
minValue(3) = Min(dirts(3), loaded(1))
minValue(4) = Min(dirts(1), loaded(2))
minValue(5) = Min(dirts(2), loaded(2))
minValue(6) = Min(dirts(3), loaded(2))
minValue(7) = Min(dirts(1), loaded(3))
minValue(8) = Min(dirts(2), loaded(3))
minValue(9) = Min(dirts(3), loaded(3))
'display min value'
Text13.Text = minValue(1)
Text14.Text = minValue(2)
Text15.Text = minValue(3)
Text16.Text = minValue(4)
Text17.Text = minValue(5)
Text18.Text = minValue(6)
Text19.Text = minValue(7)
Text20.Text = minValue(8)
Text21.Text = minValue(9)
End Sub
Function Min(loaded, dirts)
Min = loaded
If (dirts < min =" dirts" uppercoa =" 0" belowcoa =" 0" z0 =" 20" z1 =" 30" z2 =" 40" z3 =" 50" i =" 1" actual_time1 =" z0" actual_time2 =" z3" actual_time1 =" z1" actual_time2 =" z2" j =" 1" uppercoa =" upperCOA" belowcoa =" belowCOA" crispminval =" upperCOA" text =" crispMinVal">
*** Codding not full..selamat memeningkan kepala dengan codding ni..saya budak baru belajar, kalau salah tolong tunjukkan...
memang confirm pening...
&)*&0_$_(&#^Q*)&GJ B)**)&$>:<@!%*%.....
a'a bersabdu2 pening..
knp kami ndk diajar pun ini koding2 semua.. apa funsinya nya ni kak? blh ka dicopy pg laman web kami?
hmmm..sila2 testing to u too