Wiki source code of Examples

Version 6.1 by cmot on 2014/06/28 12:16

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