21 #include "ns3/simulator.h"
23 #include "ns3/pointer.h"
25 #include "ns3/propagation-loss-model.h"
26 #include "ns3/propagation-delay-model.h"
40 .SetGroupName (
"Wifi")
42 .AddAttribute (
"PropagationLossModel",
"A pointer to the propagation loss model attached to this channel.",
45 MakePointerChecker<PropagationLossModel> ())
46 .AddAttribute (
"PropagationDelayModel",
"A pointer to the propagation delay model attached to this channel.",
49 MakePointerChecker<PropagationDelayModel> ())
94 Time delay =
m_delay->GetDelay (senderMobility, receiverMobility);
95 double rxPowerDbm =
m_loss->
CalcRxPower (txPowerDbm, senderMobility, receiverMobility);
96 NS_LOG_DEBUG (
"propagation: txPower=" << txPowerDbm <<
"dbm, rxPower=" << rxPowerDbm <<
"dbm, " <<
97 "distance=" << senderMobility->GetDistanceFrom (receiverMobility) <<
"m, delay=" << delay);
101 if (dstNetDevice == 0)
103 dstNode = 0xffffffff;
107 dstNode = dstNetDevice->GetNode ()->GetId ();
112 (*i), copy, rxPowerDbm, duration);
146 int64_t currentStream = stream;
148 return (currentStream - stream);
Ptr< PropagationDelayModel > m_delay
Propagation delay model.
uint8_t GetChannelNumber(void) const
Return current channel number.
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 "...
void SetPropagationLossModel(const Ptr< PropagationLossModel > loss)
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
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...
#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.
void StartReceivePreambleAndHeader(Ptr< Packet > packet, double rxPowerW, Time rxDuration)
Starting receiving the plcp of a packet (i.e.
void Send(Ptr< YansWifiPhy > sender, Ptr< const Packet > packet, double txPowerDbm, Time duration) const
Keep track of the current position and velocity of an object.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
virtual Ptr< NetDevice > GetDevice(uint32_t i) const
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...
virtual uint32_t GetNDevices(void) const
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.
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...
PhyList m_phyList
List of YansWifiPhys connected to this YansWifiChannel.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr.
static TypeId GetTypeId(void)
Get the type ID.
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.
Ptr< MobilityModel > GetMobility(void) const
Return the mobility model this PHY is associated with.
void Add(Ptr< YansWifiPhy > phy)
Adds the given YansWifiPhy to the PHY list.
a channel to interconnect ns3::YansWifiPhy objects.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
double GetRxGain(void) const
Return the reception gain (dB).
int64_t AssignStreams(int64_t stream)
If this loss model uses objects of type RandomVariableStream, set the stream numbers to the integers ...