Add a constant rate setting function to the on-off helper
parent
6fb3fb3b99
commit
eafb5075bf
|
@ -116,9 +116,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (i3i2.GetAddress (1), port)));
|
Address (InetSocketAddress (i3i2.GetAddress (1), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("448kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (0));
|
ApplicationContainer apps = onoff.Install (c.Get (0));
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
apps.Stop (Seconds (10.0));
|
apps.Stop (Seconds (10.0));
|
||||||
|
|
|
@ -252,8 +252,7 @@ int main (int argc, char *argv[])
|
||||||
Ipv4InterfaceAddress ipv4_int_addr = ipv4->GetAddress (1, 0);
|
Ipv4InterfaceAddress ipv4_int_addr = ipv4->GetAddress (1, 0);
|
||||||
Ipv4Address ip_addr = ipv4_int_addr.GetLocal ();
|
Ipv4Address ip_addr = ipv4_int_addr.GetLocal ();
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory", InetSocketAddress (ip_addr, port)); // traffic flows from node[i] to node[j]
|
OnOffHelper onoff ("ns3::UdpSocketFactory", InetSocketAddress (ip_addr, port)); // traffic flows from node[i] to node[j]
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
|
onoff.SetConstantRate (DataRate (AppPacketRate));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));
|
|
||||||
ApplicationContainer apps = onoff.Install (nodes.Get (i)); // traffic sources are installed on all nodes
|
ApplicationContainer apps = onoff.Install (nodes.Get (i)); // traffic sources are installed on all nodes
|
||||||
apps.Start (Seconds (AppStartTime + rn));
|
apps.Start (Seconds (AppStartTime + rn));
|
||||||
apps.Stop (Seconds (AppStopTime));
|
apps.Stop (Seconds (AppStopTime));
|
||||||
|
|
|
@ -151,9 +151,7 @@ main (int argc, char *argv[])
|
||||||
uint16_t port = 9; // Discard port (RFC 863)
|
uint16_t port = 9; // Discard port (RFC 863)
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
InetSocketAddress (i5i6.GetAddress (1), port));
|
InetSocketAddress (i5i6.GetAddress (1), port));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("2kbps"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", StringValue ("2kbps"));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (50));
|
onoff.SetAttribute ("PacketSize", UintegerValue (50));
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (1));
|
ApplicationContainer apps = onoff.Install (c.Get (1));
|
||||||
|
|
|
@ -136,9 +136,7 @@ main (int argc, char *argv[])
|
||||||
uint16_t port = 9; // Discard port (RFC 863)
|
uint16_t port = 9; // Discard port (RFC 863)
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
|
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (6000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
|
|
||||||
ApplicationContainer apps = onoff.Install (nA);
|
ApplicationContainer apps = onoff.Install (nA);
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
apps.Stop (Seconds (10.0));
|
apps.Stop (Seconds (10.0));
|
||||||
|
|
|
@ -107,9 +107,7 @@ main (int argc, char *argv[])
|
||||||
uint16_t port = 9; // Discard port (RFC 863)
|
uint16_t port = 9; // Discard port (RFC 863)
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
|
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (6000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
|
|
||||||
ApplicationContainer apps = onoff.Install (nA);
|
ApplicationContainer apps = onoff.Install (nA);
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
apps.Stop (Seconds (10.0));
|
apps.Stop (Seconds (10.0));
|
||||||
|
|
|
@ -113,9 +113,7 @@ main (int argc, char *argv[])
|
||||||
uint16_t port = 9; // Discard port (RFC 863)
|
uint16_t port = 9; // Discard port (RFC 863)
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
InetSocketAddress (i5i6.GetAddress (1), port));
|
InetSocketAddress (i5i6.GetAddress (1), port));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("300bps"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", StringValue ("300bps"));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (50));
|
onoff.SetAttribute ("PacketSize", UintegerValue (50));
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (0));
|
ApplicationContainer apps = onoff.Install (c.Get (0));
|
||||||
|
|
|
@ -140,8 +140,7 @@ main (int argc, char *argv[])
|
||||||
// Create a flow from n3 to n1, starting at time 1.1 seconds
|
// Create a flow from n3 to n1, starting at time 1.1 seconds
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (i1i2.GetAddress (0), port)));
|
Address (InetSocketAddress (i1i2.GetAddress (0), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("300b/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (3));
|
ApplicationContainer apps = onoff.Install (c.Get (3));
|
||||||
apps.Start (Seconds (1.1));
|
apps.Start (Seconds (1.1));
|
||||||
|
|
|
@ -120,8 +120,7 @@ main (int argc, char *argv[])
|
||||||
uint16_t port = 9; // Discard port (RFC 863)
|
uint16_t port = 9; // Discard port (RFC 863)
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (i3i2.GetAddress (0), port)));
|
Address (InetSocketAddress (i3i2.GetAddress (0), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("448kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (0));
|
ApplicationContainer apps = onoff.Install (c.Get (0));
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
apps.Stop (Seconds (10.0));
|
apps.Stop (Seconds (10.0));
|
||||||
|
|
|
@ -112,9 +112,7 @@ main (int argc, char *argv[])
|
||||||
uint16_t port = 9; // Discard port (RFC 863)
|
uint16_t port = 9; // Discard port (RFC 863)
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
|
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (6000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
|
|
||||||
ApplicationContainer apps = onoff.Install (nA);
|
ApplicationContainer apps = onoff.Install (nA);
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
apps.Stop (Seconds (10.0));
|
apps.Stop (Seconds (10.0));
|
||||||
|
|
|
@ -363,8 +363,8 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (remoteAddr, port)));
|
Address (InetSocketAddress (remoteAddr, port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("10kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
ApplicationContainer apps = onoff.Install (appSource);
|
ApplicationContainer apps = onoff.Install (appSource);
|
||||||
apps.Start (Seconds (3.0));
|
apps.Start (Seconds (3.0));
|
||||||
apps.Stop (Seconds (20.0));
|
apps.Stop (Seconds (20.0));
|
||||||
|
|
|
@ -301,8 +301,7 @@ def main(argv):
|
||||||
|
|
||||||
onoff = ns.applications.OnOffHelper("ns3::UdpSocketFactory",
|
onoff = ns.applications.OnOffHelper("ns3::UdpSocketFactory",
|
||||||
ns.network.Address(ns.network.InetSocketAddress(remoteAddr, port)))
|
ns.network.Address(ns.network.InetSocketAddress(remoteAddr, port)))
|
||||||
onoff.SetAttribute("OnTime", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=1]"))
|
onoff.SetConstantRate (ns.network.DataRate ("10kb/s"))
|
||||||
onoff.SetAttribute("OffTime", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=0]"))
|
|
||||||
apps = onoff.Install(ns.network.NodeContainer(appSource))
|
apps = onoff.Install(ns.network.NodeContainer(appSource))
|
||||||
apps.Start(ns.core.Seconds(3.0))
|
apps.Start(ns.core.Seconds(3.0))
|
||||||
apps.Stop(ns.core.Seconds(20.0))
|
apps.Stop(ns.core.Seconds(20.0))
|
||||||
|
|
|
@ -355,9 +355,7 @@ Experiment::ApplicationSetup (Ptr<Node> client, Ptr<Node> server, double start,
|
||||||
|
|
||||||
// Equipping the source node with OnOff Application used for sending
|
// Equipping the source node with OnOff Application used for sending
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory", Address (InetSocketAddress (Ipv4Address ("10.0.0.1"), port)));
|
OnOffHelper onoff ("ns3::UdpSocketFactory", Address (InetSocketAddress (Ipv4Address ("10.0.0.1"), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (60000000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (60000000)));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (packetSize));
|
onoff.SetAttribute ("PacketSize", UintegerValue (packetSize));
|
||||||
onoff.SetAttribute ("Remote", AddressValue (InetSocketAddress (ipv4AddrServer, port)));
|
onoff.SetAttribute ("Remote", AddressValue (InetSocketAddress (ipv4AddrServer, port)));
|
||||||
|
|
||||||
|
|
|
@ -143,9 +143,7 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
|
||||||
socket.SetProtocol (1);
|
socket.SetProtocol (1);
|
||||||
|
|
||||||
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=250]"));
|
onoff.SetConstantRate (DataRate (60000000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (60000000)));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (2000));
|
onoff.SetAttribute ("PacketSize", UintegerValue (2000));
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (0));
|
ApplicationContainer apps = onoff.Install (c.Get (0));
|
||||||
|
|
|
@ -170,8 +170,7 @@ int main (int argc, char *argv[])
|
||||||
socket.SetProtocol (1);
|
socket.SetProtocol (1);
|
||||||
|
|
||||||
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=42]"));
|
onoff.SetConstantRate (DataRate ("500kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (stas.Get (0));
|
ApplicationContainer apps = onoff.Install (stas.Get (0));
|
||||||
apps.Start (Seconds (0.5));
|
apps.Start (Seconds (0.5));
|
||||||
|
|
|
@ -150,8 +150,7 @@ def main(argv):
|
||||||
socket.SetProtocol(1)
|
socket.SetProtocol(1)
|
||||||
|
|
||||||
onoff = ns.applications.OnOffHelper("ns3::PacketSocketFactory", ns.network.Address(socket))
|
onoff = ns.applications.OnOffHelper("ns3::PacketSocketFactory", ns.network.Address(socket))
|
||||||
onoff.SetAttribute("OnTime", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=42]"))
|
onoff.SetConstantRate (ns.network.DataRate ("500kb/s"))
|
||||||
onoff.SetAttribute("OffTime", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=0]"))
|
|
||||||
|
|
||||||
apps = onoff.Install(ns.network.NodeContainer(stas.Get(0)))
|
apps = onoff.Install(ns.network.NodeContainer(stas.Get(0)))
|
||||||
apps.Start(ns.core.Seconds(0.5))
|
apps.Start(ns.core.Seconds(0.5))
|
||||||
|
|
|
@ -180,8 +180,7 @@ int main (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
OnOffHelper onoff = OnOffHelper (protocol, dest);
|
OnOffHelper onoff = OnOffHelper (protocol, dest);
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("500kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
ApplicationContainer apps = onoff.Install (staNodes[0].Get (0));
|
ApplicationContainer apps = onoff.Install (staNodes[0].Get (0));
|
||||||
apps.Start (Seconds (0.5));
|
apps.Start (Seconds (0.5));
|
||||||
apps.Stop (Seconds (3.0));
|
apps.Stop (Seconds (3.0));
|
||||||
|
|
|
@ -2453,6 +2453,10 @@ def register_Ns3OnOffHelper_methods(root_module, cls):
|
||||||
cls.add_method('SetAttribute',
|
cls.add_method('SetAttribute',
|
||||||
'void',
|
'void',
|
||||||
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
|
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
|
||||||
|
## on-off-helper.h (module 'applications'): void ns3::OnOffHelper::SetConstantRate(ns3::DataRate dataRate, uint32_t packetSize=512) [member function]
|
||||||
|
cls.add_method('SetConstantRate',
|
||||||
|
'void',
|
||||||
|
[param('ns3::DataRate', 'dataRate'), param('uint32_t', 'packetSize', default_value='512')])
|
||||||
return
|
return
|
||||||
|
|
||||||
def register_Ns3PacketLossCounter_methods(root_module, cls):
|
def register_Ns3PacketLossCounter_methods(root_module, cls):
|
||||||
|
|
|
@ -2453,6 +2453,10 @@ def register_Ns3OnOffHelper_methods(root_module, cls):
|
||||||
cls.add_method('SetAttribute',
|
cls.add_method('SetAttribute',
|
||||||
'void',
|
'void',
|
||||||
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
|
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
|
||||||
|
## on-off-helper.h (module 'applications'): void ns3::OnOffHelper::SetConstantRate(ns3::DataRate dataRate, uint32_t packetSize=512) [member function]
|
||||||
|
cls.add_method('SetConstantRate',
|
||||||
|
'void',
|
||||||
|
[param('ns3::DataRate', 'dataRate'), param('uint32_t', 'packetSize', default_value='512')])
|
||||||
return
|
return
|
||||||
|
|
||||||
def register_Ns3PacketLossCounter_methods(root_module, cls):
|
def register_Ns3PacketLossCounter_methods(root_module, cls):
|
||||||
|
|
|
@ -21,7 +21,10 @@
|
||||||
#include "ns3/inet-socket-address.h"
|
#include "ns3/inet-socket-address.h"
|
||||||
#include "ns3/packet-socket-address.h"
|
#include "ns3/packet-socket-address.h"
|
||||||
#include "ns3/string.h"
|
#include "ns3/string.h"
|
||||||
|
#include "ns3/data-rate.h"
|
||||||
|
#include "ns3/uinteger.h"
|
||||||
#include "ns3/names.h"
|
#include "ns3/names.h"
|
||||||
|
#include "ns3/random-variable-stream.h"
|
||||||
#include "ns3/onoff-application.h"
|
#include "ns3/onoff-application.h"
|
||||||
|
|
||||||
namespace ns3 {
|
namespace ns3 {
|
||||||
|
@ -93,4 +96,13 @@ OnOffHelper::AssignStreams (NodeContainer c, int64_t stream)
|
||||||
return (currentStream - stream);
|
return (currentStream - stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OnOffHelper::SetConstantRate (DataRate dataRate, uint32_t packetSize)
|
||||||
|
{
|
||||||
|
m_factory.Set ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1000]"));
|
||||||
|
m_factory.Set ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
||||||
|
m_factory.Set ("DataRate", DataRateValue (dataRate));
|
||||||
|
m_factory.Set ("PacketSize", UintegerValue (packetSize));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ns3
|
} // namespace ns3
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
namespace ns3 {
|
namespace ns3 {
|
||||||
|
|
||||||
|
class DataRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A helper to make it easier to instantiate an ns3::OnOffApplication
|
* \brief A helper to make it easier to instantiate an ns3::OnOffApplication
|
||||||
* on a set of nodes.
|
* on a set of nodes.
|
||||||
|
@ -59,6 +61,16 @@ public:
|
||||||
*/
|
*/
|
||||||
void SetAttribute (std::string name, const AttributeValue &value);
|
void SetAttribute (std::string name, const AttributeValue &value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to set a constant rate source. Equivalent to
|
||||||
|
* setting the attributes OnTime to constant 1000 seconds, OffTime to
|
||||||
|
* constant 0 seconds, and the DataRate and PacketSize set accordingly
|
||||||
|
*
|
||||||
|
* \param dataRate DataRate object for the sending rate
|
||||||
|
* \param packetSize size in bytes of the packet payloads generated
|
||||||
|
*/
|
||||||
|
void SetConstantRate (DataRate dataRate, uint32_t packetSize = 512);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install an ns3::OnOffApplication on each node of the input container
|
* Install an ns3::OnOffApplication on each node of the input container
|
||||||
* configured with all the attributes set with SetAttribute.
|
* configured with all the attributes set with SetAttribute.
|
||||||
|
|
|
@ -182,8 +182,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (Ipv4Address ("10.1.1.3"), port)));
|
Address (InetSocketAddress (Ipv4Address ("10.1.1.3"), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("500kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
|
|
||||||
ApplicationContainer app = onoff.Install (n0);
|
ApplicationContainer app = onoff.Install (n0);
|
||||||
// Start the application
|
// Start the application
|
||||||
|
|
|
@ -112,8 +112,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port)));
|
Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("500kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
|
|
||||||
ApplicationContainer app = onoff.Install (terminals.Get (0));
|
ApplicationContainer app = onoff.Install (terminals.Get (0));
|
||||||
// Start the application
|
// Start the application
|
||||||
|
|
|
@ -97,8 +97,7 @@ def main(argv):
|
||||||
|
|
||||||
onoff = ns.applications.OnOffHelper("ns3::UdpSocketFactory",
|
onoff = ns.applications.OnOffHelper("ns3::UdpSocketFactory",
|
||||||
ns.network.Address(ns.network.InetSocketAddress(ns.network.Ipv4Address("10.1.1.2"), port)))
|
ns.network.Address(ns.network.InetSocketAddress(ns.network.Ipv4Address("10.1.1.2"), port)))
|
||||||
onoff.SetAttribute("OnTime", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=1]"))
|
onoff.SetConstantRate (ns.network.DataRate ("500kb/s"))
|
||||||
onoff.SetAttribute("OffTime", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=0]"))
|
|
||||||
|
|
||||||
app = onoff.Install(ns.network.NodeContainer(terminals.Get(0)))
|
app = onoff.Install(ns.network.NodeContainer(terminals.Get(0)))
|
||||||
# Start the application
|
# Start the application
|
||||||
|
|
|
@ -92,8 +92,7 @@ main (int argc, char *argv[])
|
||||||
NS_LOG_INFO ("Create Applications.");
|
NS_LOG_INFO ("Create Applications.");
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port)));
|
Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("500kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
|
|
||||||
ApplicationContainer app = onoff.Install (c0.Get (0));
|
ApplicationContainer app = onoff.Install (c0.Get (0));
|
||||||
// Start the application
|
// Start the application
|
||||||
|
|
|
@ -134,9 +134,7 @@ main (int argc, char *argv[])
|
||||||
// every few seconds
|
// every few seconds
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (multicastGroup, multicastPort)));
|
Address (InetSocketAddress (multicastGroup, multicastPort)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("255b/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("255b/s")));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (128));
|
onoff.SetAttribute ("PacketSize", UintegerValue (128));
|
||||||
|
|
||||||
ApplicationContainer srcC = onoff.Install (c0.Get (0));
|
ApplicationContainer srcC = onoff.Install (c0.Get (0));
|
||||||
|
|
|
@ -89,8 +89,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (interfaces.GetAddress (1), port)));
|
Address (InetSocketAddress (interfaces.GetAddress (1), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("500kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
|
|
||||||
ApplicationContainer app = onoff.Install (nodes.Get (0));
|
ApplicationContainer app = onoff.Install (nodes.Get (0));
|
||||||
// Start the application
|
// Start the application
|
||||||
|
|
|
@ -88,8 +88,7 @@ main (int argc, char *argv[])
|
||||||
socket.SetPhysicalAddress (devs.Get (1)->GetAddress ());
|
socket.SetPhysicalAddress (devs.Get (1)->GetAddress ());
|
||||||
socket.SetProtocol (2);
|
socket.SetProtocol (2);
|
||||||
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("500kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
ApplicationContainer apps = onoff.Install (nodes.Get (0));
|
ApplicationContainer apps = onoff.Install (nodes.Get (0));
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
apps.Stop (Seconds (10.0));
|
apps.Stop (Seconds (10.0));
|
||||||
|
|
|
@ -83,9 +83,7 @@ main (int argc, char *argv[])
|
||||||
Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2"));
|
Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2"));
|
||||||
InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3));
|
InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3));
|
||||||
OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
|
OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (15000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (15000)));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (1200));
|
onoff.SetAttribute ("PacketSize", UintegerValue (1200));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,9 +88,7 @@ main (int argc, char *argv[])
|
||||||
Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2"));
|
Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2"));
|
||||||
InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3));
|
InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3));
|
||||||
OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
|
OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (dataRate*1000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (dataRate*1000)));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (1250));
|
onoff.SetAttribute ("PacketSize", UintegerValue (1250));
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (0));
|
ApplicationContainer apps = onoff.Install (c.Get (0));
|
||||||
|
|
|
@ -132,8 +132,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
InetSocketAddress (i34.GetAddress (1), port));
|
InetSocketAddress (i34.GetAddress (1), port));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("448kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (0));
|
ApplicationContainer apps = onoff.Install (c.Get (0));
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
|
|
|
@ -158,8 +158,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port)));
|
Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("500kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
|
|
||||||
ApplicationContainer app = onoff.Install (terminals.Get (0));
|
ApplicationContainer app = onoff.Install (terminals.Get (0));
|
||||||
// Start the application
|
// Start the application
|
||||||
|
|
|
@ -191,9 +191,7 @@ int main (int argc, char** argv)
|
||||||
socket.SetProtocol (1);
|
socket.SetProtocol (1);
|
||||||
|
|
||||||
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=250]"));
|
onoff.SetConstantRate (DataRate (2*phyRate));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (2*phyRate)));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (pktSize));
|
onoff.SetAttribute ("PacketSize", UintegerValue (pktSize));
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (0));
|
ApplicationContainer apps = onoff.Install (c.Get (0));
|
||||||
|
|
|
@ -168,9 +168,7 @@ int main (int argc, char** argv)
|
||||||
socket.SetProtocol (1);
|
socket.SetProtocol (1);
|
||||||
|
|
||||||
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=250]"));
|
onoff.SetConstantRate (DataRate ("0.5Mbps"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("0.5Mbps")));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (125));
|
onoff.SetAttribute ("PacketSize", UintegerValue (125));
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (0));
|
ApplicationContainer apps = onoff.Install (c.Get (0));
|
||||||
|
|
|
@ -184,9 +184,7 @@ SpectrumIdealPhyTestCase::DoRun (void)
|
||||||
socket.SetProtocol (1);
|
socket.SetProtocol (1);
|
||||||
|
|
||||||
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=250]"));
|
onoff.SetConstantRate (DataRate (static_cast<uint64_t> (1.2*phyRate)));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (static_cast<uint64_t> (1.2*phyRate))));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (pktSize));
|
onoff.SetAttribute ("PacketSize", UintegerValue (pktSize));
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (0));
|
ApplicationContainer apps = onoff.Install (c.Get (0));
|
||||||
|
|
|
@ -207,8 +207,7 @@ main (int argc, char *argv[])
|
||||||
//
|
//
|
||||||
uint16_t port = 9; // Discard port (RFC 863)
|
uint16_t port = 9; // Discard port (RFC 863)
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory", InetSocketAddress (interfaces.GetAddress (1), port));
|
OnOffHelper onoff ("ns3::UdpSocketFactory", InetSocketAddress (interfaces.GetAddress (1), port));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("500kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (nodesLeft.Get (3));
|
ApplicationContainer apps = onoff.Install (nodesLeft.Get (3));
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "ns3/ipv4-global-routing-helper.h"
|
#include "ns3/ipv4-global-routing-helper.h"
|
||||||
#include "ns3/ipv4-static-routing-helper.h"
|
#include "ns3/ipv4-static-routing-helper.h"
|
||||||
#include "ns3/node.h"
|
#include "ns3/node.h"
|
||||||
|
#include "ns3/data-rate.h"
|
||||||
#include "ns3/node-container.h"
|
#include "ns3/node-container.h"
|
||||||
#include "ns3/on-off-helper.h"
|
#include "ns3/on-off-helper.h"
|
||||||
#include "ns3/packet.h"
|
#include "ns3/packet.h"
|
||||||
|
@ -133,9 +134,7 @@ CsmaBridgeTestCase::DoRun (void)
|
||||||
// 4096 bits / (5000 bits/second) = 0.82 second.
|
// 4096 bits / (5000 bits/second) = 0.82 second.
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port)));
|
Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (5000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
|
|
||||||
|
|
||||||
ApplicationContainer app = onoff.Install (terminals.Get (0));
|
ApplicationContainer app = onoff.Install (terminals.Get (0));
|
||||||
app.Start (Seconds (1.0));
|
app.Start (Seconds (1.0));
|
||||||
|
@ -249,9 +248,7 @@ CsmaBroadcastTestCase::DoRun (void)
|
||||||
// 4096 bits / (5000 bits/second) = 0.82 second.
|
// 4096 bits / (5000 bits/second) = 0.82 second.
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port)));
|
Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (5000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
|
|
||||||
|
|
||||||
ApplicationContainer app = onoff.Install (c0.Get (0));
|
ApplicationContainer app = onoff.Install (c0.Get (0));
|
||||||
// Start the application
|
// Start the application
|
||||||
|
@ -406,9 +403,7 @@ CsmaMulticastTestCase::DoRun (void)
|
||||||
// 4096 bits / (5000 bits/second) = 0.82 second.
|
// 4096 bits / (5000 bits/second) = 0.82 second.
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (multicastGroup, multicastPort)));
|
Address (InetSocketAddress (multicastGroup, multicastPort)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (5000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
|
|
||||||
|
|
||||||
ApplicationContainer srcC = onoff.Install (c0.Get (0));
|
ApplicationContainer srcC = onoff.Install (c0.Get (0));
|
||||||
|
|
||||||
|
@ -528,9 +523,7 @@ CsmaOneSubnetTestCase::DoRun (void)
|
||||||
// 4096 bits / (5000 bits/second) = 0.82 second.
|
// 4096 bits / (5000 bits/second) = 0.82 second.
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (interfaces.GetAddress (1), port)));
|
Address (InetSocketAddress (interfaces.GetAddress (1), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (5000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
|
|
||||||
|
|
||||||
ApplicationContainer app = onoff.Install (nodes.Get (0));
|
ApplicationContainer app = onoff.Install (nodes.Get (0));
|
||||||
// Start the application
|
// Start the application
|
||||||
|
@ -646,9 +639,7 @@ CsmaPacketSocketTestCase::DoRun (void)
|
||||||
socket.SetPhysicalAddress (devs.Get (1)->GetAddress ());
|
socket.SetPhysicalAddress (devs.Get (1)->GetAddress ());
|
||||||
socket.SetProtocol (2);
|
socket.SetProtocol (2);
|
||||||
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (5000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
|
|
||||||
ApplicationContainer apps = onoff.Install (nodes.Get (0));
|
ApplicationContainer apps = onoff.Install (nodes.Get (0));
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
apps.Stop (Seconds (10.0));
|
apps.Stop (Seconds (10.0));
|
||||||
|
@ -657,7 +648,6 @@ CsmaPacketSocketTestCase::DoRun (void)
|
||||||
socket.SetPhysicalAddress (devs.Get (0)->GetAddress ());
|
socket.SetPhysicalAddress (devs.Get (0)->GetAddress ());
|
||||||
socket.SetProtocol (3);
|
socket.SetProtocol (3);
|
||||||
onoff.SetAttribute ("Remote", AddressValue (socket));
|
onoff.SetAttribute ("Remote", AddressValue (socket));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
apps = onoff.Install (nodes.Get (3));
|
apps = onoff.Install (nodes.Get (3));
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
apps.Stop (Seconds (10.0));
|
apps.Stop (Seconds (10.0));
|
||||||
|
@ -762,9 +752,7 @@ CsmaPingTestCase::DoRun (void)
|
||||||
Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2"));
|
Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2"));
|
||||||
InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3));
|
InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3));
|
||||||
OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
|
OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (5000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
|
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (0));
|
ApplicationContainer apps = onoff.Install (c.Get (0));
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
|
@ -878,9 +866,7 @@ CsmaRawIpSocketTestCase::DoRun (void)
|
||||||
Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2"));
|
Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2"));
|
||||||
InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3));
|
InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3));
|
||||||
OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
|
OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (5000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
|
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (0));
|
ApplicationContainer apps = onoff.Install (c.Get (0));
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
|
@ -1033,9 +1019,7 @@ CsmaStarTestCase::DoRun (void)
|
||||||
// Make packets be sent about every DefaultPacketSize / DataRate =
|
// Make packets be sent about every DefaultPacketSize / DataRate =
|
||||||
// 4096 bits / (5000 bits/second) = 0.82 second.
|
// 4096 bits / (5000 bits/second) = 0.82 second.
|
||||||
OnOffHelper onOffHelper ("ns3::TcpSocketFactory", Address ());
|
OnOffHelper onOffHelper ("ns3::TcpSocketFactory", Address ());
|
||||||
onOffHelper.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onOffHelper.SetConstantRate (DataRate (5000));
|
||||||
onOffHelper.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onOffHelper.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
|
|
||||||
|
|
||||||
ApplicationContainer spokeApps;
|
ApplicationContainer spokeApps;
|
||||||
|
|
||||||
|
|
|
@ -199,9 +199,7 @@ DynamicGlobalRoutingTestCase::DoRun (void)
|
||||||
uint16_t port = 9; // Discard port (RFC 863)
|
uint16_t port = 9; // Discard port (RFC 863)
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
InetSocketAddress (i5i6.GetAddress (1), port));
|
InetSocketAddress (i5i6.GetAddress (1), port));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("2kbps"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", StringValue ("2kbps"));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (50));
|
onoff.SetAttribute ("PacketSize", UintegerValue (50));
|
||||||
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (1));
|
ApplicationContainer apps = onoff.Install (c.Get (1));
|
||||||
|
@ -368,9 +366,7 @@ GlobalRoutingSlash32TestCase::DoRun (void)
|
||||||
uint16_t port = 9; // Discard port (RFC 863)
|
uint16_t port = 9; // Discard port (RFC 863)
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
|
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (6000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
|
|
||||||
ApplicationContainer apps = onoff.Install (nA);
|
ApplicationContainer apps = onoff.Install (nA);
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
apps.Stop (Seconds (10.0));
|
apps.Stop (Seconds (10.0));
|
||||||
|
|
|
@ -149,10 +149,8 @@ WifiMsduAggregatorThroughputTest::DoRun (void)
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
InetSocketAddress (staNodeInterface.GetAddress (0),
|
InetSocketAddress (staNodeInterface.GetAddress (0),
|
||||||
udpPort));
|
udpPort));
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("1Mbps")));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (100));
|
onoff.SetAttribute ("PacketSize", UintegerValue (100));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("1Mbps"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
ApplicationContainer sourceApp = onoff.Install (ap.Get (0));
|
ApplicationContainer sourceApp = onoff.Install (ap.Get (0));
|
||||||
sourceApp.Start (Seconds (1.0));
|
sourceApp.Start (Seconds (1.0));
|
||||||
sourceApp.Stop (Seconds (9.0));
|
sourceApp.Stop (Seconds (9.0));
|
||||||
|
|
|
@ -135,9 +135,7 @@ StaticRoutingSlash32TestCase::DoRun (void)
|
||||||
uint16_t port = 9; // Discard port (RFC 863)
|
uint16_t port = 9; // Discard port (RFC 863)
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
|
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate (6000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
|
|
||||||
ApplicationContainer apps = onoff.Install (nA);
|
ApplicationContainer apps = onoff.Install (nA);
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
apps.Stop (Seconds (10.0));
|
apps.Stop (Seconds (10.0));
|
||||||
|
|
|
@ -170,9 +170,7 @@ int main (int argc, char *argv[])
|
||||||
InetSocketAddress dst = InetSocketAddress ( ipv4AddrServer );
|
InetSocketAddress dst = InetSocketAddress ( ipv4AddrServer );
|
||||||
|
|
||||||
OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
|
OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
|
onoff.SetConstantRate (DataRate (15000));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));
|
|
||||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (15000)));
|
|
||||||
onoff.SetAttribute ("PacketSize", UintegerValue (1200));
|
onoff.SetAttribute ("PacketSize", UintegerValue (1200));
|
||||||
|
|
||||||
NodeContainer clientNodes;
|
NodeContainer clientNodes;
|
||||||
|
|
|
@ -265,8 +265,7 @@ main (int argc, char *argv[])
|
||||||
uint16_t port = 9; // Discard port (RFC 863)
|
uint16_t port = 9; // Discard port (RFC 863)
|
||||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||||
Address (InetSocketAddress (Ipv4Address ("11.0.0.254"), port)));
|
Address (InetSocketAddress (Ipv4Address ("11.0.0.254"), port)));
|
||||||
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
|
onoff.SetConstantRate (DataRate ("448kb/s"));
|
||||||
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
|
|
||||||
ApplicationContainer apps = onoff.Install (c.Get (0));
|
ApplicationContainer apps = onoff.Install (c.Get (0));
|
||||||
apps.Start (Seconds (1.0));
|
apps.Start (Seconds (1.0));
|
||||||
apps.Stop (Seconds (10.0));
|
apps.Stop (Seconds (10.0));
|
||||||
|
|
Loading…
Reference in New Issue