$               This information is provided by the
$                       Aptronix FuzzyNet
$                 http://www.aptronix.com/fuzzynet 
$                  email fuzzynet@aptronix.com 
$               Aptronix may also be reached by phone
$                       at 408-261-1898 or
$                       FAX at 408-490-2729
$
$
$ FILENAME:	motor/motor1.fil
$ DATE: 	12/08/1992
$ UPDATE:	12/14/1992

$ Two inputs, one output, to determine control gain
$ INPUT(S):	Error, Derivative(_of_Error)
$ OUTPUT(S):	Gain

$ FIU HEADER

fiu tvfi (min max) *8;

$ DEFINITION OF INPUT VARIABLE(S)

invar Error " " : -300 () 300 [
	P_Large     (@100, 0,  @200,  1,  @300, 1),
	P_Medium    (@50,  0,  @100,  1,  @200, 0),
	P_Small     (@0,   0,  @50,   1,  @100, 0),
	P_VerySmall (@-3,  0,  @0,    1,  @50,  0),
	N_VerySmall (@-50, 0,  @0,    1,  @3,   0),
	N_Small     (@-100,0,  @-50,  1,  @0,   0),
	N_Medium    (@-200,0,  @-100, 1,  @-50, 0),
	N_Large     (@-300,1,  @-200, 1,  @-100,0)
	]; 

invar Derivative " " : -30 () 30 [
	P_Large     (@10,  0,  @20,  1,  @30, 1),
	P_Medium    (@5,   0,  @10,  1,  @20, 0),
	P_Small     (@0,   0,  @5,   1,  @10, 0),
	P_VerySmall (@-1,  0,  @0,   1,  @5,   0),
	N_VerySmall (@1,   0,  @0,   1,  @-5,  0),
	N_Small     (@0,   0,  @-5,  1,  @-10,0),
	N_Medium    (@-5,  0,  @-10, 1,  @-20,0),
	N_Large     (@-10, 0,  @-20, 1,  @-30,1)
	]; 


$ DEFINITION OF OUTPUT VARIABLE(S)

outvar Gain " " : -2 () 2 * (
	P_Large      = 2.00,      
	P_Medium     = 1.00,
	P_Small      = 0.50,
	P_VerySmall  = 0.25,
	Zero         = 0.00,
	N_VerySmall  = -0.25,
	N_Medium     = -1.00
    );


$ RULES

if Error is N_Large  and Derivative is P_Large     then Gain is P_Medium;
if Error is N_Large  and Derivative is P_Medium    then Gain is P_Medium;
if Error is N_Large  and Derivative is P_Small     then Gain is P_Medium;
if Error is N_Large  and Derivative is P_VerySmall then Gain is P_Medium;
if Error is N_Large  and Derivative is N_VerySmall then Gain is P_Medium;
if Error is N_Large  and Derivative is N_Small     then Gain is P_Medium;
if Error is N_Large  and Derivative is N_Medium    then Gain is P_Small;
if Error is N_Large  and Derivative is N_Large     then Gain is P_Small;

if Error is N_Medium and Derivative is P_Large     then Gain is P_Medium;
if Error is N_Medium and Derivative is P_Medium    then Gain is P_Medium;
if Error is N_Medium and Derivative is P_Small     then Gain is P_Medium;
if Error is N_Medium and Derivative is P_VerySmall then Gain is P_Medium;
if Error is N_Medium and Derivative is N_VerySmall then Gain is P_Medium;
if Error is N_Medium and Derivative is N_Small     then Gain is P_Medium;
if Error is N_Medium and Derivative is N_Medium    then Gain is P_Small;
if Error is N_Medium and Derivative is N_Large     then Gain is Zero;

