I want to start small because I'm interested on testing as I go along due to my limited C++ prog. exp.

Perhaps creating the structs or classes together with the main() to see how it will develop. Acquiring exp as I continue.

Should I use classes or structure?

**Here is the description of project:**
Type of events suggested:

person: arrives@bus stop Q.

Action: After random time, another person is sched

to arrive in the Q.

arrival: bus arrives@stop

Action: If (Q==empty)

bus goes to the next stop,

(this creates arrival event.

otherwise, the event generated is

first person in Q boarding the bus;

boarder: person boards the bus

Action: Q_length diminishes by 1; If (Q==empty), bus goes to next stop,

otherwise the next passenger boards the bus

Possible data structure (a balanced tree, or simply a

doubly-linked ring)

(THE INTEREST HERE IS TO SORT THE EVENTS BY TIME)

(HOW TO GO ABOUT

**INITIALIZING** USING)

A dummy event scheduled for time 0

**Exec prog by repeating the following steps:**
until simulated current time exceeds the defined time limit

Take next event from the event structure and update

the current time

Process the event; (generating others)

**HOW-TO:**
CIN >>number of buses, the number of stops, the driving time

between stops, the boarding time, the stop time, and the mean

arrival rate from a file.

START: assuming there are 5 bus stops, 3 buses, the

time between two stops is 5 min, avg arrival rate at each stop is 5 persons/min,

and boarding time is 10 seconds

Start with the buses distributed uniformly along the root

(HOW TO GEN ARRIVAL EVENTS?) and AND AN EVENT THAT PUTS A SINGLE PERSON AT EACH Q.

When the bus arrival event occurs, if the queue is empty,

gen. the arrival at the next bus stop at clock + drive_time.

If the queue is not empty, gen. the boarder event (at clock + boarding_time)

When the boarder event occurs, if the queue is empty

(i.e., the last person boarded), generate the arrival at

the next bus stop at clock + drive_time. If the queue is not

empty, gen. the boarder event (at clock + boarding_time)

At the person event, generate the next person event at the same

stop at clock + (mean_inter-arrival_rate) * random (exponential)

Note: Keep time in float or double (a better way of doing things).

The mean_inter-arrival_rate = 1/ mean_arrival_rate

Thanks very much...

I think you probably need 2 structures

1 for the Bus Stop holding the number of people waiting and which bus stop is next in the route (and could possible hold distence or time to next stop in case the system has to expand to a case where the bus stops are not all 5 minutes apart).

1 for the Bus holding it's current Bus Stop and possibly state (on route to or stopped at). Strangely the bus currently doesn't need to know anything about it's passengers as the problem assumes there is always room for 1 person to get on and therefore doesn't track people getting off.

I do not think you need any data structures for the people.

The Bus Stop can generate all the events

Person Arrived

Bus Arrived, no-one waiting

Bus Arrived, 1 person got on

But where are these events going to?

You problem description is not very clear, it is a bit muddled and you repeat bits. You will find it easier to solve the problem if you get your problem description written down clearly first.