Hi, I am currently working on an elevator simulation in MS Visual C# that will eventually involve at least 2, preferrably 3 elevators running across 5 floors.

There is currently one elevator that will service all floors when a call button is pressed, though adding a 2nd one brings up the problem of which to send.

My form currently includes call buttons for the ground floor and top floor, and up and down buttons for the 1st,2nd and 3rd floors. There are also two timers for the elevator, one to determine the next floor, which it does so by referring to the lift direction and checking a request array. The other timer moves the lift accordingly.

Now obviously, the two elevators can both be at any floor at any time, so handing out requests can depend on a number of variables (lift direction, position and requests).

Hoping someone can help or suggest what direction i can go with this program and if theres any questions just ask I'll provide all the information.

Thankyou in advance

9 Years
Discussion Span
Last Post by ddanbe


Think about what you know about lifts.

Go with the theory of 2 lifts, one you have more than 1 lift the logic is the same you just have more options.

Lifts go 1 of 2 ways. up or down.
A lift at floor 1 told to go up, if someone rings the bell on 3 and the lift is going there or passing there on the way up and the person said "up" on 3.. then it will stop, otherwise if its not due to stop there and the person said down, it wont. The other lift will get the job, or if both are going up, then it will be the first available lift.

Your lift needs states waiting/up/down

Your logic shouldnt be that complex, so, write down in words what your logic choices are, senarios etc

Then you should be ready to code it


thanks for your reply. I have started to go through possible scenarios and can see that, with two lifts i'd have the following situations;

Up calls will need an elevator going up that is below the floor or a free elevator.
If both elevators are above the floor or are going down then the first elevator free will get the job, or if both are free, the nearest will get the job.

Down calls will need an elevator going down that is above the floor or a free elevator.
If both are below the floor or are going up then the first free elevator will get the request, or if both are free, the nearest again will get the job.

Ok hopefully that's what I need to cover and i'm not missing anything.

My problem now is handling all of this within the code, but at least i've got a better idea. If anyone has any suggestions of ways to handle this please let me know.

In the meantime thankyou! i'll report back if theres success

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.