on-off app

905 views
Skip to first unread message

Amir Reda

unread,
Apr 9, 2014, 1:47:48 AM4/9/14
to ns-3-...@googlegroups.com
dear all i want apply an on-off app to a network of 2 nodes one is tx and other is sink with a packet size 64Byte or 512 bit and sending rate 1 packet per second

i wrote this code to apply it

in main()
{
  std::string rate ("512bps");
  Config::SetDefault ("ns3::OnOffApplication::PacketSize", StringValue ("512"));
  Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue (rate));
}
InstallApplications ()
{
      Ptr<Node> appNode1 = NodeList::GetNode (1);
      Ptr<Node> appNode2 = NodeList::GetNode (2);

      Ipv4Address nodeAddress = appNode1->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal ();
      Ptr<Socket> sink = SetupPacketReceive (nodeAddress, appNode1);
 
          OnOffHelper onoff1 ("ns3::UdpSocketFactory", Address (InetSocketAddress (interfaces.GetAddress (0), port)));
          onoff1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
          onoff1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));

              ApplicationContainer apps1 = onoff1.Install (appNode2);
              Ptr<UniformRandomVariable> var = CreateObject<UniformRandomVariable> ();
              apps1.Start (Seconds (var->GetValue (m_dataStart, m_dataStart + 1)));
              apps1.Stop (Seconds (m_totalTime));  
}
where m_dataStart time to start send data and m_totalTime is time to finish simulation

when i see the log file i found out that this scenario is sending a packet every 8 seconds not one every second what is wrong with this code
--
Warmest regards and best wishes for a good health,urs sincerely
mero

Konstantinos

unread,
Apr 9, 2014, 4:33:01 AM4/9/14
to ns-3-...@googlegroups.com
  std::string rate ("512bps");
 
Config::SetDefault ("ns3::OnOffApplication::PacketSize", StringValue ("512"));

DataRate is bits per sec (bps) and packet size is in Bytes. Hence you see 1:8 rate.
Conventions used: "b" stands for bits, "B" for bytes (8 bits) 
"k" stands for 1000, "K" also stands for 1000, "Ki" stands for 1024 
"M" stand for 1000000, "Mib" stands for 1024 kibibits, or 1048576 bits 
"G" stand for 10^9, "Gib" stands for 1024 mebibits 
whitespace is allowed but not required between the numeric value and units

Amir Reda

unread,
Apr 11, 2014, 2:23:59 PM4/11/14
to ns-3-...@googlegroups.com
dear all if i have a network of 60 node one f them are sink
and install an on off app n the nodes with a rate 4kbps and packet size 512 bit
and on time 1 sec and off time 0

          onoff1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
          onoff1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));

is this correct
transmitted packets in one second is 59 packet 

i need answer thanks for help

Tommaso Pecorella

unread,
Apr 11, 2014, 3:02:00 PM4/11/14
to ns-3-...@googlegroups.com
Amir, PLEASE, can you wait 10 minutes before posting something and use them to read your message twice ?

I am aware that English isn't your mother language (it's not for the majority of the group users), but you're really making it hard to understand what's the question. Not to mention what's the assumption.

Anyway, I totally don't understand what your numbers come from.
  • 4kbps, packet size 512 bit => 8 packets per second (average)
  • No "off" period =>  8 packets per second "always" (*)
(*) if there are on and off periods, the packet per second is calculated over the average of the on and off periods, so there's a burst during the on phase.

If you have 60 nodes and one is the sink, then you have 59 nodes transmitting.

Total... 59 * 8 = 472 packets per second.

Now, this is basic math. Do not tell me that you couldn't do it by yourself because I can't believe that.
As a consequence, I must have missed something.

T.

Amir Reda

unread,
Apr 11, 2014, 3:42:33 PM4/11/14
to ns-3-...@googlegroups.com
i apologize for bad English and sorry again sir


--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Amir Reda

unread,
Apr 11, 2014, 3:49:15 PM4/11/14
to ns-3-...@googlegroups.com
i'm totally sorry that i was not concentrating but i miss understand something this is why i was confused
thanks for help

Evgeny Kuznetsov

unread,
Mar 29, 2017, 11:08:47 PM3/29/17
to ns-3-users
Please bitch at some other place, thank you.

Tommaso Pecorella

unread,
Apr 1, 2017, 7:32:17 PM4/1/17
to ns-3-users
Hi,

I do understand that you might get confused by the not polite manners I sometimes use, but could you please notice that
1) you're replying to a 3-years old post, and
2) your message is highly offensive ?

I am confident that you didn't send it on purpose, and even if you would, I'll avoid further replies because I learnt a couple of things about fighting.

T.

kimiko yukii

unread,
Apr 26, 2018, 12:28:34 AM4/26/18
to ns-3-users
hello sir, is it possible to send one packet every second?

Konstantinos

unread,
Apr 27, 2018, 4:55:38 AM4/27/18
to ns-3-users
yes
Reply all
Reply to author
Forward
0 new messages