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"
82 m_gnuplotfile (
"uan-rc-example.gpl"),
91 while ((packet = socket->
Recv ()))
104 std::ostringstream buf;
105 buf << name <<
" " << kass;
113 fcmode = (uint32_t)((-((
double)
m_totalRate ) + (
double) bw)/2.0 + (
double) fc);
119 mode = UanTxModeFactory::CreateMode (UanTxMode::OTHER,
168 uan.
SetPhy (
"ns3::UanPhyDual",
172 uan.
SetMac (
"ns3::UanMacRcGw",
185 uan.
SetMac (
"ns3::UanMacRc",
189 nodes.Create (nNodes);
200 for (uint32_t i=0; i<nNodes; i++)
202 double theta = utheta->
GetValue (0, 2.0*M_PI);
208 pos->Add (Vector (
x, y, depth));
212 mobility.SetPositionAllocator (pos);
213 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
238 TypeId psfid = TypeId::LookupByName (
"ns3::PacketSocketFactory");
240 Ptr<Socket> sinkSocket = Socket::CreateSocket (sinkNode, psfid);
241 sinkSocket->
Bind (socket);
246 Simulator::Destroy ();
251 main (
int argc,
char *argv[])
258 cmd.AddValue (
"TotalRate",
"Total channel capacity", exp.
m_totalRate);
259 cmd.AddValue (
"NumberRates",
"Number of divided rates ( (NumberRates+1)%TotalRate should be 0)", exp.
m_numRates);
260 cmd.AddValue (
"MaxRange",
"Maximum range between gateway and acoustic node", exp.
m_maxRange);
261 cmd.AddValue (
"SimMin",
"Minimum parameter to test (nodes if DoNode=1, \"a\" param otherwise)", exp.
m_simMin);
262 cmd.AddValue (
"SimMax",
"Maximum parameter to test (nodes if DoNode=1, \"a\" param otherwise)", exp.
m_simMax);
263 cmd.AddValue (
"SimStep",
"Amount to increment param per trial", exp.
m_simStep);
265 cmd.AddValue (
"NumberNodes",
"Number of nodes (invalid for doNode=1)", exp.
m_numNodes);
266 cmd.AddValue (
"SIFS",
"SIFS time duration", exp.
m_sifs);
267 cmd.AddValue (
"PktSize",
"Packet size in bytes", exp.
m_pktSize);
268 cmd.AddValue (
"SimTime",
"Simulation time per trial", exp.
m_simTime);
269 cmd.AddValue (
"DoNode",
"1 for do max nodes simulation (invalidates AMin and AMax values)", exp.
m_doNode);
270 cmd.AddValue (
"Quiet",
"Run in quiet mode (disable logging)", quiet);
271 cmd.Parse (argc, argv);
285 uint32_t bytesRx = exp.
Run (param);
286 NS_LOG_DEBUG (
"param=" << param <<
": Received " << bytesRx <<
" bytes at sink");
290 ds.
Add (param, util);
292 SeedManager::SetRun (SeedManager::GetRun () + 1);
Helper class for UAN CW MAC example.
Gnuplot2dDataset Run(const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const WifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel)
uint32_t m_simMin
Minimum parameter to test.
uint32_t m_bytesTotal
Total bytes received.
Time m_simTime
Simulation run time, default 1000 s.
uint32_t m_simStep
Amount to increment param per trial.
UanModesList m_dataModes
List of UanTxModes used for data channels.
Time m_sifs
SIFS time duration.
uint32_t m_totalRate
Total channel capacity.
void ReceivePacket(Ptr< Socket > socket)
bool m_doNode
1 for do max nodes simulation (invalidates AMin and AMax values).
uint32_t m_simMax
Maximum parameter to test.
void CreateDualModes(uint32_t fc)
Create m_numRates matching control and data modes.
UanTxMode CreateMode(uint32_t kass, uint32_t fc, bool upperblock, std::string name)
Create a UanTxMode.
UanModesList m_controlModes
List of UanTxModes used for control channels.
uint32_t m_numRates
Number of divided rates ( (NumberRates+1)TotalRate should be 0).
uint32_t m_numNodes
Number of transmitting nodes.
uint32_t m_maxRange
Maximum range between gateway and acoustic node.
uint32_t m_pktSize
Packet size in bytes.
std::string m_gnuplotfile
Filename for GnuPlot.
a polymophic address class
holds a vector of ns3::Application pointers.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
Parse command-line arguments.
AttributeValue implementation for DataRate.
Class to represent a 2D points plot.
void Add(double x, double y)
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
void AddDataset(const GnuplotDataset &dataset)
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
virtual Address GetAddress(void) const =0
virtual uint32_t GetIfIndex(void) const =0
keep track of a set of node pointers.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
an address for a packet socket
void SetProtocol(uint16_t protocol)
Set the protocol.
void SetPhysicalAddress(const Address address)
Set the destination address.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
a unique identifier for an interface.
UAN configuration helper.
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())
Set MAC attributes.
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())
Set PHY attributes.
NetDeviceContainer Install(NodeContainer c) const
This method creates a simple ns3::UanChannel (with a default ns3::UanNoiseModelDefault and ns3::UanPr...
void AppendMode(UanTxMode mode)
Add mode to this list.
AttributeValue implementation for UanModesList.
Abstraction of packet modulation information.
Hold an unsigned integer type.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#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.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ LOG_LEVEL_ALL
Print everything.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
list x
Random number samples.