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>
43 virtual void DoRun (
void);
59 m_rxCorrectKnownOutcome (rxCorrect),
60 m_mySpectrumModel (s->GetSpectrumModel ())
80 (*n)[0] = 5.000000000000e-19;
81 (*n)[1] = 4.545454545455e-19;
83 (*i1)[0] = 5.000000000000e-18;
84 (*i2)[0] = 5.000000000000e-16;
85 (*i3)[0] = 1.581138830084e-16;
86 (*i4)[0] = 7.924465962306e-17;
87 (*i1)[1] = 1.437398936440e-18;
88 (*i2)[1] = 5.722388235428e-16;
89 (*i3)[1] = 7.204059965732e-17;
90 (*i4)[1] = 5.722388235428e-17;
94 si.
SetErrorModel (CreateObject<ShannonSpectrumErrorModel> ());
97 Time ts = Seconds (1);
98 Time ds = Seconds (1);
99 Time ti1 = Seconds (0);
100 Time di1 = Seconds (3);
101 Time ti2 = Seconds (0.7);
102 Time di2 = Seconds (1);
103 Time ti3 = Seconds (1.2);
104 Time di3 = Seconds (1);
105 Time ti4 = Seconds (1.5);
106 Time di4 = Seconds (0.1);
108 Simulator::Schedule (ts, &SpectrumInterference::AddSignal, &si,
m_s, ds);
109 Simulator::Schedule (ti1, &SpectrumInterference::AddSignal, &si, i1, di1);
110 Simulator::Schedule (ti2, &SpectrumInterference::AddSignal, &si, i2, di2);
111 Simulator::Schedule (ti3, &SpectrumInterference::AddSignal, &si, i3, di3);
112 Simulator::Schedule (ti4, &SpectrumInterference::AddSignal, &si, i4, di4);
115 Simulator::Schedule (ts, &SpectrumInterference::StartRx, &si, p,
m_s);
121 Simulator::Destroy ();
141 :
TestSuite (
"spectrum-interference", UNIT)
144 NS_LOG_INFO (
"creating SpectrumInterferenceTestSuite");
154 bands.push_back (bi);
159 bands.push_back (bi);
161 m = Create<SpectrumModel> (bands);
166 const double e = 1e-5;
171 (*s1)[0] = 1.255943215755e-15;
172 (*s1)[1] = 7.204059965732e-16;
173 b = 10067205.5632012;
183 (*s2)[0] = 2.505936168136e-17;
184 (*s2)[1] = 3.610582885110e-17;
185 b = 882401.591840728;
void RetrieveTestResult(SpectrumInterference *si)
Simulation virtual time values and global simulation resolution.
virtual ~SpectrumInterferenceTestCase()
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t m_rxCorrectKnownOutcome
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
SpectrumInterferenceTestCase(Ptr< SpectrumValue > s, uint32_t txBytes, bool rxCorrect, std::string name)
std::vector< BandInfo > Bands
virtual void DoRun(void)
Implementation to actually run this TestCase.
double fc
center frequency
#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.
double fl
lower limit of subband
bool EndRx()
notify that the RX attempt has ended.
This class implements a gaussian interference model, i.e., all incoming signals are added to the tota...
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
SpectrumInterferenceTestSuite()
void SetErrorModel(Ptr< SpectrumErrorModel > e)
set the SpectrumErrorModel to be used.
double fh
upper limit of subband
static SpectrumInterferenceTestSuite spectrumInterferenceTestSuite
The building block of a SpectrumModel.
Ptr< const SpectrumModel > m_mySpectrumModel