wifi: Use static_cast instead of C-style cast

This commit is contained in:
Sébastien Deronne
2018-01-21 09:21:38 +01:00
parent 0d6f46f648
commit 3777db41ec
29 changed files with 183 additions and 182 deletions

View File

@@ -83,7 +83,7 @@ AmpduSubframeHeader::Print (std::ostream &os) const
{
os << "EOF = " << m_eof << ", length = " << m_length;
char previousFillChar = os.fill ('0');
os << ", CRC = 0x" << std::hex << std::setw (2) << (uint16_t) m_crc << ", Signature = 0x" << (uint16_t) m_sig << std::dec;
os << ", CRC = 0x" << std::hex << std::setw (2) << static_cast<uint16_t> (m_crc) << ", Signature = 0x" << static_cast<uint16_t> (m_sig) << std::dec;
os.fill (previousFillChar);
}

View File

@@ -31,7 +31,7 @@ BlockAckAgreement::BlockAckAgreement (Mac48Address peer, uint8_t tid)
m_htSupported (0),
m_inactivityEvent ()
{
NS_LOG_FUNCTION (this << peer << (uint16_t)tid);
NS_LOG_FUNCTION (this << peer << static_cast<uint16_t> (tid));
m_tid = tid;
m_peer = peer;
}

View File

