21 #include "ns3/object.h"
22 #include "ns3/packet.h"
23 #include "ns3/simulator.h"
24 #include "ns3/mobility-model.h"
25 #include "ns3/net-device.h"
28 #include "ns3/pointer.h"
29 #include "ns3/string.h"
52 .AddAttribute (
"PropagationModel",
53 "A pointer to the propagation model.",
56 MakePointerChecker<UanPropModel> ())
57 .AddAttribute (
"NoiseModel",
58 "A pointer to the model of the channel ambient noise.",
61 MakePointerChecker<UanNoiseModel> ())
86 UanDeviceList::iterator it =
m_devList.begin ();
143 m_devList.push_back (std::make_pair (dev, trans));
153 for (UanDeviceList::const_iterator i =
m_devList.begin (); i
157 if (src == i->second)
165 UanDeviceList::const_iterator i =
m_devList.begin ();
168 if (src != i->second)
170 NS_LOG_DEBUG (
"Scheduling " << i->first->GetMac ()->GetAddress ());
172 Time delay =
m_prop->GetDelay (senderMobility, rcvrMobility, txMode);
173 UanPdp pdp =
m_prop->GetPdp (senderMobility, rcvrMobility, txMode);
174 double rxPowerDb = txPowerDb -
m_prop->GetPathLossDb (senderMobility,
178 NS_LOG_DEBUG (
"txPowerDb=" << txPowerDb <<
"dB, rxPowerDb="
179 << rxPowerDb <<
"dB, distance="
181 <<
"m, delay=" << delay);
183 uint32_t dstNodeId = i->first->GetNode ()->GetId ();
209 m_devList[i].second->Receive (packet, rxPowerDb, txMode, pdp);
216 double noise =
m_noise->GetNoiseDbHz (fKhz);
Abstract Channel Base Class.
Keep track of the current position and velocity of an object.
double GetDistanceFrom(Ptr< const MobilityModel > position) const
virtual void DoDispose(void)
Destructor implementation.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Smart pointer class similar to boost::intrusive_ptr.
static void ScheduleWithContext(uint32_t context, Time const &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Channel class used by UAN devices.
void SetNoiseModel(Ptr< UanNoiseModel > noise)
Set the noise model this channel will use to determine ambient channel noise.
double GetNoiseDbHz(double fKhz)
Get the noise level on the channel.
virtual std::size_t GetNDevices(void) const
void AddDevice(Ptr< UanNetDevice > dev, Ptr< UanTransducer > trans)
Adds device to receiver list for this channel.
Ptr< UanPropModel > m_prop
The propagation model.
virtual ~UanChannel()
Dummy destructor, see DoDispose.
Ptr< UanNoiseModel > m_noise
The noise model.
void Clear(void)
Clear all pointer references.
virtual void DoDispose(void)
Destructor implementation.
static TypeId GetTypeId(void)
Register this type.
virtual void TxPacket(Ptr< UanTransducer > src, Ptr< Packet > packet, double txPowerDb, UanTxMode txmode)
Send a packet out on the channel.
bool m_cleared
Has Clear ever been called on the channel.
UanDeviceList m_devList
The list of devices on this channel.
void SendUp(uint32_t i, Ptr< Packet > packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
Send a packet up to the receiving UanTransducer.
virtual Ptr< NetDevice > GetDevice(std::size_t i) const
void SetPropagationModel(Ptr< UanPropModel > prop)
Set the propagation model this channel will use for path loss/propagation delay.
The power delay profile returned by propagation models.
Abstraction of packet modulation information.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.