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>
54 virtual void DoRun (
void);
74 m_rxCorrectKnownOutcome (rxCorrect),
75 m_mySpectrumModel (s->GetSpectrumModel ())
95 (*n)[0] = 5.000000000000e-19;
96 (*n)[1] = 4.545454545455e-19;
98 (*i1)[0] = 5.000000000000e-18;
99 (*i2)[0] = 5.000000000000e-16;
100 (*i3)[0] = 1.581138830084e-16;
101 (*i4)[0] = 7.924465962306e-17;
102 (*i1)[1] = 1.437398936440e-18;
103 (*i2)[1] = 5.722388235428e-16;
104 (*i3)[1] = 7.204059965732e-17;
105 (*i4)[1] = 5.722388235428e-17;
109 si.
SetErrorModel (CreateObject<ShannonSpectrumErrorModel> ());
123 Simulator::Schedule (ts, &SpectrumInterference::AddSignal, &si,
m_s, ds);
124 Simulator::Schedule (ti1, &SpectrumInterference::AddSignal, &si, i1, di1);
125 Simulator::Schedule (ti2, &SpectrumInterference::AddSignal, &si, i2, di2);
126 Simulator::Schedule (ti3, &SpectrumInterference::AddSignal, &si, i3, di3);
127 Simulator::Schedule (ti4, &SpectrumInterference::AddSignal, &si, i4, di4);
130 Simulator::Schedule (ts, &SpectrumInterference::StartRx, &si, p,
m_s);
136 Simulator::Destroy ();
161 :
TestSuite (
"spectrum-interference", UNIT)
164 NS_LOG_INFO (
"creating SpectrumInterferenceTestSuite");
174 bands.push_back (bi);
179 bands.push_back (bi);
181 m = Create<SpectrumModel> (bands);
186 const double e = 1e-5;
191 (*s1)[0] = 1.255943215755e-15;
192 (*s1)[1] = 7.204059965732e-16;
193 b = 10067205.5632012;
203 (*s2)[0] = 2.505936168136e-17;
204 (*s2)[1] = 3.610582885110e-17;
205 b = 882401.591840728;
Spectrum Interference Test.
uint32_t m_rxCorrectKnownOutcome
extected Rx bytes
Ptr< SpectrumValue > m_s
Spectrum value.
virtual void DoRun(void)
Implementation to actually run this TestCase.
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.
virtual ~SpectrumInterferenceTestCase()
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