System Design Elevator
All elevator systems have, such as moving up and down, open and close doors, and of course, pick up passengers. The elevator is supposed to be used in a building having floors numbered from 1 to MaxFloor, where the first floor is the lobby. There are car call buttons in the car corresponding to each floor. For every floor except for the top floor and the lobby, there are two hall call buttons for the passengers to call for going up and down. There is only one down hall call button at the top floor and one up hall call button in the lobby. When the car stops at a floor, the doors are opened and the car lantern indicating the current direction the car is going is illuminated so that the passengers can get to know the current moving direction of the car.
Use Case Diagram
System interacts with humans or any program in UML it is term as Actor. Use case models are the behavior of the system or part of the system design which will further help us to design the class in object-oriented system design. Let us list down the behavior of the elevator.
· Process Car Calls: These scenarios includes that the elevator receives car calls from the passengers, turns on or turns off the light of car call buttons, updates the record of car calls stored in system controlling parts, etc.
· Process Hall Calls: Similar to Car Call processing, this use case includes that the elevator receives hall calls from the passengers, turns on or turns off the light of hall call buttons, updates the record of hall calls in system controlling parts, etc.
· Move/Stop the Car: The main function of an elevator, detailed action will include the changing of driving speed, how to make the decision of stop, and driving directions of the car.
· Indicating Moving Direction: The elevator should have this mechanism to let the passengers know the current moving direction of the car such that the passenger might decide whether to enter the car or not.
· Indicating Car Position: Similarly, the elevator should let the passengers know whether his/her destination floor is reached so that the passenger may decide to leave the car.
· Open/Close the Doors: The elevator should be able to open and close the doors for the passengers to get in and out of the car. The functional areas of this use case should also enable the passengers to make door reversals when the doors are closing and the passenger wants to get in the car.
· Trigger Emergency Brake: There is safety mechanism within the car to make sure that an unsafe state is not transiently generated.
Class diagram, one of the most commonly used diagrams in an object-oriented system, models the static design view for a system. Finding class is the central decision in building an object-oriented system. The most popular approach is to find all the nouns in your requirement document. This approach was pioneered by the Russell Abbott in 1983, and popularized by Grady Booch. We do the natural language analysis or the requirement document of the Use case analysis. So, Noun mentioned in the document we usually treat as a class. The below table will explain on the considering noun, verb, adjectives for the class, and their relationship.
Now let’s design the possible list of the noun. For reference we can go to the wikipedia or find the information about the Elevator and list down. Elevator controller
Noun approach is not the end of identifying the class. It also gives some of the unwanted class names or unused. Here like Door, Floor is an unwanted class. Instead open and close is one that can be used as operation.
When you are done with the class diagram the think about the operation performance and design the use case and sequence diagram. We can think of the two use case for the Hall operations. We can discuss few use case .
Use case -1 Call the elevator in hall.
There are the two scenario one is moving the elevator in same direction and another one in opposite directions
Use Case 2 — Process elevator calls:- There are two scenarios for this use case: the passenger enters the car, presses a car call button. The passenger may either want to go to a upper floor or a lower one, depending on the current moving direction of the elevator, the passenger will either get to the destination floor when the elevator passes by it, or when the elevator turns around.
Use Case 3 — Indicate Elevator position :- Whenever the doors are open what is the position close where to move.
Reference :- https://www.cs.cmu.edu/~luluo/Courses/18540PhDreport.pdf