Wiki source code of Examples

Version 10.1 by cmot on 2014/07/06 23:06

Show last authors
1 [[~[~[image:attach:SCCharts@download.png~]~]>>url:http://rtsys.informatik.uni-kiel.de/confluence/display/KIELER/SCCharts#SCCharts-Downloads||shape="rect"]] [[~[~[image:attach:SCCharts@onlinecompiler.png~]~]>>url:http://www.sccharts.com||shape="rect"]] (% class="confluence-link" %)[[image:attach:Command Line Compiler@commandlinecompiler2.png]][[doc:Command Line Compiler]](%%) [[image:attach:SCCharts@quickstart.png]][[doc:Quick Start Guide]]
2
3 = SCCharts Examples =
4
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
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 = shifter3 =
20 )))|(% colspan="1" %)(% colspan="1" %)
21 (((
22
23 )))|(% colspan="1" %)(% colspan="1" %)
24 (((
25 [[image:attach:PLDI'14 Artifact on SCCharts@shifter3.png]]
26 )))|(% colspan="1" %)(% colspan="1" %)
27 (((
28 {{code title="shifter3.sct"}}
29 scchart shifter3 {
30 input signal int I = 1;
31 signal int S0;
32 signal int S1;
33 output signal int O;
34 region R1:
35 initial state I2
36 --> I2 with pre(S0) / S1(pre(val(S0)));
37 region R0:
38 initial state I1
39 --> I1 with pre(I) / S0(pre(val(I)));
40 region R2:
41 initial state I3
42 --> I3 with pre(S1) / O(pre(val(S1)));
43 }
44 {{/code}}
45 )))
46 |(((
47 = reincarnation =
48 )))|(((
49
50 )))|(((
51 [[image:attach:PLDI'14 Artifact on SCCharts@reincarnation.png]]
52 )))|(% colspan="1" %)(% colspan="1" %)
53 (((
54 {{code title="reincarnation.sct"}}
55 scchart reincarnation {
56 input signal A;
57 output signal gotS;
58 region R0:
59 initial state Reincarnation {
60 signal S;
61 region R0:
62 initial state I
63 --> C1 immediate;
64 state p;
65 final state r;
66 state q
67 --> r with A / S;
68 state C1
69 --> p immediate with S / gotS
70 --> q immediate;
71 }
72 >-> Reincarnation;
73 }
74 {{/code}}
75 )))
76 |(((
77 = cabin =
78 )))|(((
79
80 )))|(((
81 [[image:attach:PLDI'14 Artifact on SCCharts@cabin.png]]
82 )))|(% colspan="1" %)(% colspan="1" %)
83 (((
84 {{code title="cabin.sct"}}
85 scchart Cabin {
86 input signal Stop;
87 input signal CabinStopped;
88 input signal DoorIsOpen;
89 input signal DoorOpen;
90 input signal DoorSensor;
91 input signal DoorIsClosed;
92 input signal DoorClose;
93 input signal TimerExpired;
94 output signal StartOK;
95 output signal OpenDoorMotorOff;
96 output signal OpenDoorMotorOn;
97 output signal StartTimer;
98 output signal CloseDoorMotorOn;
99 output signal CloseDoorMotorOff;
100 region R0:
101 initial state I
102 --> Open immediate with / OpenDoorMotorOn;
103 state Open
104 --> S0 with DoorIsOpen / OpenDoorMotorOff;
105 state S0 {
106 region R0:
107 initial state Initial
108 --> S0 immediate with / StartTimer;
109 state S0
110 --> S1 with TimerExpired | DoorClose / CloseDoorMotorOn;
111 state S1
112 --> S2 with DoorIsClosed / StartOK;
113 final state S2;
114 }
115 o-> I with DoorOpen | DoorSensor / CloseDoorMotorOff
116 >-> S1 with / CloseDoorMotorOff;
117 state S1
118 --> S2 with Stop;
119 state S2
120 --> I with CabinStopped;
121 }
122 {{/code}}
123 )))
124 |(((
125 = reactor control =
126 )))|(((
127
128 )))|(((
129 [[image:attach:PLDI'14 Artifact on SCCharts@reactor-control.png]]
130 )))|(% colspan="1" %)(% colspan="1" %)
131 (((
132 {{code title="reactor-control.sct"}}
133 scchart Module_ReactorControl {
134 output signal PullOutRods;
135 output signal PushInRods;
136 input signal Start;
137 input signal OverHeated;
138 input signal CooledDown;
139 signal unsafe;
140 region main:
141 initial state init0 "I"
142 --> ParallelStatementList40state immediate;
143 state ParallelStatementList40state {
144 region R0:
145 initial state init1 "I"
146 --> Await43state immediate;
147 state Await43state {
148 region R0:
149 initial state init2 "I"
150 --> S18 immediate;
151 state S18 "18"
152 --> S23 with Start / PullOutRods;
153 state S23 "23";
154 }
155 o-> Await43state with unsafe;
156 region R1:
157 initial state init3 "I"
158 --> S94 immediate;
159 state S94 "94"
160 --> S134 immediate with unsafe / PushInRods;
161 state S134 "134"
162 --> S94 with !unsafe;
163 region R2:
164 initial state init4 "I"
165 --> S193 immediate;
166 state S193 "193"
167 --> Sustain68state immediate with OverHeated;
168 state Sustain68state {
169 region R0:
170 initial state init5 "I"
171 --> S227 immediate with / unsafe;
172 state S227 "227"
173 --> S227 with / unsafe;
174 }
175 o-> S193 with CooledDown;
176 };
177 }
178 {{/code}}
179 )))