23 #include "ns3/simulator.h"
24 #include "ns3/packet.h"
27 #include "ns3/config.h"
28 #include "ns3/wimax-net-device.h"
29 #include "ns3/bs-net-device.h"
30 #include "ns3/ss-net-device.h"
31 #include "ns3/wimax-channel.h"
32 #include "ns3/simple-ofdm-wimax-channel.h"
33 #include "ns3/wimax-phy.h"
34 #include "ns3/simple-ofdm-wimax-phy.h"
35 #include "ns3/pointer.h"
36 #include "ns3/wimax-mac-to-mac-header.h"
58 std::ostringstream oss;
59 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::" << netdevice <<
"/" << connection
60 <<
"/TxQueue/Enqueue";
64 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::" << netdevice <<
"/" << connection
65 <<
"/TxQueue/Dequeue";
69 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::" << netdevice <<
"/" << connection
80 phy = CreateObject<SimpleOfdmWimaxPhy> ();
98 m_channel = CreateObject<SimpleOfdmWimaxChannel> ();
110 sphy = CreateObject<SimpleOfdmWimaxPhy> ();
112 sphy->SetSNRToBlockErrorRateTracesPath (SNRTraceFilePath);
113 sphy->ActivateLoss (activateLoss);
133 phy = CreateObject<SimpleOfdmWimaxPhy> ();
150 sphy = CreateObject<SimpleOfdmWimaxPhy> ();
152 sphy->SetSNRToBlockErrorRateTracesPath (SNRTraceFilePath);
153 sphy->ActivateLoss (activateLoss);
166 switch (schedulerType)
169 uplinkScheduler = CreateObject<UplinkSchedulerSimple> ();
172 uplinkScheduler = CreateObject<UplinkSchedulerRtps> ();
175 uplinkScheduler = CreateObject<UplinkSchedulerMBQoS> (Seconds (0.25));
181 return uplinkScheduler;
187 switch (schedulerType)
190 bsScheduler = CreateObject<BSSchedulerSimple> ();
193 bsScheduler = CreateObject<BSSchedulerRtps> ();
196 bsScheduler = CreateObject<BSSchedulerSimple> ();
209 double frameDuration)
218 phy->SetFrameDuration (Seconds (frameDuration));
228 deviceBS = CreateObject<BaseStationNetDevice> (node, phy, uplinkScheduler, bsScheduler);
230 uplinkScheduler->SetBs (deviceBS);
231 bsScheduler->SetBs (deviceBS);
235 device = CreateObject<SubscriberStationNetDevice> (node, phy);
238 phy->SetDevice (device);
244 devices.
Add (device);
267 deviceBS = CreateObject<BaseStationNetDevice> (node, phy, uplinkScheduler, bsScheduler);
269 uplinkScheduler->SetBs (deviceBS);
270 bsScheduler->SetBs (deviceBS);
274 device = CreateObject<SubscriberStationNetDevice> (node, phy);
277 phy->SetDevice (device);
283 devices.
Add (device);
307 deviceBS = CreateObject<BaseStationNetDevice> (node, phy, uplinkScheduler, bsScheduler);
309 uplinkScheduler->SetBs (deviceBS);
310 bsScheduler->SetBs (deviceBS);
314 device = CreateObject<SubscriberStationNetDevice> (node, phy);
317 phy->SetDevice (device);
319 device->Attach (channel);
322 devices.
Add (device);
343 deviceBS = CreateObject<BaseStationNetDevice> (node, phy, uplinkScheduler, bsScheduler);
345 uplinkScheduler->SetBs (deviceBS);
346 bsScheduler->SetBs (deviceBS);
350 device = CreateObject<SubscriberStationNetDevice> (node, phy);
353 phy->SetDevice (device);
355 device->Attach (channel);
413 *stream->
GetStream () << path << std::endl;
419 *stream->
GetStream () << path << std::endl;
449 bool explicitFilename)
459 NS_LOG_INFO (
"WimaxHelper::EnableAsciiInternal(): Device " << device <<
" not of type ns3::WimaxNetDevice");
483 std::string filename;
484 if (explicitFilename)
494 uint32_t nodeid = nd->GetNode ()->GetId ();
495 uint32_t deviceid = nd->GetIfIndex ();
496 std::ostringstream oss;
501 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Rx";
504 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Tx";
511 EnableAsciiForConnection (theStream, nodeid, deviceid, (
char*)
"WimaxNetDevice", (
char*)
"InitialRangingConnection");
513 EnableAsciiForConnection (theStream, nodeid, deviceid, (
char*)
"SubscriberStationNetDevice", (
char*)
"BasicConnection");
514 EnableAsciiForConnection (theStream, nodeid, deviceid, (
char*)
"SubscriberStationNetDevice", (
char*)
"PrimaryConnection");
530 uint32_t nodeid = nd->GetNode ()->GetId ();
531 uint32_t deviceid = nd->GetIfIndex ();
532 std::ostringstream oss;
534 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Rx";
538 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Tx";
543 EnableAsciiForConnection (stream, nodeid, deviceid, (
char*)
"SubscriberStationNetDevice", (
char*)
"BasicConnection");
544 EnableAsciiForConnection (stream, nodeid, deviceid, (
char*)
"SubscriberStationNetDevice", (
char*)
"PrimaryConnection");
551 std::list<Ptr<Packet> > packets = burst->
GetPackets ();
572 NS_LOG_INFO (
"WimaxHelper::EnablePcapInternal(): Device " << &device <<
" not of type ns3::WimaxNetDevice");
578 std::string filename;
579 if (explicitFilename)
598 return m_channel->AssignStreams (stream);
604 int64_t currentStream = stream;
613 currentStream += wimax->GetPhy ()->AssignStreams (currentStream);
618 currentStream +=
m_channel->AssignStreams (currentStream);
620 return (currentStream - stream);
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
Manage ASCII trace files for device models.
#define NS_LOG_FUNCTION(parameters)
static void DefaultEnqueueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Ptr< PcapFileWrapper > CreateFile(std::string filename, std::ios::openmode filemode, uint32_t dataLinkType, uint32_t snapLen=65535, int32_t tzCorrection=0)
Create and initialize a pcap file.
An migration-based uplink scheduler.
static void AsciiRxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &source)
std::vector< Ptr< Node > >::const_iterator Iterator
void SetMaxSustainedTrafficRate(uint32_t)
Manage pcap files for device models.
void Write(Time t, Ptr< const Packet > p)
Write the next packet to file.
SchedulerType
Scheduler Type Different implementations of uplink/downlink scheduler.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Build bound Callbacks which take varying numbers of arguments, and potentially returning a value...
NetDeviceType
Net Device Type Distinguish a subscriber station(SS) device from base station(BS) device...
static void DefaultDropSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
uint32_t GetSize(void) const
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits. ...
void Connect(std::string path, const CallbackBase &cb)
std::string GetFilenameFromDevice(std::string prefix, Ptr< NetDevice > device, bool useObjectNames=true)
Let the ascii trace helper figure out a reasonable filename to use for an ascii trace file associated...
NetDeviceContainer Install(NodeContainer c, NetDeviceType type, PhyType phyType, SchedulerType schedulerType)
void SetMinReservedTrafficRate(uint32_t)
void SetServiceSchedulingType(enum ServiceFlow::SchedulingType)
#define NS_FATAL_ERROR(msg)
fatal error handling
static void PcapSniffTxRxEvent(Ptr< PcapFileWrapper > file, Ptr< const PacketBurst > burst)
NS_LOG_COMPONENT_DEFINE("WimaxHelper")
A simple scheduler - rtPS based scheduler.
static void EnableAsciiForConnection(Ptr< OutputStreamWrapper > oss, uint32_t nodeid, uint32_t deviceid, char *netdevice, char *connection)
Enable ascii trace output on the indicated net device for a given connection.
double GetSeconds(void) const
void SetMaxTrafficBurst(uint32_t)
std::string GetFilenameFromDevice(std::string prefix, Ptr< NetDevice > device, bool useObjectNames=true)
Let the pcap helper figure out a reasonable filename to use for a pcap file associated with a device...
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
static void EnablePrinting(void)
By default, packets do not keep around enough metadata to perform the operations requested by the Pri...
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
holds a vector of ns3::NetDevice pointers
Ptr< WimaxChannel > m_channel
void SetRequestTransmissionPolicy(uint32_t)
void SetUnsolicitedGrantInterval(uint16_t)
void SetPropagationLossModel(SimpleOfdmWimaxChannel::PropModel propagationModel)
Set the propagation and loss model of the channel.
Ptr< Packet > Copy(void) const
void SetTrafficPriority(uint8_t)
void SetConvergenceSublayerParam(CsParameters)
static void DefaultDequeueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Hold together all Wimax-related objects in a NetDevice.
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
This class implements service flows as described by the IEEE-802.16 standard.
void SetMaximumLatency(uint32_t)
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
static Time Now(void)
Return the "current simulation time".
void SetMinTolerableTrafficRate(uint32_t)
static void AsciiTxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &dest)
uint32_t AddDevice(Ptr< NetDevice > device)
std::vector< Ptr< NetDevice > >::const_iterator Iterator
ServiceFlow CreateServiceFlow(ServiceFlow::Direction direction, ServiceFlow::SchedulingType schedulinType, IpcsClassifierRecord classifier)
Creates a transport service flow.
Ptr< WimaxPhy > CreatePhyWithoutChannel(PhyType phyType)
Ptr< BSScheduler > CreateBSScheduler(SchedulerType schedulerType)
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool explicitFilename, bool promiscuous)
Enable pcap output on the indicated net device.
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ascii trace output on the indicated net device.
void SetToleratedJitter(uint32_t)
static void EnableLogComponents(void)
Helper to enable all WimaxNetDevice log components with one statement.
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
Ptr< WimaxPhy > CreatePhy(PhyType phyType)
Ptr< UplinkScheduler > CreateUplinkScheduler(SchedulerType schedulerType)
WimaxHelper(void)
Create a Wimax helper in an empty state.
PhyType
WiMAX Physical layer WiMAX Physical layers with different levels of detail.
void SetCsSpecification(enum CsSpecification)
std::list< Ptr< Packet > > GetPackets(void) const
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
void AddHeader(const Header &header)
Add header to this packet.
A simple priority-based FCFS scheduler.
void LogComponentEnable(char const *name, enum LogLevel level)