Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. FUNCTION_BLOCK pralka
  2.  
  3. VAR_INPUT
  4. dirtness_of_clothes: REAL;
  5. type_of_dirt : REAL;
  6. END_VAR
  7.  
  8. VAR_OUTPUT
  9. wash_time : REAL;
  10. END_VAR
  11.  
  12. FUZZIFY dirtness_of_clothes
  13. TERM Small := (0, 1) (50,0);
  14. TERM Medium := (0, 0) (50, 1) (100,0);
  15. TERM Large := (50, 0) (100,1);
  16. END_FUZZIFY
  17.  
  18. FUZZIFY type_of_dirt
  19. TERM NotGreasy := (0, 1) (50,0);
  20. TERM Medium := (0, 0) (50, 1) (100,0);
  21. TERM Greasy := (50, 0) (100,1);
  22. END_FUZZIFY
  23.  
  24. DEFUZZIFY wash_time
  25. TERM VeryShort := (0,0) (6,1) (12,0);
  26. TERM Short := (7,0) (12,1) (20,0);
  27. TERM Medium := (12,0) (20,1) (40,0);
  28. TERM Long := (15,0) (40,1) (60,0);
  29. TERM VeryLong := (40,0) (60,1);
  30. METHOD : COG;
  31. DEFAULT := 0;
  32. END_DEFUZZIFY
  33.  
  34. RULEBLOCK No1
  35. AND : MIN;
  36. ACT : MIN;
  37. ACCU : MAX;
  38.  
  39. RULE 1 : IF dirtness_of_clothes IS Large AND type_of_dirt IS Greasy THEN wash_time IS VeryLong;
  40. RULE 2 : IF dirtness_of_clothes IS Medium AND type_of_dirt IS Greasy THEN wash_time IS Long;
  41. RULE 3 : IF dirtness_of_clothes IS Small AND type_of_dirt IS Greasy THEN wash_time IS Long;
  42. RULE 4 : IF dirtness_of_clothes IS Large AND type_of_dirt IS Medium THEN wash_time IS Long;
  43. RULE 5 : IF dirtness_of_clothes IS Medium AND type_of_dirt IS Medium THEN wash_time IS Medium;
  44. RULE 6 : IF dirtness_of_clothes IS Small AND type_of_dirt IS Medium THEN wash_time IS Medium;
  45. RULE 7 : IF dirtness_of_clothes IS Large AND type_of_dirt IS NotGreasy THEN wash_time IS Medium;
  46. RULE 8 : IF dirtness_of_clothes IS Medium AND type_of_dirt IS NotGreasy THEN wash_time IS Short;
  47. RULE 9 : IF dirtness_of_clothes IS Small AND type_of_dirt IS NotGreasy THEN wash_time IS VeryShort
  48.  
  49. END_RULEBLOCK
  50.  
  51. END_FUNCTION_BLOCK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement