21 #include <ns3/object.h>
22 #include <ns3/packet.h>
24 #include <ns3/simulator.h>
25 #include <ns3/spectrum-error-model.h>
26 #include <ns3/spectrum-interference.h>
55 void DoRun()
override;
76 m_rxCorrectKnownOutcome(rxCorrect),
77 m_mySpectrumModel(s->GetSpectrumModel())
94 (*n)[0] = 5.000000000000e-19;
95 (*n)[1] = 4.545454545455e-19;
97 (*i1)[0] = 5.000000000000e-18;
98 (*i2)[0] = 5.000000000000e-16;
99 (*i3)[0] = 1.581138830084e-16;
100 (*i4)[0] = 7.924465962306e-17;
101 (*i1)[1] = 1.437398936440e-18;
102 (*i2)[1] = 5.722388235428e-16;
103 (*i3)[1] = 7.204059965732e-17;
104 (*i4)[1] = 5.722388235428e-17;
121 Simulator::Schedule(ts, &SpectrumInterference::AddSignal, &si,
m_s, ds);
122 Simulator::Schedule(ti1, &SpectrumInterference::AddSignal, &si, i1, di1);
123 Simulator::Schedule(ti2, &SpectrumInterference::AddSignal, &si, i2, di2);
124 Simulator::Schedule(ti3, &SpectrumInterference::AddSignal, &si, i3, di3);
125 Simulator::Schedule(ti4, &SpectrumInterference::AddSignal, &si, i4, di4);
128 Simulator::Schedule(ts, &SpectrumInterference::StartRx, &si, p,
m_s);
134 Simulator::Destroy();
155 :
TestSuite(
"spectrum-interference", UNIT)
157 NS_LOG_INFO(
"creating SpectrumInterferenceTestSuite");
174 m = Create<SpectrumModel>(bands);
178 const double e = 1e-5;
183 (*s1)[0] = 1.255943215755e-15;
184 (*s1)[1] = 7.204059965732e-16;
185 b = 10067205.5632012;
189 static_cast<uint32_t
>(b * 0.5 + 0.5),
191 "sdBm = [-46 -48] tx bytes: b*0.5"),
194 static_cast<uint32_t
>(b * (1 - e) + 0.5),
196 "sdBm = [-46 -48] tx bytes: b*(1-e)"),
199 static_cast<uint32_t
>(b * (1 + e) + 0.5),
201 "sdBm = [-46 -48] tx bytes: b*(1+e)"),
204 static_cast<uint32_t
>(b * 1.5 + 0.5),
206 "sdBm = [-46 -48] tx bytes: b*1.5"),
211 "sdBm = [-46 -48] tx bytes: 2^32-1"),
216 (*s2)[0] = 2.505936168136e-17;
217 (*s2)[1] = 3.610582885110e-17;
218 b = 882401.591840728;
222 static_cast<uint32_t
>(b * 0.5 + 0.5),
224 "sdBm = [-63 -61] tx bytes: b*0.5"),
227 static_cast<uint32_t
>(b * (1 - e) + 0.5),
229 "sdBm = [-63 -61] tx bytes: b*(1-e)"),
232 static_cast<uint32_t
>(b * (1 + e) + 0.5),
234 "sdBm = [-63 -61] tx bytes: b*(1+e)"),
237 static_cast<uint32_t
>(b * 1.5 + 0.5),
239 "sdBm = [-63 -61] tx bytes: b*1.5"),
244 "sdBm = [-63 -61] tx bytes: 2^32-1"),
Spectrum Interference Test.
Ptr< SpectrumValue > m_s
Spectrum value.
SpectrumInterferenceTestCase(Ptr< SpectrumValue > s, uint32_t txBytes, bool rxCorrect, std::string name)
Constructor.
uint32_t m_txBytes
number of bytes to transmit
void RetrieveTestResult(SpectrumInterference *si)
Retrieve the test results.
Ptr< const SpectrumModel > m_mySpectrumModel
Spectrum model pointer.
~SpectrumInterferenceTestCase() override
bool m_rxCorrectKnownOutcome
expected Rx bytes
void DoRun() override
Implementation to actually run this TestCase.
Spectrum Interference TestSuite.
SpectrumInterferenceTestSuite()
This class implements a gaussian interference model, i.e., all incoming signals are added to the tota...
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
Set the Noise Power Spectral Density.
bool EndRx()
Notify that the RX attempt has ended.
void SetErrorModel(Ptr< SpectrumErrorModel > e)
Set the SpectrumErrorModel to be used.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< BandInfo > Bands
Container of BandInfo.
static SpectrumInterferenceTestSuite spectrumInterferenceTestSuite
Static variable for test initialization.
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband