| ... |
... |
@@ -2,6 +2,110 @@ |
| 2 |
2 |
|
| 3 |
3 |
= SCCharts Examples = |
| 4 |
4 |
|
|
5 |
+A few SCCharts examples... |
|
6 |
+ |
|
7 |
+|=((( |
|
8 |
+Example |
|
9 |
+)))|=((( |
|
10 |
+ |
|
11 |
+)))|=((( |
|
12 |
+SCChart (Graphical) |
|
13 |
+)))|=(% colspan="1" %)(% colspan="1" %) |
|
14 |
+((( |
|
15 |
+SCChart (Textual SCT) |
|
16 |
+))) |
|
17 |
+|(% colspan="1" %)(% colspan="1" %) |
|
18 |
+((( |
|
19 |
+= clock = |
|
20 |
+ |
|
21 |
+(Referenced SCCharts Example) |
|
22 |
+ |
|
23 |
+**To enable the referenced SCCharts feature,** |
|
24 |
+ |
|
25 |
+**activate the Xtext nature for your project!** |
|
26 |
+)))|(% colspan="1" %)(% colspan="1" %) |
|
27 |
+((( |
|
28 |
+ |
|
29 |
+)))|(% colspan="1" %)(% colspan="1" %) |
|
30 |
+((( |
|
31 |
+[[image:attach:delay.png]] |
|
32 |
+ |
|
33 |
+[[image:attach:emitter.png]] |
|
34 |
+ |
|
35 |
+[[image:attach:clock2h.png]] |
|
36 |
+)))|(% colspan="1" %)(% colspan="1" %) |
|
37 |
+((( |
|
38 |
+{{code title="shifter3.sct" language="sct"}} |
|
39 |
+scchart delay { |
|
40 |
+ input int ticksToWait; |
|
41 |
+ input bool clock; |
|
42 |
+ int counter = 0; |
|
43 |
+ initial state init |
|
44 |
+ --> done immediate with |
|
45 |
+ counter >= ticksToWait |
|
46 |
+ --> init with |
|
47 |
+ clock / counter = counter + 1; |
|
48 |
+ final state done; |
|
49 |
+} |
|
50 |
+{{/code}} |
|
51 |
+ |
|
52 |
+{{code title="shifter3.sct" language="sct"}} |
|
53 |
+scchart emitter { |
|
54 |
+ input bool clock; |
|
55 |
+ input bool delay; |
|
56 |
+ output bool emit = false; |
|
57 |
+ initial state wait |
|
58 |
+ references delay |
|
59 |
+ bind clock to clock, |
|
60 |
+ ticksToWait to delay |
|
61 |
+ >-> emit; |
|
62 |
+ |
|
63 |
+ state emit { |
|
64 |
+ entry / emit = true; |
|
65 |
+ exit / emit = false; |
|
66 |
+ } |
|
67 |
+ --> wait; |
|
68 |
+} |
|
69 |
+{{/code}} |
|
70 |
+ |
|
71 |
+{{code title="shifter3.sct" language="sct"}} |
|
72 |
+scchart clock { |
|
73 |
+ input bool msClock; |
|
74 |
+ output bool second; |
|
75 |
+ output bool minute; |
|
76 |
+ output bool hour; |
|
77 |
+ const int SEC = 1000; |
|
78 |
+ const int MIN = 60; |
|
79 |
+ const int HOUR = 60; |
|
80 |
+ region seconds: |
|
81 |
+ initial state seconds |
|
82 |
+ references emitter |
|
83 |
+ bind clock to msClock, |
|
84 |
+ metrum to SEC, |
|
85 |
+ emit to second |
|
86 |
+ >-> seconds; |
|
87 |
+ |
|
88 |
+ region minutes: |
|
89 |
+ initial state minutes |
|
90 |
+ references emitter |
|
91 |
+ bind clock to second, |
|
92 |
+ metrum to MIN, |
|
93 |
+ emit to minute |
|
94 |
+ >-> minutes; |
|
95 |
+ |
|
96 |
+ region hours: |
|
97 |
+ initial state hours |
|
98 |
+ references emitter |
|
99 |
+ bind clock to minute, |
|
100 |
+ metrum to HOUR, |
|
101 |
+ emit to hour |
|
102 |
+ >-> hours; |
|
103 |
+} |
|
104 |
+{{/code}} |
|
105 |
+))) |
|
106 |
+ |
|
107 |
+= SCCharts Evaluation Examples = |
|
108 |
+ |
| 5 |
5 |
In the following, you find some examples used for evaluation. Be advised that there currently is no tool integrated evaluation possible. Please refer to the SCCharts superpage for the [[project status>>doc:SCCharts]] and [[known limitations>>doc:SCCharts]]. You may use our [[online compiler>>doc:Online Compiler]] or the [[command line compiler >>doc:Command Line Compiler]]to play around with the following SCCharts. On the right side you'll find the textual SCChart (SCT) description, on the left side you see the equivalent synthesized SCChart diagram for it. You can use our [[online SCChart synthesis>>doc:Command Line Rendering]] for rendering SCCharts diagrams from textual SCCharts descriptions. |
| 6 |
6 |
|
| 7 |
7 |
|=((( |
| ... |
... |
@@ -25,7 +25,7 @@ |
| 25 |
25 |
[[image:attach:PLDI'14 Artifact on SCCharts@shifter3.png]] |
| 26 |
26 |
)))|(% colspan="1" %)(% colspan="1" %) |
| 27 |
27 |
((( |
| 28 |
|
-{{code title="shifter3.sct"}} |
|
132 |
+{{code title="shifter3.sct" language="sct"}} |
| 29 |
29 |
scchart shifter3 { |
| 30 |
30 |
input signal int I = 1; |
| 31 |
31 |
signal int S0; |
| ... |
... |
@@ -51,7 +51,7 @@ |
| 51 |
51 |
[[image:attach:PLDI'14 Artifact on SCCharts@reincarnation.png]] |
| 52 |
52 |
)))|(% colspan="1" %)(% colspan="1" %) |
| 53 |
53 |
((( |
| 54 |
|
-{{code title="reincarnation.sct"}} |
|
158 |
+{{code title="reincarnation.sct" language="sct"}} |
| 55 |
55 |
scchart reincarnation { |
| 56 |
56 |
input signal A; |
| 57 |
57 |
output signal gotS; |
| ... |
... |
@@ -81,7 +81,7 @@ |
| 81 |
81 |
[[image:attach:PLDI'14 Artifact on SCCharts@cabin.png]] |
| 82 |
82 |
)))|(% colspan="1" %)(% colspan="1" %) |
| 83 |
83 |
((( |
| 84 |
|
-{{code title="cabin.sct"}} |
|
188 |
+{{code title="cabin.sct" language="sct"}} |
| 85 |
85 |
scchart Cabin { |
| 86 |
86 |
input signal Stop; |
| 87 |
87 |
input signal CabinStopped; |
| ... |
... |
@@ -129,7 +129,7 @@ |
| 129 |
129 |
[[image:attach:PLDI'14 Artifact on SCCharts@reactor-control.png]] |
| 130 |
130 |
)))|(% colspan="1" %)(% colspan="1" %) |
| 131 |
131 |
((( |
| 132 |
|
-{{code title="reactor-control.sct"}} |
|
236 |
+{{code title="reactor-control.sct" language="sct"}} |
| 133 |
133 |
scchart Module_ReactorControl { |
| 134 |
134 |
output signal PullOutRods; |
| 135 |
135 |
output signal PushInRods; |