25 #include <ns3/core-module.h>    26 #include <ns3/network-module.h>    27 #include <ns3/spectrum-model-ism2400MHz-res1MHz.h>    28 #include <ns3/spectrum-model-300kHz-300GHz-log.h>    29 #include <ns3/wifi-spectrum-value-helper.h>    30 #include <ns3/single-model-spectrum-channel.h>    31 #include <ns3/waveform-generator.h>    32 #include <ns3/spectrum-analyzer.h>    35 #include <ns3/friis-spectrum-propagation-loss.h>    36 #include <ns3/propagation-delay-model.h>    37 #include <ns3/mobility-module.h>    38 #include <ns3/spectrum-helper.h>    39 #include <ns3/applications-module.h>    40 #include <ns3/adhoc-aloha-noack-ideal-phy-helper.h>    53       std::cout << context << 
" PHY TX START p: " << p << std::endl;
    63       std::cout << context << 
" PHY TX END p: " << p << std::endl;
    72       std::cout << context << 
" PHY RX START p:" << p << std::endl;
    81       std::cout << context << 
" PHY RX END OK p:" << p << std::endl;
    90       std::cout << context << 
" PHY RX END ERROR p:" << p << std::endl;
   100   while ((packet = socket->
Recv ()))
   106       std::cout << 
"SOCKET received " << bytes << 
" bytes" << std::endl;
   120 int main (
int argc, 
char** argv)
   123   cmd.AddValue (
"verbose", 
"Print trace information if true", 
g_verbose);
   124   cmd.Parse (argc, argv);
   131   positionAlloc->
Add (Vector (0.0, 0.0, 0.0));
   132   positionAlloc->
Add (Vector (5.0, 0.0, 0.0));
   133   mobility.SetPositionAllocator (positionAlloc);
   134   mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
   144   double txPower = 0.1; 
   145   uint32_t channelNumber = 1;
   150   const double k = 1.381e-23; 
   151   const double T = 290; 
   152   double noisePsdValue = 
k * T; 
   171   onoff.SetConstantRate (
DataRate (
"0.5Mbps"));
 
holds a vector of ns3::Application pointers. 
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload). 
create the AlohaNoackNetDevice 
void SetPhyAttribute(std::string name, const AttributeValue &v)
an address for a packet socket 
static void Run(void)
Run the simulation. 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
void PhyRxEndErrorTrace(std::string context, Ptr< const Packet > p)
void PhyRxStartTrace(std::string context, Ptr< const Packet > p)
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes. 
Give ns3::PacketSocket powers to ns3::Node. 
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice. 
a polymophic address class 
Class for representing data rates. 
Hold an unsigned integer type. 
holds a vector of ns3::NetDevice pointers 
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Parse command-line arguments. 
void Connect(std::string path, const CallbackBase &cb)
void PhyTxStartTrace(std::string context, Ptr< const Packet > p)
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy(). 
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double txPower, uint8_t channel)
Creates a SpectrumValue instance that represents the TX Power Spectral Density of a wifi device corre...
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
void SetPhysicalAddress(const Address address)
Set the destination address. 
keep track of a set of node pointers. 
virtual Ptr< SpectrumValue > CreateConstant(double psd)
Creates a SpectrumValue instance with a constant value for all frequencies. 
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket. 
Helper class used to assign positions and mobility models to nodes. 
static SpectrumChannelHelper Default()
Setup a default SpectrumChannel. 
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
  AttributeValue implementation for DataRate. 
static void Stop(void)
Tell the Simulator the calling event should be the last one executed. 
Time Seconds(double value)
Construct a Time in the indicated unit. 
void SetProtocol(uint16_t protocol)
Set the protocol. 
void Add(Vector v)
Add a position to the list of positions. 
void PhyRxEndOkTrace(std::string context, Ptr< const Packet > p)
void PhyTxEndTrace(std::string context, Ptr< const Packet > p)
void SetChannel(Ptr< SpectrumChannel > channel)
set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper ...
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index. 
void ReceivePacket(Ptr< Socket > socket)
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node. 
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer. 
a unique identifier for an interface. 
Implements Wifi SpectrumValue for the 2.4 GHz ISM band only, with a 5 MHz spectrum resolution...
NetDeviceContainer Install(NodeContainer c) const
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< SpectrumChannel > Create(void) const
void SetNoisePowerSpectralDensity(Ptr< SpectrumValue > noisePsd)
static TypeId LookupByName(std::string name)
Get a TypeId by name.