Versions Compared

Key

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

...

[1] R. von Hanxleden, B. Duderstadt, C. Motika, S. Smyth, M. Mendler, J. Aguado, S. Mercer, and O. O’Brien. SCCharts: Sequentially Constructive Statecharts for Safety-Critical Applications. In Proc. ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’14), Edinburgh, UK, June 2014. (pdf)

 

ABRO Example

In the following we will describe the basic elements using the famous ABRO example:

...

  1. In the first line you see how an SCChart is defined using the scchart keyword where the ID of the SCChart will be ABRO. An optional label can be inserted after ABRO using "<LABEL>".
  2. In the next three lines variables are declared, namely, A, B, R and O, where O is initialized with the value false. A, B, and R are inputs which must not be initialized and get there valued from the environment.
  3. An SCChart typically contains concurrent regions which are introduced with the keyword region as shown in Line 6.
  4. Every region must at least have one state, and every region must exactly have one initial state. An initial state ABO is defined for region Main in Line 7.
  5. Every state is terminated by a ; as shown in line 11 for state HandleA.
  6. If you like to specify internal behavior of a state, you can add concurrent regions to a state in { <regions> } as done for state ABO or state WaitAB.
  7. Transitions outgoing from a state must be declared right before a state is terminated with ;. For example a transition from state WA to state DA is declared in Line 11.
  8. Transitions can have triggers and effects which are separated by a dash: <trigger>/<effects>. Multiple sequential effects are separated by a ;. The transition in Line 11 declares just a trigger A (a dash is not necessary in this case), while the transition from line 18 declares only an effect O = true (here the dash is mandatory).
  9. There are three types of transitions: 1. normal/weak abort transitions -->,  2. strong abort transitions o-> and 3. termination/join transitions >->.

 

Detailed SCT Syntax of SCCharts Elements

SCChart, Initial State, State, Transition and Immediate Transition

Column
width50%
Code Block
linenumberstrue
 scchart StateTransition {
  initial state A
  --> B;
  state B
  --> C;
  state C
  --> A immediate;
}
Column
width50%

 

 

Variable

Column
width50%
Code Block
linenumberstrue
scchart Variable {
  int var1;
  bool var2;
  int var3 = 3;
  bool var4 = false;
  input int var5;
  output float var6;
  input output bool var7;
  initial state A
  --> B;
  state B;
}
Column
width50%

 

Transition: Trigger & Effect

Column
width50%
Code Block
linenumberstrue
scchart TriggerEffect {
  input int var1;
  output bool var2;
  initial state A
  --> B with var1 == 3 / var2 = true;
  state B;
}
Column
width50%

 

Super State

Column
width50%
Code Block
linenumberstrue
scchart SuperState {
  initial state A
  --> B;
  state B {
    initial state B1
    --> B2;
    state B2;
  };
}
Column
width50%

 

Super State: Final States & Termination Transition

Column
width50%
Code Block
linenumberstrue
scchart FinalStateTermination {
  initial state A
  --> B;
  state B {
    initial state B1
    --> B2;
    final state B2;
  }
  >-> C;
  state C;
}
Column
width50%

 

Super State: Weak Abort Transition

Column
width50%
Code Block
linenumberstrue
scchart WeakAbort {
  input bool W;
  initial state A
  --> B;
  state B {
    initial state B1
    --> B2;
    state B2;
  }
  --> C with W;
  state C;
}
Column
width50%

 

Super State: Strong Abort Transition

Column
width50%
Code Block
linenumberstrue
scchart StrongAbort {
  input bool S;
  initial state A
  --> B;
  state B {
    initial state B1
    --> B2;
    state B2;
  }
  o-> C with S;
  
  state C;
}
Column
width50%

 

Concurrent Regions (inside a Super State)

Column
width50%
Code Block
linenumberstrue
scchart Regions {
  input bool S;
  initial state A
  --> B;
  state B {
    region Region1 :
    initial state B1
    --> B2;
    state B2; region Region2 :
    initial state B3;
  };
}
Column
width50%

 

Entry Action, During Action, Exit Action

Column
width50%
Code Block
linenumberstrue
scchart Actions {
  input bool var1;
  output bool var2;
  initial state A
  --> B;
  state B {
    entry var1 / var2 = true;
    during var1 / var2 = true;
    immediate during var1 / var2 = true;
    exit var1 / var2 = true;
    initial state B1
    --> B2;
    state B2;
  };
}
Column
width50%

 

Shallow History Transition

Column
width50%
Code Block
linenumberstrue
scchart HistoryShallow {
  input bool var1;
  output bool var2;
  initial state A
  --> B shallow history with var1;
  state B {
    initial state B1
    --> B2;
    state B2;
  }
  --> A with var1;
}
Column
width50%

 

Deep History Transition

Column
width50%
Code Block
linenumberstrue
scchart HistoryDeep {
  input bool var1;
  output bool var2;
  initial state A
  --> B history with var1;
  state B {
    initial state B1
    --> B2;
    state B2;
  }
  --> A with var1;
}
Column
width50%

 

Deferred Transition

Column
width50%
Code Block
linenumberstrue
scchart Deferred {
  input bool var1;
  output bool var2;
  initial state A
  --> B deferred with var1;
  state B {
    entry var1 / var2 = true;
  }
  --> A with var1;
}
Column
width50%

 

Transition with Count Delay

Column
width50%
Code Block
linenumberstrue
scchart CountDelay {
  input bool var1;
  output bool var2;
  initial state A
  --> B with 4 var1;
  state B
  --> A with var1;
}
Column
width50%

 

Array

Column
width50%
Code Block
linenumberstrue
scchart Array {
  int myArray[10][2];
    initial state init
  --> done with myArray[1][0] == 1 / myArray[2][1] = 2;
  final state done;
} 
Column
width50%

 

Signal

Column
width50%
Code Block
linenumberstrue
scchart Signal {
  input signal i;
  output signal o
    initial state init
  --> done with i / o;
  final state done;
}  

...