|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
26 #include "ns3/wifi-psdu.h"
27 #include "ns3/wifi-phy.h"
28 #include "ns3/wifi-utils.h"
29 #include "ns3/simulator.h"
174 bool , uint32_t & ,
double & ,
184 return Create<DsssPpdu> (psdus.begin ()->second, txVector, ppduDuration,
216 NS_LOG_DEBUG (
"Abort reception because long/short PHY header reception failed");
246 NS_ABORT_MSG_IF (channelWidth != 22,
"Invalid channel width for DSSS");
274 NS_ABORT_MSG (
"Inexistent rate (" << rate <<
" bps) requested for HR/DSSS");
279 #define GET_DSSS_MODE(x, m) \
281 DsssPhy::Get ## x (void) \
283 static WifiMode mode = CreateDsssMode (#x, WIFI_MOD_CLASS_ ## m); \
341 uint16_t divisor = 0;
352 NS_FATAL_ERROR (
"Incorrect modulation class, must specify either WIFI_MOD_CLASS_DSSS or WIFI_MOD_CLASS_HR_DSSS!");
354 uint16_t numberOfBitsPerSubcarrier =
static_cast<uint16_t
> (log2 (constellationSize));
355 uint64_t dataRate = ((11000000 / divisor) * numberOfBitsPerSubcarrier);
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
const PpduFormats & GetPpduFormats(void) const override
Return the PPDU formats of the PHY.
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Declaration of ns3::DsssPhy class.
virtual uint16_t GetRxChannelWidth(const WifiTxVector &txVector) const
Return the channel width used in the reception spectrum model.
std::list< WifiMode > m_modeList
the list of supported modes
static WifiMode GetDsssRate(uint64_t rate)
Return a WifiMode for HR/DSSS corresponding to the provided rate.
uint16_t GetCenterFrequencyForChannelWidth(const WifiTxVector &txVector) const
Get the center frequency of the channel corresponding the current TxVector rather than that of the su...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const
double snr
SNR in linear scale.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
static WifiCodeRate GetCodeRate(const std::string &name)
Return the WifiCodeRate from the DSSS or HR/DSSS mode's unique name using ModulationLookupTable.
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
PhyRxFailureAction actionIfFailure
action to perform in case of failure
WifiModulationClass GetModulationClass() const
const uint16_t WIFI_CODE_RATE_UNDEFINED
undefined coding rate
static const ModulationLookupTable m_dsssModulationLookupTable
lookup table to retrieve code rate and constellation size corresponding to a unique name of modulatio...
static WifiMode CreateDsssMode(std::string uniqueName, WifiModulationClass modClass)
Create a DSSS or HR/DSSS mode from a unique name, the unique name must already be contained inside Mo...
@ ABORT
abort reception of PPDU
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static const std::array< uint64_t, 4 > s_dsssRatesBpsList
DSSS rates in bits per second.
@ WIFI_PPDU_FIELD_PREAMBLE
SYNC + SFD fields for DSSS or ERP, shortSYNC + shortSFD fields for HR/DSSS or ERP,...
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Time GetPreambleDuration(const WifiTxVector &txVector) const
static const PpduFormats m_dsssPpduFormats
DSSS and HR/DSSS PPDU formats.
static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of implemented PHY entities for the given modulation class.
static WifiMode GetDsssRate1Mbps(void)
Return a WifiMode for DSSS at 1 Mbps.
static WifiMode GetDsssRate2Mbps(void)
Return a WifiMode for DSSS at 2 Mbps.
static class anonymous_namespace{dsss-phy.cc}::ConstructorDsss g_constructor_dsss
the constructor for DSSS modes
@ WIFI_MOD_CLASS_HR_DSSS
HR/DSSS (Clause 16)
Smart pointer class similar to boost::intrusive_ptr.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
uint32_t GetMaxPsduSize(void) const override
Get the maximum PSDU size in bytes.
uint16_t WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
Constructor class for DSSS modes.
represent a single transmission mode
WifiPhyRxfailureReason reason
failure reason
Status of the reception of the PPDU field.
virtual ~DsssPhy()
Destructor for HR/DSSS PHY.
static WifiMode CreateWifiMode(std::string uniqueName, WifiModulationClass modClass, bool isMandatory, CodeRateCallback codeRateCallback, ConstellationSizeCallback constellationSizeCallback, PhyRateCallback phyRateCallback, PhyRateFromTxVectorCallback phyRateFromTxVectorCallback, DataRateCallback dataRateCallback, DataRateFromTxVectorCallback dataRateFromTxVectorCallback, ModeAllowedCallback isModeAllowedCallback)
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
const std::array< uint64_t, 4 > & GetDsssRatesBpsList(void)
Get the array of possible DSSS rates.
uint16_t GetRxChannelWidth(const WifiTxVector &txVector) const override
Return the channel width used in the reception spectrum model.
static void InitializeModes(void)
Initialize all HR/DSSS modes.
std::string GetUniqueName(void) const
WifiPreamble GetPreambleType(void) const
Simulation virtual time values and global simulation resolution.
#define GET_DSSS_MODE(x, m)
DsssPhy()
Constructor for HR/DSSS PHY.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
virtual PhyFieldRxStatus DoEndReceiveField(WifiPpduField field, Ptr< Event > event)
End receiving a given field, perform amendment-specific actions, and provide the status of the recept...
uint16_t GetChannelWidth(void) const
WifiPpduField
The type of PPDU field (grouped for convenience)
bool isSuccess
outcome (true if success) of the reception
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...
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
double RatioToDb(double ratio)
Convert from ratio to dB.
Time GetHeaderDuration(const WifiTxVector &txVector) const
double GetRandomValue(void) const
Obtain a random value from the WifiPhy's generator.
SnrPer GetPhyHeaderSnrPer(WifiPpduField field, Ptr< Event > event) const
Obtain the SNR and PER of the PPDU field from the WifiPhy's InterferenceHelper class.
Time GetDuration(WifiPpduField field, const WifiTxVector &txVector) const override
Get the duration of the PPDU field (or group of fields) used by this entity for the given transmissio...
static uint16_t GetConstellationSize(const std::string &name)
Return the constellation size from the DSSS or HR/DSSS mode's unique name using ModulationLookupTable...
WifiMode GetHeaderMode(const WifiTxVector &txVector) const
PhyFieldRxStatus DoEndReceiveField(WifiPpduField field, Ptr< Event > event) override
End receiving a given field, perform amendment-specific actions, and provide the status of the recept...
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
static WifiMode GetDsssRate5_5Mbps(void)
Return a WifiMode for HR/DSSS at 5.5 Mbps.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
virtual Time GetDuration(WifiPpduField field, const WifiTxVector &txVector) const
Get the duration of the PPDU field (or group of fields) used by this entity for the given transmissio...
static bool IsModeAllowed(uint16_t channelWidth, uint8_t nss)
Check whether the combination of <WifiMode, channel width, NSS> is allowed.
uint16_t GetChannelWidth(void) const
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
std::map< std::string, CodeRateConstellationSizePair > ModulationLookupTable
A modulation lookup table using unique name of modulation as key.
@ WIFI_PPDU_FIELD_DATA
data field
A struct for both SNR and PER.
WifiPhyBand
Identifies the PHY band.
static WifiMode GetDsssRate11Mbps(void)
Return a WifiMode for HR/DSSS at 11 Mbps.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
virtual WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const
Get the WifiMode for the SIG field specified by the PPDU field.
virtual bool IsConfigSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the signaled configuration (excluding bandwidth) is supported by the PHY.
static uint64_t GetDataRate(const std::string &name, WifiModulationClass modClass, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
Return the data rate from the DSSS or HR/DSSS mode's unique name and the supplied parameters.
PhyFieldRxStatus EndReceiveHeader(Ptr< Event > event)
End receiving the header, perform DSSS-specific actions, and provide the status of the reception.
Time GetPayloadDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, MpduType mpdutype, bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols, uint16_t staId) const override
@ WIFI_PPDU_FIELD_NON_HT_HEADER
PHY header field for DSSS or ERP, short PHY header field for HR/DSSS or ERP, field not present for HT...
static Ptr< SpectrumValue > CreateDsssTxPowerSpectralDensity(uint32_t centerFrequency, double txPowerW, uint16_t guardBandwidth)
Create a transmit power spectral density corresponding to DSSS.
@ WIFI_MOD_CLASS_DSSS
DSSS (Clause 15)
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
@ DROP
drop PPDU and set CCA_BUSY
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
Ptr< SpectrumValue > GetTxPowerSpectralDensity(double txPowerW, Ptr< const WifiPpdu > ppdu) const override
MpduType
The type of an MPDU.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const override
Get the WifiMode for the SIG field specified by the PPDU field.
Declaration of ns3::DsssPpdu class.