queries about exponential and uniform random distribution in ns3

246 views
Skip to first unread message

phdprojec...@gmail.com

unread,
May 6, 2016, 7:00:21 AM5/6/16
to ns-3-users
Hi everyone

I have some queries about exponential and uniform random distribution in ns3 :

- What does "mean value" in exponential random distribution mean?  is it the same meaning as the (seed) of uniform random distribution in matlab? from my knowledge about seed, it  represents a shape of distribution.  

- I want to generate packets with random size range from (250-750) bytes. Can I use exponential random distribution or uniform random distribution?

- In case of using exponential random distribution,  How can select the minimum range and the mean value of distribution? because I read about this distribution in ns3 and I noticed that just the upper limit can be determined. 

- While in case of using uniform random distribution, the minimum and maximum range can be specified but I do not know how can specify the seed of uniform random distribution like the matlab? 

looking forward to your reply 

Regards


Konstantinos

unread,
May 6, 2016, 7:28:02 AM5/6/16
to ns-3-users
Comments inline

On Friday, May 6, 2016 at 12:00:21 PM UTC+1, phdprojec...@gmail.com wrote:
Hi everyone

I have some queries about exponential and uniform random distribution in ns3 :

- What does "mean value" in exponential random distribution mean?  is it the same meaning as the (seed) of uniform random distribution in matlab? from my knowledge about seed, it  represents a shape of distribution.  



- I want to generate packets with random size range from (250-750) bytes. Can I use exponential random distribution or uniform random distribution?


Yes, you can. The question is SHOULD you use? Using any type of random variable should be backed by a theory/experimental data, i.e. for your traffic does the packet size follow any of these two distributions?
 
- In case of using exponential random distribution,  How can select the minimum range and the mean value of distribution? because I read about this distribution in ns3 and I noticed that just the upper limit can be determined. 

You can manipulate the random variable to return a value from [0, 500] which is your range and add 250, so your final range will be [250, 750]
 

- While in case of using uniform random distribution, the minimum and maximum range can be specified but I do not know how can specify the seed of uniform random distribution like the matlab? 

I think that you have misunderstood what the seed is, and yes, you can configure both SEED and RUN numbers in NS-3. It's the first chapter in the manual.

phdprojec...@gmail.com

unread,
May 6, 2016, 7:53:02 AM5/6/16
to ns-3-users
Thanks for your reply.. 
Below is my comments

Regads

   

On Friday, May 6, 2016 at 12:28:02 PM UTC+1, Konstantinos wrote:
Comments inline

On Friday, May 6, 2016 at 12:00:21 PM UTC+1, phdprojec...@gmail.com wrote:
Hi everyone

I have some queries about exponential and uniform random distribution in ns3 :

- What does "mean value" in exponential random distribution mean?  is it the same meaning as the (seed) of uniform random distribution in matlab? from my knowledge about seed, it  represents a shape of distribution.  


Mean: The mean of the values returned by this RNG stream.
 
No, SEED is a different thing both in matlab and NS-3.

- I want to generate packets with random size range from (250-750) bytes. Can I use exponential random distribution or uniform random distribution?

for specifying the the expected time of sending next packet from applications, I use: 
- some applications use Exponential Random distribution,
- some applications use Pareto Random distribution. 
- others use constant Random distribution. 

now, I am thinking to use either exponential random distribution or uniform random distribution in specifying the size of generated packets. which one is better? I know the Exponential random distribution is driven from uniform random distribution.  Should I test different values of mean (Exponential Random Distribution) and seed values (Uniform Random distribution) to see the size of generated packets?

phdprojec...@gmail.com

unread,
May 6, 2016, 7:55:16 AM5/6/16
to ns-3-users


On Friday, May 6, 2016 at 12:28:02 PM UTC+1, Konstantinos wrote:
Comments inline

On Friday, May 6, 2016 at 12:00:21 PM UTC+1, phdprojec...@gmail.com wrote:
Hi everyone

I have some queries about exponential and uniform random distribution in ns3 :

- What does "mean value" in exponential random distribution mean?  is it the same meaning as the (seed) of uniform random distribution in matlab? from my knowledge about seed, it  represents a shape of distribution.  


Mean: The mean of the values returned by this RNG stream.
 
No, SEED is a different thing both in matlab and NS-3.

- I want to generate packets with random size range from (250-750) bytes. Can I use exponential random distribution or uniform random distribution?


