10#include <ns3/object.h>
11#include <ns3/packet.h>
13#include <ns3/simulator.h>
14#include <ns3/spectrum-error-model.h>
15#include <ns3/spectrum-interference.h>
44 void DoRun()
override;
65 m_rxCorrectKnownOutcome(rxCorrect),
66 m_mySpectrumModel(s->GetSpectrumModel())
83 (*n)[0] = 5.000000000000e-19;
84 (*n)[1] = 4.545454545455e-19;
86 (*i1)[0] = 5.000000000000e-18;
87 (*i2)[0] = 5.000000000000e-16;
88 (*i3)[0] = 1.581138830084e-16;
89 (*i4)[0] = 7.924465962306e-17;
90 (*i1)[1] = 1.437398936440e-18;
91 (*i2)[1] = 5.722388235428e-16;
92 (*i3)[1] = 7.204059965732e-17;
93 (*i4)[1] = 5.722388235428e-17;
146 NS_LOG_INFO(
"creating SpectrumInterferenceTestSuite");
167 const double e = 1e-5;
172 (*s1)[0] = 1.255943215755e-15;
173 (*s1)[1] = 7.204059965732e-16;
174 b = 10067205.5632012;
176 TestCase::Duration::QUICK);
178 static_cast<uint32_t>(b * 0.5 + 0.5),
180 "sdBm = [-46 -48] tx bytes: b*0.5"),
181 TestCase::Duration::QUICK);
183 static_cast<uint32_t>(b * (1 - e) + 0.5),
185 "sdBm = [-46 -48] tx bytes: b*(1-e)"),
186 TestCase::Duration::QUICK);
188 static_cast<uint32_t>(b * (1 + e) + 0.5),
190 "sdBm = [-46 -48] tx bytes: b*(1+e)"),
191 TestCase::Duration::QUICK);
193 static_cast<uint32_t>(b * 1.5 + 0.5),
195 "sdBm = [-46 -48] tx bytes: b*1.5"),
196 TestCase::Duration::QUICK);
200 "sdBm = [-46 -48] tx bytes: 2^32-1"),
201 TestCase::Duration::QUICK);
205 (*s2)[0] = 2.505936168136e-17;
206 (*s2)[1] = 3.610582885110e-17;
207 b = 882401.591840728;
209 TestCase::Duration::QUICK);
211 static_cast<uint32_t>(b * 0.5 + 0.5),
213 "sdBm = [-63 -61] tx bytes: b*0.5"),
214 TestCase::Duration::QUICK);
216 static_cast<uint32_t>(b * (1 - e) + 0.5),
218 "sdBm = [-63 -61] tx bytes: b*(1-e)"),
219 TestCase::Duration::QUICK);
221 static_cast<uint32_t>(b * (1 + e) + 0.5),
223 "sdBm = [-63 -61] tx bytes: b*(1+e)"),
224 TestCase::Duration::QUICK);
226 static_cast<uint32_t>(b * 1.5 + 0.5),
228 "sdBm = [-63 -61] tx bytes: b*1.5"),
229 TestCase::Duration::QUICK);
233 "sdBm = [-63 -61] tx bytes: 2^32-1"),
234 TestCase::Duration::QUICK);
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()
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.
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 StartRx(Ptr< const Packet > p, Ptr< const SpectrumValue > rxPsd)
Notify that the PHY is starting a RX attempt.
void AddSignal(Ptr< const SpectrumValue > spd, const Time duration)
Notify that a new signal is being perceived in the medium.
void AddTestCase(TestCase *testCase, Duration duration=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.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#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