scchart rail { input bool second; input bool contact0 , contact1; output int track; initial state super "station controller" { initial state init --> waiting immediate with / track = 60; state waiting --> waiting_to_slowdown immediate with contact0 --> waiting_pause immediate; state waiting_pause --> waiting; state waiting_to_slowdown --> pause1; state pause1 --> slowdown immediate with / track = 20; state slowdown --> slowdown_to_stop immediate with contact1 --> slowdown_pause immediate; state slowdown_pause --> slowdown; state slowdown_to_stop --> pause2; state pause2 --> stop immediate with / track = 0; state stop { int counter; region counter: initial state init --> count immediate with / counter = 0; state count --> done immediate with counter == 5 --> count_check immediate; state count_check --> count_to_count immediate with second --> count_pause immediate; state count_pause --> count; state count_to_count --> count_tick immediate with / counter = counter + 1; state count_tick --> count; final state done; } >-> waiting immediate with / track = 60; }; }