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"
54 .AddAttribute (
"PropagationModel",
55 "A pointer to the propagation model.",
58 MakePointerChecker<UanPropModel> ())
59 .AddAttribute (
"NoiseModel",
60 "A pointer to the model of the channel ambient noise.",
63 MakePointerChecker<UanNoiseModel> ())
88 UanDeviceList::iterator it =
m_devList.begin ();
145 m_devList.push_back (std::make_pair (dev, trans));
155 for (UanDeviceList::const_iterator i =
m_devList.begin (); i
159 if (src == i->second)
167 UanDeviceList::const_iterator i =
m_devList.begin ();
170 if (src != i->second)
172 NS_LOG_DEBUG (
"Scheduling " << i->first->GetMac ()->GetAddress ());
174 Time delay =
m_prop->GetDelay (senderMobility, rcvrMobility, txMode);
175 UanPdp pdp =
m_prop->GetPdp (senderMobility, rcvrMobility, txMode);
176 double rxPowerDb = txPowerDb -
m_prop->GetPathLossDb (senderMobility,
180 NS_LOG_DEBUG (
"txPowerDb=" << txPowerDb <<
"dB, rxPowerDb="
181 << rxPowerDb <<
"dB, distance="
183 <<
"m, delay=" << delay);
185 uint32_t dstNodeId = i->first->GetNode ()->GetId ();
211 m_devList[i].second->Receive (packet, rxPowerDb, txMode, pdp);
218 double noise =
m_noise->GetNoiseDbHz (fKhz);
void SendUp(uint32_t i, Ptr< Packet > packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
Send a packet up to the receiving UanTransducer.
UanDeviceList m_devList
The list of devices on this channel.
Simulation virtual time values and global simulation resolution.
static TypeId GetTypeId(void)
Register this type.
Smart pointer class similar to boost::intrusive_ptr.
double GetDistanceFrom(Ptr< const MobilityModel > position) const
Channel class used by UAN devices.
#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.
Hold variables of type string.
#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.
double GetNoiseDbHz(double fKhz)
Get the noise level on the channel.
Ptr< UanNoiseModel > m_noise
The noise model.
virtual void DoDispose(void)
Destructor implementation.
void SetNoiseModel(Ptr< UanNoiseModel > noise)
Set the noise model this channel will use to determine ambient channel noise.
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.
Keep track of the current position and velocity of an object.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
void AddDevice(Ptr< UanNetDevice > dev, Ptr< UanTransducer > trans)
Adds device to receiver list for this channel.
virtual void DoDispose(void)
Destructor implementation.
The power delay profile returned by propagation models.
Abstraction of packet modulation information.
void Clear(void)
Clear all pointer references.
virtual uint32_t GetNDevices(void) const
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
virtual Ptr< NetDevice > GetDevice(uint32_t i) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual ~UanChannel()
Dummy destructor, see DoDispose.
static void ScheduleWithContext(uint32_t context, Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event with the given context.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void SetPropagationModel(Ptr< UanPropModel > prop)
Set the propagation model this channel will use for path loss/propagation delay.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< UanPropModel > m_prop
The propagation model.