Thread: Simulation

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    42

    Simulation

    I am doing a computer simulation, where I have to simulate cars coming into a car wash. 1 car comes in 4 minutes on an average. On a given day not more that 150 cars come into the wash. How do I simulate this in my program, that is, in a particular minute 1/2/3/4 cars may come in, but the distribution converges to 150 in a way to give an average of around .25 (4 cars in a minute) . Please help.....
    Thankx

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Are you working on a final project for an OOP C++ class? There are several solutions. I recommend that you push the limit and design the program with respect to independent objects including cars and car washing machine(s). A car enters the car wash at random time. Here is a simple design.

    - Given: simulation lasts 30 days; 1 car enters every 1 minute
    - calculate total cars for 30 interval (Poisson distribution)
    - create a queue with X number of cars. In this case, the queue is of type double (time). Each element is the arrival time of each car.
    - There will be at least four threads.
    1) main thread
    2) arrival time generator thread
    3) car generator thread
    4) car wash thread

    I assure you that if you can implement a design similar to the one above that you will be that much closer to gaining experience for real-world applications.

    Kuphryn

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    42

    How do i generate the cars

    I want a little help in the randomization process, that is, the process that generates cars randomly. How do i generate the poisson distribution.
    And yes, this is my OOP semester project.
    Thankx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fork, execv, spawn, or something else?
    By DavidP in forum C++ Programming
    Replies: 8
    Last Post: 01-26-2009, 04:25 PM
  2. Role of c++ in simulation software
    By CChakra in forum C++ Programming
    Replies: 9
    Last Post: 11-18-2008, 02:36 AM
  3. Help with time simulation assignment
    By rakan in forum C++ Programming
    Replies: 3
    Last Post: 10-31-2006, 11:39 AM
  4. Pipeline freeze simulation
    By darklightred in forum C Programming
    Replies: 2
    Last Post: 07-24-2006, 11:57 AM
  5. need some help with basic simulation
    By JOlszewski in forum C Programming
    Replies: 1
    Last Post: 01-25-2006, 10:36 PM