diff --git a/src/wifi/model/dsss-phy.cc b/src/wifi/model/dsss-phy.cc index 61a3fc615..c0beac500 100644 --- a/src/wifi/model/dsss-phy.cc +++ b/src/wifi/model/dsss-phy.cc @@ -45,6 +45,14 @@ const PhyEntity::PpduFormats DsssPhy::m_dsssPpduFormats { WIFI_PPDU_FIELD_NON_HT_HEADER, //Short PHY header WIFI_PPDU_FIELD_DATA } } }; + +const PhyEntity::ModulationLookupTable DsssPhy::m_dsssModulationLookupTable { + // Unique name Code rate Constellation size + { "DsssRate1Mbps", { WIFI_CODE_RATE_UNDEFINED, 2 } }, + { "DsssRate2Mbps", { WIFI_CODE_RATE_UNDEFINED, 4 } }, + { "DsssRate5_5Mbps", { WIFI_CODE_RATE_UNDEFINED, 16 } }, + { "DsssRate11Mbps", { WIFI_CODE_RATE_UNDEFINED, 256 } } +}; /* *NS_CHECK_STYLE_ON* */ DsssPhy::DsssPhy () diff --git a/src/wifi/model/dsss-phy.h b/src/wifi/model/dsss-phy.h index eec4e5863..ec8ae01c2 100644 --- a/src/wifi/model/dsss-phy.h +++ b/src/wifi/model/dsss-phy.h @@ -142,6 +142,8 @@ private: PhyFieldRxStatus EndReceiveHeader (Ptr event); static const PpduFormats m_dsssPpduFormats; //!< DSSS and HR/DSSS PPDU formats + + static const ModulationLookupTable m_dsssModulationLookupTable; //!< lookup table to retrieve code rate and constellation size corresponding to a unique name of modulation }; //class DsssPhy } //namespace ns3 diff --git a/src/wifi/model/erp-ofdm-phy.cc b/src/wifi/model/erp-ofdm-phy.cc index 8ae937ec0..f6172c62e 100644 --- a/src/wifi/model/erp-ofdm-phy.cc +++ b/src/wifi/model/erp-ofdm-phy.cc @@ -35,6 +35,20 @@ NS_LOG_COMPONENT_DEFINE ("ErpOfdmPhy"); * ERP-OFDM PHY (IEEE 802.11-2016, clause 18) *******************************************************/ +/* *NS_CHECK_STYLE_OFF* */ +const PhyEntity::ModulationLookupTable ErpOfdmPhy::m_erpOfdmModulationLookupTable { + // Unique name Code rate Constellation size + { "ErpOfdmRate6Mbps", { WIFI_CODE_RATE_1_2, 2 } }, + { "ErpOfdmRate9Mbps", { WIFI_CODE_RATE_3_4, 2 } }, + { "ErpOfdmRate12Mbps", { WIFI_CODE_RATE_1_2, 4 } }, + { "ErpOfdmRate18Mbps", { WIFI_CODE_RATE_3_4, 4 } }, + { "ErpOfdmRate24Mbps", { WIFI_CODE_RATE_1_2, 16 } }, + { "ErpOfdmRate36Mbps", { WIFI_CODE_RATE_3_4, 16 } }, + { "ErpOfdmRate48Mbps", { WIFI_CODE_RATE_2_3, 64 } }, + { "ErpOfdmRate54Mbps", { WIFI_CODE_RATE_3_4, 64 } } +}; +/* *NS_CHECK_STYLE_ON* */ + ErpOfdmPhy::ErpOfdmPhy () : OfdmPhy (OFDM_PHY_DEFAULT, false) //don't add OFDM modes to list { diff --git a/src/wifi/model/erp-ofdm-phy.h b/src/wifi/model/erp-ofdm-phy.h index df13d1f71..6e9e1f38a 100644 --- a/src/wifi/model/erp-ofdm-phy.h +++ b/src/wifi/model/erp-ofdm-phy.h @@ -131,6 +131,8 @@ private: WifiMode GetHeaderMode (WifiTxVector txVector) const override; Time GetPreambleDuration (WifiTxVector txVector) const override; Time GetHeaderDuration (WifiTxVector txVector) const override; + + static const ModulationLookupTable m_erpOfdmModulationLookupTable; //!< lookup table to retrieve code rate and constellation size corresponding to a unique name of modulation }; //class ErpOfdmPhy } //namespace ns3 diff --git a/src/wifi/model/ofdm-phy.cc b/src/wifi/model/ofdm-phy.cc index 2866232f1..541f9c3fa 100644 --- a/src/wifi/model/ofdm-phy.cc +++ b/src/wifi/model/ofdm-phy.cc @@ -42,6 +42,34 @@ const PhyEntity::PpduFormats OfdmPhy::m_ofdmPpduFormats { WIFI_PPDU_FIELD_NON_HT_HEADER, //SIG WIFI_PPDU_FIELD_DATA } } }; + +const PhyEntity::ModulationLookupTable OfdmPhy::m_ofdmModulationLookupTable { + // Unique name Code rate Constellation size + { "OfdmRate6Mbps", { WIFI_CODE_RATE_1_2, 2 } }, // 20 MHz + { "OfdmRate9Mbps", { WIFI_CODE_RATE_3_4, 2 } }, // | + { "OfdmRate12Mbps", { WIFI_CODE_RATE_1_2, 4 } }, // V + { "OfdmRate18Mbps", { WIFI_CODE_RATE_3_4, 4 } }, + { "OfdmRate24Mbps", { WIFI_CODE_RATE_1_2, 16 } }, + { "OfdmRate36Mbps", { WIFI_CODE_RATE_3_4, 16 } }, + { "OfdmRate48Mbps", { WIFI_CODE_RATE_2_3, 64 } }, + { "OfdmRate54Mbps", { WIFI_CODE_RATE_3_4, 64 } }, + { "OfdmRate3MbpsBW10MHz", { WIFI_CODE_RATE_1_2, 2 } }, // 10 MHz + { "OfdmRate4_5MbpsBW10MHz", { WIFI_CODE_RATE_3_4, 2 } }, // | + { "OfdmRate6MbpsBW10MHz", { WIFI_CODE_RATE_1_2, 4 } }, // V + { "OfdmRate9MbpsBW10MHz", { WIFI_CODE_RATE_3_4, 4 } }, + { "OfdmRate12MbpsBW10MHz", { WIFI_CODE_RATE_1_2, 16 } }, + { "OfdmRate18MbpsBW10MHz", { WIFI_CODE_RATE_3_4, 16 } }, + { "OfdmRate24MbpsBW10MHz", { WIFI_CODE_RATE_2_3, 64 } }, + { "OfdmRate27MbpsBW10MHz", { WIFI_CODE_RATE_3_4, 64 } }, + { "OfdmRate1_5MbpsBW5MHz", { WIFI_CODE_RATE_1_2, 2 } }, // 5 MHz + { "OfdmRate2_25MbpsBW5MHz", { WIFI_CODE_RATE_3_4, 2 } }, // | + { "OfdmRate3MbpsBW5MHz", { WIFI_CODE_RATE_1_2, 4 } }, // V + { "OfdmRate4_5MbpsBW5MHz", { WIFI_CODE_RATE_3_4, 4 } }, + { "OfdmRate6MbpsBW5MHz", { WIFI_CODE_RATE_1_2, 16 } }, + { "OfdmRate9MbpsBW5MHz", { WIFI_CODE_RATE_3_4, 16 } }, + { "OfdmRate12MbpsBW5MHz", { WIFI_CODE_RATE_2_3, 64 } }, + { "OfdmRate13_5MbpsBW5MHz", { WIFI_CODE_RATE_3_4, 64 } } +}; /* *NS_CHECK_STYLE_ON* */ OfdmPhy::OfdmPhy (OfdmPhyVariant variant /* = OFDM_PHY_DEFAULT */, bool buildModeList /* = true */) diff --git a/src/wifi/model/ofdm-phy.h b/src/wifi/model/ofdm-phy.h index 434ef1b73..bbe0b19bf 100644 --- a/src/wifi/model/ofdm-phy.h +++ b/src/wifi/model/ofdm-phy.h @@ -318,6 +318,8 @@ protected: private: static const PpduFormats m_ofdmPpduFormats; //!< OFDM PPDU formats + + static const ModulationLookupTable m_ofdmModulationLookupTable; //!< lookup table to retrieve code rate and constellation size corresponding to a unique name of modulation }; //class OfdmPhy } //namespace ns3 diff --git a/src/wifi/model/phy-entity.h b/src/wifi/model/phy-entity.h index b74c7bbf1..12f72aa88 100644 --- a/src/wifi/model/phy-entity.h +++ b/src/wifi/model/phy-entity.h @@ -468,6 +468,16 @@ protected: */ typedef std::map > PpduFormats; + /** + * A pair to hold modulation information: code rate and constellation size. + */ + typedef std::pair CodeRateConstellationSizePair; + + /** + * A modulation lookup table using unique name of modulation as key. + */ + typedef std::map ModulationLookupTable; + /** * Return the PPDU formats of the PHY. *