Simulation of Single Server Queuing System

In simulating real world systems on computer like a Single channel queue consisting of a single server for serving the
queue of customers.so we have its following simulation programme  using java:


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package singleserver;

import java.util.Random;

/**
*
* @author Hizbul Bahar
*/
public class SingleServer {
static int Queue_size = 32000;
static int next_event_type;
static int num_custs_delayed;
static int num_events=2;
static int num_in_q;
static int server_status;
static int num_delays_required;
static double area_num_in_q;
static double area_server_status;
static double sim_time;
static double time_last_event;
static double total_of_delays;
static double mean_interarrival;
static double mean_service;

static double[] time_arrival = new double[Queue_size];
static double[] time_next_event=new double[3];

static Random random = new Random(10000);

static void initialize()
{
sim_time = 0;

server_status = 0;
num_in_q = 0;
time_last_event = 0;

num_custs_delayed = 0;
total_of_delays = 0;
area_num_in_q = 0;
area_server_status = 0;

time_next_event[1] = sim_time + expon(mean_interarrival);
time_next_event[2] = 1.0e+30;
}

static void timing()
{

if (time_next_event[1] < time_next_event[2])
next_event_type = 1;
else
next_event_type = 2;

sim_time = time_next_event[next_event_type];
}

static void arrive()
{
double delay;

time_next_event[1] = sim_time + expon(mean_interarrival);

if (server_status == 1)
{
num_in_q++;
time_arrival[num_in_q] = sim_time;
}

else
{
delay = 0;
total_of_delays += delay;

num_custs_delayed++;
server_status = 1;

time_next_event[2] = sim_time + expon(mean_service);
}
}

static void depart()
{
if (num_in_q == 0)
{
server_status = 0;
time_next_event[2] = 1.0e+30;
}
else
{
num_in_q--;

num_custs_delayed++;
time_next_event[2] = sim_time + expon(mean_service);

for (int i = 1; i <= num_in_q; i++)
time_arrival[i] = time_arrival[i+1];
}
}

static void report()
{
System.out.println( "TOtal customer uses this server " + num_custs_delayed + "\n");
System.out.println( "Average delay in queue minutes  " + total_of_delays / num_custs_delayed + "\n");
System.out.println( "Average number in queue  " + area_num_in_q / sim_time + "\n");
System.out.println( "Server utilization  " + area_server_status / sim_time + "\n");
}

static void update_time_avg_stats()
{
double time_since_last_event;

time_since_last_event = sim_time - time_last_event;
time_last_event = sim_time;

area_num_in_q += num_in_q * time_since_last_event;

area_server_status += server_status * time_since_last_event;
}

static double expon(double  mean)
{
return -mean * Math.log(random.nextDouble());
}

public static void main(String[] args) {

timing();
update_time_avg_stats();

switch (next_event_type)
{
case 1: arrive();
break;
case 2: depart();
}
}
}

To get complete java project you may knock me through email, mobile or commented below as your requirement.

Advertisements

Software Engineer at The Jaxara IT Ltd , Dhaka , Bangladesh

Tagged with: , ,
Posted in JAVA
35 comments on “Simulation of Single Server Queuing System
  1. Azhar says:

    can I get those source code

  2. Otman says:

    hello sir great work can you send me the source code please i shall learn from this a lot

  3. Sam says:

    the source code should be very helpful.. can you email it to me
    Cheers

  4. motijola says:

    Hello sir, please can I get the source code too. Need it for an assignment I’m working on.

  5. all is well says:

    could i get the complete source code,need for an assignment.

  6. Melvin Odalson says:

    cheers Bro, could you send the complete source code please.need it for an assignment.

  7. all is well says:

    can you please help me out as soon as possible??? please please please please….i beg!!!!1

  8. james says:

    pls send me the source code for submitting assignment

  9. james says:

    pls i beg you!!!!

  10. Bassel says:

    plz send me the project

  11. Marques M says:

    please send me the source code to macmarq88@aol.com

  12. Ezwan Faeez says:

    Hi,My name is Ezwan. Im currently study and my assignment is to have a queueing system in the bank and by using identification card,it can be swapped if the customer already offline the system.i wonder if you have a queueing system in php instead of java..that will be great. My email is ezwanfaeez@gmail.com

  13. akansha says:

    sir please send the java code for single channel queueing model as soon as possible at akanshab.b17@gmail.com

  14. Ayubu says:

    Please send me an email with the source code at: anapapaa@yahoo.com

  15. Carla says:

    Can I get the complete source code too.

  16. maria says:

    sir can u please give me code?

  17. maria says:

    pleaseee give me code

  18. Proaye says:

    Thanks for sharing. Can you please send me the complete code for my study? It would be much more appreciated . Thanks

    Email : proayeassymessi@gmail.com

  19. Thanks for sharing these useful application, can you please send me the full code? I really need this as an example to complete my task. Thank you very much

    Email: 0109672@kdu-online.com

  20. lim lim says:

    Hi, can i have the complete codes for both the single and multiple server for a project that I’m working on? Thanks in advance. liml13112@gmail.com

  21. santoshi says:

    Hi, can you please send me the full code and other simulation programs also..

    my mail id is santoshik29@gmail.com

  22. shaheema beegum p.v says:

    the source code should be very helpful.. can you email it to me

  23. SOHAM MHATRE says:

    anyone got reply from him?

  24. SOHAM MHATRE says:

    full code please

  25. Iven says:

    Can i get complete code?

  26. can u please send me a full project to my email Tikkhamfongnoy@yahoo.com ?

  27. Razib Hasan says:

    hlw sir…
    I need the complete project…
    can u please sand me to my email..
    razibhasan67@gmail.com

  28. irhami d says:

    Can i have the code completely ??
    thanks before
    irhami.drive@gmail.com

  29. Rabby says:

    Source code please.
    tariqul2h2@gmail.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: