21 #include <ns3/object.h>
22 #include <ns3/spectrum-interference.h>
23 #include <ns3/spectrum-error-model.h>
26 #include <ns3/simulator.h>
27 #include <ns3/packet.h>
29 #include <ns3/string.h>
32 #include <ns3/spectrum-model-ism2400MHz-res1MHz.h>
33 #include <ns3/spectrum-model-300kHz-300GHz-log.h>
34 #include <ns3/wifi-spectrum-value-helper.h>
35 #include <ns3/single-model-spectrum-channel.h>
36 #include <ns3/waveform-generator.h>
37 #include <ns3/spectrum-analyzer.h>
41 #include <ns3/friis-spectrum-propagation-loss.h>
42 #include <ns3/propagation-delay-model.h>
43 #include <ns3/spectrum-helper.h>
44 #include <ns3/adhoc-aloha-noack-ideal-phy-helper.h>
45 #include <ns3/mobility-helper.h>
46 #include <ns3/data-rate.h>
47 #include <ns3/uinteger.h>
48 #include <ns3/packet-socket-helper.h>
49 #include <ns3/packet-socket-address.h>
50 #include <ns3/on-off-helper.h>
51 #include <ns3/config.h>
54 #define log2(x) (log(x)/M_LN2)
77 bool rateIsAchievable,
78 std::string channelType);
82 virtual void DoRun (
void);
83 static std::string
Name (std::string channelType,
double snrLinear, uint64_t phyRate);
94 std::ostringstream oss;
96 <<
" snr = " << snrLinear <<
" (linear), "
97 <<
" phyRate = " << phyRate <<
" bps";
104 bool rateIsAchievable,
105 std::string channelType)
107 m_snrLinear (snrLinear),
109 m_rateIsAchievable (rateIsAchievable),
110 m_channelType (channelType)
123 double txPowerW = 0.1;
126 const double k = 1.381e-23;
127 const double T = 290;
128 double noisePsdValue = k * T;
130 double lossDb = 10 * log10 (lossLinear);
132 uint32_t pktSize = 50;
134 uint32_t numPkts = 200;
138 double testDuration = (numPkts * pktSize * 8.0) / phyRate;
139 NS_LOG_INFO (
"test duration = " << std::fixed << testDuration);
146 positionAlloc->Add (
Vector (0.0, 0.0, 0.0));
147 positionAlloc->Add (
Vector (5.0, 0.0, 0.0));
166 uint32_t channelNumber = 1;
199 double throughputBps = (
g_rxBytes * 8.0) / testDuration;
223 :
TestSuite (
"spectrum-ideal-phy", SYSTEM)
226 NS_LOG_INFO (
"creating SpectrumIdealPhyTestSuite");
228 for (
double snr = 0.01; snr <= 10 ; snr *= 2)
238 for (
double snr = 0.01; snr <= 10 ; snr *= 10)