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>
42 virtual void DoRun (
void);
58 m_rxCorrectKnownOutcome (rxCorrect),
59 m_mySpectrumModel (s->GetSpectrumModel ())
79 (*n)[0] = 5.000000000000e-19;
80 (*n)[1] = 4.545454545455e-19;
82 (*i1)[0] = 5.000000000000e-18;
83 (*i2)[0] = 5.000000000000e-16;
84 (*i3)[0] = 1.581138830084e-16;
85 (*i4)[0] = 7.924465962306e-17;
86 (*i1)[1] = 1.437398936440e-18;
87 (*i2)[1] = 5.722388235428e-16;
88 (*i3)[1] = 7.204059965732e-17;
89 (*i4)[1] = 5.722388235428e-17;
93 si.
SetErrorModel (CreateObject<ShannonSpectrumErrorModel> ());
107 Simulator::Schedule (ts, &SpectrumInterference::AddSignal, &si,
m_s, ds);
108 Simulator::Schedule (ti1, &SpectrumInterference::AddSignal, &si, i1, di1);
109 Simulator::Schedule (ti2, &SpectrumInterference::AddSignal, &si, i2, di2);
110 Simulator::Schedule (ti3, &SpectrumInterference::AddSignal, &si, i3, di3);
111 Simulator::Schedule (ti4, &SpectrumInterference::AddSignal, &si, i4, di4);
114 Simulator::Schedule (ts, &SpectrumInterference::StartRx, &si, p,
m_s);
120 Simulator::Destroy ();
140 :
TestSuite (
"spectrum-interference", UNIT)
143 NS_LOG_INFO (
"creating SpectrumInterferenceTestSuite");
153 bands.push_back (bi);
158 bands.push_back (bi);
160 m = Create<SpectrumModel> (bands);
165 const double e = 1e-5;
170 (*s1)[0] = 1.255943215755e-15;
171 (*s1)[1] = 7.204059965732e-16;
172 b = 10067205.5632012;
182 (*s2)[0] = 2.505936168136e-17;
183 (*s2)[1] = 3.610582885110e-17;
184 b = 882401.591840728;
uint32_t m_rxCorrectKnownOutcome
virtual void DoRun(void)
Implementation to actually run this TestCase.
SpectrumInterferenceTestCase(Ptr< SpectrumValue > s, uint32_t txBytes, bool rxCorrect, std::string name)
void RetrieveTestResult(SpectrumInterference *si)
Ptr< const SpectrumModel > m_mySpectrumModel
virtual ~SpectrumInterferenceTestCase()
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
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband