index.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <!doctype html>
  2. <title>CodeMirror: FCL mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <link rel="stylesheet" href="../../theme/elegant.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="../../addon/edit/matchbrackets.js"></script>
  9. <script src="fcl.js"></script>
  10. <style>.CodeMirror {border:1px solid #999; background:#ffc}</style>
  11. <div id=nav>
  12. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  13. <ul>
  14. <li><a href="../../index.html">Home</a>
  15. <li><a href="../../doc/manual.html">Manual</a>
  16. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  17. </ul>
  18. <ul>
  19. <li><a href="../index.html">Language modes</a>
  20. <li><a class=active href="#">FCL</a>
  21. </ul>
  22. </div>
  23. <article>
  24. <h2>FCL mode</h2>
  25. <form><textarea id="code" name="code">
  26. FUNCTION_BLOCK Fuzzy_FB
  27. VAR_INPUT
  28. TimeDay : REAL; (* RANGE(0 .. 23) *)
  29. ApplicateHost: REAL;
  30. TimeConfiguration: REAL;
  31. TimeRequirements: REAL;
  32. END_VAR
  33. VAR_OUTPUT
  34. ProbabilityDistribution: REAL;
  35. ProbabilityAccess: REAL;
  36. END_VAR
  37. FUZZIFY TimeDay
  38. TERM inside := (0, 0) (8, 1) (22,0);
  39. TERM outside := (0, 1) (8, 0) (22, 1);
  40. END_FUZZIFY
  41. FUZZIFY ApplicateHost
  42. TERM few := (0, 1) (100, 0) (200, 0);
  43. TERM many := (0, 0) (100, 0) (200, 1);
  44. END_FUZZIFY
  45. FUZZIFY TimeConfiguration
  46. TERM recently := (0, 1) (30, 1) (120, 0);
  47. TERM long := (0, 0) (30, 0) (120, 1);
  48. END_FUZZIFY
  49. FUZZIFY TimeRequirements
  50. TERM recently := (0, 1) (30, 1) (365, 0);
  51. TERM long := (0, 0) (30, 0) (365, 1);
  52. END_FUZZIFY
  53. DEFUZZIFY ProbabilityAccess
  54. TERM hight := 1;
  55. TERM medium := 0.5;
  56. TERM low := 0;
  57. ACCU: MAX;
  58. METHOD: COGS;
  59. DEFAULT := 0;
  60. END_DEFUZZIFY
  61. DEFUZZIFY ProbabilityDistribution
  62. TERM hight := 1;
  63. TERM medium := 0.5;
  64. TERM low := 0;
  65. ACCU: MAX;
  66. METHOD: COGS;
  67. DEFAULT := 0;
  68. END_DEFUZZIFY
  69. RULEBLOCK No1
  70. AND : MIN;
  71. RULE 1 : IF TimeDay IS outside AND ApplicateHost IS few THEN ProbabilityAccess IS hight;
  72. RULE 2 : IF ApplicateHost IS many THEN ProbabilityAccess IS hight;
  73. RULE 3 : IF TimeDay IS inside AND ApplicateHost IS few THEN ProbabilityAccess IS low;
  74. END_RULEBLOCK
  75. RULEBLOCK No2
  76. AND : MIN;
  77. RULE 1 : IF ApplicateHost IS many THEN ProbabilityDistribution IS hight;
  78. END_RULEBLOCK
  79. END_FUNCTION_BLOCK
  80. </textarea></form>
  81. <script>
  82. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  83. theme: "elegant",
  84. matchBrackets: true,
  85. indentUnit: 8,
  86. tabSize: 8,
  87. indentWithTabs: true,
  88. mode: "text/x-fcl"
  89. });
  90. </script>
  91. <p><strong>MIME type:</strong> <code>text/x-fcl</code></p>
  92. </article>