21 #include "ns3/packet.h"    22 #include "ns3/simulator.h"    24 #include "ns3/pointer.h"    25 #include "ns3/net-device.h"    27 #include "ns3/propagation-loss-model.h"    28 #include "ns3/propagation-delay-model.h"    29 #include "ns3/mobility-model.h"    45     .SetGroupName (
"Wifi")
    47     .AddAttribute (
"PropagationLossModel", 
"A pointer to the propagation loss model attached to this channel.",
    50                    MakePointerChecker<PropagationLossModel> ())
    51     .AddAttribute (
"PropagationDelayModel", 
"A pointer to the propagation delay model attached to this channel.",
    54                    MakePointerChecker<PropagationDelayModel> ())
   101           Time delay = 
m_delay->GetDelay (senderMobility, receiverMobility);
   102           double rxPowerDbm = 
m_loss->
CalcRxPower (txPowerDbm, senderMobility, receiverMobility);
   103           NS_LOG_DEBUG (
"propagation: txPower=" << txPowerDbm << 
"dbm, rxPower=" << rxPowerDbm << 
"dbm, " <<
   104                         "distance=" << senderMobility->GetDistanceFrom (receiverMobility) << 
"m, delay=" << delay);
   108           if (dstNetDevice == 0)
   110               dstNode = 0xffffffff;
   114               dstNode = dstNetDevice->GetNode ()->GetId ();
   119                                           (*i), copy, rxPowerDbm, duration);
   130   if ((rxPowerDbm + 
phy->GetRxGain ()) < 
phy->GetRxSensitivity ())
   132       NS_LOG_INFO (
"Received signal too weak to process: " << rxPowerDbm << 
" dBm");
   135   phy->StartReceivePreamble (packet, 
DbmToW (rxPowerDbm + 
phy->GetRxGain ()), duration);
   161   int64_t currentStream = stream;
   163   return (currentStream - stream);
 Ptr< PropagationDelayModel > m_delay
Propagation delay model. 
Simulation virtual time values and global simulation resolution. 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
double CalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account all the PropagationLossModel(s) chained to the current one...
void SetPropagationLossModel(const Ptr< PropagationLossModel > loss)
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system. 
double DbmToW(double dBm)
Convert from dBm to Watts. 
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit. 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
Abstract Channel Base Class. 
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO. 
virtual Ptr< NetDevice > GetDevice(std::size_t i) const
Keep track of the current position and velocity of an object. 
void SetPropagationDelayModel(const Ptr< PropagationDelayModel > delay)
virtual ~YansWifiChannel()
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
 Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Ptr< PropagationLossModel > m_loss
Propagation loss model. 
static void Receive(Ptr< YansWifiPhy > receiver, Ptr< Packet > packet, double txPowerDbm, Time duration)
This method is scheduled by Send for each associated YansWifiPhy. 
PhyList m_phyList
List of YansWifiPhys connected to this YansWifiChannel. 
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object. 
Ptr< MobilityModel > GetMobility(void) const
Return the mobility model this PHY is associated with. 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
Hold objects of type Ptr<T>. 
Ptr< Packet > Copy(void) const
performs a COW copy of the packet. 
static TypeId GetTypeId(void)
Get the type ID. 
uint8_t GetChannelNumber(void) const
Return current channel number. 
static void ScheduleWithContext(uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event with the given context. 
Network layer to device interface. 
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG. 
virtual std::size_t GetNDevices(void) const
void Add(Ptr< YansWifiPhy > phy)
Adds the given YansWifiPhy to the PHY list. 
a channel to interconnect ns3::YansWifiPhy objects. 
void Send(Ptr< YansWifiPhy > sender, Ptr< const Packet > packet, double txPowerDbm, Time duration) const
a unique identifier for an interface. 
TypeId SetParent(TypeId tid)
Set the parent TypeId. 
int64_t AssignStreams(int64_t stream)
If this loss model uses objects of type RandomVariableStream, set the stream numbers to the integers ...