Elevator simulation, queue management suggestions

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2007
Posts: 16
Reputation: richasr1 is an unknown quantity at this point 
Solved Threads: 0
richasr1 richasr1 is offline Offline
Newbie Poster

Elevator simulation, queue management suggestions

 
0
  #1
Nov 30th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Elevator simulation, queue management suggestions

 
0
  #2
Nov 30th, 2008
Well.

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
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 16
Reputation: richasr1 is an unknown quantity at this point 
Solved Threads: 0
richasr1 richasr1 is offline Offline
Newbie Poster

Re: Elevator simulation, queue management suggestions

 
0
  #3
Nov 30th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,024
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 300
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Postaholic

Re: Elevator simulation, queue management suggestions

 
0
  #4
Nov 30th, 2008
There is an excellent discussion on an elevator algorithm in D.E.Knuth "The Art of Computer Programming" Vol 1 Fundamental Algorithms.
You may also view a short note on http://en.wikiversity.org/wiki/TAoCP:Algorithms
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C# Forum
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC