//Fuzzy function to produce optimized power
public double fuzzy()
{
//Fuzzification of variables, distance and angle
if((angle<-60)&&(angle>=-90))
neg_small=0;
else if((angle<-10)&&(angle>=-60))
neg_small=(0.02*angle+1.2);
else if((angle<0)&&(angle>=-10))
neg_small=(-0.1*angle);
else if((angle<=90)&&(angle>=0))
neg_small=0;
if((angle<-60)&&(angle>=-90))
neg_big=1;
else if((angle>=-60)&&(angle<-10))
neg_big=(-0.02*angle-0.2);
else if((angle>=-10)&&(angle<=90))
neg_big=0;
if((distance<5)&&(distance>=-10))
medium=0;
else if((distance<10)&&(distance>=5))
medium=(0.2*distance-1);
else if((distance<22)&&(distance>=10))
medium=((-1/12)*distance+(11/6));
else if((distance<=30)&&(distance>=22))
medium=0;
if((distance<10)&&(distance>=-10))
far=0;
else if((distance<22)&&(distance>=10))
far=((1/12)*distance-(5/6));
else if((distance<=30)&&(distance>=22))
far=1;
//... other if_ then_else clauses for other terms of distance and angle to be
// continued .
//Defuzzification of variable, power
return
System.Math.Round(System.Math.Max(System.Math.Min(pos_small,zerodis),
System.Math.Min(pos_small,close))*neg_medium_pow+System.Math.Max(
System.Math.Min(zero,zerodis),System.Math.Min(zero,close))*zero_pow+System.Math.Max(
System.Math.Max(System.Math.Min(neg_small,close),System.Math.Min(neg_big,medium)),
System.Math.Min(zero,far))*pos_medium_pow+System.Math.Max(System.Math.Min(neg_small,
medium),System.Math.Min(neg_small,far))*pos_high_pow,2);
}
public double fuzzy()
{
//Fuzzification of variables, distance and angle
if((angle<-60)&&(angle>=-90))
neg_small=0;
else if((angle<-10)&&(angle>=-60))
neg_small=(0.02*angle+1.2);
else if((angle<0)&&(angle>=-10))
neg_small=(-0.1*angle);
else if((angle<=90)&&(angle>=0))
neg_small=0;
if((angle<-60)&&(angle>=-90))
neg_big=1;
else if((angle>=-60)&&(angle<-10))
neg_big=(-0.02*angle-0.2);
else if((angle>=-10)&&(angle<=90))
neg_big=0;
if((distance<5)&&(distance>=-10))
medium=0;
else if((distance<10)&&(distance>=5))
medium=(0.2*distance-1);
else if((distance<22)&&(distance>=10))
medium=((-1/12)*distance+(11/6));
else if((distance<=30)&&(distance>=22))
medium=0;
if((distance<10)&&(distance>=-10))
far=0;
else if((distance<22)&&(distance>=10))
far=((1/12)*distance-(5/6));
else if((distance<=30)&&(distance>=22))
far=1;
//... other if_ then_else clauses for other terms of distance and angle to be
// continued .
//Defuzzification of variable, power
return
System.Math.Round(System.Math.Max(System.Math.Min(pos_small,zerodis),
System.Math.Min(pos_small,close))*neg_medium_pow+System.Math.Max(
System.Math.Min(zero,zerodis),System.Math.Min(zero,close))*zero_pow+System.Math.Max(
System.Math.Max(System.Math.Min(neg_small,close),System.Math.Min(neg_big,medium)),
System.Math.Min(zero,far))*pos_medium_pow+System.Math.Max(System.Math.Min(neg_small,
medium),System.Math.Min(neg_small,far))*pos_high_pow,2);
}
No comments:
Post a Comment