52#include "ns3/applications-module.h"
53#include "ns3/config-store-module.h"
54#include "ns3/core-module.h"
55#include "ns3/csma-module.h"
56#include "ns3/global-route-manager.h"
57#include "ns3/internet-module.h"
58#include "ns3/mobility-module.h"
59#include "ns3/network-module.h"
60#include "ns3/vector.h"
61#include "ns3/wimax-module.h"
71main(
int argc,
char* argv[])
76 std::vector<Ptr<SubscriberStationNetDevice>> ss;
94 std::vector<Ptr<RandomWaypointMobilityModel>> SSPosition;
95 std::vector<Ptr<RandomRectanglePositionAllocator>> SSPosAllocator;
104 cmd.AddValue(
"nbSS",
"number of subscriber station to create", nbSS);
105 cmd.AddValue(
"scheduler",
"type of scheduler to use with the netdevices", schedType);
106 cmd.AddValue(
"duration",
"duration of the simulation in seconds", duration);
107 cmd.AddValue(
"verbose",
"turn on all WimaxNetDevice log components",
verbose);
108 cmd.Parse(argc, argv);
116 scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
119 scheduler = WimaxHelper::SCHED_TYPE_MBQOS;
122 scheduler = WimaxHelper::SCHED_TYPE_RTPS;
125 scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
129 SSPosition.resize(nbSS);
130 SSPosAllocator.resize(nbSS);
140 channel = CreateObject<SimpleOfdmWimaxChannel>();
141 channel->SetPropagationModel(SimpleOfdmWimaxChannel::COST231_PROPAGATION);
142 ssDevs = wimax.
Install(ssNodes,
143 WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
144 WimaxHelper::SIMPLE_PHY_TYPE_OFDM,
148 WimaxHelper::DEVICE_TYPE_BASE_STATION,
149 WimaxHelper::SIMPLE_PHY_TYPE_OFDM,
153 BSPosition = CreateObject<ConstantPositionMobilityModel>();
155 BSPosition->SetPosition(
Vector(1000, 0, 0));
163 for (
int i = 0; i < nbSS; i++)
165 SSPosition[i] = CreateObject<RandomWaypointMobilityModel>();
166 SSPosAllocator[i] = CreateObject<RandomRectanglePositionAllocator>();
170 SSPosAllocator[i]->SetX(xVar);
174 SSPosAllocator[i]->SetY(yVar);
175 SSPosition[i]->SetAttribute(
"PositionAllocator",
PointerValue(SSPosAllocator[i]));
176 SSPosition[i]->SetAttribute(
"Speed",
177 StringValue(
"ns3::UniformRandomVariable[Min=10.3|Max=40.7]"));
178 SSPosition[i]->SetAttribute(
"Pause",
179 StringValue(
"ns3::ConstantRandomVariable[Constant=0.01]"));
194 LAN_ASN_BS.
Add(bsNodes.
Get(0));
196 LAN_ASN_BS.
Add(ASNGW_Node.
Get(0));
205 BS_CSMADevs.
Add(LAN_ASN_BS_Devs.
Get(0));
208 ASN_Devs1.
Add(LAN_ASN_BS_Devs.
Get(1));
213 LAN_ASN_STREAMER.
Add(ASNGW_Node.
Get(0));
214 LAN_ASN_STREAMER.
Add(Streamer_Node.
Get(0));
224 ASN_Devs2.
Add(LAN_ASN_STREAMER_Devs.
Get(0));
225 STREAMER_Devs.
Add(LAN_ASN_STREAMER_Devs.
Get(1));
230 stack.Install(bsNodes);
232 stack.Install(ssNodes);
233 stack.Install(Streamer_Node);
234 stack.Install(ASNGW_Node);
238 address.SetBase(
"10.1.0.0",
"255.255.255.0");
240 BSinterfaces =
address.Assign(bsDevsOne);
241 SSinterfaces =
address.Assign(ssDevs);
243 address.SetBase(
"11.1.1.0",
"255.255.255.0");
247 address.SetBase(
"12.1.1.0",
"255.255.255.0");
271 multicastRouter = bsNodes.
Get(0);
272 inputIf = BS_CSMADevs.
Get(0);
280 uint16_t multicast_port = 100;
306 ServiceFlow::SF_TYPE_UGS,
307 MulticastClassifier);
309 bs->GetServiceFlowManager()->AddMulticastServiceFlow(MulticastServiceFlow,
310 WimaxPhy::MODULATION_TYPE_QPSK_12);
312 Simulator::Stop(
Seconds(duration + 0.1));
316 for (
int i = 0; i < nbSS; i++)
319 SSPosition[i] =
nullptr;
320 SSPosAllocator[i] =
nullptr;
325 Simulator::Destroy();
holds a vector of ns3::Application pointers.
Parse command-line arguments.
build a set of CsmaNetDevice objects
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
void SetChannelAttribute(std::string n1, const AttributeValue &v1)
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttri...
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
aggregate IP/TCP/UDP functionality to existing Nodes.
IpcsClassifierRecord class.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Ipv4 addresses are stored in host order in this class.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
a class to represent an Ipv4 address mask
Helper class that adds ns3::Ipv4StaticRouting objects.
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>
void SetDefaultMulticastRoute(Ptr< Node > n, Ptr< NetDevice > nd)
Add a default route to the static routing protocol to forward packets out a particular interface.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Hold objects of type Ptr<T>.
Smart pointer class similar to boost::intrusive_ptr.
This class implements service flows as described by the IEEE-802.16 standard.
Hold variables of type string.
SubscriberStationNetDevice subclass of WimaxNetDevice.
void SetModulationType(WimaxPhy::ModulationType modulationType)
Set the most efficient modulation and coding scheme (MCS) supported by the device.
AttributeValue implementation for Time.
Create a server application which waits for input UDP packets and uses the information carried into t...
ApplicationContainer Install(NodeContainer c)
Create one UDP server application on each of the Nodes in the NodeContainer.
Create UdpTraceClient application which sends UDP packets based on a trace file of an MPEG4 stream.
ApplicationContainer Install(NodeContainer c)
Hold an unsigned integer type.
Vector3D Vector
Vector alias typedef for compatibility with mobility models.
helps to manage and create WimaxNetDevice objects
SchedulerType
Scheduler Type Different implementations of uplink/downlink scheduler.
NetDeviceContainer Install(NodeContainer c, NetDeviceType type, PhyType phyType, SchedulerType schedulerType)
static void EnableLogComponents()
Helper to enable all WimaxNetDevice log components with one statement.
ServiceFlow CreateServiceFlow(ServiceFlow::Direction direction, ServiceFlow::SchedulingType schedulinType, IpcsClassifierRecord classifier)
Creates a transport service flow.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ LOG_LEVEL_INFO
LOG_INFO and above.
void LogComponentEnable(const char *name, enum LogLevel level)
Enable the logging output associated with that log component.