12#include "ns3/bs-net-device.h"
13#include "ns3/config.h"
15#include "ns3/packet.h"
16#include "ns3/pointer.h"
17#include "ns3/simple-ofdm-wimax-channel.h"
18#include "ns3/simple-ofdm-wimax-phy.h"
19#include "ns3/simulator.h"
20#include "ns3/ss-net-device.h"
21#include "ns3/wimax-channel.h"
22#include "ns3/wimax-mac-to-mac-header.h"
23#include "ns3/wimax-net-device.h"
24#include "ns3/wimax-phy.h"
49 std::ostringstream oss;
50 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::" << netdevice <<
"/"
51 << connection <<
"/TxQueue/Enqueue";
56 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::" << netdevice <<
"/"
57 << connection <<
"/TxQueue/Dequeue";
62 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::" << netdevice <<
"/"
63 << connection <<
"/TxQueue/Drop";
110 sphy->SetSNRToBlockErrorRateTracesPath(SNRTraceFilePath);
111 sphy->ActivateLoss(activateLoss);
153 sphy->SetSNRToBlockErrorRateTracesPath(SNRTraceFilePath);
154 sphy->ActivateLoss(activateLoss);
168 switch (schedulerType)
183 return uplinkScheduler;
190 switch (schedulerType)
213 double frameDuration)
216 for (
auto i = c.
Begin(); i != c.
End(); i++)
222 phy->SetFrameDuration(
Seconds(frameDuration));
234 uplinkScheduler->SetBs(deviceBS);
235 bsScheduler->SetBs(deviceBS);
242 phy->SetDevice(device);
246 node->AddDevice(device);
260 for (
auto i = c.
Begin(); i != c.
End(); i++)
274 uplinkScheduler->SetBs(deviceBS);
275 bsScheduler->SetBs(deviceBS);
282 phy->SetDevice(device);
286 node->AddDevice(device);
301 for (
auto i = c.
Begin(); i != c.
End(); i++)
315 uplinkScheduler->SetBs(deviceBS);
316 bsScheduler->SetBs(deviceBS);
323 phy->SetDevice(device);
325 device->Attach(channel);
327 node->AddDevice(device);
351 uplinkScheduler->SetBs(deviceBS);
352 bsScheduler->SetBs(deviceBS);
359 phy->SetDevice(device);
361 device->Attach(channel);
363 node->AddDevice(device);
419 *stream->GetStream() << path << std::endl;
429 *stream->GetStream() << path << std::endl;
460 bool explicitFilename)
470 NS_LOG_INFO(
"WimaxHelper::EnableAsciiInternal(): Device "
471 << device <<
" not of type ns3::WimaxNetDevice");
495 std::string filename;
496 if (explicitFilename)
506 uint32_t nodeid = nd->GetNode()->GetId();
507 uint32_t deviceid = nd->GetIfIndex();
508 std::ostringstream oss;
513 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Rx";
516 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Tx";
526 (
char*)
"WimaxNetDevice",
527 (
char*)
"InitialRangingConnection");
531 (
char*)
"WimaxNetDevice",
532 (
char*)
"BroadcastConnection");
548 ssNetDev->SetAsciiTxQueueEnqueueCallback(EnqueueCb);
552 ssNetDev->SetAsciiTxQueueDequeueCallback(DequeueCb);
556 ssNetDev->SetAsciiTxQueueDropCallback(DropCb);
574 uint32_t nodeid = nd->GetNode()->GetId();
575 uint32_t deviceid = nd->GetIfIndex();
576 std::ostringstream oss;
578 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Rx";
582 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Tx";
588 (
char*)
"WimaxNetDevice",
589 (
char*)
"InitialRangingConnection");
593 (
char*)
"WimaxNetDevice",
594 (
char*)
"BroadcastConnection");
608 ssNetDev->SetAsciiTxQueueEnqueueCallback(EnqueueCb);
612 ssNetDev->SetAsciiTxQueueDequeueCallback(DequeueCb);
616 ssNetDev->SetAsciiTxQueueDropCallback(DropCb);
628 std::list<Ptr<Packet>> packets = burst->GetPackets();
629 for (
auto iter = packets.begin(); iter != packets.end(); ++iter)
641 bool explicitFilename,
652 NS_LOG_INFO(
"WimaxHelper::EnablePcapInternal(): Device "
653 << &device <<
" not of type ns3::WimaxNetDevice");
659 std::string filename;
660 if (explicitFilename)
686 int64_t currentStream = stream;
688 for (
auto i = c.
Begin(); i != c.
End(); ++i)
695 currentStream += wimax->GetPhy()->AssignStreams(currentStream);
700 currentStream +=
m_channel->AssignStreams(currentStream);
702 return (currentStream - stream);
Manage ASCII trace files for device models.
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...
static void DefaultDropSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Drop default trace sink.
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.
static void DefaultEnqueueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Enqueue default trace sink.
static void DefaultDequeueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Dequeue default trace sink.
IpcsClassifierRecord class.
static Mac48Address Allocate()
Allocate a new Mac48Address.
holds a vector of ns3::NetDevice pointers
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
Iterator End() const
Get an iterator which indicates past-the-last NetDevice in the container.
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
static void EnablePrinting()
Enable printing packets metadata.
Manage pcap files for device models.
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.
Ptr< PcapFileWrapper > CreateFile(std::string filename, std::ios::openmode filemode, DataLinkType dataLinkType, uint32_t snapLen=std::numeric_limits< uint32_t >::max(), int32_t tzCorrection=0)
Create and initialize a pcap file.
Smart pointer class similar to boost::intrusive_ptr.
This class implements service flows as described by the IEEE-802.16 standard.
void SetRequestTransmissionPolicy(uint32_t policy)
Set request transmission policy.
void SetCsSpecification(CsSpecification spec)
Set CS specification.
void SetMaxTrafficBurst(uint32_t maxTrafficBurst)
Set maximum traffic burst.
void SetServiceSchedulingType(ServiceFlow::SchedulingType schedType)
Set service scheduling type.
void SetMaximumLatency(uint32_t MaximumLatency)
Set maximum latency.
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
void SetConvergenceSublayerParam(CsParameters csparam)
Set convergence sublayer parameters.
void SetSduSize(uint8_t sduSize)
Set SDU size.
void SetTrafficPriority(uint8_t priority)
Set traffic priority.
void SetMinTolerableTrafficRate(uint32_t minJitter)
Set minimum tolerable traffic rate.
void SetToleratedJitter(uint32_t jitter)
Set tolerated jitter.
void SetUnsolicitedGrantInterval(uint16_t unsolicitedGrantInterval)
Set unsolicited grant interval.
void SetMinReservedTrafficRate(uint32_t minResvRate)
Set minimum reserved traffic rate.
Direction
Direction enumeration.
void SetMaxSustainedTrafficRate(uint32_t maxSustainedRate)
Set max sustained traffic rate.
SimpleOfdmWimaxChannel class.
PropModel
PropModel enumeration.
static Time Now()
Return the current simulation virtual time.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
SchedulerType
Scheduler Type Different implementations of uplink/downlink scheduler.
@ SCHED_TYPE_RTPS
A simple scheduler - rtPS based scheduler.
@ SCHED_TYPE_MBQOS
An migration-based uplink scheduler.
@ SCHED_TYPE_SIMPLE
A simple priority-based FCFS scheduler.
NetDeviceType
Net Device Type Distinguish a subscriber station(SS) device from base station(BS) device.
@ DEVICE_TYPE_BASE_STATION
Base station(BS) device.
Ptr< WimaxChannel > m_channel
wifi channel
Ptr< WimaxPhy > CreatePhyWithoutChannel(PhyType phyType)
Ptr< UplinkScheduler > CreateUplinkScheduler(SchedulerType schedulerType)
void SetPropagationLossModel(SimpleOfdmWimaxChannel::PropModel propagationModel)
Set the propagation and loss model of the channel.
PhyType
WiMAX Physical layer WiMAX Physical layers with different levels of detail.
Ptr< BSScheduler > CreateBSScheduler(SchedulerType schedulerType)
Ptr< WimaxPhy > CreatePhy(PhyType phyType)
WimaxHelper()
Create a Wimax helper in an empty state.
void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) override
Enable ascii trace output on the indicated net device.
static void AsciiTxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &dest)
ASCII trace transmit event.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
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.
NetDeviceContainer Install(NodeContainer c, NetDeviceType type, PhyType phyType, SchedulerType schedulerType)
static void EnableLogComponents()
Helper to enable all WimaxNetDevice log components with one statement.
static void AsciiRxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &source)
ASCII trace receive event.
ServiceFlow CreateServiceFlow(ServiceFlow::Direction direction, ServiceFlow::SchedulingType schedulingType, IpcsClassifierRecord classifier)
Creates a transport service flow.
void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool explicitFilename, bool promiscuous) override
Enable pcap output on the indicated net device.
Hold together all WiMAX-related objects in a NetDevice.
void Connect(std::string path, const CallbackBase &cb)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
static void PcapSniffTxRxEvent(Ptr< PcapFileWrapper > file, Ptr< const PacketBurst > burst)
print pcap record
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
@ LOG_LEVEL_ALL
Print everything.