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);
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);
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);
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);
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)
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");
524 ssNetDev->SetAsciiTxQueueEnqueueCallback (EnqueueCb);
527 ssNetDev->SetAsciiTxQueueDequeueCallback (DequeueCb);
530 ssNetDev->SetAsciiTxQueueDropCallback (DropCb);
550 std::ostringstream oss;
552 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Rx";
556 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::WimaxNetDevice/Tx";
572 ssNetDev->SetAsciiTxQueueEnqueueCallback (EnqueueCb);
575 ssNetDev->SetAsciiTxQueueDequeueCallback (DequeueCb);
578 ssNetDev->SetAsciiTxQueueDropCallback (DropCb);
590 std::list<Ptr<Packet> > packets = burst->GetPackets ();
611 NS_LOG_INFO (
"WimaxHelper::EnablePcapInternal(): Device " << &device <<
" not of type ns3::WimaxNetDevice");
617 std::string filename;
618 if (explicitFilename)
637 return m_channel->AssignStreams (stream);
643 int64_t currentStream = stream;
652 currentStream += wimax->GetPhy ()->AssignStreams (currentStream);
657 currentStream +=
m_channel->AssignStreams (currentStream);
659 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(void)
Allocate a new Mac48Address.
holds a vector of ns3::NetDevice pointers
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
virtual Ptr< Node > GetNode(void) const =0
virtual uint32_t GetIfIndex(void) const =0
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
uint32_t GetId(void) const
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
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.
static void EnablePrinting(void)
Enable printing packets metadata.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
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 SetMaxTrafficBurst(uint32_t maxTrafficBurst)
Set maximum traffic burst.
void SetMaximumLatency(uint32_t MaximumLatency)
Set maximum latency.
void SetCsSpecification(enum CsSpecification spec)
Set CS specification.
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 unsolicied grant interval.
void SetServiceSchedulingType(enum ServiceFlow::SchedulingType schedType)
Set service scheduling type.
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(void)
Return the current simulation virtual time.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ascii trace output on the indicated net device.
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)
static void EnableLogComponents(void)
Helper to enable all WimaxNetDevice log components with one statement.
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)
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 AsciiRxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &source)
ASCII trace receive event.
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool explicitFilename, bool promiscuous)
Enable pcap output on the indicated net device.
ServiceFlow CreateServiceFlow(ServiceFlow::Direction direction, ServiceFlow::SchedulingType schedulinType, IpcsClassifierRecord classifier)
Creates a transport service flow.
WimaxHelper(void)
Create a Wimax helper in an empty state.
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.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static void PcapSniffTxRxEvent(Ptr< PcapFileWrapper > file, Ptr< const PacketBurst > burst)
print pcap record
@ LOG_LEVEL_ALL
Print everything.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.