-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdestination.cc
108 lines (100 loc) · 4.23 KB
/
destination.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#include <iostream>
#include "destination.h"
/**************************************************************************************************************************************
* Source: Wikipedia
* MCS and PhyRate in 802.11ax - 1 spatial stream
Modulation and coding schemes for single spatial stream MCS
index[i]
type Coding
rate Modulation Data rate (in Mbit/s)[ii]
20 MHz channels 40 MHz channels 80 MHz channels 160 MHz channels
1600 ns GI[iii] 800 ns GI 1600 ns GI 800 ns GI 1600 ns GI 800 ns GI 1600 ns GI 800 ns GI
0 BPSK 1/2 8 8.6 16 17.2 34 36.0 68 72
1 QPSK 1/2 16 17.2 33 34.4 68 72.1 136 144
2 QPSK 3/4 24 25.8 49 51.6 102 108.1 204 216
3 16-QAM 1/2 33 34.4 65 68.8 136 144.1 272 282
4 16-QAM 3/4 49 51.6 98 103.2 204 216.2 408 432
5 64-QAM 2/3 65 68.8 130 137.6 272 288.2 544 576
6 64-QAM 3/4 73 77.4 146 154.9 306 324.4 613 649
7 64-QAM 5/6 81 86.0 163 172.1 340 360.3 681 721
8 256-QAM 3/4 98 103.2 195 206.5 408 432.4 817 865
9 256-QAM 5/6 108 114.7 217 229.4 453 480.4 907 961
10 1024-QAM 3/4 122 129.0 244 258.1 510 540.4 1021 1081
11 1024-QAM 5/6 135 143.4 271 286.8 567 600.5 1134 1201
**************************************************************************************************************************************/
// Symbol is multiple of bits, each symbol is transferred between the constant amount of time is called GI (Guard Interval)
// Modulation is the how bits are mapped onto signal waves
// coding is the part of data is protected against error,a coding rate of 1/3 means that for every 3 bits transmitted, only 1 bit is actual data, and the rest are error-correcting codes.
// Class destination methods
//Constructor: 1 spatial stream - 800ns GI - 20MHz
/**
* @brief Construct a new destination::destination object
*
* @param no Destination address
* @param mcs How bits are mapped
* @param arrivalRate Number of packet transfered in a second
* @param arrivalType Deterministic (0) or Poisson (1)
*/
destination::destination (int no, int mcs, double arrivalRate, int arrivalType) // Constructor
{
m_no = no; // Destination address
m_mcs = mcs; // index of how bits are mapped
m_arrivalRate = arrivalRate; //number of packet for second
m_arrivalDistribution = arrivalType; // Deterministic (0) or Poisson (1)
switch(mcs)
{
case 0: m_phyRate=8.6; break; // 800ns GI
case 1: m_phyRate=17.2; break;
case 2: m_phyRate=25.8; break;
case 3: m_phyRate=34.4; break;
case 4: m_phyRate=51.6; break;
case 5: m_phyRate=68.8; break;
case 6: m_phyRate=77.4; break;
case 7: m_phyRate=86.0; break;
case 8: m_phyRate=103.2; break;
case 9: m_phyRate=114.7; break;
case 10: m_phyRate=129.0; break;
case 11: m_phyRate=143.4; break;
default: std::cerr << "MCS is not valid: abort." << std::endl;
exit(1);
}
};
// constructor overloading, given different instance base on parameter provided. This is custom destination with given dataRate (notice that mcs = -1)
/**
* @brief Constructor overloading a new destination::destination object
*
* @param phyRate Custom physical rate
* @param no Destination address
* @param arrivalRate Number of packet transfered per seconds
* @param arrivalType Deterministic (0) or Poisson (1)
*/
destination::destination (double phyRate, int no, double arrivalRate, int arrivalType)
{
m_phyRate = phyRate;
m_no = no;
m_mcs = -1;
m_arrivalRate = arrivalRate;
m_arrivalDistribution = arrivalType;
};
//Compare two instance
/**
* @brief Comparision
*
* @param aDest Given destination
* @return true
* @return false
*/
bool destination::operator==(destination &aDest)
{
if ((this->m_no == aDest.m_no)&&(this->m_mcs==aDest.m_mcs)&&(this->m_phyRate==aDest.m_phyRate)&&(this->m_arrivalRate==aDest.m_arrivalRate)&&(this->m_arrivalDistribution==aDest.m_arrivalDistribution))
{
return true;
} else {
return false;
}
};
/**
* @brief Destroy the destination::destination object
*
*/
destination::~destination () {};