9#include "ns3/adhoc-aloha-noack-ideal-phy-helper.h"
10#include "ns3/applications-module.h"
11#include "ns3/core-module.h"
12#include "ns3/friis-spectrum-propagation-loss.h"
13#include "ns3/ism-spectrum-value-helper.h"
15#include "ns3/mobility-module.h"
16#include "ns3/network-module.h"
17#include "ns3/propagation-delay-model.h"
18#include "ns3/single-model-spectrum-channel.h"
19#include "ns3/spectrum-analyzer.h"
20#include "ns3/spectrum-helper.h"
21#include "ns3/spectrum-model-300kHz-300GHz-log.h"
22#include "ns3/spectrum-model-ism2400MHz-res1MHz.h"
23#include "ns3/waveform-generator.h"
47 std::cout << context <<
" PHY RX END OK p:" << p << std::endl;
106 std::cout <<
txit->first <<
" --> " <<
rxit->first <<
" : " <<
rxit->second <<
" dB"
121 std::string
channelType(
"ns3::SingleModelSpectrumChannel");
122 cmd.AddValue(
"verbose",
"Print trace information if true",
g_verbose);
123 cmd.AddValue(
"lossDb",
"link loss in dB",
lossDb);
124 cmd.AddValue(
"txPowerW",
"txPower in Watts",
txPowerW);
125 cmd.AddValue(
"phyRate",
"PHY rate in bps",
phyRate);
126 cmd.AddValue(
"pktSize",
"packet size in bytes",
pktSize);
127 cmd.AddValue(
"simDuration",
"duration of the simulation in seconds",
simDuration);
128 cmd.AddValue(
"channelType",
"which SpectrumChannel implementation to be used",
channelType);
135 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
141 channelHelper.SetPropagationDelay(
"ns3::ConstantSpeedPropagationDelayModel");
157 const double k = 1.381e-23;
158 const double T = 290;
201 std::cout <<
"throughput: " << std::setw(20) << std::fixed <<
throughputBps <<
" bps"
203 std::cout <<
"phy rate : " << std::setw(20) << std::fixed <<
phyRate * 1.0 <<
" bps"
207 std::cout <<
"shannon capacity: " << std::setw(20) << std::fixed <<
capacity <<
" bps"
static bool g_verbose
True if verbose output.
void PhyRxEndOkTrace(std::string context, Ptr< const Packet > p)
Trace for PHY Rx successful end.
static uint64_t g_rxBytes
Rx bytes counter.
Store the last pathloss value for each TX-RX pair.
void Print()
print the stored pathloss values to standard output
void UpdatePathloss(std::string context, Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb)
update the pathloss value
std::map< uint32_t, std::map< uint32_t, double > > m_pathlossMap
Path loss map.
a polymophic address class
create the AlohaNoackNetDevice
void SetChannel(Ptr< SpectrumChannel > channel)
set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
holds a vector of ns3::Application pointers.
Parse command-line arguments.
Class for representing data rates.
AttributeValue implementation for DataRate.
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
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.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
void SetChannel(std::string type, Ts &&... args)
Implements Wifi SpectrumValue for the 2.4 GHz ISM band only, with a 5 MHz spectrum resolution.
Hold an unsigned integer type.
void Connect(std::string path, const CallbackBase &cb)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
uint32_t pktSize
packet size used for the simulation (in bytes)