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)
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");
556 std::list<Ptr<Packet> > packets = burst->
GetPackets ();
577 NS_LOG_INFO (
"WimaxHelper::EnablePcapInternal(): Device " << &device <<
" not of type ns3::WimaxNetDevice");
583 std::string filename;
584 if (explicitFilename)
603 return m_channel->AssignStreams (stream);
609 int64_t currentStream = stream;
618 currentStream += wimax->GetPhy ()->AssignStreams (currentStream);
623 currentStream +=
m_channel->AssignStreams (currentStream);
625 return (currentStream - stream);
Manage ASCII trace files for device models.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
static void DefaultEnqueueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Enqueue default trace sink.
An migration-based uplink scheduler.
static void AsciiRxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &source)
ASCII trace receive event.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
void SetRequestTransmissionPolicy(uint32_t policy)
Set request transmission policy.
Manage pcap files for device models.
SchedulerType
Scheduler Type Different implementations of uplink/downlink scheduler.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
SimpleOfdmWimaxChannel class.
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)
Basic Drop default trace sink.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetToleratedJitter(uint32_t jitter)
Set tolerated jitter.
PropModel
PropModel enumeration.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
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. ...
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
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)
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.
IpcsClassifierRecord class.
void SetSduSize(uint8_t sduSize)
Set SDU size.
void SetMinReservedTrafficRate(uint32_t minResvRate)
Set minimum reserved traffic rate.
std::list< Ptr< Packet > > GetPackets(void) const
static void PcapSniffTxRxEvent(Ptr< PcapFileWrapper > file, Ptr< const PacketBurst > burst)
print pcap record
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.
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
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...
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
Direction
Direction enumeration.
static void EnablePrinting(void)
Enable printing packets metadata.
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
holds a vector of ns3::NetDevice pointers
void SetUnsolicitedGrantInterval(uint16_t unsolicitedGrantInterval)
Set unsolicied grant interval.
Ptr< WimaxChannel > m_channel
wifi channel
void SetPropagationLossModel(SimpleOfdmWimaxChannel::PropModel propagationModel)
Set the propagation and loss model of the channel.
void Connect(std::string path, const CallbackBase &cb)
void SetMaximumLatency(uint32_t MaximumLatency)
Set maximum latency.
static void DefaultDequeueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Dequeue default trace sink.
Hold together all WiMAX-related objects in a NetDevice.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetConvergenceSublayerParam(CsParameters csparam)
Set convergence sublayer parameters.
keep track of a set of node pointers.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
This class implements service flows as described by the IEEE-802.16 standard.
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 virtual time.
void SetMinTolerableTrafficRate(uint32_t minJitter)
Set minimum tolerable traffic rate.
static void AsciiTxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &dest)
ASCII trace transmit event.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetMaxTrafficBurst(uint32_t maxTrafficBurst)
Set maximum traffic burst.
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.
void SetTrafficPriority(uint8_t priority)
Set traffic priority.
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ascii trace output on the indicated net device.
void SetCsSpecification(enum CsSpecification spec)
Set CS specification.
void SetMaxSustainedTrafficRate(uint32_t maxSustainedRate)
Set max sustained traffic rate.
static void EnableLogComponents(void)
Helper to enable all WimaxNetDevice log components with one statement.
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 SetServiceSchedulingType(enum ServiceFlow::SchedulingType schedType)
Set service scheduling type.
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.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
A simple priority-based FCFS scheduler.