if Error is N_Small  and Derivative is P_Large     then Gain is P_Medium;
if Error is N_Small  and Derivative is P_Medium    then Gain is P_Medium;
if Error is N_Small  and Derivative is P_Small     then Gain is P_Medium;
if Error is N_Small  and Derivative is P_VerySmall then Gain is P_Medium;
if Error is N_Small  and Derivative is N_VerySmall then Gain is P_Medium;
if Error is N_Small  and Derivative is N_Small     then Gain is P_Small;
if Error is N_Small  and Derivative is N_Medium    then Gain is P_VerySmall;
if Error is N_Small  and Derivative is N_Large     then Gain is N_VerySmall;

if Error is N_VerySmall  and Derivative is P_Large     then Gain is P_Medium;
if Error is N_VerySmall  and Derivative is P_Medium    then Gain is P_Medium;
if Error is N_VerySmall  and Derivative is P_Small     then Gain is P_Medium;
if Error is N_VerySmall  and Derivative is P_VerySmall then Gain is P_Medium;
if Error is N_VerySmall  and Derivative is N_VerySmall then Gain is P_Large;
if Error is N_VerySmall  and Derivative is N_Small     then Gain is P_VerySmall;
if Error is N_VerySmall  and Derivative is N_Medium    then Gain is N_VerySmall;
if Error is N_VerySmall  and Derivative is N_Large     then Gain is N_Medium;

if Error is P_VerySmall  and Derivative is P_Large     then Gain is N_Medium;
if Error is P_VerySmall  and Derivative is P_Medium    then Gain is N_VerySmall;
if Error is P_VerySmall  and Derivative is P_Small     then Gain is P_VerySmall;
if Error is P_VerySmall  and Derivative is P_VerySmall then Gain is P_Large;
if Error is P_VerySmall  and Derivative is N_VerySmall then Gain is P_Medium;
if Error is P_VerySmall  and Derivative is N_Small     then Gain is P_Medium;
if Error is P_VerySmall  and Derivative is N_Medium    then Gain is P_Medium;
if Error is P_VerySmall  and Derivative is N_Large     then Gain is P_Medium;

if Error is P_Small  and Derivative is P_Large     then Gain is N_VerySmall;
if Error is P_Small  and Derivative is P_Medium    then Gain is P_VerySmall;
if Error is P_Small  and Derivative is P_Small     then Gain is P_Small;
if Error is P_Small  and Derivative is P_VerySmall then Gain is P_Medium;
if Error is P_Small  and Derivative is N_VerySmall then Gain is P_Medium;
if Error is P_Small  and Derivative is N_Small     then Gain is P_Medium;
if Error is P_Small  and Derivative is N_Medium    then Gain is P_Medium;
if Error is P_Small  and Derivative is N_Large     then Gain is P_Medium;

if Error is P_Medium  and Derivative is P_Large     then Gain is Zero;
if Error is P_Medium  and Derivative is P_Medium    then Gain is P_Small;
if Error is P_Medium  and Derivative is P_Small     then Gain is P_Medium;
if Error is P_Medium  and Derivative is P_VerySmall then Gain is P_Medium;
if Error is P_Medium  and Derivative is N_VerySmall then Gain is P_Medium;
if Error is P_Medium  and Derivative is N_Small     then Gain is P_Medium;
if Error is P_Medium  and Derivative is N_Medium    then Gain is P_Medium;
if Error is P_Medium  and Derivative is N_Large     then Gain is P_Medium;

if Error is P_Medium  and Derivative is P_Large     then Gain is P_Small;
if Error is P_Medium  and Derivative is P_Medium    then Gain is P_Small;
if Error is P_Medium  and Derivative is P_Small     then Gain is P_Medium;
if Error is P_Medium  and Derivative is P_VerySmall then Gain is P_Medium;
if Error is P_Medium  and Derivative is N_VerySmall then Gain is P_Medium;
if Error is P_Medium  and Derivative is N_Small     then Gain is P_Medium;
if Error is P_Medium  and Derivative is N_Medium    then Gain is P_Medium;
if Error is P_Medium  and Derivative is N_Large     then Gain is P_Medium

end