home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / windows / c / fuzzgn / example1.doc < prev    next >
Encoding:
Text File  |  1992-09-07  |  2.0 KB  |  81 lines

  1.  
  2. This is the documentation for Sample file EXAMPLE1. 
  3.  
  4. Essentially, EXAMPLE1 is used to show the "temperature input from 
  5. 0 to 100 degrees C" graph, the use of colour to denote membership
  6. functions, and to show the rudiments of Fuzzy Logic as implemented
  7. by FuzzGen.
  8.  
  9. The low end of the graph is shown in RED and represents a 
  10. trapezoidal decision shape; it is named LOW.
  11. The middle ground in VIOLET shows a classic triangular shape. It
  12. is named MEDIUM.
  13. The high end in BLUE shows another trapezoidal shape, and we 
  14. named it HIGH.
  15.  
  16. The Rule set we chose uses the input variable TEMPIN to trigger
  17. output variable OUTSTATE. The code generated by FuzzGen is
  18. designed to look at an input data point (i.e. TEMPIN) and determine 
  19. not only what set contains the highest membership percentage but also
  20. to assign an output state based on this.
  21.  
  22. Rules use plain english syntax:
  23.  
  24. IF...THEN...IS
  25. OR        --------- Logical
  26. AND                      "
  27. NOT                      "
  28.  
  29. For instance, Rule 1 looks to see if the output state (OUTSTATE)
  30. is set to 1, which is the set assigned to LOW. OUTSTATE has a 
  31. number of ordinal pseudo-variables assigned to it as follows:
  32.  
  33. 1 = HIGH HEAT
  34. 2 = NO_CHANGE
  35. 3 = LOW_COOL
  36.  
  37. Construction of simple rules look like this:
  38.  
  39. RULE 1: IF TEMPIN IS LOW THEN OUTSTATE IS HIGH_HEAT
  40.  
  41. Which means --
  42.  
  43. If the input data (TEMPIN) is a member of the LOW set (denoted 
  44. by RED) then the output state is HIGH_HEAT. Essentially, this is
  45. the sort of logic you'd expect to see in a temperature controller,
  46. but it serves to illustrate how Fuzzy Logic works.
  47.  
  48. You'll note that FuzzGen has generated all the code you need except 
  49. for implementation of the RULE set. However, this isn't overly hard
  50. to do:
  51.  
  52. in C:
  53.  
  54. #define HIGH_HEAT 1
  55. #define NO_CHANGE 2
  56. #define LOW_COOL 3
  57.  
  58. If(InputTest(data_that_got_input) == 1) 
  59.    Trigger_Temp_Controller(HIGH_HEAT);
  60.  
  61. This code fragment uses the generated code as an extension of
  62. Fuzzy Rule #1 and applies it to some function called 
  63. "Trigger_Temp_Controller."
  64.  
  65.  
  66.    
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.