Parallele_Verteilte_Systeme/mCRL2/TrafficLights/v1/v1_spec.mcrl2

35 lines
929 B
Plaintext
Raw Normal View History

2020-04-25 20:43:47 +02:00
sort
CardinalDirection = struct north | east | south | west;
2020-05-08 19:42:15 +02:00
%-----------------------------------------------------------------------------
2020-04-25 20:43:47 +02:00
sort
Colour = struct red | green | yellow;
2020-05-08 19:42:15 +02:00
%Definition Farbliche Reihenfolge
2020-04-25 20:43:47 +02:00
map
nextColour: Colour -> Colour;
eqn
nextColour(red) = green;
nextColour(green) = yellow;
nextColour(yellow) = red;
2020-05-08 19:42:15 +02:00
%------------------------------------------------------------------------------
2020-04-25 20:43:47 +02:00
act
show : CardinalDirection # Colour;
proc
TrafficLight(direction : CardinalDirection) = TF(direction, red);
TF(direction : CardinalDirection, colour : Colour) =
2020-05-08 19:42:15 +02:00
show(direction, colour) . %zeige aktuellen Zustand
TF(direction, nextColour(colour)) %zum n<>chsten Zustand wechseln
2020-04-25 20:43:47 +02:00
;
2020-05-08 19:42:15 +02:00
%-----------------------------------------------------------------------------
%Initialisation der seperaten Ampeln
2020-04-25 20:43:47 +02:00
init
TrafficLight(north) || TrafficLight(east) || TrafficLight(south) || TrafficLight(west)
;