@@ -48,7 +48,7 @@ Bar::Bar (Ptr<const Packet> bar, Mac48Address recipient, uint8_t tid, bool immed
tid (tid),
immediate (immediate)
{
NS_LOG_FUNCTION (this << bar << recipient << (uint16_t)tid << immediate);
NS_LOG_FUNCTION (this << bar << recipient << static_cast<uint16_t> (tid) << immediate);
}
NS_OBJECT_ENSURE_REGISTERED (BlockAckManager);
@@ -80,7 +80,7 @@ BlockAckManager::~BlockAckManager ()
bool
BlockAckManager::ExistsAgreement (Mac48Address recipient, uint8_t tid) const
{
NS_LOG_FUNCTION (this << recipient << (uint16_t)tid);
NS_LOG_FUNCTION (this << recipient << static_cast<uint16_t> (tid));
return (m_agreements.find (std::make_pair (recipient, tid)) != m_agreements.end ());
}
@@ -88,7 +88,7 @@ bool
BlockAckManager::ExistsAgreementInState (Mac48Address recipient, uint8_t tid,
OriginatorBlockAckAgreement::State state) const
{
NS_LOG_FUNCTION (this << recipient << (uint16_t)tid << state);
NS_LOG_FUNCTION (this << recipient << static_cast<uint16_t> (tid) << state);
AgreementsCI it;
it = m_agreements.find (std::make_pair (recipient, tid));
if (it != m_agreements.end ())
@@ -142,7 +142,7 @@ BlockAckManager::CreateAgreement (const MgtAddBaRequestHeader *reqHdr, Mac48Addr
void
BlockAckManager::DestroyAgreement (Mac48Address recipient, uint8_t tid)
{
NS_LOG_FUNCTION (this << recipient << (uint16_t)tid);
NS_LOG_FUNCTION (this << recipient << static_cast<uint16_t> (tid));
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
if (it != m_agreements.end ())
{
@@ -413,7 +413,7 @@ BlockAckManager::RemovePacket (uint8_t tid, Mac48Address recipient, uint16_t seq
i->second.second.erase ((*it));
m_retryPackets.erase (it);
NS_LOG_DEBUG ("Removed Packet from retry queue = " << hdr.GetSequenceNumber () << " " << (uint16_t)tid << " " << recipient << " Buffer Size = " << m_retryPackets.size ());
NS_LOG_DEBUG ("Removed Packet from retry queue = " << hdr.GetSequenceNumber () << " " << static_cast<uint16_t> (tid) << " " << recipient << " Buffer Size = " << m_retryPackets.size ());
return true;
}
}
@@ -443,7 +443,7 @@ BlockAckManager::HasPackets (void) const
uint32_t
BlockAckManager::GetNBufferedPackets (Mac48Address recipient, uint8_t tid) const
{
NS_LOG_FUNCTION (this << recipient << (uint16_t)tid);
NS_LOG_FUNCTION (this << recipient << static_cast<uint16_t> (tid));
uint32_t nPackets = 0;
if (ExistsAgreement (recipient, tid))
{
@@ -468,7 +468,7 @@ BlockAckManager::GetNBufferedPackets (Mac48Address recipient, uint8_t tid) const
uint32_t
BlockAckManager::GetNRetryNeededPackets (Mac48Address recipient, uint8_t tid) const
{
NS_LOG_FUNCTION (this << recipient << (uint16_t)tid);
NS_LOG_FUNCTION (this << recipient << static_cast<uint16_t> (tid));
uint32_t nPackets = 0;
uint16_t currentSeq = 0;
if (ExistsAgreement (recipient, tid))
@@ -503,7 +503,7 @@ BlockAckManager::GetNRetryNeededPackets (Mac48Address recipient, uint8_t tid) co
void
BlockAckManager::SetBlockAckThreshold (uint8_t nPackets)
{
NS_LOG_FUNCTION (this << (uint16_t)nPackets);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (nPackets));
m_blockAckThreshold = nPackets;
}
@@ -761,7 +761,7 @@ BlockAckManager::SetQueue (const Ptr<WifiMacQueue> queue)
bool
BlockAckManager::SwitchToBlockAckIfNeeded (Mac48Address recipient, uint8_t tid, uint16_t startingSeq)
{
NS_LOG_FUNCTION (this << recipient << (uint16_t)tid << startingSeq);
NS_LOG_FUNCTION (this << recipient << static_cast<uint16_t> (tid) << startingSeq);
NS_ASSERT (!ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::PENDING));
if (!ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::UNSUCCESSFUL) && ExistsAgreement (recipient, tid))
{
@@ -881,7 +881,7 @@ BlockAckManager::SetTxMiddle (const Ptr<MacTxMiddle> txMiddle)
uint16_t
BlockAckManager::GetSeqNumOfNextRetryPacket (Mac48Address recipient, uint8_t tid) const
{
NS_LOG_FUNCTION (this << recipient << (uint16_t)tid);
NS_LOG_FUNCTION (this << recipient << static_cast<uint16_t> (tid));
std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin ();
while (it != m_retryPackets.end ())
{

View File

@@ -123,7 +123,7 @@ EdcaTxopN::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> remo
void
EdcaTxopN::SetTypeOfStation (TypeOfStation type)
{
NS_LOG_FUNCTION (this << (uint16_t)type);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (type));
m_typeOfStation = type;
}
@@ -613,7 +613,7 @@ EdcaTxopN::MissedAck (void)
void
EdcaTxopN::MissedBlockAck (uint8_t nMpdus)
{
NS_LOG_FUNCTION (this << (uint16_t)nMpdus);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (nMpdus));
uint8_t tid = GetTid (m_currentPacket, m_currentHdr);
if (GetAmpduExist (m_currentHdr.GetAddr1 ()))
{
@@ -1162,7 +1162,7 @@ EdcaTxopN::GetFragmentPacket (WifiMacHeader *hdr)
void
EdcaTxopN::SetAccessCategory (AcIndex ac)
{
NS_LOG_FUNCTION (this << (uint16_t)ac);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (ac));
m_ac = ac;
}
@@ -1418,7 +1418,7 @@ EdcaTxopN::CompleteConfig (void)
void
EdcaTxopN::SetBlockAckThreshold (uint8_t threshold)
{
NS_LOG_FUNCTION (this << (uint16_t)threshold);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (threshold));
m_blockAckThreshold = threshold;
m_baManager->SetBlockAckThreshold (threshold);
}
@@ -1441,7 +1441,7 @@ void
EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq,
uint16_t timeout, bool immediateBAck)
{
NS_LOG_FUNCTION (this << dest << (uint16_t)tid << startSeq << timeout << immediateBAck);
NS_LOG_FUNCTION (this << dest << static_cast<uint16_t> (tid) << startSeq << timeout << immediateBAck);
NS_LOG_DEBUG ("sent ADDBA request to " << dest);
WifiMacHeader hdr;
hdr.SetType (WIFI_MAC_MGT_ACTION);
@@ -1501,7 +1501,7 @@ EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq,
void
EdcaTxopN::SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator)
{
NS_LOG_FUNCTION (this << addr << (uint16_t)tid << byOriginator);
NS_LOG_FUNCTION (this << addr << static_cast<uint16_t> (tid) << byOriginator);
WifiMacHeader hdr;
hdr.SetType (WIFI_MAC_MGT_ACTION);
hdr.SetAddr1 (addr);

View File

@@ -60,7 +60,7 @@ public:
* are passed into this method. The WifiTxVector may be from a signal that
* contains multiple modes (e.g. PLCP header sent differently from PLCP
* payload). Consequently, the mode parameter is what the method uses
* to calculate the chunk error rate, and the txVector is used for
* to calculate the chunk error rate, and the txVector is used for
* other information as needed.
*
* \param mode the Wi-Fi mode applicable to this chunk
@@ -70,7 +70,7 @@ public:
*
* \return probability of successfully receiving the chunk
*/
virtual double GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint32_t nbits) const = 0;
virtual double GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const = 0;
};
} //namespace ns3

View File

@@ -288,24 +288,24 @@ HeCapabilities::GetHePhyCapabilitiesInfo1 () const
val |= (m_dcmEncodingRx & 0x0f) << 27;
val |= (m_ulHeMuPpduPayloadSupport & 0x01) << 30;
val |= (m_suBeamformer & 0x01) << 31;
val |= ((uint64_t)m_suBeamformee & 0x01) << 32;
val |= ((uint64_t)m_muBeamformer & 0x01) << 33;
val |= ((uint64_t)m_beamformeeStsForSmallerOrEqualThan80Mhz & 0x07) << 34;
val |= ((uint64_t)m_nstsTotalForSmallerOrEqualThan80Mhz & 0x07) << 37;
val |= ((uint64_t)m_beamformeeStsForLargerThan80Mhz & 0x07) << 40;
val |= ((uint64_t)m_nstsTotalForLargerThan80Mhz & 0x07) << 43;
val |= ((uint64_t)m_numberOfSoundingDimensionsForSmallerOrEqualThan80Mhz & 0x07) << 46;
val |= ((uint64_t)m_numberOfSoundingDimensionsForLargerThan80Mhz & 0x07) << 49;
val |= ((uint64_t)m_ngEqual16ForSuFeedbackSupport & 0x01) << 52;
val |= ((uint64_t)m_ngEqual16ForMuFeedbackSupport & 0x01) << 53;
val |= ((uint64_t)m_codebookSize42ForSuSupport & 0x01) << 54;
val |= ((uint64_t)m_codebookSize75ForSuSupport & 0x01) << 55;
val |= ((uint64_t)m_beamformingFeedbackWithTriggerFrame & 0x07) << 56;
val |= ((uint64_t)m_heErSuPpduPayload & 0x01) << 59;
val |= ((uint64_t)m_dlMuMimoOnPartialBandwidth & 0x01) << 60;
val |= ((uint64_t)m_ppeThresholdPresent & 0x01) << 61;
val |= ((uint64_t)m_srpBasedSrSupport & 0x01) << 62;
val |= ((uint64_t)m_powerBoostFactorAlphaSupport & 0x01) << 63;
val |= (static_cast<uint64_t> (m_suBeamformee) & 0x01) << 32;
val |= (static_cast<uint64_t> (m_muBeamformer) & 0x01) << 33;
val |= (static_cast<uint64_t> (m_beamformeeStsForSmallerOrEqualThan80Mhz) & 0x07) << 34;
val |= (static_cast<uint64_t> (m_nstsTotalForSmallerOrEqualThan80Mhz) & 0x07) << 37;
val |= (static_cast<uint64_t> (m_beamformeeStsForLargerThan80Mhz) & 0x07) << 40;
val |= (static_cast<uint64_t> (m_nstsTotalForLargerThan80Mhz) & 0x07) << 43;
val |= (static_cast<uint64_t> (m_numberOfSoundingDimensionsForSmallerOrEqualThan80Mhz) & 0x07) << 46;
val |= (static_cast<uint64_t> (m_numberOfSoundingDimensionsForLargerThan80Mhz) & 0x07) << 49;
val |= (static_cast<uint64_t> (m_ngEqual16ForSuFeedbackSupport) & 0x01) << 52;
val |= (static_cast<uint64_t> (m_ngEqual16ForMuFeedbackSupport) & 0x01) << 53;
val |= (static_cast<uint64_t> (m_codebookSize42ForSuSupport) & 0x01) << 54;
val |= (static_cast<uint64_t> (m_codebookSize75ForSuSupport) & 0x01) << 55;
val |= (static_cast<uint64_t> (m_beamformingFeedbackWithTriggerFrame) & 0x07) << 56;
val |= (static_cast<uint64_t> (m_heErSuPpduPayload) & 0x01) << 59;
val |= (static_cast<uint64_t> (m_dlMuMimoOnPartialBandwidth) & 0x01) << 60;
val |= (static_cast<uint64_t> (m_ppeThresholdPresent) & 0x01) << 61;
val |= (static_cast<uint64_t> (m_srpBasedSrSupport) & 0x01) << 62;
val |= (static_cast<uint64_t> (m_powerBoostFactorAlphaSupport) & 0x01) << 63;
return val;
}
@@ -481,9 +481,9 @@ std::ostream &
operator << (std::ostream &os, const HeCapabilities &HeCapabilities)
{
os << HeCapabilities.GetHeMacCapabilitiesInfo1 () << "|"
<< (uint16_t) HeCapabilities.GetHeMacCapabilitiesInfo2 () << "|"
<< static_cast<uint16_t> (HeCapabilities.GetHeMacCapabilitiesInfo2 ()) << "|"
<< HeCapabilities.GetHePhyCapabilitiesInfo1 () << "|"
<< (uint16_t) HeCapabilities.GetHePhyCapabilitiesInfo2 () << "|"
<< static_cast<uint16_t> (HeCapabilities.GetHePhyCapabilitiesInfo2 ()) << "|"
<< HeCapabilities.GetSupportedMcsAndNss ();
return os;
}

View File

@@ -132,8 +132,8 @@ IdealWifiManager::DoInitialize ()
//derive NSS from the MCS index
nss = (mode.GetMcsValue () / 8) + 1;
NS_LOG_DEBUG ("Initialize, adding mode = " << mode.GetUniqueName () <<
" channel width " << (uint16_t) j <<
" nss " << (uint16_t) nss <<
" channel width " << static_cast<uint16_t> (j) <<
" nss " << static_cast<uint16_t> (nss) <<
" GI " << guardInterval);
NS_LOG_DEBUG ("In SetupPhy, adding mode = " << mode.GetUniqueName ());
txVector.SetNss (nss);
@@ -154,8 +154,8 @@ IdealWifiManager::DoInitialize ()
for (uint8_t i = 1; i <= GetPhy ()->GetMaxSupportedTxSpatialStreams (); i++)
{
NS_LOG_DEBUG ("Initialize, adding mode = " << mode.GetUniqueName () <<
" channel width " << (uint16_t) j <<
" nss " << (uint16_t) i <<
" channel width " << static_cast<uint16_t> (j) <<
" nss " << static_cast<uint16_t> (i) <<
" GI " << guardInterval);
NS_LOG_DEBUG ("In SetupPhy, adding mode = " << mode.GetUniqueName ());
txVector.SetNss (i);
@@ -175,13 +175,13 @@ IdealWifiManager::GetSnrThreshold (WifiTxVector txVector) const
for (Thresholds::const_iterator i = m_thresholds.begin (); i != m_thresholds.end (); i++)
{
NS_LOG_DEBUG ("Checking " << i->second.GetMode ().GetUniqueName () <<
" nss " << (uint16_t) i->second.GetNss () <<
" nss " << static_cast<uint16_t> (i->second.GetNss ()) <<
" GI " << i->second.GetGuardInterval () <<
" width " << (uint16_t) i->second.GetChannelWidth ());
" width " << static_cast<uint16_t> (i->second.GetChannelWidth ()));
NS_LOG_DEBUG ("against TxVector " << txVector.GetMode ().GetUniqueName () <<
" nss " << (uint16_t) txVector.GetNss () <<
" nss " << static_cast<uint16_t> (txVector.GetNss ()) <<
" GI " << txVector.GetGuardInterval () <<
" width " << (uint16_t) txVector.GetChannelWidth ());
" width " << static_cast<uint16_t> (txVector.GetChannelWidth ()));
if (txVector.GetMode () == i->second.GetMode ()
&& txVector.GetNss () == i->second.GetNss ()
&& txVector.GetChannelWidth () == i->second.GetChannelWidth ())
@@ -255,7 +255,7 @@ IdealWifiManager::DoReportDataOk (WifiRemoteStation *st,
void
IdealWifiManager::DoReportAmpduTxStatus (WifiRemoteStation *st, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus, double rxSnr, double dataSnr)
{
NS_LOG_FUNCTION (this << st << (uint16_t)nSuccessfulMpdus << (uint16_t)nFailedMpdus << rxSnr << dataSnr);
NS_LOG_FUNCTION (this << st << static_cast<uint16_t> (nSuccessfulMpdus) << static_cast<uint16_t> (nFailedMpdus) << rxSnr << dataSnr);
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
if (dataSnr == 0)
{
@@ -301,7 +301,7 @@ IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st)
NS_LOG_DEBUG ("Using cached mode = " << maxMode.GetUniqueName () <<
" last snr observed " << station->m_lastSnrObserved <<
" cached " << station->m_lastSnrCached <<
" nss " << (uint16_t) selectedNss);
" nss " << static_cast<uint16_t> (selectedNss));
}
else
{
@@ -333,8 +333,8 @@ IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st)
|| nss > std::min (GetMaxNumberOfTransmitStreams (), GetNumberOfSupportedStreams (st)))
{
NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
" nss " << (uint16_t) nss << " width " <<
(uint16_t) txVector.GetChannelWidth ());
" nss " << static_cast<uint16_t> (nss) <<
" width " << static_cast<uint16_t> (txVector.GetChannelWidth ()));
continue;
}
double threshold = GetSnrThreshold (txVector);
@@ -376,8 +376,8 @@ IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st)
if (!txVector.IsValid ())
{
NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
" nss " << (uint16_t) nss << " width " <<
(uint16_t) txVector.GetChannelWidth ());
" nss " << static_cast<uint16_t> (nss) <<
" width " << static_cast<uint16_t> (txVector.GetChannelWidth ()));
continue;
}
double threshold = GetSnrThreshold (txVector);
@@ -415,8 +415,8 @@ IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st)
if (!txVector.IsValid ())
{
NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
" nss " << (uint16_t) nss << " width " <<
(uint16_t) txVector.GetChannelWidth ());
" nss " << static_cast<uint16_t> (nss) <<
" width " << static_cast<uint16_t> (txVector.GetChannelWidth ()));
continue;
}
double threshold = GetSnrThreshold (txVector);
@@ -474,7 +474,7 @@ IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st)
station->m_lastMode = maxMode;
station->m_nss = selectedNss;
}
NS_LOG_DEBUG ("Found maxMode: " << maxMode << " channelWidth: " << (uint16_t) channelWidth);
NS_LOG_DEBUG ("Found maxMode: " << maxMode << " channelWidth: " << static_cast<uint16_t> (channelWidth));
if (maxMode.GetModulationClass () == WIFI_MOD_CLASS_HE)
{
guardInterval = std::max (GetGuardInterval (station), static_cast<uint16_t> (GetPhy ()->GetGuardInterval ().GetNanoSeconds ()));

View File

@@ -238,7 +238,7 @@ InterferenceHelper::CalculateSnr (double signal, double noiseInterference, uint8
double noiseFloor = m_noiseFigure * Nt;
double noise = noiseFloor + noiseInterference;
double snr = signal / noise; //linear scale
NS_LOG_DEBUG ("bandwidth(MHz)=" << (uint16_t)channelWidth << ", signal(W)= " << signal << ", noise(W)=" << noiseFloor << ", interference(W)=" << noiseInterference << ", snr(linear)=" << snr);
NS_LOG_DEBUG ("bandwidth(MHz)=" << static_cast<uint16_t> (channelWidth) << ", signal(W)= " << signal << ", noise(W)=" << noiseFloor << ", interference(W)=" << noiseInterference << ", snr(linear)=" << snr);
return snr;
}
@@ -292,15 +292,17 @@ InterferenceHelper::CalculateChunkSuccessRate (double snir, Time duration, WifiM
return 1.0;
}
uint64_t rate = mode.GetPhyRate (txVector);
uint64_t nbits = (uint64_t)(rate * duration.GetSeconds ());
uint64_t nbits = static_cast<uint64_t> (rate * duration.GetSeconds ());
if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT || txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HE)
{
nbits /= txVector.GetNss (); //divide effective number of bits by NSS to achieve same chunk error rate as SISO for AWGN
double gain = (txVector.GetNTx () * m_numRxAntennas); //compute gain offered by MIMO, SIMO or MISO compared to SISO for AWGN
NS_LOG_DEBUG ("TX=" << (uint16_t)txVector.GetNTx () << ", RX=" << (uint16_t)m_numRxAntennas << ", SNIR improvement=+" << 10 * std::log10 (gain) << "dB");
NS_LOG_DEBUG ("TX=" << static_cast<uint16_t> (txVector.GetNTx ()) <<
", RX=" << static_cast<uint16_t> (m_numRxAntennas) <<
", SNIR improvement=+" << 10 * std::log10 (gain) << "dB");
snir *= gain;
}
double csr = m_errorRateModel->GetChunkSuccessRate (mode, txVector, snir, (uint32_t)nbits);
double csr = m_errorRateModel->GetChunkSuccessRate (mode, txVector, snir, nbits);
return csr;
}

