Anda di halaman 1dari 16

# Simulating Elevators

## So, What is a Simulation?

Simulation is the imitation of some real thing available, state of affairs, or process. The act of simulating something generally entails representing certain key characteristics or behaviours of a selected physical or abstract system.
- Wikipedias definition (Dont worry if you didnt get it! We didnt either :P)

To find something about a real system, you can use a simulation. To simulate is to let things play themselves out and your job is to just stand there and observe whatever you wanted to! Easy enough, Right?

## FOR THE USER, YEAH!!

Simulation is a lazy mans alternative to actually getting into the nitty-gritties of mathematical analysis of a system. Granted that it wont give you an equation for your characteristic of interest, but it sure will give you numbers numbers that you can analyse and make sense of. Its not just the lazy people! Simulations can be used to verify theories too and are in fact used all the time!!

## WHOLE DIFFERENT STORY FOR A PROGRAMMER!

Imitating real life is probably the hardest thing for a programmer to do! (Ironical, right?) I bet every programmer who has attempted to simulate a reasonably complicated system will agree on that. (And, yes. Elevators qualify as reasonably complicated)

## Why the hell would anyone ever want to simulate Elevators?

Could be used by building planners to determine the number of elevators required for a building based on requirements such as the number of floors, flow of people and the waiting time requirements. As an interesting study Intellectual Curiosity

## What we have done

Taken the case of a building with M floors and N elevators. Users arrive at random times at random floors, wanting to go to random floors. (Too random, huh? :P) Two buttons to call an elevator on each floor (Except on the Ground and the top floors) One Up and one Down. Assumed a constant elevator speed and implemented an elevator scheduling algorithm (Our own! Thats what makes this a bit more challenging than other simulations. The simulator also had an algorithm to implement.) We try to play things out based on the input parameters including inter-arrival times, elevator speed, etc..

## What we give you

Just Numbers for you to crunch!
Were sorry to disappoint you but theres not going to fancy, flashy visuals or any elevators actually moving around. If anyone of you is AWESOME in visual designs, please contact one of us immediately!

## BUT THERES A BEAUTY IN THEM AND SO IS A LOT OF INFORMATION

We can customize the simulator for a variety of inputs:
Number of Floors in the building Number of Elevators in the building Number of Successful departures to Simulate Maximum Minimum of the inter-arrival times Speed of the elevator Whether the users can be assumed to know that the UP button is to go up (Youd be surprised to know how many dont! We call this the Sane factor :D)

## BUT THERES A BEAUTY IN THEM AND SO IS A LOT OF INFORMATION

What the Simulator spits back at you:
How long a user had to wait before they could get into an elevator. How long it took for a user to reach their destination Total time taken for N users to get places. Fraction of time an elevator was busy. A raw power factor Power consumed for N users to get places. How much more power a bunch of insane users consume as opposed to the same number of sane users. (The metrics are all averaged of course!)

## Design of the Program

The Simulator follows a complete Object oriented design and has the following objects, both real and abstract interacting with each other

Real Objects
Elevator Customer Elevator System

Abstract Classes
Object Event Task Timer Event Buffer The Simulator

FLOW OF PROGRAM
Simulator The Master of all other Objects Event Buffer

Elevator System

## THE ELEVATOR SCHEDULING ALGORITHM

JOB TO FIND BEST ELEVATOR FOR A TASK A button at a certain floor (say m) is pressed, and the direction of button is also specified (UP or DOWN) The task to reach the floor is given to each and every elevator in the system. This task is inserted into a task list maintained by each elevator, inserted under certain conditions
For example, suppose an elevator is currently at floor 2, and it is performing its task to reach floor 10. Now, a button is pressed at floor 5. The elevator should first go to floor 5 and then floor 10.

## THE ELEVATOR SCHEDULING ALGORITHM

This is kept under consideration when adding tasks to the task list Once this is done, the time calculated to perform this task is calculated for each elevator. The minimum of all these times are taken, and then, this particular task is given to the elevator corresponding to the minimum time.

WORK DISTRIBUTION
Ankush
Broadly responsible for - Algorithmic part of the program and Maintaining the performance metrics.

Nivvedan
Broadly responsible for - Program Design, Class Structures, Flow of Control in the program and other ascpects

Lines of code contributed Approximately 1300 lines of code each. Work distribution was also roughly 50% as we worked together for the better part of the project.