---
# System prepended metadata

title: 'HOMEWORK :'

---

# HOMEWORK : 
## Problem 1:
Consider the given data:
* N = Total number of links
* R = Transmission rate
* L = Packet length
* P = Packets that transmit over the N links

The first packet reaches the destination : 
$$
N*{L\over R} 
$$
The second packet reaches the destination : 
$$
N*{L\over R} + {L\over R}
$$
The third packet reaches the destination : 
$$
N*{L\over R} + {L\over R} + {L\over R}
$$
=> The Pth reaches the destination : 
$$ N *{L\over R} +(P-1)*{L\over R} $$
or
$$ (N+P-1)*{L\over R}
$$
## Problem 2: 
The first packet reaches the destination : 
$$
N*{L_1 \over R} 
$$
The second packet reaches the destination : 
$$
N*{L_2\over R} + {L_1\over R}
$$
The third packet reaches the destination : 
$$
N*{L_3\over R} + {L_2\over R} + {L_1\over R}
$$
=> The Pth reaches the destination : 
$$ N *{L_p\over R} + {L_{p-1}\over R} +{L_{p-2}\over R}+...+{L_3\over R}+{L_2\over R}+{L_1\over R} $$
or
$$ \sum_{i=1}^{p} {L_i\over R}+{N*L_p\over R}
$$


## Problem 3: 
#### a. The total delay is : 
Calculate the total delay by using the below formula : 
Total delay = Queuing delay + Transmission delay
Then, we have : 
**Total delay = d~trans~ + d~queue~**
=> Total delay is : 
$$
{IL \over {R(1-I)}} + {L \over R}
$$
 

$$
={L \over R} * ({I\over{1-I}}+1)
$$

$$
={L \over R} * {1 \over{1-I}} sec
$$
#### b. 
Let us assume that the transmission is represented by x.
So, the transmission delay is: $$ x = {L \over R} $$
=> Traffic intensity $$I = {La \over R} = xa$$
Hence, the total delay is: $${x \over{1-xa}} $$
We have a function of $L\over R$ in Matlab is (*$x= {L\over R}$*) : 
```clike=
> x = [0:0.5:10];

a = [0:0.5:10];
[X,A] = meshgrid(x,a);
Y = X./(1-A.*X);
> mesh(Y)
```
And the figure here : 
![](https://i.imgur.com/V0XvnQb.png)


#### c.
Given rate of the transmission link and the rate of packets arriving at a link
Let the rate of the transmission link = $\mu$ packets/sec
Let the rate of packets arriving at a link = a packets/sec
* Formula for Queuing delay = $IL \over {\mu(1-I)}$
* Formula for Traffic Intensity I = $La \over \mu$

Calculation of Total delay in terms of a and $\mu$
The Queuing delay plus the Transmission delay to get the total delay.
So, we have:

**Total delay 
= Queuing delay + Transmission delay**
              =d~queue~ + d~trans~
=$IL \over \mu(1-I)$ + $L \over \mu$
=$L \over \mu$  [$I \over 1-I$+1]
=$L \over \mu$ [$1 \over 1- I$] sec
Substituting the value of **I** from above equation : 
$L \over \mu$ $1 \over{1-{La\over \mu}}$ => $L \over \mu$ $\mu\over{\mu -La}$=>$L\over{\mu - La}$
Therefore, the formula in terms of a and $\mu$ is : 
**Total delay = $L \over{\mu - La}$ packets/sec.**

## Problem 4:
#### a)
Calculate the average queuing delay:
The first packet queuing delay = 0
The second packet queuing delay = $L\over R$
The third packet queuing delay = $2L\over R$
So, the Nth packet queuing delay = $(N-1)L\over R$
**Therefore, the average queuing delay of Nth packet =**

$$
{{L \over R} + {2L \over R} + {3L\over R}+...+{(N-1)L \over R}} \over N
$$
$$
={L\over RN} {\sum_{i=1}^{N-1} i}
$$
$$
={L\over RN} {N(N-1)\over 2}
$$
$$
={(N-1)}{L\over 2R}
$$
#### b)
To transmit N such batches, it takes LN/R seconds. Therefore, a new batch arrives then the queue is empty each time. Thus, the average delay of a packet across all batches is the average delay within one batch.
Hence, the average queuing delay of a packet = $(N-1)L\over {2R}$
## Problem 5:
Because each user just active 10% of time. So,
Probability that **one user is active** : 
P(X)=0,1=p
The number of user by topic is 35 => n=35
So, Probability that **10 users simultaneously active is** : 
P(Y)= $\sum_{x-0}^{10} ~n~C~x~ *p^x*(1-p)^{n-x}$=0.9996

Hence, we have the probability for case that 11 or more users simultaneously active is:
P(Z)=1-P(Y)=1-0.9996=0.0004.
## Problem 6:
a.Look at the figure we have a function of total delay:
The total delay = 3d~trans1~ + 2d~proc~+3d~prop1~+d~trans2~+d~trans3~
=3$L_1\over R_1$+2d~proc~+3$D_1\over S_1$+$L_2\over R_2$+$L_3 \over R_3$
b.If we have P packets and N nodes, We have a function of total delay here : 
The total delay = (N-1)$L_1\over R_1$+(N-2)d~proc~+(N-1)$D_1\over S_1$+$L_2\over R_2$+$L_3\over R_3$+....+$L_p\over R_p$


















