http://www.phaedsys.com/principals/bytecraft/bytecraftdata/bcfuzlogic.pdf
Belgesinden bir örneğin bi kısmı burayı da inceleyebilirsin.Anlamadığın biryer olursa sorabilirsin.İyi çalışmalar..
Example of PID Controller:
Int OldError,SumError;
int process(void);
LINGUISTIC Error TYPE int MIN -90 MAX 90
{
MEMBER LNegative { -90, -90, -20, 0 }
MEMBER normal { -20, 0, 20 }
MEMBER close { -3, 0, 3 }
MEMBER LPositive { 0, 20, 90, 90 }
}
LINGUISTIC DeltaError TYPE int MIN -90 MAX 90
{
MEMBER Negative { -90, -90, -10, 0 }
MEMBER Positive { 0, 10, 90, 90 }
}
LINGUISTIC SumError TYPE int MIN -90 MAX 90
{
MEMBER LNeg { -90, -90, -5, 0 }
MEMBER LPos { 0, 5, 90, 90 }
}
CONSEQUENCE ManVar TYPE int MIN -20 MAX 20 DEFUZZ cg
{
MEMBER LNegative { -18 }
MEMBER SNegative { -6 }
MEMBER SPositive { 6 }
MEMBER LPositive { 18 }
}
FUZZY pid
{
IF Error IS LNegative THEN ManVar IS LPositive
IF Error IS LPositive THEN ManVar IS LNegative
IF Error IS normal AND DeltaError IS Positive
THEN ManVar IS SNegative
IF Error IS normal AND DeltaError IS Negative
THEN ManVar IS SPositive
IF Error IS close AND SumError IS LPos
THEN ManVar IS SNegative
IF Error IS close AND SumError IS LNeg
THEN ManVar IS SPositive
}
void main (void)
{
while(1)
{
OldError = Error;
Error = Setpoint - Process();
DeltaError = Error - OldError;
SumError := SumError + Error;
pid();
}
}