Yes, you can. The question is SHOULD you use? Using any type of random variable should be backed by a theory/experimental data, i.e. for your traffic does the packet size follow any of these two distributions?
 
 for specifying the the expected time of sending next packet from applications, I use: 
- some applications use Exponential Random distribution,
- some applications use Pareto Random distribution. 
- others use constant Random distribution. 

now, I am thinking to use either exponential random distribution or uniform random distribution in specifying the size of generated packets. which one is better? I know the Exponential random distribution is driven from uniform random distribution.  Should I test different values of mean (Exponential Random Distribution) and seed values (Uniform Random distribution) to see the size of generated packets?

 
- In case of using exponential random distribution,  How can select the minimum range and the mean value of distribution? because I read about this distribution in ns3 and I noticed that just the upper limit can be determined. 

Konstantinos

unread,
May 6, 2016, 9:25:52 AM5/6/16
to ns-3-users


On Friday, May 6, 2016 at 12:53:02 PM UTC+1, phdprojec...@gmail.com wrote:
Thanks for your reply.. 
Below is my comments

Regads

   

On Friday, May 6, 2016 at 12:28:02 PM UTC+1, Konstantinos wrote:
Comments inline

On Friday, May 6, 2016 at 12:00:21 PM UTC+1, phdprojec...@gmail.com wrote:
Hi everyone

I have some queries about exponential and uniform random distribution in ns3 :

- What does "mean value" in exponential random distribution mean?  is it the same meaning as the (seed) of uniform random distribution in matlab? from my knowledge about seed, it  represents a shape of distribution.  


Mean: The mean of the values returned by this RNG stream.
 
No, SEED is a different thing both in matlab and NS-3.

- I want to generate packets with random size range from (250-750) bytes. Can I use exponential random distribution or uniform random distribution?

for specifying the the expected time of sending next packet from applications, I use: 
- some applications use Exponential Random distribution,
- some applications use Pareto Random distribution. 
- others use constant Random distribution. 

now, I am thinking to use either exponential random distribution or uniform random distribution in specifying the size of generated packets. which one is better? I know the Exponential random distribution is driven from uniform random distribution.  

As I said, there is no single distribution that is better than some other. It depends on what you want to model. For sure there should be a consensus on the type of model to use for your application traffic. Search the literature and if not, try to analyse real traffic to make your model.  
 
Should I test different values of mean (Exponential Random Distribution) and seed values (Uniform Random distribution) to see the size of generated packets?

Still you have not a clear understanding what seed is and you confuse your self. Perhaps this will help: https://en.wikipedia.org/wiki/Random_seed
Yes, putting different mean value will change the size of the generated packets, that's expected if you have coded the application properly.
Just putting different mean values without understanding what they mean, is not advised though. The mean value should be backed by either a theory or experimental data.

phdprojec...@gmail.com

unread,
May 13, 2016, 6:07:56 AM5/13/16
to ns-3-users

Thanks for your reply and assistance. 

If a traffic source generate packets (1500)Bytes at bit rate 3000Kbits/sec. should the exponential random distribution of ns3  be configured as below with mean value equal to 250 because, the number of packet should be sent from traffic source per sec according to the mentioned bits rate is equal to (3000000/8)/1500 = 250 packets.

Ptr<ExponentialRandomVariable> x = CreateObject<ExponentialRandomVariable>();
     x->SetAttribute("Mean", DoubleValue(250));
     m_packetSize = (uint32_t)(x->GetValue()) ;

in case of making the size of generated packets different (1024-1500)bytes. should the exponential random distribution be configured as below? does the mean value of distribution change if I use same bit rate 3000Kbits/sec?

in case of using the same mean value (250), the output of distribution will be 250 packets per sec at size range (1024-1500) bytes. Right?

Ptr<ExponentialRandomVariable> x = CreateObject<ExponentialRandomVariable>();
     x->SetAttribute("Mean", DoubleValue(250));
     x->SetAttribute("Bound", DoubleValue(476));
     m_packetSize = (uint32_t)(x->GetValue()) + 1024;

Regards

Konstantinos

unread,
May 13, 2016, 6:56:39 AM5/13/16
to ns-3-users
Hi,

You have mistaken packet size (1500 bytes) with number of packets. 
You said you want to generate packets of fixed (?) size 1500bytes with a bit rate 3Mbps following an exponential distribution. 

From my understanding, this exponential distribution is in the inter-arrival time. So this 
   m_packetSize = (uint32_t)(x->GetValue()) ;
