/*
 |	CIRCLE.C  -  CubiCalc compiler-generated definitions
 |
 | This file was created by the CubiCalc Runtime Compiler,
 | a product of HyperLogic Corporation.
 |
 |      Source file: C:\TMP\CIRCLE\CIRCLE.CBC
 |    Creation date: 09/01/95 08:51:01
 | CubiCalc Version: V2.0 (Windows)
 |
 |     Numeric Type: Integer (255)
 |     Activation variables excluded
*/



#include <fzopti.h>
#include <fz.h>
#include <fzproto.h>





			/*
			 | rule text
			*/

#if 0
/*

#{
       Rules for "Circle"


       RATIONALE:

       The problem is to drive a car in a circle.
       Abstracted, the problem becomes a one-dimensional
       tracking problem in the plane.  Compare this example
       with the "Dog vs. Cat" scenario, which is a variation
       on the same theme.

       The car will simply steer to the left if it is outside
       the circle, and steer to the right if it is inside.
       The car will circle in a counterclockwise direction.

       The actual rule base is simple:  Generate corrections
       in direct proportion to the error.  No allowance is made
       for large positive errors; the car will probably spin
       aimlessly in that case.


       SYSTEM VARIABLES:
       
       This one-dimensional problem has a single input
       (RangeError), and a single output (SteeringAngle).

       RangeError ranges from -70 to 70 (linear units).
       SteeringAngle ranges from -60 to 60 (degrees).

       Adjectives for the two variables have identical
       characteristics except for scale. 


       ASSUMPTIONS:

       1.      The plane has a rectangular coordinate system.
       2.      The location of the origin is immaterial.
       3.      Positive angles are measured in the clockwise
               direction.
       4.      RangeError is defined as "actual radius" - "desired radius".
       5.      The simulator will produce a positive error signal
               to induce a leftward correction, negative for a
               rightward correction.
       6.      The simulator will ADD the output signal to the
               car's current azimuth to get the new azimuth.

       The assumptions matter since they define the basis
       for interaction with the simulator.  In view of
       assumption 5, both simulator and fuzzy engine must
       agree on the angle convention.


       RULES:

       Rules use three fuzzy sets.  Beyond that, they simply
       track the input data.  The names of the fuzzy sets
       are the same for both variables, but their meanings
       depend on which one they are used with. Activations
       are available through the activation variables.

#}

(Weights[0]) If RangeError is Positive then make SteeringAngle Negative @ Activations[0];

(Weights[1]) If RangeError is NearZero then make SteeringAngle NearZero @ Activations[1];

(Weights[2]) If RangeError is Negative then make SteeringAngle Positive @ Activations[2];

#
#       End of rules for Circle tracking problem
#

*/
#endif
			/*
			 | Rules
			*/

static FZ_OP Circ_Bank0[] = {
	0x17, 0x4e, 0x18, 0x4e, 0x18, 0x4e, 0x06
};

static FZ_COMPIDX Circ_Index0[] = {
	0, 0, 2, 1, 1, 1, 2, 2,
	0, 3, 0
};

static FZ_OP *Circ_Rules[1] = {
	Circ_Bank0
};

static FZ_COMPIDX *Circ_Indices[1] = {
	Circ_Index0
};

static FZ_NUMERIC Circ_Weights[4] = {
	255,
	255,
	255,
	255
};



			/*
			 | Output Intermediates
			*/

static FZ_NUMERIC Circ_Out0Adjs[3] = {
	0, 126, 255
};

static FZ_NUMERIC *Circ_OutAdjs[1] = {
	Circ_Out0Adjs
};

static FZ_COMPIDX Circ_OutAdjCounts[1] = {
	3
};



			/*
			 | Input Adjective Definitions
			*/

static FZ_NUMERIC Circ_In0Adj0[6] = {
	0, 255,
	128, 0,
	255, 0
};

static FZ_NUMERIC Circ_In0Adj1[10] = {
	0, 0,
	100, 0,
	128, 255,
	155, 0,
	255, 0
};

static FZ_NUMERIC Circ_In0Adj2[6] = {
	0, 0,
	128, 0,
	255, 255
};

static FZ_PAIR Circ_In0Adjs[3] = {
	{ 3, Circ_In0Adj0 },
	{ 5, Circ_In0Adj1 },
	{ 3, Circ_In0Adj2 }
};

static FZ_PAIR *Circ_InAdjs[1] = {
	Circ_In0Adjs
};

static FZ_COMPIDX Circ_InAdjCounts[3] = {
	3,
	1,
	3
};



			/*
			 | ROM Parameter Structure
			*/

struct fz_romparm Circ_ROM_Parms = {

	Circ_Rules,
	Circ_Indices,
	Circ_InAdjCounts,
	Circ_OutAdjCounts,
	Circ_Weights,
	Circ_InAdjs,
	Circ_OutAdjs,
	_fzi_rules,
	_fzi_memptl,
	_fzi_respscs,
	0,
	4,
	3,
	0
};

