|
|
| 178 |
MakeUintegerAccessor (&WifiPhy::SetChannelNumber, |
178 |
MakeUintegerAccessor (&WifiPhy::SetChannelNumber, |
| 179 |
&WifiPhy::GetChannelNumber), |
179 |
&WifiPhy::GetChannelNumber), |
| 180 |
MakeUintegerChecker<uint8_t> (0, 196)) |
180 |
MakeUintegerChecker<uint8_t> (0, 196)) |
| 181 |
.AddAttribute ("EnergyDetectionThreshold", |
|
|
| 182 |
"The energy of a received signal should be higher than " |
| 183 |
"this threshold (dbm) to allow the PHY layer to detect the signal.", |
| 184 |
DoubleValue (-96.0), |
| 185 |
MakeDoubleAccessor (&WifiPhy::SetEdThreshold), |
| 186 |
MakeDoubleChecker<double> (), |
| 187 |
TypeId::DEPRECATED, "Replaced by RxSensitivity") |
| 188 |
.AddAttribute ("RxSensitivity", |
181 |
.AddAttribute ("RxSensitivity", |
| 189 |
"The energy of a received signal should be higher than " |
182 |
"The energy of a received signal should be higher than " |
| 190 |
"this threshold (dBm) for the PHY to detect the signal.", |
183 |
"this threshold (dBm) for the PHY to detect the signal.", |
|
|
| 192 |
MakeDoubleAccessor (&WifiPhy::SetRxSensitivity, |
185 |
MakeDoubleAccessor (&WifiPhy::SetRxSensitivity, |
| 193 |
&WifiPhy::GetRxSensitivity), |
186 |
&WifiPhy::GetRxSensitivity), |
| 194 |
MakeDoubleChecker<double> ()) |
187 |
MakeDoubleChecker<double> ()) |
| 195 |
.AddAttribute ("CcaMode1Threshold", |
188 |
.AddAttribute ("CcaEdThreshold", |
| 196 |
"The energy of a received signal should be higher than " |
189 |
"The energy of a received signal should be higher than " |
| 197 |
"this threshold (dbm) to allow the PHY layer to declare CCA BUSY state.", |
190 |
"this threshold (dbm) to allow the PHY layer to declare CCA BUSY state.", |
| 198 |
DoubleValue (-62.0), |
191 |
DoubleValue (-62.0), |
| 199 |
MakeDoubleAccessor (&WifiPhy::SetCcaMode1Threshold, |
192 |
MakeDoubleAccessor (&WifiPhy::SetCcaEdThreshold, |
| 200 |
&WifiPhy::GetCcaMode1Threshold), |
193 |
&WifiPhy::GetCcaEdThreshold), |
| 201 |
MakeDoubleChecker<double> ()) |
194 |
MakeDoubleChecker<double> ()) |
| 202 |
.AddAttribute ("TxGain", |
195 |
.AddAttribute ("TxGain", |
| 203 |
"Transmission gain (dB).", |
196 |
"Transmission gain (dB).", |
|
|
| 471 |
} |
464 |
} |
| 472 |
|
465 |
|
| 473 |
void |
466 |
void |
| 474 |
WifiPhy::SetEdThreshold (double threshold) |
|
|
| 475 |
{ |
| 476 |
NS_LOG_FUNCTION (this << threshold); |
| 477 |
m_edThresholdW = DbmToW (threshold); |
| 478 |
} |
| 479 |
|
| 480 |
double |
| 481 |
WifiPhy::GetEdThreshold (void) const |
| 482 |
{ |
| 483 |
return WToDbm (m_edThresholdW); |
| 484 |
} |
| 485 |
|
| 486 |
void |
| 487 |
WifiPhy::SetRxSensitivity (double threshold) |
467 |
WifiPhy::SetRxSensitivity (double threshold) |
| 488 |
{ |
468 |
{ |
| 489 |
NS_LOG_FUNCTION (this << threshold); |
469 |
NS_LOG_FUNCTION (this << threshold); |
|
|
| 497 |
} |
477 |
} |
| 498 |
|
478 |
|
| 499 |
void |
479 |
void |
| 500 |
WifiPhy::SetCcaMode1Threshold (double threshold) |
480 |
WifiPhy::SetCcaEdThreshold (double threshold) |
| 501 |
{ |
481 |
{ |
| 502 |
NS_LOG_FUNCTION (this << threshold); |
482 |
NS_LOG_FUNCTION (this << threshold); |
| 503 |
m_ccaMode1ThresholdW = DbmToW (threshold); |
483 |
m_ccaEdThresholdW = DbmToW (threshold); |
| 504 |
} |
484 |
} |
| 505 |
|
485 |
|
| 506 |
double |
486 |
double |
| 507 |
WifiPhy::GetCcaMode1Threshold (void) const |
487 |
WifiPhy::GetCcaEdThreshold (void) const |
| 508 |
{ |
488 |
{ |
| 509 |
return WToDbm (m_ccaMode1ThresholdW); |
489 |
return WToDbm (m_ccaEdThresholdW); |
| 510 |
} |
490 |
} |
| 511 |
|
491 |
|
| 512 |
void |
492 |
void |
|
|
| 1648 |
case WifiPhyState::SLEEP: |
1628 |
case WifiPhyState::SLEEP: |
| 1649 |
{ |
1629 |
{ |
| 1650 |
NS_LOG_DEBUG ("resuming from sleep mode"); |
1630 |
NS_LOG_DEBUG ("resuming from sleep mode"); |
| 1651 |
Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaMode1ThresholdW); |
1631 |
Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaEdThresholdW); |
| 1652 |
m_state->SwitchFromSleep (delayUntilCcaEnd); |
1632 |
m_state->SwitchFromSleep (delayUntilCcaEnd); |
| 1653 |
break; |
1633 |
break; |
| 1654 |
} |
1634 |
} |
|
|
| 1679 |
case WifiPhyState::OFF: |
1659 |
case WifiPhyState::OFF: |
| 1680 |
{ |
1660 |
{ |
| 1681 |
NS_LOG_DEBUG ("resuming from off mode"); |
1661 |
NS_LOG_DEBUG ("resuming from off mode"); |
| 1682 |
Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ())); |
1662 |
Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaEdThreshold ())); |
| 1683 |
m_state->SwitchFromOff (delayUntilCcaEnd); |
1663 |
m_state->SwitchFromOff (delayUntilCcaEnd); |
| 1684 |
break; |
1664 |
break; |
| 1685 |
} |
1665 |
} |
|
|
| 2547 |
//In this model, CCA becomes busy when the aggregation of all signals as |
2527 |
//In this model, CCA becomes busy when the aggregation of all signals as |
| 2548 |
//tracked by the InterferenceHelper class is higher than the CcaBusyThreshold |
2528 |
//tracked by the InterferenceHelper class is higher than the CcaBusyThreshold |
| 2549 |
|
2529 |
|
| 2550 |
Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ())); |
2530 |
Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaEdThreshold ())); |
| 2551 |
if (!delayUntilCcaEnd.IsZero ()) |
2531 |
if (!delayUntilCcaEnd.IsZero ()) |
| 2552 |
{ |
2532 |
{ |
| 2553 |
m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd); |
2533 |
m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd); |
|
|
| 3643 |
//In this model, CCA becomes busy when the aggregation of all signals as |
3623 |
//In this model, CCA becomes busy when the aggregation of all signals as |
| 3644 |
//tracked by the InterferenceHelper class is higher than the CcaBusyThreshold |
3624 |
//tracked by the InterferenceHelper class is higher than the CcaBusyThreshold |
| 3645 |
|
3625 |
|
| 3646 |
Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ())); |
3626 |
Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaEdThreshold ())); |
| 3647 |
if (!delayUntilCcaEnd.IsZero ()) |
3627 |
if (!delayUntilCcaEnd.IsZero ()) |
| 3648 |
{ |
3628 |
{ |
| 3649 |
NS_LOG_DEBUG ("Calling SwitchMaybeToCcaBusy for " << delayUntilCcaEnd.As (Time::S)); |
3629 |
NS_LOG_DEBUG ("Calling SwitchMaybeToCcaBusy for " << delayUntilCcaEnd.As (Time::S)); |