A Discrete-Event Network Simulator
API
wave-bsm-stats.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 North Carolina State University
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Scott E. Carpenter <scarpen@ncsu.edu>
18  *
19  */
20 
21 #ifndef WAVE_BSM_STATS_H
22 #define WAVE_BSM_STATS_H
23 
24 #include "ns3/object.h"
25 
26 #include <vector>
27 
28 namespace ns3
29 {
50 class WaveBsmStats : public Object
51 {
52  public:
56  WaveBsmStats();
57 
62  static TypeId GetTypeId();
63 
67  void IncTxPktCount();
68 
73  int GetTxPktCount() const;
74 
75  /*
76  * Note:
77  * The WAVE Basic Safety Message (BSM) is broadcast and
78  * unacknowledged. In order to calculate packet delivery
79  * ratio (PDR), we must count i) the packets that are
80  * actually received and ii) the transmitted packets that
81  * are expected to be received. Both are relative to a
82  * specified (circular) coverage area.
83  *
84  * For example: Say we have three nodes, A, B, and C, each
85  * separated by 40m, as follows:
86  *
87  * A --<40m>-- B --<40m>-- C
88  *
89  * Let's assume that the transmission range is 50m, and only
90  * A is transmitting (i.e. broadcasting). B can receive A's
91  * broadcasts, while C cannot. Let's assume no dropped packets.
92  * If we set the coverage area to 100m, then the PDR is 50%,
93  * because B receives every transmission from A, while C receives
94  * none of them. However, if we change the effective
95  * coverage area to 75m then the PDR improves to 100%, because
96  * B receives 100% of A's transmissions, and C is outside of the
97  * coverage area, and so does not factor in to the PDR.
98  */
99 
110  void IncExpectedRxPktCount(int index);
111 
116  void IncRxPktCount();
117 
126  void IncRxPktInRangeCount(int index);
127 
132  int GetRxPktCount() const;
133 
139  int GetExpectedRxPktCount(int index);
140 
146  int GetRxPktInRangeCount(int index);
147 
153  void SetExpectedRxPktCount(int index, int count);
154 
160  void SetRxPktInRangeCount(int index, int count);
161 
167  void ResetTotalRxPktCounts(int index);
168 
173  void SetTxPktCount(int count);
174 
179  void SetRxPktCount(int count);
180 
186  void IncTxByteCount(int bytes);
187 
193  int GetTxByteCount() const;
194 
202  double GetBsmPdr(int index);
203 
211  double GetCumulativeBsmPdr(int index);
212 
217  void SetLogging(bool log);
218 
223  bool GetLogging() const;
224 
225  private:
231  std::vector<int>
234  bool m_log;
235 };
236 
237 } // namespace ns3
238 
239 #endif /* WAVE_BSM_STATS_H*/
A base class which provides memory management and object aggregation.
Definition: object.h:89
a unique identifier for an interface.
Definition: type-id.h:60
The WaveBsmStats class implements a stats collector for IEEE 1609 WAVE (Wireless Access in Vehicular ...
void IncTxByteCount(int bytes)
Increments the count of (application data) bytes transmitted not including MAC/PHY overhead.
void IncTxPktCount()
Increments the count of transmitted packets.
void SetExpectedRxPktCount(int index, int count)
Sets the count of packets expected to received.
WaveBsmStats()
Constructor.
std::vector< int > m_waveTotalPktInCoverageReceiveCounts
total packet in coverage receive counts
bool m_log
logging state
int GetTxByteCount() const
Returns the count of (application data) bytes transmitted not include MAC/PHY overhead.
void SetTxPktCount(int count)
Sets the count of packets transmitted.
void SetLogging(bool log)
Enables/disables logging.
int GetExpectedRxPktCount(int index)
Returns the count of expected packets received within range(index)
bool GetLogging() const
Gets logging state.
int m_wavePktReceiveCount
packet receive count
static TypeId GetTypeId()
Register this type.
void IncExpectedRxPktCount(int index)
Increments the count of (broadcast) packets expected to be received within the coverage area1.
void IncRxPktCount()
Increments the count of actual packets received (regardless of coverage area).
std::vector< int > m_wavePktInCoverageReceiveCounts
packet in coverage receive counts
int m_wavePktSendCount
packet sent count
int GetRxPktInRangeCount(int index)
Increments the count of actual packets received within range(index)
int GetRxPktCount() const
Returns the count of packets received.
double GetBsmPdr(int index)
Returns the BSM Packet Delivery Ratio (PDR) which is the percent of expected packets within range(ind...
void SetRxPktCount(int count)
Sets the count of packets received.
void IncRxPktInRangeCount(int index)
Increments the count of actual packets received within the coverage area(index).
double GetCumulativeBsmPdr(int index)
Returns the cumulative BSM Packet Delivery Ratio (PDR) which is the percent of cumulative expected pa...
int GetTxPktCount() const
Returns the count of transmitted packets.
std::vector< int > m_waveTotalPktExpectedReceiveCounts
total packet expected receive counts
int m_waveByteSendCount
byte sent count
std::vector< int > m_wavePktExpectedReceiveCounts
packet expected receive counts
void SetRxPktInRangeCount(int index, int count)
Sets the count of packets within range that are received.
void ResetTotalRxPktCounts(int index)
Resets the count of total packets expected and/or within range(index) that are received.
Every class exported by the ns3 library is enclosed in the ns3 namespace.