Skip to main content

Elevator system design

Let's first start with the use cases or requirements of the elevator. There are multiple modules/ systems involved in complete elevator system. We will break down the uses cases as per the individual system.

High Level Requirements:

  1. User should able to request the elevator from the floor.
  2. Once elevator reaches the requested floor, User should get in and should able to choose destination floor.
  3. Once destination is chosen by user, elevator should move to destination floor. 
  4. Once elevator reaches destination floor, user leaves elevator.

  • Presses the button on particular floor to request the elevator. 
  • Inside elevator cabin (referred as Cabin here after) user presses the required floor button.
  • Leaves the cabin once elevator reaches particular floor.
  • Floor has ID which indicates which floor it is.
  • Floor has buttons to request the elevator.
  • Floor has a display which indicates current location of the lift.
  • Button get illuminated when pressed indicating the action is performed.
  • Button should stop illuminating once action is complete. 
  • When pressed, button places request for elevator for particular floor.
  • Cabin can move up or down as requested by controller.
  • Cabin has set of buttons which tells user which all floors elevator can go.
  • Cabin has button to close/open door.
  • Cabin has door.
  • Cabin commands door to open.
  • Cabin commands door to close.
  • Cabin has weight limit, which indicate how many passengers it can carry.
  • Door can be opened or closed as requested.
  • Once door is open it closes automatically after certain delay.
Elevator Controller
  • Elevator controller start up or stops the elevator.
  • Elevator controller has status of the elevator.
  • Elevator controller accepts request from floor and cabin buttons.
  • Elevator controller commands cabin to move to particular floor.
  • Elevator controller commands cabin to stop.
  • Elevator controller updates status to each floor.
Elevator Request
  • Stores all elevator requests.
  • Has a scheduling algorithm which decides, which request should be served next.
  • Each request has direction, floor id. 

Elevator Status
  • Cabin State
  • Current floor
  • Directions
Cabin State
  • Moving
  • Idle
  • Under Maintenance
  • Up
  • Down
Now we have got the requirements and also modeled in different artifacts, we can build the UML diagram of the same. 


Popular posts from this blog

How to boot Samsung Galaxy SL( GT-I9003) in recovery mode

** I Will Not responsible for any damage done with use of below mentioned methods. ** Power off your Samsung Galaxy SL (GT- I9003) to start in recovery mode. Once you have power off the phone, press and Hold Volume UP and Home button. Make sure you have hold volume up, don't press in  the middle of the volume buttons.  Now keep pressing these two buttons(VOL UP + HOME) and presspower button for 2-3 seconds. Release only power button, but keep pressing Volume Up + Home Button, until you see the screen shown below. Once you see recovery screen release the Home button else your phone will restart as first selected option will be restart and pressing home will make that happen.

In the recovery mode, volume up & down act as a up scroll and down scroll buttons, by pressing Home button you will be able to click the selected option.

How to flash CWM Recovery to Samsung Galaxy SL( GT-I9003) using Odin

** I Will Not responsible for any damage done with use of below mentioned methods. ** To flash the CWM recovery to your Samsung Galaxy SL you will require to following things in place: Odin  : you can download it from here.CWM Recovery image : you can download it from here. Thanks to XDA-developers. USB driver to connect your phone with computer. Install Samsung Kias so it will install the USB driver. Once you have downloaded above required items and installed the USB driver, reboot you phone to download mode. You can read how to reboot phone in download mode from here. Now connect the phone with USB cable to computer. 
Extract the Odin from the zip file that you have downloaded at some location on your computer and launch the Odin executable by double clicking it. Wait for Odin to detect your phone.You will be able to see it in yellow once detected on odin screen as shown below.
Click the PDA button to select the CWM recovery image. Once you have selected the recovery image, check the od…

Exception handling with RestTemplate

Spring framework offers RestTemplate for consuming RESTful services. Recently I used RestTemplate for consuming one of the third party RESTful service.

RestTemplate offers 'ResponseErrorHandler'; which you can extend to decide which are errors for you and how to handle those error. You can override hasError and handleError methods of ResponseErrorHandler.
In handleError you can throw customException if you want, as outlined in below code.

import org.springframework.http.HttpStatus; import org.springframework.http.client.ClientHttpResponse; import org.springframework.web.client.ResponseErrorHandler; import; public class RestTemplateErrorHandler implements ResponseErrorHandler { @Override public void handleError(ClientHttpResponse response) throws IOException { throw new MyCustomException(response.getStatusText(), response.getStatusCode()); } @Override public boolean hasError(ClientHttpResponse response) throws IOException …