mtype = { call_1, call_2, call_3, go_1, go_2, go_3, open, close, up, down} chan floor_buttons = [0] of { mtype }; chan elevator_buttons = [0] of { mtype }; chan commands = [0] of { mtype }; active proctype elevator() { do :: commands ? open -> printf("Elevator: opened doors.\n"); :: commands ? close -> printf("Elevator: closed doors.\n"); :: commands ? up -> printf("Elevator: moved up one floor.\n"); :: commands ? down -> printf("Elevator: moved down one floor.\n"); od } /* Simulates random pushing of call buttons. */ active proctype floor_button_pusher() { do :: floor_buttons ! call_1; :: floor_buttons ! call_2; :: floor_buttons ! call_3; od } /* Simulates random pushing of elevator buttons. */ active proctype elevator_button_pusher() { do :: elevator_buttons ! go_1; :: elevator_buttons ! go_2; :: elevator_buttons ! go_3; od } active proctype controller() { int at = 1; bool closed = true; /* Implement your own elevator controller here! */ }