# Examples (sct)

Last modified by Alexander Schulz-Rosengarten on 2023/09/11 16:17
Export
Office Formats
Export as PDF Export as ODT Export as RTF
Other Formats

Select the pages to export:

select all/ none

Legend:
  Created Page
  Modified Extension Page
  Clean Extension Page

Export as HTML

Command Line Compiler Quick Start Guide (pre 0.13)

# SCCharts Examples

A few SCCharts examples...

Example |  | SCChart (Graphical) | SCChart (Textual SCT)
--- | --- | --- | ---
# ABO |  |  | ABO.sct @VHLayout scchart ABO { input output bool A; input output bool B; output bool O1; output bool O2; region: initial state Init --> WaitAB immediate with / O1 = false; O2 = false; state WaitAB { region HandleA: initial state WaitA --> DoneA immediate with A / B = true; O1 = true; final state DoneA; region HandleB: initial state WaitB --> DoneB with B / O1 = true; final state DoneB; } >-> GotAB with / O1 = false; O2 = true; state GotAB; }
# clock (Referenced SCCharts Example) To enable the referenced SCCharts feature, activate the Xtext nature for your project! |  |  | shifter3.sct scchart delay { input int ticksToWait; input bool clock; int counter = 0; initial state init --> done immediate with counter >= ticksToWait --> init with clock / counter = counter + 1; final state done; } shifter3.sct scchart emitter { input bool clock; input bool delay; output bool emit = false; initial state wait references delay bind clock to clock, ticksToWait to delay >-> emit; state emit { entry / emit = true; exit / emit = false; } --> wait; } shifter3.sct scchart clock { input bool msClock; output bool second; output bool minute; output bool hour; const int SEC = 1000; const int MIN = 60; const int HOUR = 60; region seconds: initial state seconds references emitter bind clock to msClock, metrum to SEC, emit to second >-> seconds; region minutes: initial state minutes references emitter bind clock to second, metrum to MIN, emit to minute >-> minutes; region hours: initial state hours references emitter bind clock to minute, metrum to HOUR, emit to hour >-> hours; }

# SCCharts Evaluation Examples

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 and known limitations. You may use our online compiler or the 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 for rendering SCCharts diagrams from textual SCCharts descriptions.

Example |  | SCChart (Graphical) | SCChart (Textual SCT)
--- | --- | --- | ---
# shifter3 |  |  | shifter3.sct scchart shifter3 { input signal int I = 1; signal int S0; signal int S1; output signal int O; region R1: initial state I2 --> I2 with pre(S0) / S1(pre(val(S0))); region R0: initial state I1 --> I1 with pre(I) / S0(pre(val(I))); region R2: initial state I3 --> I3 with pre(S1) / O(pre(val(S1))); }
# reincarnation |  |  | reincarnation.sct scchart reincarnation { input signal A; output signal gotS; region R0: initial state Reincarnation { signal S; region R0: initial state I --> C1 immediate; state p; final state r; state q --> r with A / S; state C1 --> p immediate with S / gotS --> q immediate; } >-> Reincarnation; }
# cabin |  |  | cabin.sct scchart Cabin { input signal Stop; input signal CabinStopped; input signal DoorIsOpen; input signal DoorOpen; input signal DoorSensor; input signal DoorIsClosed; input signal DoorClose; input signal TimerExpired; output signal StartOK; output signal OpenDoorMotorOff; output signal OpenDoorMotorOn; output signal StartTimer; output signal CloseDoorMotorOn; output signal CloseDoorMotorOff; region R0: initial state I --> Open immediate with / OpenDoorMotorOn; state Open --> S0 with DoorIsOpen / OpenDoorMotorOff; state S0 { region R0: initial state Initial --> S0 immediate with / StartTimer; state S0 --> S1 with TimerExpired | DoorClose / CloseDoorMotorOn; state S1 --> S2 with DoorIsClosed / StartOK; final state S2; } o-> I with DoorOpen | DoorSensor / CloseDoorMotorOff >-> S1 with / CloseDoorMotorOff; state S1 --> S2 with Stop; state S2 --> I with CabinStopped; }
# reactor control |  |  | reactor-control.sct scchart Module_ReactorControl { output signal PullOutRods; output signal PushInRods; input signal Start; input signal OverHeated; input signal CooledDown; signal unsafe; region main: initial state init0 "I" --> ParallelStatementList40state immediate; state ParallelStatementList40state { region R0: initial state init1 "I" --> Await43state immediate; state Await43state { region R0: initial state init2 "I" --> S18 immediate; state S18 "18" --> S23 with Start / PullOutRods; state S23 "23"; } o-> Await43state with unsafe; region R1: initial state init3 "I" --> S94 immediate; state S94 "94" --> S134 immediate with unsafe / PushInRods; state S134 "134" --> S94 with !unsafe; region R2: initial state init4 "I" --> S193 immediate; state S193 "193" --> Sustain68state immediate with OverHeated; state Sustain68state { region R0: initial state init5 "I" --> S227 immediate with / unsafe; state S227 "227" --> S227 with / unsafe; } o-> S193 with CooledDown; }; }

Tags:
Created by cmot on 2014/06/28 11:21

- Comments (0)
- Attachments (4)
- History
- Information

# Quick Links

KIELER on GitHub
RTSYS Homepage

XWiki 14.4.7