25 #include "uan-helper.h"
26 #include "ns3/uan-net-device.h"
27 #include "ns3/uan-mac.h"
28 #include "ns3/uan-phy.h"
29 #include "ns3/uan-channel.h"
30 #include "ns3/uan-prop-model.h"
31 #include "ns3/uan-prop-model-ideal.h"
32 #include "ns3/uan-transducer.h"
33 #include "ns3/mobility-model.h"
35 #include "ns3/uan-tx-mode.h"
36 #include "ns3/config.h"
37 #include "ns3/simulator.h"
38 #include "ns3/uan-noise-model-default.h"
46 static void AsciiPhyTxEvent (std::ostream *os, std::string context,
47 Ptr<const Packet> packet,
double txPowerDb, UanTxMode mode)
52 static void AsciiPhyRxOkEvent (std::ostream *os, std::string context,
53 Ptr<const Packet> packet,
double snr, UanTxMode mode)
58 UanHelper::UanHelper ()
62 m_transducer.
SetTypeId (
"ns3::UanTransducerHd");
66 UanHelper::~UanHelper ()
132 m_transducer.
Set (n0, v0);
133 m_transducer.
Set (n1, v1);
134 m_transducer.
Set (n2, v2);
135 m_transducer.
Set (n3, v3);
136 m_transducer.
Set (n4, v4);
137 m_transducer.
Set (n5, v5);
138 m_transducer.
Set (n6, v6);
139 m_transducer.
Set (n7, v7);
147 std::ostringstream oss;
149 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::UanNetDevice/Phy/RxOk";
150 Config::Connect (oss.str (), MakeBoundCallback (&AsciiPhyRxOkEvent, &os));
154 oss <<
"/NodeList/" << nodeid <<
"/DeviceList/" << deviceid <<
"/$ns3::UanNetDevice/Phy/Tx";
155 Config::Connect (oss.str (), MakeBoundCallback (&AsciiPhyTxEvent, &os));
161 for (NetDeviceContainer::Iterator i = d.
Begin (); i != d.
End (); ++i)
164 EnableAscii (os, dev->GetNode ()->GetId (), dev->GetIfIndex ());
172 for (NodeContainer::Iterator i = n.
Begin (); i != n.
End (); ++i)
175 for (uint32_t j = 0; j < node->
GetNDevices (); ++j)
194 channel->SetPropagationModel (CreateObject<UanPropModelIdeal> ());
195 channel->SetNoiseModel (noise);
204 for (NodeContainer::Iterator i = c.
Begin (); i != c.
End (); i++)
210 devices.
Add (device);
226 device->SetMac (mac);
227 device->SetPhy (phy);
228 device->SetTransducer (trans);
229 device->SetChannel (channel);
239 int64_t currentStream = stream;
241 for (NetDeviceContainer::Iterator i = c.
Begin (); i != c.
End (); ++i)
247 currentStream += uan->GetPhy ()->AssignStreams (currentStream);
248 currentStream += uan->GetMac ()->AssignStreams (currentStream);
251 return (currentStream - stream);
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
smart pointer class similar to boost::intrusive_ptr
Hold a value for an Attribute.
#define NS_LOG_COMPONENT_DEFINE(name)
void SetTypeId(TypeId tid)
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
void Connect(std::string path, const CallbackBase &cb)
Keep track of the current position and velocity of an object.
double GetSeconds(void) const
Virtual base class for all UAN MAC protocols.
static void EnablePrinting(void)
void SetMac(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
void SetTransducer(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Ptr< Object > Create(void) const
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
holds a vector of ns3::NetDevice pointers
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Ptr< NetDevice > GetDevice(uint32_t index) const
Virtual base for Transducer objects.
static void EnableAscii(std::ostream &os, uint32_t nodeid, uint32_t deviceid)
uint32_t GetNDevices(void) const
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
void Set(std::string name, const AttributeValue &value)
static void EnableAsciiAll(std::ostream &os)
Base class for UAN Phy models.
static NodeContainer GetGlobal(void)
Create a NodeContainer that contains a list of all nodes created through NodeContainer::Create() and ...
instantiate subclasses of ns3::Object.
uint32_t AddDevice(Ptr< NetDevice > device)
static UanAddress Allocate()
Allocates UanAddress from 0-254 (will wrap back to 0 if more than 255 are allocated) ...
#define NS_LOG_DEBUG(msg)
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
NetDeviceContainer Install(NodeContainer c) const
Ptr< T > GetObject(void) const
void SetPhy(std::string phyType, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())