|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
53 #include "ns3/core-module.h"
54 #include "ns3/network-module.h"
55 #include "ns3/applications-module.h"
56 #include "ns3/mobility-module.h"
57 #include "ns3/config-store-module.h"
58 #include "ns3/wimax-module.h"
59 #include "ns3/csma-module.h"
61 #include "ns3/global-route-manager.h"
62 #include "ns3/internet-module.h"
63 #include "ns3/vector.h"
70 int main (
int argc,
char *argv[])
75 std::vector<Ptr<SubscriberStationNetDevice> > ss;
92 std::vector<Ptr<RandomWaypointMobilityModel> > SSPosition;
93 std::vector<Ptr<RandomRectanglePositionAllocator> > SSPosAllocator;
96 int nbSS = 10, duration = 7, schedType = 0;
100 cmd.AddValue (
"nbSS",
"number of subscriber station to create", nbSS);
101 cmd.AddValue (
"scheduler",
"type of scheduler to use with the netdevices", schedType);
102 cmd.AddValue (
"duration",
"duration of the simulation in seconds", duration);
103 cmd.AddValue (
"verbose",
"turn on all WimaxNetDevice log components",
verbose);
104 cmd.Parse (argc, argv);
125 SSPosition.resize (nbSS);
126 SSPosAllocator.resize (nbSS);
136 channel = CreateObject<SimpleOfdmWimaxChannel> ();
138 ssDevs = wimax.
Install (ssNodes,
149 BSPosition = CreateObject<ConstantPositionMobilityModel> ();
159 for (
int i = 0; i < nbSS; i++)
161 SSPosition[i] = CreateObject<RandomWaypointMobilityModel> ();
162 SSPosAllocator[i] = CreateObject<RandomRectanglePositionAllocator> ();
166 SSPosAllocator[i]->SetX (xVar);
170 SSPosAllocator[i]->SetY (yVar);
171 SSPosition[i]->SetAttribute (
"PositionAllocator",
PointerValue (SSPosAllocator[i]));
172 SSPosition[i]->SetAttribute (
"Speed",
StringValue (
"ns3::UniformRandomVariable[Min=10.3|Max=40.7]"));
173 SSPosition[i]->SetAttribute (
"Pause",
StringValue (
"ns3::ConstantRandomVariable[Constant=0.01]"));
189 LAN_ASN_BS.
Add (bsNodes.
Get (0));
191 LAN_ASN_BS.
Add (ASNGW_Node.
Get (0));
200 BS_CSMADevs.
Add (LAN_ASN_BS_Devs.
Get (0));
203 ASN_Devs1.
Add (LAN_ASN_BS_Devs.
Get (1));
208 LAN_ASN_STREAMER.
Add (ASNGW_Node.
Get (0));
209 LAN_ASN_STREAMER.
Add (Streamer_Node.
Get (0));
219 ASN_Devs2.
Add (LAN_ASN_STREAMER_Devs.
Get (0));
220 STREAMER_Devs.
Add (LAN_ASN_STREAMER_Devs.
Get (1));
225 stack.Install (bsNodes);
227 stack.Install (ssNodes);
228 stack.Install (Streamer_Node);
229 stack.Install (ASNGW_Node);
233 address.SetBase (
"10.1.0.0",
"255.255.255.0");
235 BSinterfaces =
address.Assign (bsDevsOne);
236 SSinterfaces =
address.Assign (ssDevs);
238 address.SetBase (
"11.1.1.0",
"255.255.255.0");
242 address.SetBase (
"12.1.1.0",
"255.255.255.0");
255 multicast.
AddMulticastRoute (multicastRouter, multicastSource, multicastGroup, inputIf, ASN_Devs1);
263 multicastRouter = bsNodes.
Get (0);
264 inputIf = BS_CSMADevs.
Get (0);
266 multicast.
AddMulticastRoute (multicastRouter, multicastSource, multicastGroup, inputIf, bsDevsOne);
268 uint16_t multicast_port = 100;
295 MulticastClassifier);
303 for (
int i = 0; i < nbSS; i++)
307 SSPosAllocator[i] = 0;
holds a vector of ns3::NetDevice pointers
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
AttributeValue implementation for DataRate.
Parse command-line arguments.
@ LOG_LEVEL_INFO
LOG_INFO and above.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
@ MODULATION_TYPE_QPSK_12
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void SetPosition(const Vector &position)
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Ipv4 addresses are stored in host order in this class.
Hold objects of type Ptr<T>.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttri...
Create UdpTraceClient application which sends UDP packets based on a trace file of an MPEG4 stream.
@ SCHED_TYPE_SIMPLE
A simple priority-based FCFS scheduler.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
build a set of CsmaNetDevice objects
Create a server application which waits for input UDP packets and uses the information carried into t...
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
Helper class that adds ns3::Ipv4StaticRouting objects.
Smart pointer class similar to boost::intrusive_ptr.
Class for representing data rates.
@ DEVICE_TYPE_BASE_STATION
Base station(BS) device.
ApplicationContainer Install(NodeContainer c)
@ DEVICE_TYPE_SUBSCRIBER_STATION
Subscriber station(SS) device.
NetDeviceContainer Install(NodeContainer c, NetDeviceType type, PhyType phyType, SchedulerType schedulerType)
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
helps to manage and create WimaxNetDevice objects
void SetChannelAttribute(std::string n1, const AttributeValue &v1)
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
@ MODULATION_TYPE_QAM16_12
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
@ SCHED_TYPE_RTPS
A simple scheduler - rtPS based scheduler.
ServiceFlow CreateServiceFlow(ServiceFlow::Direction direction, ServiceFlow::SchedulingType schedulinType, IpcsClassifierRecord classifier)
Creates a transport service flow.
static void EnableLogComponents(void)
Helper to enable all WimaxNetDevice log components with one statement.
SubscriberStationNetDevice subclass of WimaxNetDevice.
static void Run(void)
Run the simulation.
Hold variables of type string.
void AddMulticastRoute(Ptr< Node > n, Ipv4Address source, Ipv4Address group, Ptr< NetDevice > input, NetDeviceContainer output)
Add a multicast route to a node and net device using explicit Ptr<Node> and Ptr<NetDevice>
Time Seconds(double value)
Construct a Time in the indicated unit.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
holds a vector of ns3::Application pointers.
@ SCHED_TYPE_MBQOS
An migration-based uplink scheduler.
AttributeValue implementation for Time.
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
ApplicationContainer Install(NodeContainer c)
Create one UDP server application on each of the Nodes in the NodeContainer.
keep track of a set of node pointers.
a class to represent an Ipv4 address mask
SchedulerType
Scheduler Type Different implementations of uplink/downlink scheduler.
This class implements service flows as described by the IEEE-802.16 standard.
Hold an unsigned integer type.
void SetDefaultMulticastRoute(Ptr< Node > n, Ptr< NetDevice > nd)
Add a default route to the static routing protocol to forward packets out a particular interface.
aggregate IP/TCP/UDP functionality to existing Nodes.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Ptr< BsServiceFlowManager > GetServiceFlowManager(void) const
Helper class used to assign positions and mobility models to nodes.
IpcsClassifierRecord class.