Traffic Light
This example demonstrates modeling of a simple Traffic Light state machine. Based on slide no. 3 from lecture presentation.
The most simple example
- no concurrency,
- no forks,
- deterministic,
- no events,
- no time.
Abstract types for state machine modeling
abstract State
abstract StateMachine
Simple traffic Light model with transitions only
abstract TrafficLight_1
final xor TLStates_1 : StateMachine
Scenarios and Properties
assert [ always t1.TLStates_1.on -->> t1.TLStates_1.on.flashing ]
//assert [ always t1.TLStates_1.on -->> t1.TLStates_1.flashing -->> t1.TLStates_1.yellow_on -->> t1.TLStates_1.yellow_off -->> t1.TLStates_1.yellow_on]
The constraint desugars to
[ on && X flashing && X yellow_on && X yellow_off && X yellow_on]