26#include "ns3/core-module.h"
27#include "ns3/gnuplot.h"
28#include "ns3/lr-wpan-module.h"
29#include "ns3/mobility-module.h"
30#include "ns3/network-module.h"
31#include "ns3/propagation-module.h"
32#include "ns3/spectrum-module.h"
57 std::ostringstream os;
58 std::ofstream
perfile(
"802.15.4-per-vs-rxSignal.plt");
71 cmd.AddValue(
"txPower",
"transmit power (dBm)",
txPower);
72 cmd.AddValue(
"packetSize",
"packet (MSDU) size (bytes)",
packetSize);
73 cmd.AddValue(
"channelNumber",
"channel number", channelNumber);
92 dev0->SetChannel(channel);
93 dev1->SetChannel(channel);
100 mob0->SetPosition(Vector(0, 0, 0));
101 mob1->SetPosition(Vector(0, 0, 0));
105 dev0->GetPhy()->SetTxPowerSpectralDensity(psd);
112 dev1->GetMac()->SetMcpsDataIndicationCallback(
cb0);
148 std::cout <<
"Experimental Test || Signal: " <<
j <<
" dBm | Received " <<
g_packetsReceived
150 <<
"/" <<
maxPackets <<
" | PER " << per <<
" %\n";
192 signal =
pow(10.0,
j / 10.0) / 1000.0;
193 snr = signal / noise;
199 std::cout <<
"Theoretical Test || Signal: " <<
j <<
" dBm | SNR: " << snr <<
"| PER "
210 std::cout <<
"_____________________________________________________________________________\n";
211 std::cout <<
"Experimental Test || Receiving with a current sensitivity of " <<
sensitivityExp
213 std::cout <<
"Theoretical Test || Receiving with a current sensitivity of " <<
sensitivityTheo
215 std::cout <<
"Gnu plot generated.";
217 os <<
"Pkt Payload (MSDU) size = " <<
packetSize <<
" bytes | "
218 <<
"Tx power = " <<
txPower <<
" dBm | "
225 perplot.SetTerminal(
"postscript eps color enh \"Times-BoldItalic\"");
226 perplot.SetLegend(
"Rx signal (dBm)",
"Packet Error Rate (%)");
227 perplot.SetExtra(
"set xrange [-110:-82]\n\
229 set yrange [0.000000000001:120]\n\
232 set style line 1 linewidth 5\n\
233 set style line 2 linewidth 3\n\
234 set style increment user\n\
235 set arrow from -110,1 to -82,1 nohead lc 'web-blue' front");
Parse command-line arguments.
Class to represent a 2D points plot.
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
This class can contain 16 bit addresses.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
void McpsDataRequest(McpsDataRequestParams params, Ptr< Packet > p) override
IEEE 802.15.4-2006, section 7.1.1.1 MCPS-DATA.request Request to transfer a MSDU.
This class defines all functions to create spectrum model for LrWpan.
static double TotalAvgPower(Ptr< const SpectrumValue > psd, uint32_t channel)
total average power of the signal is the integral of the PSD using the limits of the given channel
void SetNoiseFactor(double f)
Set the noise factor added to the thermal noise.
#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.
uint32_t g_packetsReceived
number of packets received
void PacketReceivedCallback(McpsDataIndicationParams params, Ptr< Packet > p)
Function called when a Data indication is invoked.
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...
LogLevel
Logging severity classes and levels.
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
@ LOG_PREFIX_NODE
Prefix all trace prints with simulation node.
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
MCPS-DATA.indication params.
MCPS-DATA.request params.
static const uint32_t packetSize
Packet size generated at the AP.