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