Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

SCCharts Examples

A few SCCharts examples...

Example SCChart  (Graphical)SCChart (Textual SCT)

clock

(Referenced SCCharts Example)

To enable the referenced SCCharts feature,

activate the Xtext nature for your project!

 

Image Added

Image Added

Image Added

Code Block
languagesct
titleshifter3.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;
}
Code Block
languagesct
titleshifter3.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;  
}
Code Block
languagesct
titleshifter3.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.

...