Class MM1Logic

java.lang.Object
jmt.jmarkov.Queues.MM1Logic
All Implemented Interfaces:
QueueLogic
Direct Known Subclasses:
MM1dLogic, MMNdLogic, MMNLogic

public class MM1Logic extends Object implements 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
    Modifier and Type
    Field
    Description
    protected double
    arrival rate [job/ms]
    protected Random
    random number generator
    protected double
    service time in the processor[ms]
  • Constructor Summary

    Constructors
    Constructor
    Description
    MM1Logic(double lambda, double s)
    Initialize the queue
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Calculates the arrival of the next job.(ms)
    double
     
    int
    Returns the maximum number of the jobs in the queue(only buffer)
    int
    Returns the number of the servers.
    double
    Calculates the service time of the job.(ms)
    double
     
    double
    Calculates the probability of each status.
    double
    Calculate the average jobs in the station with respect to lambda and s
    double
    Calculates the average response time(R)
    void
    setLambda(double lambda)
    setting the value of lambda
    void
    setMaxStates(int buffer)
    Sets the max states.
    void
    setS(double s)
    setting the value of s
    double
    Calculates the average throughput(X)
    double
    Calculate the utilizaion of the server with respect to parameters lambda and s

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • lambda

      protected double lambda
      arrival rate [job/ms]
    • s

      protected double s
      service time in the processor[ms]
    • rnd

      protected Random 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

      public double getArrivalTime() throws NoJobsException
      Description copied from interface: QueueLogic
      Calculates the arrival of the next job.(ms)
      Specified by:
      getArrivalTime in interface QueueLogic
      Returns:
      interarrival time
      Throws:
      NoJobsException - if the operation cannot be completed
    • getRunTime

      public double getRunTime()
      Description copied from interface: QueueLogic
      Calculates the service time of the job.(ms)
      Specified by:
      getRunTime in interface QueueLogic
      Returns:
      service time
    • getStatusProbability

      public double getStatusProbability(int status) throws NonErgodicException
      Description copied from interface: QueueLogic
      Calculates the probability of each status.
      Specified by:
      getStatusProbability in interface QueueLogic
      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

      public double mediaJobs() throws NonErgodicException
      Calculate the average jobs in the station with respect to lambda and s
      Specified by:
      mediaJobs in interface QueueLogic
      Returns:
      number of average jobs in the station
      Throws:
      NonErgodicException - queue is not ergodic (U > 1 o U < 0)
    • utilization

      public double utilization() throws NonErgodicException
      Calculate the utilizaion of the server with respect to parameters lambda and s
      Specified by:
      utilization in interface QueueLogic
      Returns:
      utilization
      Throws:
      NonErgodicException - queue is not ergodic (U > 1 o U < 0)
    • getMaxStates

      public int getMaxStates()
      Description copied from interface: QueueLogic
      Returns the maximum number of the jobs in the queue(only buffer)
      Specified by:
      getMaxStates in interface QueueLogic
      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

      public double throughput() throws NonErgodicException
      Description copied from interface: QueueLogic
      Calculates the average throughput(X)
      Specified by:
      throughput in interface QueueLogic
      Throws:
      NonErgodicException
    • responseTime

      public double responseTime() throws NonErgodicException
      Description copied from interface: QueueLogic
      Calculates the average response time(R)
      Specified by:
      responseTime in interface QueueLogic
      Throws:
      NonErgodicException
    • getLambda

      public double getLambda()
    • getS

      public double getS()
    • getNumberServer

      public int getNumberServer()
      Description copied from interface: QueueLogic
      Returns the number of the servers.
      Specified by:
      getNumberServer in interface QueueLogic