TOGAI INFRALOGIC INVERTED PENDULUM DEMONSTRATIONS OVERVIEW This diskette contains three demonstration programs which illustrate adaptive and non-adaptive fuzzy control of an inverted pendulum. 1. PENDEMO.EXE was developed using Togai InfraLogic's Fuzzy-C Development System. The intermediate knowledge-base file generated by Togai InfraLogic's Fuzzy Logic CASE tool, TILShell, is DEMO.TIL. The machine-generated C code, created by Togai InfraLogic's Fuzzy-C Development System, is DEMO.C. The fuzzy knowledge base, or FAM matrix, was developed by observing the system and fine tuning. 2. DCLDEMO.EXE uses an adaptive vector quantizer with differential competitive learning (DCL) to adaptively infer the FAM rules from sample data. 3. NEWDEMO.EXE is the inverted pendulum demo with the original FAM matrix replaced by the DCL-estimated matrix. I. PENDEMO In this demo, a fuzzy logic controller balances a stationary inverted pendulum with variable mass, period, and motor strength. The control inputs are the angle away from vertical (Theta) and the change in angle (dTheta). The output is the current that drives the motor. To run the demonstration, type "pendemo". The demo will immediately begin with the default settings. Before proceeding, hit the "?" key and page through the help menus. This will provide an overview of how the demonstration works. The demonstration screen is divided into five display windows as follows: 1. The center window shows the pendulum itself. - The red bob at the top of the pendulum is a user-alterable mass. Pressing F6 increases the mass of the bob; shift-F6 decreases it. - The green shaft separates the bob from the motor. Pressing the F7 key causes the length of the shaft to vary, altering the system non-linearities considerably. - The blue ball at the bottom of the pendulum is a motor which drives the shaft to the left or right. The current supplied to the motor is determined by the fuzzy controller. F5 and shift-F5 increase or decrease the strength of the motor. The other items in the window reflect the status of these main features. 2. The upper right window shows the FAM matrix governing the fuzzy controller. Each element in the matrix represents one fuzzy associative memory or FAM rule. For example, the center element in the matrix reads IF Theta is Z and dTheta is Z THEN Current = Z. If a rule in the knowledge base is firing, the matrix element corresponding to the rule is highlighted in gray. 3. The lower right window consists of two main sections: the rule list and the currently selected rule display. You can scroll through the rule list with the up and down arrows on your PC. Scrolling through the list dynamically sets the highlighted rule in the rule list to be the "current rule". The current rule is then graphically displayed to the right of the rule list. Pressing the F1 key disables the current rule in the knowledge base, preventing it from firing under any circumstances. Pressing F1 again re-enables the rule. 4. The lower left window displays the system from a black-box perspective. The crisp input values, Theta and dTheta, are shown at the top of the window, while the crisp output value, motor current, is displayed at the bottom of the window. The middle portion of the window shows the combined output fuzzy set determined by all of the rules in the knowledge base firing to different degrees. The crisp output value (for that cycle) is the centroid of the combined output fuzzy set. 5. The upper left window is a trace buffer showing the motor current as it varies over time. Each fuzzy control rule relates input fuzzy sets to an output fuzzy set. Hence it is a "fuzzy associative memory" (FAM). Each antecedent in the premise is a fuzzy association which admits a "level of belief". Fuzzy "membership functions" defined for each variable determine the degree to which a "crisp," or numerical, input value belongs to each of five fuzzy-set values: Negative Medium (NM), Negative Small (NS), Zero (Z), Positive Small (PS), and Positive Medium (PM). An antecedent's level of belief is the degree to which the crisp input value belongs to the associated fuzzy-set value. For example, if the crisp value of Theta belongs to the PS fuzzy set to degree 0.8, then the fuzzy association Theta is PS has a 0.8 level of belief. The output "activation" for each FAM rule is the minimum level of belief in the premise (maximum if the antecedents are combined with OR). The output of each rule is a fuzzy set formed by "clipping" the consequent fuzzy set at this activation level. The lower right window shows the antecedents' levels of belief, the output activation, and the resulting clipped output fuzzy set (in red) for the current rule. Output fuzzy sets from all of the enabled FAM rules are combined with a logical OR to form a "combined output fuzzy set," displayed in the lower left window. This combined output fuzzy set is then "defuzzi- fied", or converted to a crisp output value, by taking its centroid. The user can test the robustness of this simple fuzzy controller by disabling one or more FAM rules and noting the effect. Such action distorts or even eliminates sections of the control surface mapping crisp inputs to crisp outputs. II. DCLDEMO This demo blindly estimates the pendulum's FAM matrix from sample data vectors. Crisp values of Theta, dTheta and Current, which appear in the upper left window of PENDEMO, were saved in a trace file called PEND.DAT during trial runs of the original PENDEMO. Each data vector is a point in the three-dimensional product space. An adaptive vector quantizer (AVQ) with differential competitive learning (DCL) adaptively clusters these data vectors to estimate the underlying control surface which generated them. The product space is then partitioned into FAM cells, each one representing a single FAM rule. On the left side of the screen, two-dimensional projections of the data vectors appear as points in the input plane. The color of each point indicates which fuzzy-set value admits the highest level of belief for that vector's crisp output value. Cyan lines partitioning the plane indicate FAM cell boundaries. If the number of data vectors in a cell exceeds a threshold, then the associated FAM rule is entered in the FAM matrix on the right side of the screen. Since points of more than one color often appear within a FAM cell, we sum the consequent fuzzy sets in each cell and employ centroid defuzzification. The consequent fuzzy set for each FAM rule is that output fuzzy-set value with centroid nearest the defuzzified centroid for its cell. After the specified number of samples are processed, the resulting FAM matrix resembles the underlying fuzzy control surface. Like most neural networks, an AVQ's performance is highly data- dependent. Since the AVQ assumes no prior knowledge of the underlying control surface, FAM rules that are seldom used will not appear in the final FAM matrix. Hence, one or more rules may need to be added to the estimated FAM matrix to handle initial boundary conditions. III. NEWDEMO This demo is the same as PENDEMO, except the original FAM matrix has been replaced by the DCL-estimated matrix. FURTHER INFORMATION Please direct any comments, suggestions, or questions to Togai InfraLogic, Inc. 30 Corporate Park, Suite 107 Irvine, CA 92714 Phone: (714) 975-8522 F A X: (714) 975-8524