23 #include "ns3/bs-net-device.h"
24 #include "ns3/config.h"
26 #include "ns3/packet.h"
27 #include "ns3/pointer.h"
28 #include "ns3/simple-ofdm-wimax-channel.h"
29 #include "ns3/simple-ofdm-wimax-phy.h"
30 #include "ns3/simulator.h"
31 #include "ns3/ss-net-device.h"
32 #include "ns3/wimax-channel.h"
33 #include "ns3/wimax-mac-to-mac-header.h"
34 #include "ns3/wimax-net-device.h"
35 #include "ns3/wimax-phy.h"
60 std::ostringstream oss;
61 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::" << netdevice <<
"/"
62 << connection <<
"/TxQueue/Enqueue";
67 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::" << netdevice <<
"/"
68 << connection <<
"/TxQueue/Dequeue";
73 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::" << netdevice <<
"/"
74 << connection <<
"/TxQueue/Drop";
86 phy = CreateObject<SimpleOfdmWimaxPhy>();
106 m_channel = CreateObject<SimpleOfdmWimaxChannel>();
119 sphy = CreateObject<SimpleOfdmWimaxPhy>();
121 sphy->SetSNRToBlockErrorRateTracesPath(SNRTraceFilePath);
122 sphy->ActivateLoss(activateLoss);
144 phy = CreateObject<SimpleOfdmWimaxPhy>();
162 sphy = CreateObject<SimpleOfdmWimaxPhy>();
164 sphy->SetSNRToBlockErrorRateTracesPath(SNRTraceFilePath);
165 sphy->ActivateLoss(activateLoss);
179 switch (schedulerType)
182 uplinkScheduler = CreateObject<UplinkSchedulerSimple>();
185 uplinkScheduler = CreateObject<UplinkSchedulerRtps>();
188 uplinkScheduler = CreateObject<UplinkSchedulerMBQoS>(
Seconds(0.25));
194 return uplinkScheduler;
201 switch (schedulerType)
204 bsScheduler = CreateObject<BSSchedulerSimple>();
207 bsScheduler = CreateObject<BSSchedulerRtps>();
210 bsScheduler = CreateObject<BSSchedulerSimple>();
224 double frameDuration)
227 for (
auto i = c.
Begin(); i != c.
End(); i++)
233 phy->SetFrameDuration(
Seconds(frameDuration));
243 deviceBS = CreateObject<BaseStationNetDevice>(node,
phy, uplinkScheduler, bsScheduler);
245 uplinkScheduler->SetBs(deviceBS);
246 bsScheduler->SetBs(deviceBS);
250 device = CreateObject<SubscriberStationNetDevice>(node,
phy);
253 phy->SetDevice(device);
271 for (
auto i = c.
Begin(); i != c.
End(); i++)
283 deviceBS = CreateObject<BaseStationNetDevice>(node,
phy, uplinkScheduler, bsScheduler);
285 uplinkScheduler->SetBs(deviceBS);
286 bsScheduler->SetBs(deviceBS);
290 device = CreateObject<SubscriberStationNetDevice>(node,
phy);
293 phy->SetDevice(device);
312 for (
auto i = c.
Begin(); i != c.
End(); i++)
324 deviceBS = CreateObject<BaseStationNetDevice>(node,
phy, uplinkScheduler, bsScheduler);
326 uplinkScheduler->SetBs(deviceBS);
327 bsScheduler->SetBs(deviceBS);
331 device = CreateObject<SubscriberStationNetDevice>(node,
phy);
334 phy->SetDevice(device);
360 deviceBS = CreateObject<BaseStationNetDevice>(node,
phy, uplinkScheduler, bsScheduler);
362 uplinkScheduler->SetBs(deviceBS);
363 bsScheduler->SetBs(deviceBS);
367 device = CreateObject<SubscriberStationNetDevice>(node,
phy);
370 phy->SetDevice(device);
430 *stream->
GetStream() << path << std::endl;
440 *stream->
GetStream() << path << std::endl;
471 bool explicitFilename)
481 NS_LOG_INFO(
"WimaxHelper::EnableAsciiInternal(): Device "
482 << device <<
" not of type ns3::WimaxNetDevice");
506 std::string filename;
507 if (explicitFilename)
517 uint32_t nodeid = nd->GetNode()->GetId();
518 uint32_t deviceid = nd->GetIfIndex();
519 std::ostringstream oss;
524 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Rx";
527 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Tx";
537 (
char*)
"WimaxNetDevice",
538 (
char*)
"InitialRangingConnection");
542 (
char*)
"WimaxNetDevice",
543 (
char*)
"BroadcastConnection");
559 ssNetDev->SetAsciiTxQueueEnqueueCallback(EnqueueCb);
563 ssNetDev->SetAsciiTxQueueDequeueCallback(DequeueCb);
567 ssNetDev->SetAsciiTxQueueDropCallback(DropCb);
585 uint32_t nodeid = nd->GetNode()->GetId();
586 uint32_t deviceid = nd->GetIfIndex();
587 std::ostringstream oss;
589 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Rx";
593 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Tx";
599 (
char*)
"WimaxNetDevice",
600 (
char*)
"InitialRangingConnection");
604 (
char*)
"WimaxNetDevice",
605 (
char*)
"BroadcastConnection");
619 ssNetDev->SetAsciiTxQueueEnqueueCallback(EnqueueCb);
623 ssNetDev->SetAsciiTxQueueDequeueCallback(DequeueCb);
627 ssNetDev->SetAsciiTxQueueDropCallback(DropCb);
639 std::list<Ptr<Packet>> packets = burst->GetPackets();
640 for (
auto iter = packets.begin(); iter != packets.end(); ++iter)
652 bool explicitFilename,
663 NS_LOG_INFO(
"WimaxHelper::EnablePcapInternal(): Device "
664 << &device <<
" not of type ns3::WimaxNetDevice");
670 std::string filename;
671 if (explicitFilename)
697 int64_t currentStream = stream;
699 for (
auto i = c.
Begin(); i != c.
End(); ++i)
706 currentStream += wimax->GetPhy()->AssignStreams(currentStream);
711 currentStream +=
m_channel->AssignStreams(currentStream);
713 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.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
std::ostream * GetStream()
Return a pointer to an ostream previously set in the wrapper.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Ptr< Packet > Copy() const
performs a COW copy of the packet.
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.
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.
void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool explicitFilename, bool promiscuous) override
Enable pcap output on the indicated net device.
ServiceFlow CreateServiceFlow(ServiceFlow::Direction direction, ServiceFlow::SchedulingType schedulinType, IpcsClassifierRecord classifier)
Creates a transport service flow.
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.
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
@ LOG_LEVEL_ALL
Print everything.