This is my first post here. Nice to meet you all!
I've read a related question here and am still having issues.
There is a building consisting of 7 storeys (indexed 0-6). Design a system that controls the elevator in this building.
There are navigation buttons in each floor (up / down).
Inside the elevator there are buttons to select the destination. (For simplicity, can I assume that only one destination can be selected)
Seven segment displays indicate the position of the lift. These are present in each floor and inside the elevator.
There are LEDs to indicate the direction of movement of the elevator in each floor. (arrows, I presume?)
There are buttons inside the elevator to control the fan and lights. (Fans and lights are OFF by default . They turn on automatically if the lift is in motion).
What I've done so far :
System #1: Controlling the seven segment display
Let the elevator be in floor 'x'. For the destination selection (say y) from inside the elevator, we use an encoder to obtain the destination floor in binary. We then pass it on to the controller which compares x and y and decides the direction of movement. As it moves, keep updating x and send it to the seven segment displays in each floor and inside the elevator.
System #2: Fans and lights. Default state : OFF. If the destination is selected, turn ON. Switch ON/OFF as per the passenger's choice.
System #3: The movement control unit (This is where I'm having issues):
Since we are modelling the elevator as a finite state machine, I have the following states.
Moving up (UP)
Moving down (DOWN)
The following changes cause state transitions:
1.The elevator is called from one of the floors.
2.The destination has been reached.
3.The destination has been selected.
Case #1: The destination has been selected (y). If y > x (current floor) then UP. else if y
Case #2: The elevator is moving from say, the 3rd floor to the 6th floor. Someone at the 4th floor wants to go down. At the 5th floor, someone wants to go up. The obvious solution, halt at floor 5. go to floor 6 and then go to the 4th floor.
Issue #1: How do I handle the priorities ?
Issue #2: How do I store the information ? (I'm aware of flip-flops and related memory elements. Not sure about the finer implementation details)
Issue #3: How do I encode the states and create the state transition table ? (I'm not able to visualize it.)
PS: Since the question was worded ambiguously, I think it is safe to make some assumptions to simplify the problem.
Help would be greatly appreciated. Thanks in advance.
EDIT 1: For the movement control unit, there are 19 inputs (1 each from floors 0 & 6, 2 each from floors 1-5, 7 from inside the elevator) and 1 output signal to the motor (UP, DOWN).