21 #include "ns3/packet.h"
22 #include "ns3/simulator.h"
23 #include "ns3/mobility-model.h"
24 #include "ns3/net-device.h"
27 #include "ns3/pointer.h"
28 #include "ns3/object-factory.h"
30 #include "ns3/propagation-loss-model.h"
31 #include "ns3/propagation-delay-model.h"
44 .SetGroupName (
"Wifi")
46 .AddAttribute (
"PropagationLossModel",
"A pointer to the propagation loss model attached to this channel.",
49 MakePointerChecker<PropagationLossModel> ())
50 .AddAttribute (
"PropagationDelayModel",
"A pointer to the propagation delay model attached to this channel.",
53 MakePointerChecker<PropagationDelayModel> ())
98 Time delay =
m_delay->GetDelay (senderMobility, receiverMobility);
99 double rxPowerDbm =
m_loss->
CalcRxPower (txPowerDbm, senderMobility, receiverMobility);
100 NS_LOG_DEBUG (
"propagation: txPower=" << txPowerDbm <<
"dbm, rxPower=" << rxPowerDbm <<
"dbm, " <<
101 "distance=" << senderMobility->
GetDistanceFrom (receiverMobility) <<
"m, delay=" << delay);
105 if (dstNetDevice == 0)
107 dstNode = 0xffffffff;
116 parameters.
aMpdu = aMpdu;
123 j, copy, parameters);
155 int64_t currentStream = stream;
157 return (currentStream - stream);
Ptr< PropagationDelayModel > m_delay
Propagation delay model.
Simulation virtual time values and global simulation resolution.
uint16_t GetChannelNumber(void) const
Return the current channel number.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
double GetDistanceFrom(Ptr< const MobilityModel > position) const
#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.
void Receive(uint32_t i, Ptr< Packet > packet, struct Parameters parameters) const
This method is scheduled by Send for each associated YansWifiPhy.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
void SetPropagationLossModel(Ptr< PropagationLossModel > loss)
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
#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.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Keep track of the current position and velocity of an object.
virtual Ptr< NetDevice > GetDevice(uint32_t i) const
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.
double CalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account all the PropagatinLossModel(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)
Wifi Channel interface specificationThis class works in tandem with the ns3::WifiPhy class...
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.
void Send(Ptr< YansWifiPhy > sender, Ptr< const Packet > packet, double txPowerDbm, WifiTxVector txVector, WifiPreamble preamble, struct mpduInfo aMpdu, Time duration) const
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void Add(Ptr< YansWifiPhy > phy)
Adds the given YansWifiPhy to the PHY list.
A Yans wifi channelThis wifi channel implements the propagation model described in "Yet Another Netwo...
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 ...
Ptr< MobilityModel > GetMobility(void)
Return the mobility model this PHY is associated with.