Class MM1Logic
java.lang.Object
jmt.jmarkov.Queues.MM1Logic
- All Implemented Interfaces:
QueueLogic
Contains the algorithm of the queue M/M/1 where lambda represent the arrival of the job
in second and s as service time of the job in the processor.
M/M/1 is the poisson process of arrival and service time.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleCalculates the arrival of the next job.(ms)doubleintReturns the maximum number of the jobs in the queue(only buffer)intReturns the number of the servers.doubleCalculates the service time of the job.(ms)doublegetS()doublegetStatusProbability(int status) Calculates the probability of each status.doubleCalculate the average jobs in the station with respect to lambda and sdoubleCalculates the average response time(R)voidsetLambda(double lambda) setting the value of lambdavoidsetMaxStates(int buffer) Sets the max states.voidsetS(double s) setting the value of sdoubleCalculates the average throughput(X)doubleCalculate the utilizaion of the server with respect to parameters lambda and s
-
Field Details
-
lambda
protected double lambdaarrival rate [job/ms] -
s
protected double sservice time in the processor[ms] -
rnd
random number generator
-
-
Constructor Details
-
MM1Logic
public MM1Logic(double lambda, double s) Initialize the queue- Parameters:
lambda- represent the medium of arrival of Poisson process [job/s]s- represent the medium of the service time of Poisson process [ms]
-
-
Method Details
-
getArrivalTime
Description copied from interface:QueueLogicCalculates the arrival of the next job.(ms)- Specified by:
getArrivalTimein interfaceQueueLogic- Returns:
- interarrival time
- Throws:
NoJobsException- if the operation cannot be completed
-
getRunTime
public double getRunTime()Description copied from interface:QueueLogicCalculates the service time of the job.(ms)- Specified by:
getRunTimein interfaceQueueLogic- Returns:
- service time
-
getStatusProbability
Description copied from interface:QueueLogicCalculates the probability of each status.- Specified by:
getStatusProbabilityin interfaceQueueLogic- Parameters:
status- number of elements in the status- Returns:
- the probability of the status
- Throws:
NonErgodicException- if the operation cannot be completed
-
setLambda
public void setLambda(double lambda) setting the value of lambda- Parameters:
lambda- new value [job/s]
-
setS
public void setS(double s) setting the value of s- Parameters:
s- new value [s]
-
mediaJobs
Calculate the average jobs in the station with respect to lambda and s- Specified by:
mediaJobsin interfaceQueueLogic- Returns:
- number of average jobs in the station
- Throws:
NonErgodicException- queue is not ergodic (U > 1 o U < 0)
-
utilization
Calculate the utilizaion of the server with respect to parameters lambda and s- Specified by:
utilizationin interfaceQueueLogic- Returns:
- utilization
- Throws:
NonErgodicException- queue is not ergodic (U > 1 o U < 0)
-
getMaxStates
public int getMaxStates()Description copied from interface:QueueLogicReturns the maximum number of the jobs in the queue(only buffer)- Specified by:
getMaxStatesin interfaceQueueLogic- Returns:
- 0 if the buffer is ideal(infinite), a positive number, otherwise
-
setMaxStates
public void setMaxStates(int buffer) Sets the max states.- Parameters:
buffer-
-
throughput
Description copied from interface:QueueLogicCalculates the average throughput(X)- Specified by:
throughputin interfaceQueueLogic- Throws:
NonErgodicException
-
responseTime
Description copied from interface:QueueLogicCalculates the average response time(R)- Specified by:
responseTimein interfaceQueueLogic- Throws:
NonErgodicException
-
getLambda
public double getLambda() -
getS
public double getS() -
getNumberServer
public int getNumberServer()Description copied from interface:QueueLogicReturns the number of the servers.- Specified by:
getNumberServerin interfaceQueueLogic
-