Translate the structured flowchart into pseudocodes.
ECE206 Homework 3 Elevator Flowchart
A two-story building uses a simple elevator to carry its tenants. A switch is located on each floor to call the elevator: switch on the first floor and switch on the second floor. Two switches are available inside the elevator; one to go to the first floor ( button) and the other to go to the second floor ( button). No other facilities such as emergency stop, “open door”, “close door”, etc. are supported by the elevator. A flowchart for the control of the elevator is attached. Work to do and document to submit in Canvas:
1. Verify that the flowchart is unstructured by identifying the parts of the flowchart that cannot be reduced to a rectangle.
2. Transform the flowchart so that it is structured and maintains the same flow of logic as the unstructured flowchart. (Use Visio to draw the transformed flowchart)
3. Translate the structured flowchart into pseudocodes. Legends for the flowchart:
1. Safely close door: A set of instructions ( not shown) to close the door safely. It will check to see if there is an obstruction (people, luggage, etc. ) at the door way before closing the door. The door will remain open if there is an obstruction. Similar set of instructions for the sliding door have been discussed in class
2. Floor 1 calls: Someone on the first floor calls the elevator; that is, someone pushes the button on the first floor.
3. Floor 2 calls: Someone on the second floor calls the elevator; that is, someone pushes the button on the second floor.
4. 1st button pressed: Someone inside the elevator wants to go to the first floor; that is, someone pushes the button inside the elevator.
5. 2nd button pressed: Someone inside the elevator wants to go to the second floor; that is, someone pushes the button inside the elevator.
STAR T
Door Closed?
Safely close door
Floor 1 calls?
On 1st
Floor?
Set directi on DOWN
Open do or Completely
Set motor off
Set motor
on
Wait 5 sec
On 2nd Floor?
Set Direction
UP
Set motor off
Set motor
on
Wait 5 sec
F
T
T
F
T
F
Open do or Completely
1st button Press ed?
F
T
F
T
Floor 2 calls? T
2nd button Press ed?
F
T
F
Two-Story Building Elevator Flowchart