24 #include "ns3/pointer.h" 25 #include "ns3/simulator.h" 26 #include "ns3/rng-seed-manager.h" 27 #include "ns3/constant-position-mobility-model.h" 28 #include "ns3/wifi-spectrum-signal-parameters.h" 29 #include "ns3/wifi-spectrum-value-helper.h" 30 #include "ns3/multi-model-spectrum-channel.h" 31 #include "ns3/spectrum-wifi-phy.h" 32 #include "ns3/nist-error-rate-model.h" 33 #include "ns3/wifi-mac-header.h" 34 #include "ns3/wifi-net-device.h" 35 #include "ns3/wifi-psdu.h" 36 #include "ns3/wifi-ppdu.h" 37 #include "ns3/waveform-generator.h" 38 #include "ns3/non-communicating-net-device.h" 65 uint16_t GetStaId (
void)
const override;
100 virtual void DoRun (
void);
149 void CheckResultsSta1 (uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes);
156 void CheckResultsSta2 (uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes);
163 void CheckResultsSta3 (uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes);
175 void SendMuPpdu (uint16_t rxStaId1, uint16_t rxStaId2);
229 m_countRxSuccessSta1 (0),
230 m_countRxSuccessSta2 (0),
231 m_countRxSuccessSta3 (0),
232 m_countRxFailureSta1 (0),
233 m_countRxFailureSta2 (0),
234 m_countRxFailureSta3 (0),
235 m_countRxBytesSta1 (0),
236 m_countRxBytesSta2 (0),
237 m_countRxBytesSta3 (0),
267 ruType = HeRu::RU_106_TONE;
271 ruType = HeRu::RU_242_TONE;
275 ruType = HeRu::RU_484_TONE;
279 ruType = HeRu::RU_996_TONE;
290 txVector.
SetRu (ru1, rxStaId1);
291 txVector.
SetMode (WifiPhy::GetHeMcs7 (), rxStaId1);
292 txVector.
SetNss (1, rxStaId1);
298 txVector.
SetRu (ru2, rxStaId2);
299 txVector.
SetMode (WifiPhy::GetHeMcs9 (), rxStaId2);
300 txVector.
SetNss (1, rxStaId2);
307 hdr1.SetSequenceNumber (1);
309 psdus.insert (std::make_pair (rxStaId1, psdu1));
316 hdr2.SetSequenceNumber (2);
318 psdus.insert (std::make_pair (rxStaId2, psdu2));
428 phy->GetAttribute (
"State", ptr);
445 Ptr<Node> apNode = CreateObject<Node> ();
447 m_phyAp = CreateObject<SpectrumWifiPhy> ();
460 Ptr<Node> sta1Node = CreateObject<Node> ();
462 m_phySta1 = CreateObject<OfdmaSpectrumWifiPhy> (1);
476 Ptr<Node> sta2Node = CreateObject<Node> ();
478 m_phySta2 = CreateObject<OfdmaSpectrumWifiPhy> (2);
492 Ptr<Node> sta3Node = CreateObject<Node> ();
494 m_phySta3 = CreateObject<OfdmaSpectrumWifiPhy> (3);
508 Ptr<Node> interfererNode = CreateObject<Node> ();
514 interfererNode->
AddDevice (interfererDev);
520 RngSeedManager::SetSeed (1);
521 RngSeedManager::SetRun (1);
522 int64_t streamNumber = 0;
598 bands.push_back (bandInfo);
601 Ptr<SpectrumValue> interferencePsdRu1 = Create<SpectrumValue> (SpectrumInterferenceRu1);
602 double interferencePower = 0.1;
603 *interferencePsdRu1 = interferencePower / ((
m_channelWidth / 2) * 20e6);
634 bands.push_back (bandInfo);
637 Ptr<SpectrumValue> interferencePsdRu2 = Create<SpectrumValue> (SpectrumInterferenceRu2);
638 *interferencePsdRu2 = interferencePower / ((
m_channelWidth / 2) * 20e6);
669 bands.push_back (bandInfo);
672 Ptr<SpectrumValue> interferencePsdAll = Create<SpectrumValue> (SpectrumInterferenceAll);
673 *interferencePsdAll = interferencePower / (
m_channelWidth * 20e6);
722 Simulator::Destroy ();
void CheckResultsSta2(uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes)
Check the results for STA 2.
Simulation virtual time values and global simulation resolution.
void SendMuPpdu(uint16_t rxStaId1, uint16_t rxStaId2)
Send MU-PPDU function.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint32_t m_countRxFailureSta2
count RX failure for STA 2
void StopInterference(void)
Stop interference function.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint16_t GetStaId(void) const override
Return the STA ID that has been assigned to the station this PHY belongs to.
uint32_t m_countRxBytesSta2
count RX bytes for STA 2
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Time m_expectedPpduDuration
expected duration to send MU PPDU
Ptr< SpectrumWifiPhy > m_phyAp
PHY of AP.
void SetReceiveErrorCallback(RxErrorCallback callback)
uint32_t m_countRxSuccessSta3
count RX success for STA 3
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
bool primary80MHz
true if the RU is allocated in the primary 80MHz channel
void RxFailureSta2(Ptr< WifiPsdu > psdu)
Receive failure function for STA 2.
void RunOne()
Run one function.
uint16_t m_staId
ID of the STA to which this PHY belongs to.
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Ptr< WaveformGenerator > m_phyInterferer
PHY of interferer.
uint32_t m_countRxBytesSta3
count RX bytes for STA 3
void AddPropagationLossModel(Ptr< PropagationLossModel > loss)
Add the single-frequency propagation loss model to be used.
uint32_t m_countRxSuccessSta2
count RX success for STA 2
void CheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Schedule now to check the PHY state.
std::vector< BandInfo > Bands
Container of BandInfo.
void DoCheckPhyState(Ptr< OfdmaSpectrumWifiPhy > phy, WifiPhyState expectedState)
Check the PHY state now.
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
void CheckResultsSta1(uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes)
Check the results for STA 1.
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
uint32_t m_countRxBytesSta1
count RX bytes for STA 1
void RxSuccessSta3(Ptr< WifiPsdu > psdu, double snr, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function for STA 3.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
void RxFailureSta3(Ptr< WifiPsdu > psdu)
Receive failure function for STA 3.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
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.
uint32_t m_countRxSuccessSta1
count RX success for STA 1
The PHY layer has sense the medium busy through the CCA mechanism.
TestDlOfdmaPhyTransmission()
802.11 PHY layer modelThis PHY implements a spectrum-aware enhancement of the 802.11 SpectrumWifiPhy model.
Ptr< OfdmaSpectrumWifiPhy > m_phySta3
PHY of STA 3.
virtual void SetFrequency(uint16_t freq)
uint16_t m_channelWidth
channel width in MHz
void SetNss(uint8_t nss)
Sets the number of Nss.
uint32_t m_countRxFailureSta1
count RX failure for STA 1
virtual void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band)
Configure the PHY-level parameters for different Wi-Fi standard.
void CheckResultsSta3(uint32_t expectedRxSuccess, uint32_t expectedRxFailure, uint32_t expectedRxBytes)
Check the results for STA 3.
uint16_t m_frequency
frequency in MHz
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
virtual ~TestDlOfdmaPhyTransmission()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double fl
lower limit of subband
Hold objects of type Ptr<T>.
virtual void DoRun(void)
Implementation to actually run this TestCase.
WifiPhyState
The state of the PHY layer.
RuType
The different HE Resource Unit (RU) types.
void GenerateInterference(Ptr< SpectrumValue > interferencePsd, Time duration)
Generate interference function.
wifi PHY OFDMA Test Suite
Ptr< OfdmaSpectrumWifiPhy > m_phySta2
PHY of STA 2.
uint32_t m_countRxFailureSta3
count RX failure for STA 3
virtual void SetChannelWidth(uint16_t channelwidth)
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void SetReceiveOkCallback(RxOkCallback callback)
This objects implements the PHY state machine of the Wifi device.
WifiPhyState GetState(void) const
Return the current state of WifiPhy.
void RxSuccessSta2(Ptr< WifiPsdu > psdu, double snr, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function for STA 2.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
static const uint16_t DEFAULT_CHANNEL_WIDTH
virtual ~OfdmaSpectrumWifiPhy()
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
Set the propagation delay model to be used.
Time Seconds(double value)
Construct a Time in the indicated unit.
The PHY layer is receiving a packet.
std::size_t index
index (starting at 1)
void Send(Ptr< const WifiPsdu > psdu, WifiTxVector txVector)
void RxSuccessSta1(Ptr< WifiPsdu > psdu, double snr, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Receive success function for STA 1.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
void ResetResults()
Reset the results.
OfdmaSpectrumWifiPhy(uint16_t staId)
Constructor.
double fh
upper limit of subband
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
The building block of a SpectrumModel.
void RxFailureSta1(Ptr< WifiPsdu > psdu)
Receive failure function for STA 1.
void SetRu(HeRu::RuSpec ru, uint16_t staId)
Set the RU specification for the STA-ID.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
static WifiPhyOfdmaTestSuite wifiPhyOfdmaTestSuite
the test suite
Ptr< OfdmaSpectrumWifiPhy > m_phySta1
PHY of STA 1.
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...
static const uint32_t DEFAULT_FREQUENCY