A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
wifi-remote-station-info.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2005,2006,2007 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
9
#include "
wifi-remote-station-info.h
"
10
11
#include "ns3/simulator.h"
12
13
namespace
ns3
14
{
15
16
WifiRemoteStationInfo::WifiRemoteStationInfo
()
17
: m_memoryTime(
Seconds
(1.0)),
18
m_lastUpdate(
Seconds
(0.0)),
19
m_failAvg(0.0)
20
{
21
}
22
23
WifiRemoteStationInfo::~WifiRemoteStationInfo
()
24
{
25
}
26
27
double
28
WifiRemoteStationInfo::CalculateAveragingCoefficient
()
29
{
30
double
retval = std::exp(((
m_lastUpdate
-
Now
()) /
m_memoryTime
).GetDouble());
31
m_lastUpdate
=
Simulator::Now
();
32
return
retval;
33
}
34
35
void
36
WifiRemoteStationInfo::NotifyTxSuccess
(
uint32_t
retryCounter)
37
{
38
double
coefficient =
CalculateAveragingCoefficient
();
39
m_failAvg
=
static_cast<
double
>
(retryCounter) / (1 + retryCounter) * (1 - coefficient) +
40
coefficient *
m_failAvg
;
41
}
42
43
void
44
WifiRemoteStationInfo::NotifyTxFailed
()
45
{
46
double
coefficient =
CalculateAveragingCoefficient
();
47
m_failAvg
= (1 - coefficient) + coefficient *
m_failAvg
;
48
}
49
50
double
51
WifiRemoteStationInfo::GetFrameErrorRate
()
const
52
{
53
return
m_failAvg
;
54
}
55
56
}
// namespace ns3
ns3::Simulator::Now
static Time Now()
Return the current simulation virtual time.
Definition
simulator.cc:197
ns3::WifiRemoteStationInfo::m_failAvg
double m_failAvg
moving percentage of failed frames
Definition
wifi-remote-station-info.h:60
ns3::WifiRemoteStationInfo::m_lastUpdate
Time m_lastUpdate
when last update has occurred
Definition
wifi-remote-station-info.h:59
ns3::WifiRemoteStationInfo::WifiRemoteStationInfo
WifiRemoteStationInfo()
Definition
wifi-remote-station-info.cc:16
ns3::WifiRemoteStationInfo::CalculateAveragingCoefficient
double CalculateAveragingCoefficient()
Calculate averaging coefficient for frame error rate.
Definition
wifi-remote-station-info.cc:28
ns3::WifiRemoteStationInfo::NotifyTxSuccess
void NotifyTxSuccess(uint32_t retryCounter)
Updates average frame error rate when data or RTS was transmitted successfully.
Definition
wifi-remote-station-info.cc:36
ns3::WifiRemoteStationInfo::~WifiRemoteStationInfo
virtual ~WifiRemoteStationInfo()
Definition
wifi-remote-station-info.cc:23
ns3::WifiRemoteStationInfo::m_memoryTime
Time m_memoryTime
averaging coefficient depends on the memory time
Definition
wifi-remote-station-info.h:58
ns3::WifiRemoteStationInfo::GetFrameErrorRate
double GetFrameErrorRate() const
Return frame error rate (probability that frame is corrupted due to transmission error).
Definition
wifi-remote-station-info.cc:51
ns3::WifiRemoteStationInfo::NotifyTxFailed
void NotifyTxFailed()
Updates average frame error rate when final data or RTS has failed.
Definition
wifi-remote-station-info.cc:44
uint32_t
ns3::Now
Time Now()
create an ns3::Time instance which contains the current simulation time.
Definition
simulator.cc:294
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition
nstime.h:1308
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
wifi-remote-station-info.h
src
wifi
model
wifi-remote-station-info.cc
Generated on Fri Nov 8 2024 13:59:08 for ns-3 by
1.11.0