View File

@@ -1922,7 +1922,7 @@ MacLow::ReceiveMpdu (Ptr<Packet> packet, WifiMacHeader hdr)
(*it).second.first.SetWinEnd (seqNumber);
int16_t winEnd = (*it).second.first.GetWinEnd ();
int16_t bufferSize = (*it).second.first.GetBufferSize ();
uint16_t sum = ((uint16_t)(std::abs (winEnd - bufferSize + 1))) % 4096;
uint16_t sum = (static_cast<uint16_t> (std::abs (winEnd - bufferSize + 1))) % 4096;
(*it).second.first.SetStartingSequence (sum);
RxCompleteBufferedPacketsWithSmallerSequence ((*it).second.first.GetStartingSequenceControl (), originator, tid);
}
@@ -2183,7 +2183,7 @@ MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time durat
NS_LOG_FUNCTION (this);
if (!m_phy->IsStateTx () && !m_phy->IsStateRx ())
{
NS_LOG_FUNCTION (this << (uint16_t) tid << originator << duration.As (Time::S) << blockAckReqTxVector << rxSnr);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (tid) << originator << duration.As (Time::S) << blockAckReqTxVector << rxSnr);
CtrlBAckResponseHeader blockAck;
uint16_t seqNumber = 0;
BlockAckCachesI i = m_bAckCaches.find (std::make_pair (originator, tid));

View File

@@ -1129,7 +1129,7 @@ public:
*
* \param tid traffic ID
*/
void SetTid (uint8_t);
void SetTid (uint8_t tid);
/**
* Set the initiator bit in the DELBA.
*/

View File

