Waiting room sim. program help.
Posted on 2005-02-26
I'm trying to write a simulation with some statistical/metric information. The simulation goes as follow. It's a waiting room simulation. There will be one entrace will ppl wait in line to be seated in a room and en exit door when people to go the doctor's room (enter door and exit door will be at opposite end of this system. The waiting room will have about 10 chairs (two rows of five chairs each). When the ppl waiting in line goes into the waiting room, they look for an empty chair to sit randomly. If there are no empty seats, they will continue to wait until there's an empty seat and sit. Once everyone in line (queue) have all been in the waiting room, sat down, and leave. The system of the simulation ends.
Some of my state variables:
# of people waiting to be serve.
# of seats.
-arrival rate of people entering
-Range of how long ppl sit in seconds.
-Rate at which exit door will allow the people to leave (in seconds).
Each user waiting in line (queue) to find a sit will be assigned a random number (the seat). They will have time associated with them to from entering the door to finding a seat, the time they have seat, and the time from getting off the seat to exit.
Some data I want to keep track of:
1) Time each person spent in the system (waiting in line and seated),
2) # of ppl in entrance and exit queue, number of cars "seated"
3) average time in each queue,
4) average time a car is parked, etc.
I know I can write a queue of nodes. The queue will contain number of people waiting in line to be seated, with nodes containing info. about a user time spent waiting in line, time to get to the seat, time seated, time to leave, and the total time in the system.
- How would I write one when all the seats are full and the user has to wait? ex. "if seats are full, then user time increase. when one seat chair becomes empty, user takes a seat and the time gets recorded, etc, etc"?
Can someone help me with the pseudo-code and ideas on this, and especially help me with how to keep track of the data (1-4)?