|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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);
holds a vector of ns3::NetDevice pointers
std::list< Ptr< Packet > > GetPackets(void) const
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
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.
void SetUnsolicitedGrantInterval(uint16_t unsolicitedGrantInterval)
Set unsolicied grant interval.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint32_t GetId(void) const
void AddHeader(const Header &header)
Add header to this packet.
static Time Now(void)
Return the current simulation virtual time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Direction
Direction enumeration.
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< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
static void EnablePrinting(void)
Enable printing packets metadata.
void SetServiceSchedulingType(enum ServiceFlow::SchedulingType schedType)
Set service scheduling type.
@ LOG_LEVEL_ALL
Print everything.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
void SetMaxSustainedTrafficRate(uint32_t maxSustainedRate)
Set max sustained traffic rate.
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
void SetMaximumLatency(uint32_t MaximumLatency)
Set maximum latency.
Ptr< WimaxChannel > m_channel
wifi channel
Ptr< BSScheduler > CreateBSScheduler(SchedulerType schedulerType)
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ascii trace output on the indicated net device.
@ SCHED_TYPE_SIMPLE
A simple priority-based FCFS scheduler.
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool explicitFilename, bool promiscuous)
Enable pcap output on the indicated net device.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
void SetConvergenceSublayerParam(CsParameters csparam)
Set convergence sublayer parameters.
Hold together all WiMAX-related objects in a NetDevice.
@ DEVICE_TYPE_BASE_STATION
Base station(BS) device.
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
NetDeviceContainer Install(NodeContainer c, NetDeviceType type, PhyType phyType, SchedulerType schedulerType)
static void AsciiTxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &dest)
ASCII trace transmit event.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
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.
SimpleOfdmWimaxChannel class.
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
virtual Ptr< Node > GetNode(void) const =0
Ptr< UplinkScheduler > CreateUplinkScheduler(SchedulerType schedulerType)
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.
@ SCHED_TYPE_RTPS
A simple scheduler - rtPS based scheduler.
ServiceFlow CreateServiceFlow(ServiceFlow::Direction direction, ServiceFlow::SchedulingType schedulinType, IpcsClassifierRecord classifier)
Creates a transport service flow.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Manage pcap files for device models.
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
static void EnableLogComponents(void)
Helper to enable all WimaxNetDevice log components with one statement.
void SetSduSize(uint8_t sduSize)
Set SDU size.
void SetMinReservedTrafficRate(uint32_t minResvRate)
Set minimum reserved traffic rate.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Manage ASCII trace files for device models.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
void Connect(std::string path, const CallbackBase &cb)
PropModel
PropModel enumeration.
Ptr< WimaxPhy > CreatePhy(PhyType phyType)
void SetMinTolerableTrafficRate(uint32_t minJitter)
Set minimum tolerable traffic rate.
static void PcapSniffTxRxEvent(Ptr< PcapFileWrapper > file, Ptr< const PacketBurst > burst)
print pcap record
static void DefaultDequeueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Dequeue default trace sink.
void SetTrafficPriority(uint8_t priority)
Set traffic priority.
Time Seconds(double value)
Construct a Time in the indicated unit.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
void SetCsSpecification(enum CsSpecification spec)
Set CS specification.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
@ SCHED_TYPE_MBQOS
An migration-based uplink scheduler.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
keep track of a set of node pointers.
void SetPropagationLossModel(SimpleOfdmWimaxChannel::PropModel propagationModel)
Set the propagation and loss model of the channel.
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
SchedulerType
Scheduler Type Different implementations of uplink/downlink scheduler.
void SetToleratedJitter(uint32_t jitter)
Set tolerated jitter.
This class implements service flows as described by the IEEE-802.16 standard.
static void DefaultDropSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Drop default trace sink.
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 DefaultEnqueueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Enqueue default trace sink.
PhyType
WiMAX Physical layer WiMAX Physical layers with different levels of detail.
NetDeviceType
Net Device Type Distinguish a subscriber station(SS) device from base station(BS) device.
void SetRequestTransmissionPolicy(uint32_t policy)
Set request transmission policy.
void SetMaxTrafficBurst(uint32_t maxTrafficBurst)
Set maximum traffic burst.
virtual uint32_t GetIfIndex(void) const =0
static void AsciiRxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &source)
ASCII trace receive event.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Ptr< WimaxPhy > CreatePhyWithoutChannel(PhyType phyType)
IpcsClassifierRecord class.
WimaxHelper(void)
Create a Wimax helper in an empty state.