is not correct. 
The random variable (x) should be used for the time to send the next packet.

Same for the other part. You would need TWO random variables.. one for the packet size and the other for the inter-arrival.

Regards,
K

phdprojec...@gmail.com

unread,
May 13, 2016, 7:48:38 AM5/13/16
to ns-3-users
Thanks for your reply..
Sorry for this mistake.

- in case of generating fixed packet size (1500) Bytes at bits rate 3Mbits/sec. then the number of generated packets per second is fixed which is equal to (3000000/8)/1500 = 250 packets so constant random distribution with mean (0.004) is used instead of using exponential distribution as below. Right?? 
Here, if the exponential distribution with mean (250 or any value) could not be used because the distribution will return non periodic (different) interval for scheduling the next packet sending.  
Ptr<ConstantRandomVariable> x = CreateObject<ConstantRandomVariable>();
x->SetAttribute("Constant", DoubleValue(0.004));
value = x->GetValue();  // this use in scheduling the time of sending next packet. 

-In case of generating (250) packets with different size range (1024-1500)Bytes at bits rate 3Mbits/sec, here I need two random distributions one exponential for packet size and another constant for scheduling the sending of next packet. Both distributions can be configured as below:

// For different packet size
Ptr<ExponentialRandomVariable> x = CreateObject<ExponentialRandomVariable>();
     x->SetAttribute("Mean", DoubleValue(250));
     x->SetAttribute("Bound", DoubleValue(476));
     m_packetSize = (uint32_t)(x->GetValue()) + 1024;


// For scheduling the sending of next packet
Ptr<ConstantRandomVariable> x = CreateObject<ConstantRandomVariable>();
x->SetAttribute("Constant", DoubleValue(0.004));
value = x->GetValue();   

is that correct?? what about the setting the values of mean?  

Regards

Konstantinos

unread,
May 13, 2016, 8:19:29 AM5/13/16
to ns-3-users
Hi,


On Friday, May 13, 2016 at 12:48:38 PM UTC+1, phdprojec...@gmail.com wrote:
Thanks for your reply..
Sorry for this mistake.

- in case of generating fixed packet size (1500) Bytes at bits rate 3Mbits/sec. then the number of generated packets per second is fixed which is equal to (3000000/8)/1500 = 250 packets so constant random distribution with mean (0.004) is used instead of using exponential distribution as below. Right?? 

The 3Mbps is your AVERAGE rate, which correctly gives you an AVERAGE 250 packets/sec. You can use ANY random variable for your inter-arrival time which would give you the same result in AVERAGE packets. E.g. you can use exponential with that mean/average. But you have you make sure how you use that variable. 
 
Here, if the exponential distribution with mean (250 or any value) could not be used because the distribution will return non periodic (different) interval for scheduling the next packet sending.  
Ptr<ConstantRandomVariable> x = CreateObject<ConstantRandomVariable>();
x->SetAttribute("Constant", DoubleValue(0.004));
value = x->GetValue();  // this use in scheduling the time of sending next packet. 

This will generate a constant rate with 250pkt/sec. As I said above, you can use other random variables with the same mean/average value if you want to investigate random inter-arrival times which would however give you the same AVERAGE rate. 
Make sure that you will use the 'VALUE' for the correct purpose, i.e. the time to schedule the next event.
 

-In case of generating (250) packets with different size range (1024-1500)Bytes at bits rate 3Mbits/sec, here I need two random distributions one exponential for packet size and another constant for scheduling the sending of next packet. Both distributions can be configured as below:


If you generate an average 250pkt/sec with different size (1024-1500), then your (average) rate won't be 3Mbps. It will be something lower because the average packet size will not be 1500. You might need to re-calculate your rate.
 
// For different packet size
Ptr<ExponentialRandomVariable> x = CreateObject<ExponentialRandomVariable>();
     x->SetAttribute("Mean", DoubleValue(250));
     x->SetAttribute("Bound", DoubleValue(476));
     m_packetSize = (uint32_t)(x->GetValue()) + 1024;


// For scheduling the sending of next packet
Ptr<ConstantRandomVariable> x = CreateObject<ConstantRandomVariable>();
x->SetAttribute("Constant", DoubleValue(0.004));
value = x->GetValue();   

is that correct?? what about the setting the values of mean?  

Try not to use the same variable names (i.e. x).  Other than that, I think they are correct.
Reply all
Reply to author
Forward
0 new messages