     The FuzzyCLIPS  Inverted Pendulum Demonstration

OVERVIEW

This demonstration consists of a simulated inverted pendulum
that is controlled by a fuzzy logic knowledge base.

It is based on a demonstration program written by Michelangelo
Sebastiani called FLIPC.

DESCRIPTION

This is a demonstration of fuzzy logic control using a
stationary inverted pendulum with a variable weight (Bob) and
variable motor strength.  The demonstration is designed for
"hands on" evaluation as to how fuzzy logic works. 

The application window is divided into 10 display areas:


           ---------------------------------------------
           |                                           |
           | ---------  ---------  ------------------- |
           | |       |  |       |  |                 | |
           | |       |  |       |  |                 | |
           | |   4   |  |   1   |  |        2        | |
           | |       |  |       |  |                 | |
           | ---------  ---------  ------------------- |
           |                                           |
           | ---------  ------------------------------ |
           | |       |  |                            | |
           | |       |  |                            | |
           | |  5    |  |                            | |
           | |       |  |            3               | |
           | ---------  |                            | |
           |            |                            | |
           | ---------  |                            | |
           | |       |  |                            | |
           | |       |  ------------------------------ |
           | |       |                                 |
           | |  6    |  ---------- ---------- -------- |
           | |       |  |        | |        | |      | |
           | |       |  |   7    | |   8    | |  9   | |
           | |       |  |        | |        | |      | |
           | ---------  ---------- ---------- -------- |
           |                                           |
           |   * Quit  * Help   Select Displayed Rule  |
           ---------------------------------------------

    1. The top center area shows the pendulum itself.
       - The red bob at the top of the pendulum is the mass.
         The mass can be changed -- see area 8 controls	
       - The blue ball at the bottom of the pendulum is a motor
	 which, when given current, drives the pendulum one way or
         the other. the motor strength can be changed -- see area
         9 controls.

       The other items in the window reflect the status of these
       main features.

       A green rod will come from the left side and 'bop' the 
       pendulum mass when it has reached a stable (balanced) 
       position. This can be controlled (ON or OFF) with a check
       box in area 6.

    2. The top right area shows, in matrix format, the fuzzy logic
       production rules that control the pendulum.  Each element
       in the matrix corresponds to a rule.  For example the
       3rd row, 1st column in the matrix reads:

		 IF Theta is NM and dTheta is Z THEN
		     Current = PM

       When a rule fires in the knowledge base, the matrix
       element corresponding to that rule is highlighted in green.
       If the rule is disabled (controlled by check boxxes in area
       3) the matrix area is set to dark blue. If the rule is
       enabled but is not currently firing is it a light blue.

    3. The area below the pendulum and matrix consists of two main 
       sections: 
          - the rule list and the currently selected rule display.

       Next to each rule there is a check box which when in the "OFF"
       state disables that rule in the knowledge base and the system
       behaves as though the rule does not exist. Setting the check
       box to the "ON" state re-enables the rule.

       The Rule to be graphically displayed is identified as the:

            "Rule Currently Displayed"

       This can be changed by selecting from the pull down list
       labelled "Select Displayed Rule" along the bottom area of
       the window.
       
    4. The top left area is a trace buffer showing the motor
       current as it varies over time.

    5. The area on the left below the current display shows the 
       output from each cycle of inferencing.  The crisp values for
       Theta and dTheta are shown at the top of this area (inputs)
       while the crisp value for the motor current is displayed at
       the bottom of this area (output).
       The middle portion of the window shows the combined fuzzy
       output for all the rules that fired in the knowledge base
       over one cycle.	The final crisp value (for that cycle)
       for motor control is determined by what is called the
       centroid defuzzification technique.  This process computes
       the moment and area for the fuzzy output polygon (shown in
       red in the center of this window) and then divides the
       moment by the area to get a crisp value (shown by a yellow
       vertical line).

    6. The area on the left (and 3rd from the top) has a set of
       check boxes that allow for control of the operation of
       the simulation:

       Stop bopping - when ON this will inhibit the mass (bob) 
           from being 'bopped' by a green bar that comes from
           the left.
       Bump to right - this when selected will give the mass
           a small bump to the right.
       Bump to left - this when selected will give the mass
           a small bump to the left.
       Start Pendulum right - this will pull the pendulum to
           the far right
       Start Pendulum left - this will pull the pendulum to
           the far left
       Stop Bob movement - the mass (bob) can be allowed to
           move up and down making the control of the pendulum
           a little more difficult when the check box is off
           (this is ON by default). Note that by turning On the
           bob movement and then turning it OFF at the right time
           you can control the length of the pendulum.

    7. This area is used to control the speed of the simulation. 
       The simulation can be paused by selecting the 'Freeze
       Pendulum' check box. In this state the simulation stops
       until the check box is turned OFF.
       The simulation can also be operated in a single step mode
       by selecting 'Execution in Step Mode'. A single step can
       be run by selecting the 'Next Step' check box. A single step
       consists of the execution of all of the control rules that
       will fire to provide one control action (ie. determine
       the next control action to apply to the current of the motor).

    8, 9. These 2 areas are used to set the size of the mass and
       the size of the Motor respectively. 

    10. The area along the bottom of the window has 3 components:

       Quit - select this to stop the application
       Help - select this to get this message
       Select displayed Rule - use this pull down list to determine
          which of the rules will be displayed in area 3.



One of the most valuable attributes of fuzzy logic is its
elasticity or rubustness.  This can be demonstrated by selecting and
deselecting the rules to see their effect (check boxes of area 3). 
There are 25 possible two input and one output fuzzy production
rules for this system (11 are used in the demonstration) 
with a single conclusion shown as each position in the matrix.
However, the actual number of rules required to control
an inverted pendulum is about seven. Thus, some of the
production rules can be eliminated.




