Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleRelated Publications

Time in SCCharts. Alexander Schulz-Rosengarten and Reinhard von Hanxleden and Frédéric Mallet and Robert de Simone and Julien Deantoni. In Proc. Forum on Specification and Design Languages (FDL ’18), Munich, Germany, September 2018.

Clocks

Clocks can be defined to gain access to real time and specify timed transitions.

This feature requires a dynamic tick environment to work. Then the time in all clocks will be automatically updated and the SCChart will requiest a sleep time such that it will wake up when a timed transition will be enabled.

Various annotations (for the root SCChart) can be used to modify the generated behavior.

Annotation
Effect
@NoSleepPrevents declaration and calculation of sleepT.
@DefaultSleepSets the default sleep time, requested if there is no timed transition for the active state.
@SimulateSleepGenerates code that simulates the dynamic tick environment by assuming that between ticks always the requested sleep time passes.
@IntegerClockTypeSwitches from type float to int for the sleepT and deltaT variables and related calculations.
@ClocksUseSDEnables support for concurrent and hierarchical usage of the clock variable. (experimental)
Code Block
languagesct
linenumberstrue
scchart SimpleTimes {
  clock c
	
  initial state A
  if c >= 5 do c = 0 go to B 
  
  /** Will be reach at time T+5 */
  state B
  if c >= 10 go to C

  /** Will be reach at time T+15 */
  final state C
}


Greedy Bounds

Code Block
languagesct
linenumberstrue
scchart FastAndSlowGreedy {
  region Fast {
    clock x = 0
    
    initial state S ""
    if x >= 333 do x = 0 go to S
    
  }
  region Slow {
    clock x = 0
    
    initial state S ""
    if x >= 999 || x >= 1000 do x = 0 go to S
  }
}


Periodic Regions

Annotation
Effect
@SoftResetPrevents
@HardReset(default)
Code Block
languagesct
linenumberstrue
@DefaultSleep 1000
scchart Motor {
  output bool motorL = false, motorR = false

  region Left {
    @SoftReset
    period 4.2
    
    initial state Off ""
      do motorL = true go to On
    
    state On ""
      do motorL = false go to Off
  }
  
  region Right {
    @SoftReset
    period 1.0
    
    initial state Off ""
      do motorR = true go to On
    
    state On ""
      do motorR = false go to Off
  }
}


Dynamic Ticks

Dynamic Ticks are based on an extended tick environment that provides deltaT and receives sleepT.

The simulation in KIELER supports a dynamic ticks mode to test models using this feature.
In the simulation view switch mode to Dynamic, see screenshot below.

Image Modified

Image Removed