add the holland 802.11a set of modes.

This commit is contained in:
Mathieu Lacage
2007-11-06 16:16:06 +01:00
parent b5a64f2fae
commit ecc4bab8f2
5 changed files with 61 additions and 14 deletions

View File

@@ -32,7 +32,8 @@ MacParameters::MacParameters ()
m_maxSlrc = WifiDefaultParameters::GetMaxSlrc ();
// ensure something not too stupid is set by default.
NS_ASSERT (WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_80211a);
NS_ASSERT (WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_80211a ||
WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_Holland);
uint32_t ctsAckSize = (2 + 2 + 6) * 8; // bits
double dataRate = (6e6 / 2); // mb/s
Time delay = Seconds (ctsAckSize / dataRate);
@@ -42,7 +43,8 @@ MacParameters::MacParameters ()
void
MacParameters::Initialize (Time ctsDelay, Time ackDelay)
{
NS_ASSERT (WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_80211a);
NS_ASSERT (WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_80211a ||
WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_Holland);
// these values are really 802.11a specific
m_sifs = MicroSeconds (16);

View File

@@ -25,6 +25,13 @@ namespace ns3 {
namespace WifiDefaultParameters {
static EnumDefaultValue<enum PhyStandard> g_phyStandard
("WifiPhyStandard",
"Describe the set of physical-layer tx modes and parameters",
PHY_STANDARD_80211a, "80211a",
PHY_STANDARD_holland, "holland",
0, (void*)0);
static NumericDefaultValue<uint32_t> g_maxSsrc
("WifiMaxSsrc",
"The MAC maximum number of short retransmission retries (rts retransmissions).",
@@ -185,7 +192,7 @@ GetApBeaconInterval (void)
enum PhyStandard
GetPhyStandard (void)
{
return PHY_STANDARD_80211a;
return g_phyStandard.GetValue ();
}
enum RateControlAlgorithm
GetRateControlAlgorithm (void)

View File

@@ -30,6 +30,7 @@ namespace WifiDefaultParameters {
enum PhyStandard {
PHY_STANDARD_80211a,
PHY_STANDARD_holland,
};
enum RateControlAlgorithm {
CONSTANT_RATE,

View File

@@ -193,8 +193,17 @@ WifiPhy::WifiPhy (Ptr<WifiNetDevice> device)
m_endSyncEvent (),
m_random (0.0, 1.0)
{
NS_ASSERT (WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_80211a);
Configure80211a ();
switch (WifiDefaultParameters::GetPhyStandard ()) {
case WifiDefaultParameters::PHY_STANDARD_80211a:
Configure80211a ();
break;
case WifiDefaultParameters::PHY_STANDARD_holland:
ConfigureHolland ();
break;
default:
NS_ASSERT (false);
break;
}
}
WifiPhy::~WifiPhy ()
@@ -389,7 +398,7 @@ WifiPhy::CalculateSnr (WifiMode txMode, double ber) const
}
void
WifiPhy::Configure80211a (void)
WifiPhy::Configure80211aParameters (void)
{
m_plcpLongPreambleDelayUs = 20;
m_plcpShortPreambleDelayUs = 20;
@@ -398,15 +407,11 @@ WifiPhy::Configure80211a (void)
m_plcpHeaderLength = 4 + 1 + 12 + 1 + 6 + 16 + 6;
/* 4095 bytes at a 6Mb/s rate with a 1/2 coding rate. */
m_maxPacketDuration = Seconds (4095.0*8.0/6000000.0*(1.0/2.0));
}
m_modes.push_back (g_6mba);
m_modes.push_back (g_9mba);
m_modes.push_back (g_18mba);
m_modes.push_back (g_24mba);
m_modes.push_back (g_36mba);
m_modes.push_back (g_48mba);
m_modes.push_back (g_54mba);
void
WifiPhy::PrintModes (void) const
{
#ifdef PHY80211_DEBUG
for (double db = 0; db < 30; db+= 0.5) {
std::cout <<db<<" ";
@@ -420,6 +425,35 @@ WifiPhy::Configure80211a (void)
#endif
}
void
WifiPhy::Configure80211a (void)
{
Configure80211aParameters ();
m_modes.push_back (g_6mba);
m_modes.push_back (g_9mba);
m_modes.push_back (g_12mba);
m_modes.push_back (g_18mba);
m_modes.push_back (g_24mba);
m_modes.push_back (g_36mba);
m_modes.push_back (g_48mba);
m_modes.push_back (g_54mba);
PrintModes ();
}
void
WifiPhy::ConfigureHolland (void)
{
Configure80211aParameters ();
m_modes.push_back (g_6mba);
m_modes.push_back (g_12mba);
m_modes.push_back (g_18mba);
m_modes.push_back (g_36mba);
m_modes.push_back (g_54mba);
PrintModes ();
}
void
WifiPhy::RegisterListener (WifiPhyListener *listener)
{

View File

@@ -246,7 +246,10 @@ private:
private:
// inherited from ns3::Object.
virtual Ptr<TraceResolver> GetTraceResolver (void) const;
void Configure80211aParameters (void);
void PrintModes (void) const;
void Configure80211a (void);
void ConfigureHolland (void);
char const *StateToString (enum State state);
enum WifiPhy::State GetState (void);
double GetEdThresholdW (void) const;