@@ -253,7 +253,7 @@ MinstrelHtWifiManager::DoInitialize ()
AddFirstMpduTxTime (groupId, mode, CalculateFirstMpduTxDuration (GetPhy (), streams, sgi, chWidth, mode));
AddMpduTxTime (groupId, mode, CalculateMpduTxDuration (GetPhy (), streams, sgi, chWidth, mode));
}
NS_LOG_DEBUG ("Initialized group " << groupId << ": (" << (uint16_t)streams << "," << (uint16_t)sgi << "," << (uint16_t)chWidth << ")");
NS_LOG_DEBUG ("Initialized group " << groupId << ": (" << static_cast<uint16_t> (streams) << "," << static_cast<uint16_t> (sgi) << "," << static_cast<uint16_t> (chWidth) << ")");
}
}
}
@@ -295,7 +295,7 @@ MinstrelHtWifiManager::DoInitialize ()
AddMpduTxTime (groupId, mode, CalculateMpduTxDuration (GetPhy (), streams, sgi, chWidth, mode));
}
}
NS_LOG_DEBUG ("Initialized group " << groupId << ": (" << (uint16_t)streams << "," << (uint16_t)sgi << "," << (uint16_t)chWidth << ")");
NS_LOG_DEBUG ("Initialized group " << groupId << ": (" << static_cast<uint16_t> (streams) << "," << static_cast<uint16_t> (sgi) << "," << static_cast<uint16_t> (chWidth) << ")");
}
}
}
@@ -315,7 +315,7 @@ MinstrelHtWifiManager::SetupMac (const Ptr<WifiMac> mac)
bool
MinstrelHtWifiManager::IsValidMcs (Ptr<WifiPhy> phy, uint8_t streams, uint8_t chWidth, WifiMode mode)
{
NS_LOG_FUNCTION (this << phy << (uint16_t)streams << (uint16_t)chWidth << mode);
NS_LOG_FUNCTION (this << phy << static_cast<uint16_t> (streams) << static_cast<uint16_t> (chWidth) << mode);
WifiTxVector txvector;
txvector.SetNss (streams);
txvector.SetChannelWidth (chWidth);
@@ -326,7 +326,7 @@ MinstrelHtWifiManager::IsValidMcs (Ptr<WifiPhy> phy, uint8_t streams, uint8_t ch
Time
MinstrelHtWifiManager::CalculateFirstMpduTxDuration (Ptr<WifiPhy> phy, uint8_t streams, uint8_t sgi, uint8_t chWidth, WifiMode mode)
{
NS_LOG_FUNCTION (this << phy << (uint16_t)streams << (uint16_t)sgi << (uint16_t)chWidth << mode);
NS_LOG_FUNCTION (this << phy << static_cast<uint16_t> (streams) << static_cast<uint16_t> (sgi) << static_cast<uint16_t> (chWidth) << mode);
WifiTxVector txvector;
txvector.SetNss (streams);
@@ -342,7 +342,7 @@ MinstrelHtWifiManager::CalculateFirstMpduTxDuration (Ptr<WifiPhy> phy, uint8_t s
Time
MinstrelHtWifiManager::CalculateMpduTxDuration (Ptr<WifiPhy> phy, uint8_t streams, uint8_t sgi, uint8_t chWidth, WifiMode mode)
{
NS_LOG_FUNCTION (this << phy << (uint16_t)streams << (uint16_t)sgi << (uint16_t)chWidth << mode);
NS_LOG_FUNCTION (this << phy << static_cast<uint16_t> (streams) << static_cast<uint16_t> (sgi) << static_cast<uint16_t> (chWidth) << mode);
WifiTxVector txvector;
txvector.SetNss (streams);
@@ -689,7 +689,7 @@ MinstrelHtWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
void
MinstrelHtWifiManager::DoReportAmpduTxStatus (WifiRemoteStation *st, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus, double rxSnr, double dataSnr)
{
NS_LOG_FUNCTION (this << st << (uint16_t)nSuccessfulMpdus << (uint16_t)nFailedMpdus << rxSnr << dataSnr);
NS_LOG_FUNCTION (this << st << static_cast<uint16_t> (nSuccessfulMpdus) << static_cast<uint16_t> (nFailedMpdus) << rxSnr << dataSnr);
MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st;
CheckInit (station);
@@ -704,7 +704,7 @@ MinstrelHtWifiManager::DoReportAmpduTxStatus (WifiRemoteStation *st, uint8_t nSu
}
NS_LOG_DEBUG ("DoReportAmpduTxStatus. TxRate=" << station->m_txrate << " SuccMpdus= " <<
(uint16_t)nSuccessfulMpdus << " FailedMpdus= " << (uint16_t)nFailedMpdus);
static_cast<uint16_t> (nSuccessfulMpdus) << " FailedMpdus= " << static_cast<uint16_t> (nFailedMpdus));
station->m_ampduPacketCount++;
station->m_ampduLen += nSuccessfulMpdus + nFailedMpdus;
@@ -853,7 +853,7 @@ MinstrelHtWifiManager::UpdateRetry (MinstrelHtWifiRemoteStation *station)
void
MinstrelHtWifiManager::UpdatePacketCounters (MinstrelHtWifiRemoteStation *station, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus)
{
NS_LOG_FUNCTION (this << station << (uint16_t)nSuccessfulMpdus << (uint16_t)nFailedMpdus);
NS_LOG_FUNCTION (this << station << static_cast<uint16_t> (nSuccessfulMpdus) << static_cast<uint16_t> (nFailedMpdus));
station->m_totalPacketsCount += nSuccessfulMpdus + nFailedMpdus;
if (station->m_isSampling)
@@ -920,8 +920,10 @@ MinstrelHtWifiManager::DoGetDataTxVector (WifiRemoteStation *st)
// Check consistency of rate selected.
if ((group.sgi && !GetShortGuardInterval (station)) || group.chWidth > GetChannelWidth (station) || group.streams > GetNumberOfSupportedStreams (station))
{
NS_ASSERT_MSG (false,"Inconsistent group selected. Group: (" << (uint16_t)group.streams << "," << (uint16_t)group.sgi << "," << (uint16_t)group.chWidth << ")" <<
" Station capabilities: (" << GetNumberOfSupportedStreams (station) << "," << GetShortGuardInterval (station) << "," << GetChannelWidth (station) << ")");
NS_ASSERT_MSG (false, "Inconsistent group selected. Group: (" << static_cast<uint16_t> (group.streams) <<
"," << static_cast<uint16_t> (group.sgi) << "," << static_cast<uint16_t> (group.chWidth) << ")" <<
" Station capabilities: (" << GetNumberOfSupportedStreams (station) <<
"," << GetShortGuardInterval (station) << "," << GetChannelWidth (station) << ")");
}
uint64_t dataRate = GetMcsSupported (station, mcsIndex).GetDataRate (group.chWidth, group.sgi ? 400 : 800, group.streams);
@@ -1190,8 +1192,8 @@ MinstrelHtWifiManager::FindRate (MinstrelHtWifiRemoteStation *station)
Time maxProbDuration = station->m_groupsTable[maxProbGroupId].m_ratesTable[maxProbRateId].perfectTxTime;
NS_LOG_DEBUG ("Use sample rate? SampleDuration= " << sampleDuration << " maxTp2Duration= " << maxTp2Duration <<
" maxProbDuration= " << maxProbDuration << " sampleStreams= " << (uint16_t)sampleStreams <<
" maxTpStreams= " << (uint16_t)maxTpStreams);
" maxProbDuration= " << maxProbDuration << " sampleStreams= " << static_cast<uint16_t> (sampleStreams) <<
" maxTpStreams= " << static_cast<uint16_t> (maxTpStreams));
if (sampleDuration < maxTp2Duration || (sampleStreams < maxTpStreams && sampleDuration < maxProbDuration))
{
/// Set flag that we are currently sampling.
@@ -1524,8 +1526,8 @@ MinstrelHtWifiManager::RateInit (MinstrelHtWifiRemoteStation *station)
&& (GetChannelWidth (station) >= m_minstrelGroups[groupId].chWidth) ///Is channel width supported by the receiver?
&& (GetNumberOfSupportedStreams (station) >= m_minstrelGroups[groupId].streams)) ///Are streams supported by the receiver?
{
NS_LOG_DEBUG ("Group " << groupId << ": (" << (uint16_t)m_minstrelGroups[groupId].streams <<
"," << (uint16_t)m_minstrelGroups[groupId].sgi << "," << (uint16_t)m_minstrelGroups[groupId].chWidth << ")");
NS_LOG_DEBUG ("Group " << groupId << ": (" << static_cast<uint16_t> (m_minstrelGroups[groupId].streams) <<
"," << static_cast<uint16_t> (m_minstrelGroups[groupId].sgi) << "," << static_cast<uint16_t> (m_minstrelGroups[groupId].chWidth) << ")");
station->m_groupsTable[groupId].m_supported = true; ///Group supported.
station->m_groupsTable[groupId].m_col = 0;
@@ -1827,16 +1829,14 @@ MinstrelHtWifiManager::GetGroupId (uint32_t index)
uint32_t
MinstrelHtWifiManager::GetHtGroupId (uint8_t txstreams, uint8_t sgi, uint8_t chWidth)
{
NS_LOG_FUNCTION (this << (uint16_t)txstreams << (uint16_t)sgi << (uint16_t)chWidth);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (txstreams) << static_cast<uint16_t> (sgi) << static_cast<uint16_t> (chWidth));
return MAX_SUPPORTED_STREAMS * 2 * (chWidth == 40 ? 1 : 0) + MAX_SUPPORTED_STREAMS * sgi + txstreams - 1;
}
uint32_t
MinstrelHtWifiManager::GetVhtGroupId (uint8_t txstreams, uint8_t sgi, uint8_t chWidth)
{
NS_LOG_FUNCTION (this << (uint16_t)txstreams << (uint16_t)sgi << (uint16_t)chWidth);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (txstreams) << static_cast<uint16_t> (sgi) << static_cast<uint16_t> (chWidth));
return MAX_HT_STREAM_GROUPS * MAX_SUPPORTED_STREAMS + MAX_SUPPORTED_STREAMS * 2 * (chWidth == 160 ? 3 : chWidth == 80 ? 2 : chWidth == 40 ? 1 : 0) + MAX_SUPPORTED_STREAMS * sgi + txstreams - 1;
}

View File

@@ -105,7 +105,7 @@ NistErrorRateModel::Get1024QamBer (double snr) const
}
double
NistErrorRateModel::GetFecBpskBer (double snr, uint32_t nbits,
NistErrorRateModel::GetFecBpskBer (double snr, uint64_t nbits,
uint32_t bValue) const
{
NS_LOG_FUNCTION (this << snr << nbits << bValue);
@@ -116,12 +116,12 @@ NistErrorRateModel::GetFecBpskBer (double snr, uint32_t nbits,
}
double pe = CalculatePe (ber, bValue);
pe = std::min (pe, 1.0);
double pms = std::pow (1 - pe, (double)nbits);
double pms = std::pow (1 - pe, nbits);
return pms;
}
double
NistErrorRateModel::GetFecQpskBer (double snr, uint32_t nbits,
NistErrorRateModel::GetFecQpskBer (double snr, uint64_t nbits,
uint32_t bValue) const
{
NS_LOG_FUNCTION (this << snr << nbits << bValue);
@@ -132,7 +132,7 @@ NistErrorRateModel::GetFecQpskBer (double snr, uint32_t nbits,
}
double pe = CalculatePe (ber, bValue);
pe = std::min (pe, 1.0);
double pms = std::pow (1 - pe, (double)nbits);
double pms = std::pow (1 - pe, nbits);
return pms;
}
@@ -209,7 +209,7 @@ NistErrorRateModel::CalculatePe (double p, uint32_t bValue) const
}
double
NistErrorRateModel::GetFec16QamBer (double snr, uint32_t nbits,
NistErrorRateModel::GetFec16QamBer (double snr, uint64_t nbits,
uint32_t bValue) const
{
NS_LOG_FUNCTION (this << snr << nbits << bValue);
@@ -220,12 +220,12 @@ NistErrorRateModel::GetFec16QamBer (double snr, uint32_t nbits,
}
double pe = CalculatePe (ber, bValue);
pe = std::min (pe, 1.0);
double pms = std::pow (1 - pe, static_cast<double> (nbits));
double pms = std::pow (1 - pe, nbits);
return pms;
}
double
NistErrorRateModel::GetFec64QamBer (double snr, uint32_t nbits,
NistErrorRateModel::GetFec64QamBer (double snr, uint64_t nbits,
uint32_t bValue) const
{
NS_LOG_FUNCTION (this << snr << nbits << bValue);
@@ -236,12 +236,12 @@ NistErrorRateModel::GetFec64QamBer (double snr, uint32_t nbits,
}
double pe = CalculatePe (ber, bValue);
pe = std::min (pe, 1.0);
double pms = std::pow (1 - pe, static_cast<double> (nbits));
double pms = std::pow (1 - pe, nbits);
return pms;
}
double
NistErrorRateModel::GetFec256QamBer (double snr, uint32_t nbits,
NistErrorRateModel::GetFec256QamBer (double snr, uint64_t nbits,
uint32_t bValue) const
{
NS_LOG_FUNCTION (this << snr << nbits << bValue);
@@ -252,12 +252,12 @@ NistErrorRateModel::GetFec256QamBer (double snr, uint32_t nbits,
}
double pe = CalculatePe (ber, bValue);
pe = std::min (pe, 1.0);
double pms = std::pow (1 - pe, static_cast<double> (nbits));
double pms = std::pow (1 - pe, nbits);
return pms;
}
double
NistErrorRateModel::GetFec1024QamBer (double snr, uint32_t nbits,
NistErrorRateModel::GetFec1024QamBer (double snr, uint64_t nbits,
uint32_t bValue) const
{
NS_LOG_FUNCTION (this << snr << nbits << bValue);
@@ -268,12 +268,12 @@ NistErrorRateModel::GetFec1024QamBer (double snr, uint32_t nbits,
}
double pe = CalculatePe (ber, bValue);
pe = std::min (pe, 1.0);
double pms = std::pow (1 - pe, static_cast<double> (nbits));
double pms = std::pow (1 - pe, nbits);
return pms;
}
double
NistErrorRateModel::GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint32_t nbits) const
NistErrorRateModel::GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const
{
NS_LOG_FUNCTION (this << mode << txVector.GetMode () << snr << nbits);
if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM

View File

@@ -45,7 +45,7 @@ public:
NistErrorRateModel ();
double GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint32_t nbits) const;
double GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const;
private:
@@ -113,7 +113,7 @@ private:
*
* \return BER of BPSK at the given SNR after applying FEC
*/
double GetFecBpskBer (double snr, uint32_t nbits,
double GetFecBpskBer (double snr, uint64_t nbits,
uint32_t bValue) const;
/**
* Return BER of QPSK at the given SNR after applying FEC.
@@ -124,7 +124,7 @@ private:
*
* \return BER of QPSK at the given SNR after applying FEC
*/
double GetFecQpskBer (double snr, uint32_t nbits,
double GetFecQpskBer (double snr, uint64_t nbits,
uint32_t bValue) const;
/**
* Return BER of QAM16 at the given SNR after applying FEC.
@@ -135,7 +135,7 @@ private:
*
* \return BER of QAM16 at the given SNR after applying FEC
*/
double GetFec16QamBer (double snr, uint32_t nbits,
double GetFec16QamBer (double snr, uint64_t nbits,
uint32_t bValue) const;
/**
* Return BER of QAM64 at the given SNR after applying FEC.
@@ -146,7 +146,7 @@ private:
*
* \return BER of QAM64 at the given SNR after applying FEC
*/
double GetFec64QamBer (double snr, uint32_t nbits,
double GetFec64QamBer (double snr, uint64_t nbits,
uint32_t bValue) const;
/**
* Return BER of QAM256 at the given SNR after applying FEC.
@@ -156,7 +156,7 @@ private:
* \param bValue
* \return BER of QAM256 at the given SNR after applying FEC
*/
double GetFec256QamBer (double snr, uint32_t nbits,
double GetFec256QamBer (double snr, uint64_t nbits,
uint32_t bValue) const;
/**
* Return BER of QAM1024 at the given SNR after applying FEC.
@@ -166,7 +166,7 @@ private:
* \param bValue
* \return BER of QAM1024 at the given SNR after applying FEC
*/
double GetFec1024QamBer (double snr, uint32_t nbits,
double GetFec1024QamBer (double snr, uint64_t nbits,
uint32_t bValue) const;
};

View File

@@ -27,7 +27,7 @@ namespace ns3 {
AcIndex
QosUtilsMapTidToAc (uint8_t tid)
{
NS_ASSERT_MSG (tid < 8, "Tid " << (uint16_t) tid << " out of range");
NS_ASSERT_MSG (tid < 8, "Tid " << static_cast<uint16_t> (tid) << " out of range");
switch (tid)
{
case 0:

View File

@@ -398,28 +398,28 @@ RegularWifiMac::SetBkMaxAmpduSize (uint32_t size)
void
RegularWifiMac::SetVoBlockAckThreshold (uint8_t threshold)
{
NS_LOG_FUNCTION (this << (uint16_t) threshold);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (threshold));
GetVOQueue ()->SetBlockAckThreshold (threshold);
}
void
RegularWifiMac::SetViBlockAckThreshold (uint8_t threshold)
{
NS_LOG_FUNCTION (this << (uint16_t) threshold);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (threshold));
GetVIQueue ()->SetBlockAckThreshold (threshold);
}
void
RegularWifiMac::SetBeBlockAckThreshold (uint8_t threshold)
{
NS_LOG_FUNCTION (this << (uint16_t) threshold);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (threshold));
GetBEQueue ()->SetBlockAckThreshold (threshold);
}
void
RegularWifiMac::SetBkBlockAckThreshold (uint8_t threshold)
{
NS_LOG_FUNCTION (this << (uint16_t) threshold);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (threshold));
GetBKQueue ()->SetBlockAckThreshold (threshold);
}

View File

@@ -408,7 +408,7 @@ RraaWifiManager::RunBasicAlgorithm (RraaWifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
WifiRraaThresholds thresholds = GetThresholds (station, station->m_rateIndex);
double ploss = (double) station->m_nFailed / (double) thresholds.m_ewnd;
double ploss = (static_cast<double> (station->m_nFailed) / thresholds.m_ewnd);
if (station->m_counter == 0
|| ploss > thresholds.m_mtl)
{

View File

@@ -464,8 +464,8 @@ RrpaaWifiManager::RunBasicAlgorithm (RrpaaWifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
WifiRrpaaThresholds thresholds = GetThresholds (station, station->m_rateIndex);
double bploss = (double) station->m_nFailed / (double) thresholds.m_ewnd;
double wploss = (double) (station->m_counter + station->m_nFailed) / (double) thresholds.m_ewnd;
double bploss = (static_cast<double> (station->m_nFailed) / thresholds.m_ewnd);
double wploss = (static_cast<double> (station->m_counter + station->m_nFailed) / thresholds.m_ewnd);
NS_LOG_DEBUG ("Best loss prob= " << bploss);
NS_LOG_DEBUG ("Worst loss prob= " << wploss);
if (bploss >= thresholds.m_mtl)
@@ -474,7 +474,7 @@ RrpaaWifiManager::RunBasicAlgorithm (RrpaaWifiRemoteStation *station)
{
NS_LOG_DEBUG ("bploss >= MTL and power < maxPower => Increase Power");
station->m_pdTable[station->m_rateIndex][station->m_powerLevel] /= m_gamma;
NS_LOG_DEBUG ("pdTable[" << static_cast<uint16_t>(station->m_rateIndex) << "][" << station->m_powerLevel << "] = " << station->m_pdTable[station->m_rateIndex][station->m_powerLevel]);
NS_LOG_DEBUG ("pdTable[" << static_cast<uint16_t> (station->m_rateIndex) << "][" << station->m_powerLevel << "] = " << station->m_pdTable[station->m_rateIndex][station->m_powerLevel]);
station->m_powerLevel++;
ResetCountersBasic (station);
}
@@ -482,7 +482,7 @@ RrpaaWifiManager::RunBasicAlgorithm (RrpaaWifiRemoteStation *station)
{
NS_LOG_DEBUG ("bploss >= MTL and power = maxPower => Decrease Rate");
station->m_pdTable[station->m_rateIndex][station->m_powerLevel] /= m_gamma;
NS_LOG_DEBUG ("pdTable[" << static_cast<uint16_t>(station->m_rateIndex) << "][" << station->m_powerLevel << "] = " << station->m_pdTable[station->m_rateIndex][station->m_powerLevel]);
NS_LOG_DEBUG ("pdTable[" << static_cast<uint16_t> (station->m_rateIndex) << "][" << station->m_powerLevel << "] = " << station->m_pdTable[station->m_rateIndex][station->m_powerLevel]);
station->m_rateIndex--;
ResetCountersBasic (station);
}
@@ -526,7 +526,7 @@ RrpaaWifiManager::RunBasicAlgorithm (RrpaaWifiRemoteStation *station)
{
station->m_pdTable[station->m_rateIndex][i] = 1;
}
NS_LOG_DEBUG ("pdTable[" << static_cast<uint16_t>(station->m_rateIndex) << "][" << i << "] = " << station->m_pdTable[station->m_rateIndex][i]);
NS_LOG_DEBUG ("pdTable[" << static_cast<uint16_t> (station->m_rateIndex) << "][" << i << "] = " << station->m_pdTable[station->m_rateIndex][i]);
}
double rand = m_uniformRandomVariable->GetValue (0,1);
if (rand < station->m_pdTable[station->m_rateIndex][station->m_powerLevel - 1])
@@ -551,7 +551,7 @@ RrpaaWifiManager::RunBasicAlgorithm (RrpaaWifiRemoteStation *station)
{
station->m_pdTable[station->m_rateIndex][i] = 1;
}
NS_LOG_DEBUG ("pdTable[" << static_cast<uint16_t>(station->m_rateIndex) << "][" << i << "] = " << station->m_pdTable[station->m_rateIndex][i]);
NS_LOG_DEBUG ("pdTable[" << static_cast<uint16_t> (station->m_rateIndex) << "][" << i << "] = " << station->m_pdTable[station->m_rateIndex][i]);
}
double rand = m_uniformRandomVariable->GetValue (0,1);
if (rand < station->m_pdTable[station->m_rateIndex][station->m_powerLevel - 1])

View File

@@ -106,7 +106,7 @@ SpectrumWifiPhy::GetRxSpectrumModel () const
}
else
{
NS_LOG_DEBUG ("Creating spectrum model from frequency/width pair of (" << GetFrequency () << ", " << (uint16_t)GetChannelWidth () << ")");
NS_LOG_DEBUG ("Creating spectrum model from frequency/width pair of (" << GetFrequency () << ", " << static_cast<uint16_t> (GetChannelWidth ()) << ")");
m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel (GetFrequency (), GetChannelWidth (), GetBandBandwidth (), GetGuardBandwidth ());
}
}
@@ -130,7 +130,7 @@ SpectrumWifiPhy::ResetSpectrumModel (void)
{
NS_LOG_FUNCTION (this);
NS_ASSERT_MSG (IsInitialized (), "Executing method before run-time");
NS_LOG_DEBUG ("Run-time change of spectrum model from frequency/width pair of (" << GetFrequency () << ", " << (uint16_t)GetChannelWidth () << ")");
NS_LOG_DEBUG ("Run-time change of spectrum model from frequency/width pair of (" << GetFrequency () << ", " << static_cast<uint16_t> (GetChannelWidth ()) << ")");
// Replace existing spectrum model with new one, and must call AddRx ()
// on the SpectrumChannel to provide this new spectrum model to it
m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel (GetFrequency (), GetChannelWidth (), GetBandBandwidth (), GetGuardBandwidth ());
@@ -140,7 +140,7 @@ SpectrumWifiPhy::ResetSpectrumModel (void)
void
SpectrumWifiPhy::SetChannelNumber (uint8_t nch)
{
NS_LOG_FUNCTION (this << (uint16_t) nch);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (nch));
WifiPhy::SetChannelNumber (nch);
if (IsInitialized ())
{
@@ -162,7 +162,7 @@ SpectrumWifiPhy::SetFrequency (uint16_t freq)
void
SpectrumWifiPhy::SetChannelWidth (uint8_t channelwidth)
{
NS_LOG_FUNCTION (this << (uint16_t) channelwidth);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (channelwidth));
WifiPhy::SetChannelWidth (channelwidth);
if (IsInitialized ())
{
@@ -170,7 +170,7 @@ SpectrumWifiPhy::SetChannelWidth (uint8_t channelwidth)
}
}
void
void
SpectrumWifiPhy::ConfigureStandard (WifiPhyStandard standard)
{
NS_LOG_FUNCTION (this << standard);
@@ -286,7 +286,7 @@ SpectrumWifiPhy::CreateWifiSpectrumPhyInterface (Ptr<NetDevice> device)
Ptr<SpectrumValue>
SpectrumWifiPhy::GetTxPowerSpectralDensity (uint16_t centerFrequency, uint8_t channelWidth, double txPowerW, WifiModulationClass modulationClass) const
{
NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << txPowerW);
NS_LOG_FUNCTION (centerFrequency << static_cast<uint16_t> (channelWidth) << txPowerW);
Ptr<SpectrumValue> v;
switch (modulationClass)
{
@@ -340,7 +340,7 @@ SpectrumWifiPhy::StartTx (Ptr<Packet> packet, WifiTxVector txVector, Time txDura
txParams->txPhy = m_wifiSpectrumPhyInterface->GetObject<SpectrumPhy> ();
txParams->txAntenna = m_antenna;
txParams->packet = packet;
NS_LOG_DEBUG ("Starting transmission with power " << WToDbm (txPowerWatts) << " dBm on channel " << (uint16_t) GetChannelNumber ());
NS_LOG_DEBUG ("Starting transmission with power " << WToDbm (txPowerWatts) << " dBm on channel " << static_cast<uint16_t> (GetChannelNumber ()));
NS_LOG_DEBUG ("Starting transmission with integrated spectrum power " << WToDbm (Integral (*txPowerSpectrum)) << " dBm; spectrum model Uid: " << txPowerSpectrum->GetSpectrumModel ()->GetUid ());
m_channel->StartTx (txParams);
}

View File

@@ -90,7 +90,7 @@ SupportedRates::AddSupportedRate (uint32_t bs)
}
m_rates[m_nRates] = bs / 500000;
m_nRates++;
NS_LOG_DEBUG ("add rate=" << bs << ", n rates=" << (uint32_t)m_nRates);
NS_LOG_DEBUG ("add rate=" << bs << ", n rates=" << static_cast<uint16_t> (m_nRates));
}
}
@@ -108,7 +108,7 @@ SupportedRates::SetBasicRate (uint32_t bs)
}
if (rate == m_rates[i])
{
NS_LOG_DEBUG ("set basic rate=" << bs << ", n rates=" << (uint32_t)m_nRates);
NS_LOG_DEBUG ("set basic rate=" << bs << ", n rates=" << static_cast<uint16_t> (m_nRates));
m_rates[i] |= 0x80;
return;
}

View File

@@ -195,15 +195,15 @@ VhtCapabilities::GetSupportedMcsAndNssSet () const
for (uint8_t i = 0; i < 8; i++)
{
n = i * 2;
val |= ((uint64_t)m_rxMcsMap[i] & 0x03) << n;
val |= (static_cast<uint64_t> (m_rxMcsMap[i]) & 0x03) << n;
}
val |= ((uint64_t)m_rxHighestSupportedLongGuardIntervalDataRate & 0x1fff) << 16;
val |= (static_cast<uint64_t> (m_rxHighestSupportedLongGuardIntervalDataRate) & 0x1fff) << 16;
for (uint8_t i = 0; i < 8; i++)
{
n = (i * 2) + 32;
val |= ((uint64_t)m_txMcsMap[i] & 0x03) << n;
val |= (static_cast<uint64_t> (m_txMcsMap[i]) & 0x03) << n;
}
val |= ((uint64_t)m_txHighestSupportedLongGuardIntervalDataRate & 0x1fff) << 48;
val |= (static_cast<uint64_t> (m_txHighestSupportedLongGuardIntervalDataRate) & 0x1fff) << 48;
return val;
}

View File

@@ -174,9 +174,9 @@ ATTRIBUTE_HELPER_CPP (VhtOperation);
std::ostream &
operator << (std::ostream &os, const VhtOperation &VhtOperation)
{
os << (uint16_t) VhtOperation.GetChannelWidth () << "|"
<< (uint16_t) VhtOperation.GetChannelCenterFrequencySegment0 () << "|"
<< (uint16_t) VhtOperation.GetChannelCenterFrequencySegment1 () << "|"
os << static_cast<uint16_t> (VhtOperation.GetChannelWidth ()) << "|"
<< static_cast<uint16_t> (VhtOperation.GetChannelCenterFrequencySegment0 ()) << "|"
<< static_cast<uint16_t> (VhtOperation.GetChannelCenterFrequencySegment1 ()) << "|"
<< VhtOperation.GetBasicVhtMcsAndNssSet ();
return os;
}

View File

@@ -104,7 +104,7 @@ WifiInformationElementVector::DeserializeSingleIe (Buffer::Iterator start)
switch (id)
{
default:
NS_FATAL_ERROR ("Information element " << (uint16_t) id << " is not implemented");
NS_FATAL_ERROR ("Information element " << static_cast<uint16_t> (id) << " is not implemented");
return 0;
}
/* unreachable: b/c switch is guaranteed to return from this function

View File

@@ -256,7 +256,7 @@ WifiMacHeader::SetType (WifiMacType type)
void
WifiMacHeader::SetDuration (Time duration)
{
int64_t duration_us = ceil ((double)duration.GetNanoSeconds () / 1000);
int64_t duration_us = ceil (static_cast<double> (duration.GetNanoSeconds ()) / 1000);
NS_ASSERT (duration_us >= 0 && duration_us <= 0x7fff);
m_duration = static_cast<uint16_t> (duration_us);
}

View File

@@ -198,11 +198,11 @@ WifiMode::GetDataRate (uint8_t channelWidth, uint16_t guardInterval, uint8_t nss
{
if (item->modClass == WIFI_MOD_CLASS_VHT)
{
NS_ASSERT_MSG (IsAllowed (channelWidth, nss), "VHT MCS " << (uint16_t)item->mcsValue << " forbidden at " << (uint16_t)channelWidth << " MHz when NSS is " << (uint16_t)nss);
NS_ASSERT_MSG (IsAllowed (channelWidth, nss), "VHT MCS " << static_cast<uint16_t> (item->mcsValue) << " forbidden at " << static_cast<uint16_t> (channelWidth) << " MHz when NSS is " << static_cast<uint16_t> (nss));
}
NS_ASSERT (guardInterval == 800 || guardInterval == 400);
symbolRate = (1 / (3.2 + ((double)guardInterval / 1000))) * 1e6;
symbolRate = (1 / (3.2 + (static_cast<double> (guardInterval) / 1000))) * 1e6;
if (item->modClass == WIFI_MOD_CLASS_HT)
{
@@ -255,7 +255,7 @@ WifiMode::GetDataRate (uint8_t channelWidth, uint16_t guardInterval, uint8_t nss
break;
case WIFI_CODE_RATE_UNDEFINED:
default:
NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding rate defined with nss: " << (uint16_t) nss);
NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding rate defined with nss: " << static_cast<uint16_t> (nss));
break;
}
@@ -264,7 +264,7 @@ WifiMode::GetDataRate (uint8_t channelWidth, uint16_t guardInterval, uint8_t nss
else if (item->modClass == WIFI_MOD_CLASS_HE)
{
NS_ASSERT (guardInterval == 800 || guardInterval == 1600 || guardInterval == 3200);
symbolRate = (1 / (12.8 + ((double)guardInterval / 1000))) * 1e6;
symbolRate = (1 / (12.8 + (static_cast<double> (guardInterval) / 1000))) * 1e6;
switch (channelWidth)
{
@@ -299,7 +299,7 @@ WifiMode::GetDataRate (uint8_t channelWidth, uint16_t guardInterval, uint8_t nss
break;
case WIFI_CODE_RATE_UNDEFINED:
default:
NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding rate defined with nss: " << (uint16_t) nss);
NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding rate defined with nss: " << static_cast<uint16_t> (nss));
break;
}

View File

@@ -471,7 +471,7 @@ WifiPhy::InitializeFrequencyChannelNumber (void)
}
else if (m_initialChannelNumber != 0 && GetStandard () == WIFI_PHY_STANDARD_UNSPECIFIED)
{
NS_FATAL_ERROR ("Error, ChannelNumber " << (uint16_t)GetChannelNumber () << " was set by user, but neither a standard nor a frequency");
NS_FATAL_ERROR ("Error, ChannelNumber " << static_cast<uint16_t> (GetChannelNumber ()) << " was set by user, but neither a standard nor a frequency");
}
m_frequencyChannelNumberInitialized = true;
}
@@ -1051,7 +1051,7 @@ WifiPhy::Configure80211ax (void)
bool
WifiPhy::DefineChannelNumber (uint8_t channelNumber, WifiPhyStandard standard, uint16_t frequency, uint8_t channelWidth)
{
NS_LOG_FUNCTION (this << (uint16_t)channelNumber << standard << frequency << (uint16_t)channelWidth);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (channelNumber) << standard << frequency << static_cast<uint16_t> (channelWidth));
ChannelNumberStandardPair p = std::make_pair (channelNumber, standard);
ChannelToFrequencyWidthMap::const_iterator it;
it = m_channelToFrequencyWidth.find (p);
@@ -1068,7 +1068,7 @@ WifiPhy::DefineChannelNumber (uint8_t channelNumber, WifiPhyStandard standard, u
uint8_t
WifiPhy::FindChannelNumberForFrequencyWidth (uint16_t frequency, uint8_t width) const
{
NS_LOG_FUNCTION (this << frequency << (uint16_t)width);
NS_LOG_FUNCTION (this << frequency << static_cast<uint16_t> (width));
bool found = false;
FrequencyWidthPair f = std::make_pair (frequency, width);
ChannelToFrequencyWidthMap::const_iterator it = m_channelToFrequencyWidth.begin ();
@@ -1083,7 +1083,7 @@ WifiPhy::FindChannelNumberForFrequencyWidth (uint16_t frequency, uint8_t width)
}
if (found)
{
NS_LOG_DEBUG ("Found, returning " << it->first.first);
NS_LOG_DEBUG ("Found, returning " << static_cast<uint16_t> (it->first.first));
return (it->first.first);
}
else
@@ -1108,7 +1108,7 @@ WifiPhy::ConfigureChannelForStandard (WifiPhyStandard standard)
uint8_t channelNumberSearched = FindChannelNumberForFrequencyWidth (GetFrequency (), GetChannelWidth ());
if (channelNumberSearched)
{
NS_LOG_DEBUG ("Channel number found; setting to " << (uint16_t)channelNumberSearched);
NS_LOG_DEBUG ("Channel number found; setting to " << static_cast<uint16_t> (channelNumberSearched));
SetChannelNumber (channelNumberSearched);
}
else
@@ -1122,7 +1122,7 @@ WifiPhy::ConfigureChannelForStandard (WifiPhyStandard standard)
// If the channel number is known for this particular standard or for
// the unspecified standard, configure using the known values;
// otherwise, this is a configuration error
NS_LOG_DEBUG ("Configuring for channel number " << (uint16_t)GetChannelNumber ());
NS_LOG_DEBUG ("Configuring for channel number " << static_cast<uint16_t> (GetChannelNumber ()));
FrequencyWidthPair f = GetFrequencyWidthForChannelNumberStandard (GetChannelNumber (), standard);
if (f.first == 0)
{
@@ -1132,11 +1132,11 @@ WifiPhy::ConfigureChannelForStandard (WifiPhyStandard standard)
}
if (f.first == 0)
{
NS_FATAL_ERROR ("Error, ChannelNumber " << (uint16_t)GetChannelNumber () << " is unknown for this standard");
NS_FATAL_ERROR ("Error, ChannelNumber " << static_cast<uint16_t> (GetChannelNumber ()) << " is unknown for this standard");
}
else
{
NS_LOG_DEBUG ("Setting frequency to " << f.first << "; width to " << (uint16_t)f.second);
NS_LOG_DEBUG ("Setting frequency to " << f.first << "; width to " << static_cast<uint16_t> (f.second));
SetFrequency (f.first);
SetChannelWidth (f.second);
}
@@ -1238,10 +1238,10 @@ WifiPhy::SetFrequency (uint16_t frequency)
uint8_t nch = FindChannelNumberForFrequencyWidth (frequency, GetChannelWidth ());
if (nch != 0)
{
NS_LOG_DEBUG ("Setting frequency " << frequency << " corresponds to channel " << (uint16_t)nch);
NS_LOG_DEBUG ("Setting frequency " << frequency << " corresponds to channel " << static_cast<uint16_t> (nch));
if (DoFrequencySwitch (frequency))
{
NS_LOG_DEBUG ("Channel frequency switched to " << frequency << "; channel number to " << (uint16_t)nch);
NS_LOG_DEBUG ("Channel frequency switched to " << frequency << "; channel number to " << static_cast<uint16_t> (nch));
m_channelCenterFrequency = frequency;
m_channelNumber = nch;
}
@@ -1392,7 +1392,7 @@ WifiPhy::GetMembershipSelectorModes (uint32_t selector)
void
WifiPhy::AddSupportedChannelWidth (uint8_t width)
{
NS_LOG_FUNCTION (this << (uint16_t)width);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (width));
for (std::vector<uint32_t>::size_type i = 0; i != m_supportedChannelWidthSet.size (); i++)
{
if (m_supportedChannelWidthSet[i] == width)
@@ -1400,7 +1400,7 @@ WifiPhy::AddSupportedChannelWidth (uint8_t width)
return;
}
}
NS_LOG_FUNCTION ("Adding " << (uint16_t)width << " to supported channel width set");
NS_LOG_FUNCTION ("Adding " << static_cast<uint16_t> (width) << " to supported channel width set");
m_supportedChannelWidthSet.push_back (width);
}
@@ -1421,7 +1421,7 @@ WifiPhy::GetFrequencyWidthForChannelNumberStandard (uint8_t channelNumber, WifiP
void
WifiPhy::SetChannelNumber (uint8_t nch)
{
NS_LOG_FUNCTION (this << (uint16_t)nch);
NS_LOG_FUNCTION (this << static_cast<uint16_t> (nch));
if (m_isConstructed == false)
{
NS_LOG_DEBUG ("Saving channel number configuration for initialization");
@@ -1455,7 +1455,7 @@ WifiPhy::SetChannelNumber (uint8_t nch)
{
if (DoChannelSwitch (nch))
{
NS_LOG_DEBUG ("Setting frequency to " << f.first << "; width to " << (uint16_t)f.second);
NS_LOG_DEBUG ("Setting frequency to " << f.first << "; width to " << static_cast<uint16_t> (f.second));
m_channelCenterFrequency = f.first;
SetChannelWidth (f.second);
m_channelNumber = nch;
@@ -1484,7 +1484,7 @@ WifiPhy::DoChannelSwitch (uint8_t nch)
if (!IsInitialized ())
{
//this is not channel switch, this is initialization
NS_LOG_DEBUG ("initialize to channel " << (uint16_t)nch);
NS_LOG_DEBUG ("initialize to channel " << static_cast<uint16_t> (nch));
return true;
}
@@ -1517,7 +1517,7 @@ WifiPhy::DoChannelSwitch (uint8_t nch)
switchChannel:
NS_LOG_DEBUG ("switching channel " << (uint16_t)GetChannelNumber () << " -> " << (uint16_t)nch);
NS_LOG_DEBUG ("switching channel " << static_cast<uint16_t> (GetChannelNumber ()) << " -> " << static_cast<uint16_t> (nch));
m_state->SwitchToChannelSwitching (GetChannelSwitchDelay ());
m_interference.EraseEvents ();
/*
@@ -2298,8 +2298,8 @@ WifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, MpduType m
NS_LOG_FUNCTION (this << packet << txVector.GetMode ()
<< txVector.GetMode ().GetDataRate (txVector)
<< txVector.GetPreambleType ()
<< (uint16_t)txVector.GetTxPowerLevel ()
<< (uint16_t)mpdutype);
<< static_cast<uint16_t> (txVector.GetTxPowerLevel ())
<< static_cast<uint16_t> (mpdutype));
/* Transmission can happen if:
* - we are syncing on a packet. It is the responsability of the
* MAC layer to avoid doing this but the PHY does nothing to
@@ -2371,7 +2371,7 @@ WifiPhy::StartReceivePreambleAndHeader (Ptr<Packet> packet, double rxPowerW, Tim
if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT
&& (txVector.GetNss () != (1 + (txVector.GetMode ().GetMcsValue () / 8))))
{
NS_FATAL_ERROR ("MCS value does not match NSS value: MCS = " << (uint16_t)txVector.GetMode ().GetMcsValue () << ", NSS = " << (uint16_t)txVector.GetNss ());
NS_FATAL_ERROR ("MCS value does not match NSS value: MCS = " << static_cast<uint16_t> (txVector.GetMode ().GetMcsValue ()) << ", NSS = " << static_cast<uint16_t> (txVector.GetNss ()));
}
Ptr<InterferenceHelper::Event> event;
@@ -2488,7 +2488,7 @@ WifiPhy::StartReceivePacket (Ptr<Packet> packet,
MpduType mpdutype,
Ptr<InterferenceHelper::Event> event)
{
NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetPreambleType () << (uint16_t)mpdutype);
NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetPreambleType () << static_cast<uint16_t> (mpdutype));
NS_ASSERT (IsStateRx ());
NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
WifiMode txMode = txVector.GetMode ();
@@ -3606,7 +3606,7 @@ WifiPhy::AbortCurrentReception ()
void
WifiPhy::StartRx (Ptr<Packet> packet, WifiTxVector txVector, MpduType mpdutype, double rxPowerW, Time rxDuration, Ptr<InterferenceHelper::Event> event)
{
NS_LOG_FUNCTION (this << packet << txVector << (uint16_t)mpdutype << rxPowerW << rxDuration);
NS_LOG_FUNCTION (this << packet << txVector << static_cast<uint16_t> (mpdutype) << rxPowerW << rxDuration);
if (rxPowerW > GetEdThresholdW ()) //checked here, no need to check in the payload reception (current implementation assumes constant rx power over the packet duration)
{
AmpduTag ampduTag;

View File

@@ -817,11 +817,11 @@ WifiRemoteStationManager::PrepareForQueue (Mac48Address address, const WifiMacHe
uint8_t
WifiRemoteStationManager::GetChannelWidthForTransmission (WifiMode mode, uint8_t maxSupportedChannelWidth)
{
NS_LOG_FUNCTION (mode << (uint16_t)maxSupportedChannelWidth);
NS_LOG_FUNCTION (mode << static_cast<uint16_t> (maxSupportedChannelWidth));
WifiModulationClass modulationClass = mode.GetModulationClass ();
if (maxSupportedChannelWidth > 20 &&
(modulationClass == WifiModulationClass::WIFI_MOD_CLASS_OFDM || // all non-HT OFDM control and management frames
modulationClass == WifiModulationClass::WIFI_MOD_CLASS_ERP_OFDM)) // special case of beacons at 2.4 GHz
if (maxSupportedChannelWidth > 20
&& (modulationClass == WifiModulationClass::WIFI_MOD_CLASS_OFDM // all non-HT OFDM control and management frames
|| modulationClass == WifiModulationClass::WIFI_MOD_CLASS_ERP_OFDM)) // special case of beacons at 2.4 GHz
{
NS_LOG_LOGIC ("Channel width reduced to 20 MHz");
return 20;
@@ -1023,7 +1023,7 @@ WifiRemoteStationManager::ReportAmpduTxStatus (Mac48Address address, uint8_t tid
uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus,
double rxSnr, double dataSnr)
{
NS_LOG_FUNCTION (this << address << (uint16_t)tid << (uint16_t)nSuccessfulMpdus << (uint16_t)nFailedMpdus << rxSnr << dataSnr);
NS_LOG_FUNCTION (this << address << static_cast<uint16_t> (tid) << static_cast<uint16_t> (nSuccessfulMpdus) << static_cast<uint16_t> (nFailedMpdus) << rxSnr << dataSnr);
NS_ASSERT (!address.IsGroup ());
WifiRemoteStation *station = Lookup (address, tid);
for (uint8_t i = 0; i < nFailedMpdus; i++)
@@ -1678,7 +1678,7 @@ WifiRemoteStationManager::Lookup (Mac48Address address, const WifiMacHeader *hea
WifiRemoteStation *
WifiRemoteStationManager::Lookup (Mac48Address address, uint8_t tid) const
{
NS_LOG_FUNCTION (this << address << (uint16_t)tid);
NS_LOG_FUNCTION (this << address << static_cast<uint16_t> (tid));
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
{
if ((*i)->m_tid == tid
@@ -1902,7 +1902,7 @@ WifiRemoteStationManager::GetNonErpBasicMode (uint8_t i) const
void
WifiRemoteStationManager::AddBasicMcs (WifiMode mcs)
{
NS_LOG_FUNCTION (this << (uint16_t)mcs.GetMcsValue ());
NS_LOG_FUNCTION (this << static_cast<uint16_t> (mcs.GetMcsValue ()));
for (uint8_t i = 0; i < GetNBasicMcs (); i++)
{
if (GetBasicMcs (i) == mcs)
@@ -2248,8 +2248,7 @@ WifiRemoteStationInfo::WifiRemoteStationInfo ()
double
WifiRemoteStationInfo::CalculateAveragingCoefficient ()
{
double retval = std::exp ((double)(m_lastUpdate.GetMicroSeconds () - Simulator::Now ().GetMicroSeconds ())
/ (double)m_memoryTime.GetMicroSeconds ());
double retval = std::exp (static_cast<double> (m_lastUpdate.GetMicroSeconds () - Simulator::Now ().GetMicroSeconds ()) / m_memoryTime.GetMicroSeconds ());
m_lastUpdate = Simulator::Now ();
return retval;
}
@@ -2258,14 +2257,14 @@ void
WifiRemoteStationInfo::NotifyTxSuccess (uint32_t retryCounter)
{
double coefficient = CalculateAveragingCoefficient ();
m_failAvg = (double)retryCounter / (1 + (double)retryCounter) * (1.0 - coefficient) + coefficient * m_failAvg;
m_failAvg = static_cast<double> (retryCounter) / (1 + retryCounter) * (1 - coefficient) + coefficient * m_failAvg;
}
void
WifiRemoteStationInfo::NotifyTxFailed ()
{
double coefficient = CalculateAveragingCoefficient ();
m_failAvg = (1.0 - coefficient) + coefficient * m_failAvg;
m_failAvg = (1 - coefficient) + coefficient * m_failAvg;
}
double

View File

@@ -242,14 +242,14 @@ WifiTxVector::IsValid (void) const
std::ostream & operator << ( std::ostream &os, const WifiTxVector &v)
{
os << "mode: " << v.GetMode () <<
" txpwrlvl: " << (uint16_t)v.GetTxPowerLevel () <<
" retries: " << (uint16_t)v.GetRetries () <<
" txpwrlvl: " << static_cast<uint16_t> (v.GetTxPowerLevel ()) <<
" retries: " << static_cast<uint16_t> (v.GetRetries ()) <<
" preamble: " << v.GetPreambleType () <<
" channel width: " << (uint16_t)v.GetChannelWidth () <<
" channel width: " << static_cast<uint16_t> (v.GetChannelWidth ()) <<
" GI: " << v.GetGuardInterval () <<
" NTx: " << (uint16_t)v.GetNTx () <<
" Nss: " << (uint16_t)v.GetNss () <<
" Ness: " << (uint16_t)v.GetNess () <<
" NTx: " << static_cast<uint16_t> (v.GetNTx ()) <<
" Nss: " << static_cast<uint16_t> (v.GetNss ()) <<
" Ness: " << static_cast<uint16_t> (v.GetNess ()) <<
" MPDU aggregation: " << v.IsAggregation () <<
" STBC: " << v.IsStbc ();
return os;

View File

@@ -137,7 +137,7 @@ YansErrorRateModel::CalculatePd (double ber, unsigned int d) const
}
double
YansErrorRateModel::GetFecBpskBer (double snr, double nbits,
YansErrorRateModel::GetFecBpskBer (double snr, uint64_t nbits,
uint32_t signalSpread, uint64_t phyRate,
uint32_t dFree, uint32_t adFree) const
{
@@ -155,7 +155,7 @@ YansErrorRateModel::GetFecBpskBer (double snr, double nbits,
}
double
YansErrorRateModel::GetFecQamBer (double snr, uint32_t nbits,
YansErrorRateModel::GetFecQamBer (double snr, uint64_t nbits,
uint32_t signalSpread,
uint64_t phyRate,
uint32_t m, uint32_t dFree,
@@ -174,12 +174,12 @@ YansErrorRateModel::GetFecQamBer (double snr, uint32_t nbits,
pd = CalculatePd (ber, dFree + 1);
pmu += adFreePlusOne * pd;
pmu = std::min (pmu, 1.0);
double pms = std::pow (1 - pmu, static_cast<double> (nbits));
double pms = std::pow (1 - pmu, nbits);
return pms;
}
double
YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint32_t nbits) const
YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const
{
NS_LOG_FUNCTION (this << mode << txVector.GetMode () << snr << nbits);
if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM

View File

@@ -62,7 +62,7 @@ public:
YansErrorRateModel ();
virtual double GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint32_t nbits) const;
virtual double GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const;
private:
@@ -136,7 +136,7 @@ private:
*
* \return double
*/
double GetFecBpskBer (double snr, double nbits,
double GetFecBpskBer (double snr, uint64_t nbits,
uint32_t signalSpread, uint64_t phyRate,
uint32_t dFree, uint32_t adFree) const;
/**
@@ -151,7 +151,7 @@ private:
*
* \return double
*/
double GetFecQamBer (double snr, uint32_t nbits,
double GetFecQamBer (double snr, uint64_t nbits,
uint32_t signalSpread,
uint64_t phyRate,
uint32_t m, uint32_t dfree,