Package sim2net.packet_loss
¶
This package provides a collection of packet loss model classes.
Packet loss occurs when a packet of data (or message) traveling across a computer network fails to reach its destination(s). In wireless communication, the loss may be caused by wireless channel properties (e.g. signal degradation due to multipath fading or shadowing), packet collisions or faulty networking hardware. Thus, the purpose of packet loss models is to simulate (potential) transmission failures in wireless communication.
Package modules:
See also
Module sim2net.packet_loss._packet_loss
¶
Contains an abstract class that should be implemented by all packet loss model classes.

class
sim2net.packet_loss._packet_loss.
PacketLoss
(name)¶ Bases:
object
This class is an abstract class that should be implemented by all packet loss model classes.
 Parameters:
 name (str): a name of the implemented placement model.

logger
¶ (Property) A logger object of the
logging.Logger
class with an appropriate channel name.See also

packet_loss
()¶ Returns information about whether a transmitted packet has been lost or can be successfully received by destination nodes according to the implemented packet loss model.
 Returns:
 (bool) True if the packet has been lost, or False otherwise.
 Raises:
 NotImplementedError: this method is an abstract method.

random_generator
¶ (Property) An object representing the
sim2net.utility.randomness._Randomness
pseudorandom number generator.
Module sim2net.packet_loss.gilbert_elliott
¶
This module provides an implementation of the GilbertElliott packet loss model.
The GilbertElliott model ([Gil60], [Ell63]) describes error patterns in
communication channels ([HH08]). The model is based on a simple Markov
chain with two states: G
(for good or gap) and B
(for bad or
burst). Each of them may generate errors (packet losses) as independent
events at a state dependent error rate: \(1k\) in the good state and
\(1h\) in the bad state. The chain is shown in the figure below along
with the transition matrix \(A\) that uses two transitions:
\(p=P(q_t=Bq_{t1}=G)\) and \(r=P(q_t=Gq_{t1}=B)\) (\(q_t\)
denotes the state at time \(t\)):
++ p ++ { }
+ > <+ { 1p p }
1p   G   B   1r A = { }
  (1k)   (1h)   { r 1r }
+> < + { }
++ r ++
Then, error rate \(p_E\) is obtained (in steady mode) for the model as follows: \(p_E=(1k)\times\frac{r}{p+r}+(1h)\times\frac{p}{p+r}\) (assuming: \(0<p,r<1\)).
It is worth to note that when \(q=1p\) (and \(k=1, h=0\)), this model reduces to the Bernoulli model – a very simple loss model, characterized by a single parameter, the loss rate \(r\), used for modeling packet loss.
Finally, \(p\) equal to \(0\) means that no losses are possible,
whereas \(r\) equal to \(0\) means that no transmission is successful
(once the B
state is reached).
[Ell63]  E. O. Elliott. Estimates of Error Rates for Codes on BurstNoise Channels. In Bell System Technical Journal, vol. 42(5), 1977–1997. Bell Laboratories, September 1963. 
[Gil60]  Edgar Nelson Gilbert. Capacity of a BurstNoise Channel. In Bell System Technical Journal, vol. 39(5), 1253–1265. Bell Laboratories, September 1960. 
[HH08]  (1, 2) Gerhard Haßlinger, Oliver Hohlfeld. The GilbertElliott Model for Packet Loss in Real Time Services on the Internet. In Proceedings of the 14th GI/ITG Conference on Measurement, Modelling and Evaluation of Computer and Communication Systems (MMB 2008), pp. 269–286. Dortmund, Germany, April 2008. 

class
sim2net.packet_loss.gilbert_elliott.
GilbertElliott
(prhk=None)¶ Bases:
sim2net.packet_loss._packet_loss.PacketLoss
This class implements the GilbertElliott packet loss model.
 Parameters:
prhk (tuple): a tuple that contains four model parameters: \(0\leqslant p,r,h,k\leqslant 1\), respectively (each of type float). The parameters default to the following values:
 \(p=0.00001333\),
 \(r=0.00601795\),
 \(h=0.55494900\),
 \(k=0.99999900\);
(which leads to error rate equal to \(0.098\%\) and the mean packet loss rate equal to \(0.1\%\) ([HH08])).
 Raises:
 ValueError: raised when the given value any model parameter is less than zero or greater that one.
(At the beginning the model is in the
G
state.)
packet_loss
()¶ Returns information about whether a transmitted packet has been lost or can be successfully received by destination node(s) according to the GilbertElliott packet loss model.
 Returns:
 (bool) True if the packet has been lost, or False otherwise.