55 #include "ns3/core-module.h"
56 #include "ns3/network-module.h"
57 #include "ns3/applications-module.h"
58 #include "ns3/mobility-module.h"
60 #include "ns3/config.h"
61 #include "ns3/callback.h"
62 #include "ns3/stats-module.h"
81 m_sifs (Seconds (0.05)),
82 m_simTime (Seconds (5000)),
83 m_gnuplotfile (
"uan-rc-example.gpl"),
92 while ((packet = socket->
Recv ()))
105 std::ostringstream buf;
106 buf << name <<
" " << kass;
114 fcmode = (uint32_t)((-((
double)
m_totalRate ) + (
double) bw)/2.0 + (
double) fc);
120 mode = UanTxModeFactory::CreateMode (UanTxMode::OTHER,
141 for (uint32_t i=m_numRates; i > 0; i--)
169 uan.
SetPhy (
"ns3::UanPhyDual",
170 "SupportedModesPhy1", UanModesListValue (
m_dataModes),
173 uan.
SetMac (
"ns3::UanMacRcGw",
186 uan.
SetMac (
"ns3::UanMacRc",
201 for (uint32_t i=0; i<nNodes; i++)
203 double theta = utheta->GetValue (0, 2.0*M_PI);
235 apps.
Start (Seconds (0.5));
239 TypeId psfid = TypeId::LookupByName (
"ns3::PacketSocketFactory");
241 Ptr<Socket> sinkSocket = Socket::CreateSocket (sinkNode, psfid);
242 sinkSocket->
Bind (socket);
245 Simulator::Stop (
m_simTime + Seconds (0.6));
247 Simulator::Destroy ();
261 cmd.
AddValue (
"NumberRates",
"Number of divided rates ( (NumberRates+1)%TotalRate should be 0)", exp.
m_numRates);
262 cmd.
AddValue (
"MaxRange",
"Maximum range between gateway and acoustic node", exp.
m_maxRange);
263 cmd.
AddValue (
"SimMin",
"Minimum parameter to test (nodes if DoNode=1, \"a\" param otherwise)", exp.
m_simMin);
264 cmd.
AddValue (
"SimMax",
"Maximum parameter to test (nodes if DoNode=1, \"a\" param otherwise)", exp.
m_simMax);
267 cmd.
AddValue (
"NumberNodes",
"Number of nodes (invalid for doNode=1)", exp.
m_numNodes);
271 cmd.
AddValue (
"DoNode",
"1 for do max nodes simulation (invalidates AMin and AMax values)", exp.
m_doNode);
272 cmd.
Parse (argc, argv);
283 uint32_t bytesRx = exp.
Run (param);
284 NS_LOG_DEBUG (
"param=" << param <<
": Received " << bytesRx <<
" bytes at sink");
288 ds.
Add (param, util);
290 SeedManager::SetRun (SeedManager::GetRun () + 1);
Helper class for UAN CW MAC example.
holds a vector of ns3::Application pointers.
keep track of time values and allow control of global simulation resolution
UanModesList m_controlModes
Class to represent a 2D points plot. Set the line or points style using SetStyle() and set points usi...
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
an address for a packet socket
int main(int argc, char *argv[])
uint32_t GetSize(void) const
void AddDataset(const GnuplotDataset &dataset)
void ReceivePacket(Ptr< Socket > socket)
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Give ns3::PacketSocket powers to ns3::Node.
void SetSingleDevice(uint32_t device)
#define NS_FATAL_ERROR(msg)
fatal error handling
a polymophic address class
std::string m_gnuplotfile
double GetSeconds(void) const
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
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())
hold objects of type ns3::Time
Hold an unsigned integer type.
Gnuplot2dDataset Run(const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel, const MobilityHelper &mobility)
Abstraction of packet modulation information.
holds a vector of ns3::NetDevice pointers
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream.
void Add(double x, double y)
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Parse command-line arguments.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
void SetPhysicalAddress(const Address address)
keep track of a set of node pointers.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
void SetMobilityModel(std::string type, 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(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
void Install(Ptr< Node > node) const
void CreateDualModes(uint32_t fc)
UanTxMode CreateMode(uint32_t kass, uint32_t fc, bool upperblock, std::string name)
Helper class used to assign positions and mobility models to nodes.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
NS_LOG_COMPONENT_DEFINE("PacketLossCounter")
hold objects of type ns3::DataRate
void AddValue(const std::string &name, const std::string &help, T &value)
#define NS_LOG_DEBUG(msg)
void AppendMode(UanTxMode mode)
void SetProtocol(uint16_t protocol)
void Parse(int argc, char *argv[])
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
NetDeviceContainer Install(NodeContainer c) const
ApplicationContainer Install(NodeContainer c) const
a unique identifier for an interface.
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())
void SetAttribute(std::string name, const AttributeValue &value)
void LogComponentEnable(char const *name, enum LogLevel level)