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