pamvotis.sources
Class Source

java.lang.Object
  extended by pamvotis.sources.Source
Direct Known Subclasses:
FTPSource, GenericSource, HTTPSource, VideoSource

public abstract class Source
extends java.lang.Object

This abstract class represents a source that generates packets. Objects of this class should not created. Create objects of the inherited class, that represent the type of source. This class is used by the simulation engine to add packets to a node's queue. The abstract classes getnextPacket and synchronize should be implemented from the inherited sources.

Author:
Dimitris El. Vassis

Field Summary
 int _sourceId
          The Id of the source
static java.util.Random generator
          Generator for generating random variables
 int interArTime
          The interarrival time of the packet to be generated.
 int packetToBeTransmittedID
          The Id of the packet to be generated.
 int pktLength
          The packet length of the packet to be generated.
 java.util.Vector<VirtualPacket> session
          A vector of virtual packets representing a session of packets.
static float slot
          The time slot value according to the physical layer.
static long timer
          Represents the current time in slots. used for synchronization
 
Constructor Summary
Source()
           
 
Method Summary
 float genRv(char distr, float mean)
          Generates a random variable obeying a specific distribution.
 float genRv(char distr, float mean, float stDev)
          Generates a random variable obeying a specific distribution.
 float genRv(char distr, float mean, float max, float min)
          Generates a random variable obeying a specific distribution.
 float genRv(char distr, float mean, float stDev, float max, float min)
          Generates a random variable obeying a specific distribution.
abstract  void getNextPacket()
          This abstract method is called by the source manager to get a packet generated by the packet source.
abstract  void synchronize()
          This method is called by the simulator in every slot, to make synchronization procedures with the sources.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

slot

public static float slot
The time slot value according to the physical layer. Used for synchronization


generator

public static java.util.Random generator
Generator for generating random variables


_sourceId

public int _sourceId
The Id of the source


timer

public static long timer
Represents the current time in slots. used for synchronization


interArTime

public int interArTime
The interarrival time of the packet to be generated.


pktLength

public int pktLength
The packet length of the packet to be generated.


packetToBeTransmittedID

public int packetToBeTransmittedID
The Id of the packet to be generated.


session

public java.util.Vector<VirtualPacket> session
A vector of virtual packets representing a session of packets. After generating a session of virtual packets, each one of them, when the time to be generated arrives, it is converted to a real packet and added to the source for transmission.

Constructor Detail

Source

public Source()
Method Detail

genRv

public float genRv(char distr,
                   float mean,
                   float stDev,
                   float max,
                   float min)
Generates a random variable obeying a specific distribution.

Parameters:
distr - The distribution which the random variable will obey: 'c' for constant, 'e' for exponential, 'p' for Pareto, 'l' for lognormal. For Pareto, alfa=1.2 is always assumed.
mean - Mean value of the distribution
stDev - Standard deviation of the distribution (only available for some distributions)
max - Maximum value. If this value is set, truncation will occur using the accept/reject method and the variable will obviously obey a truncated distribution. If you want to ommit this parameter, set it to Integer.MAX_VALUE
min - Minimum value. If this value is set, truncation will occur using the accept/reject method and the variable will obviously obey a truncated distribution. If you want to ommit this parameter, set it to -1.
Returns:
A float which obeys the distribution set by 'dist'

genRv

public float genRv(char distr,
                   float mean)
Generates a random variable obeying a specific distribution. Should only be used for constant or exponential distribution. If used for Pareto, alfa=1.2 alway assumed.

Parameters:
distr - The distribution which the random variable will obey: 'c' for constant, 'e' for exponential, 'p' for Pareto.
mean - Mean value of the distribution
Returns:
A float which obeys the distribution set by 'dist'

genRv

public float genRv(char distr,
                   float mean,
                   float stDev)
Generates a random variable obeying a specific distribution.

Parameters:
distr - The distribution which the random variable will obey: 'c' for constant, 'e' for exponential, 'p' for Pareto, 'l' for lognormal. For Pareto, alfa=1.2 is always assumed.
mean - Mean value of the distribution
stDev - Standard deviation of the distribution (only available for some distributions)
Returns:
A float which obeys the distribution set by 'dist'

genRv

public float genRv(char distr,
                   float mean,
                   float max,
                   float min)
Generates a random variable obeying a specific distribution.

Parameters:
distr - The distribution which the random variable will obey: 'c' for constant, 'e' for exponential, 'p' for Pareto, 'l' for lognormal. For Pareto, alfa=1.2 is always assumed.
mean - Mean value of the distribution
max - Maximum value. If this value is set, truncation will occur using the accept/reject method and the variable will obviously obey a truncated distribution.
min - Minimum value. If this value is set, truncation will occur using the accept/reject method and the variable will obviously obey a truncated distribution.
Returns:
A float which obeys the distribution set by 'dist'

getNextPacket

public abstract void getNextPacket()
This abstract method is called by the source manager to get a packet generated by the packet source. Implemented differently in each source.


synchronize

public abstract void synchronize()
This method is called by the simulator in every slot, to make synchronization procedures with the sources. Mainly needed for the video source, but can be used by every source as a help function that is called in every time slot.