author | Andrea Sacco |
Tue, 16 Aug 2011 20:22:40 +0200 | |
changeset 7433 | b29227c0eee0 |
parent 7385 | 10beb0e53130 |
child 7738 | fe52cb6371f2 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7061
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
2 |
/* |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 University of Washington |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
4 |
* |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
8 |
* |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
13 |
* |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
17 |
* |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
18 |
* Author: Leonard Tracy <lentracy@gmail.com> |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
19 |
* Andrea Sacco <andrea.sacco85@gmail.com> |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
20 |
*/ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
21 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
22 |
#include "uan-phy-gen.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
23 |
#include "uan-transducer.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
24 |
#include "uan-channel.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
25 |
#include "uan-net-device.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
26 |
#include "ns3/simulator.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
27 |
#include "ns3/traced-callback.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
28 |
#include "ns3/ptr.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
29 |
#include "ns3/trace-source-accessor.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
30 |
#include "ns3/double.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
31 |
#include "ns3/log.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
32 |
#include "ns3/uan-tx-mode.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
33 |
#include "ns3/node.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
34 |
#include "ns3/uinteger.h" |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
35 |
#include "ns3/random-variable.h" |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
36 |
#include "ns3/energy-source-container.h" |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
37 |
#include "ns3/acoustic-modem-energy-model.h" |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
38 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
39 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
40 |
NS_LOG_COMPONENT_DEFINE ("UanPhyGen"); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
41 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
42 |
namespace ns3 { |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
43 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
44 |
NS_OBJECT_ENSURE_REGISTERED (UanPhyGen); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
45 |
NS_OBJECT_ENSURE_REGISTERED (UanPhyPerGenDefault); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
46 |
NS_OBJECT_ENSURE_REGISTERED (UanPhyCalcSinrDefault); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
47 |
NS_OBJECT_ENSURE_REGISTERED (UanPhyCalcSinrFhFsk); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
48 |
NS_OBJECT_ENSURE_REGISTERED (UanPhyPerUmodem); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
49 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
50 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
51 |
/*************** UanPhyCalcSinrDefault definition *****************/ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
52 |
UanPhyCalcSinrDefault::UanPhyCalcSinrDefault () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
53 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
54 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
55 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
56 |
UanPhyCalcSinrDefault::~UanPhyCalcSinrDefault () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
57 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
58 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
59 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
60 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
61 |
TypeId |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
62 |
UanPhyCalcSinrDefault::GetTypeId (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
63 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
64 |
static TypeId tid = TypeId ("ns3::UanPhyCalcSinrDefault") |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
65 |
.SetParent<Object> () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
66 |
.AddConstructor<UanPhyCalcSinrDefault> () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
67 |
; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
68 |
return tid; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
69 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
70 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
71 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
72 |
UanPhyCalcSinrDefault::CalcSinrDb (Ptr<Packet> pkt, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
73 |
Time arrTime, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
74 |
double rxPowerDb, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
75 |
double ambNoiseDb, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
76 |
UanTxMode mode, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
77 |
UanPdp pdp, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
78 |
const UanTransducer::ArrivalList &arrivalList) const |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
79 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
80 |
if (mode.GetModType () == UanTxMode::OTHER) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
81 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
82 |
NS_LOG_WARN ("Calculating SINR for unsupported modulation type"); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
83 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
84 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
85 |
double intKp = -DbToKp (rxPowerDb); // This packet is in the arrivalList |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
86 |
UanTransducer::ArrivalList::const_iterator it = arrivalList.begin (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
87 |
for (; it != arrivalList.end (); it++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
88 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
89 |
intKp += DbToKp (it->GetRxPowerDb ()); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
90 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
91 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
92 |
double totalIntDb = KpToDb (intKp + DbToKp (ambNoiseDb)); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
93 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
94 |
NS_LOG_DEBUG ("Calculating SINR: RxPower = " << rxPowerDb << " dB. Number of interferers = " << arrivalList.size () << " Interference + noise power = " << totalIntDb << " dB. SINR = " << rxPowerDb - totalIntDb << " dB."); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
95 |
return rxPowerDb - totalIntDb; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
96 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
97 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
98 |
/*************** UanPhyCalcSinrFhFsk definition *****************/ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
99 |
UanPhyCalcSinrFhFsk::UanPhyCalcSinrFhFsk () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
100 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
101 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
102 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
103 |
UanPhyCalcSinrFhFsk::~UanPhyCalcSinrFhFsk () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
104 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
105 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
106 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
107 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
108 |
TypeId |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
109 |
UanPhyCalcSinrFhFsk::GetTypeId (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
110 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
111 |
static TypeId tid = TypeId ("ns3::UanPhyCalcSinrFhFsk") |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
112 |
.SetParent<Object> () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
113 |
.AddConstructor<UanPhyCalcSinrFhFsk> () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
114 |
.AddAttribute ("NumberOfHops", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
115 |
"Number of frequencies in hopping pattern", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
116 |
UintegerValue (13), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
117 |
MakeUintegerAccessor (&UanPhyCalcSinrFhFsk::m_hops), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
118 |
MakeUintegerChecker<uint32_t> ()) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
119 |
; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
120 |
return tid; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
121 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
122 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
123 |
UanPhyCalcSinrFhFsk::CalcSinrDb (Ptr<Packet> pkt, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
124 |
Time arrTime, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
125 |
double rxPowerDb, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
126 |
double ambNoiseDb, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
127 |
UanTxMode mode, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
128 |
UanPdp pdp, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
129 |
const UanTransducer::ArrivalList &arrivalList) const |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
130 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
131 |
if (mode.GetModType () != UanTxMode::FSK) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
132 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
133 |
NS_LOG_WARN ("Calculating SINR for unsupported mode type"); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
134 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
135 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
136 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
137 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
138 |
double ts = 1.0 / mode.GetPhyRateSps (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
139 |
double clearingTime = (m_hops - 1.0) * ts; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
140 |
double csp = pdp.SumTapsFromMaxNc (Seconds (0), Seconds (ts)); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
141 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
142 |
// Get maximum arrival offset |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
143 |
double maxAmp = -1; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
144 |
double maxTapDelay = 0.0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
145 |
UanPdp::Iterator pit = pdp.GetBegin (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
146 |
for (; pit != pdp.GetEnd (); pit++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
147 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
148 |
if (abs (pit->GetAmp ()) > maxAmp) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
149 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
150 |
maxAmp = abs (pit->GetAmp ()); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
151 |
maxTapDelay = pit->GetDelay ().GetSeconds (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
152 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
153 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
154 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
155 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
156 |
double effRxPowerDb = rxPowerDb + KpToDb (csp); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
157 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
158 |
double isiUpa = rxPowerDb * pdp.SumTapsFromMaxNc (Seconds (ts + clearingTime), Seconds (ts)); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
159 |
UanTransducer::ArrivalList::const_iterator it = arrivalList.begin (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
160 |
double intKp = -DbToKp (effRxPowerDb); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
161 |
for (; it != arrivalList.end (); it++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
162 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
163 |
UanPdp intPdp = it->GetPdp (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
164 |
double tDelta = std::abs (arrTime.GetSeconds () + maxTapDelay - it->GetArrivalTime ().GetSeconds ()); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
165 |
// We want tDelta in terms of a single symbol (i.e. if tDelta = 7.3 symbol+clearing |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
166 |
// times, the offset in terms of the arriving symbol power is |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
167 |
// 0.3 symbol+clearing times. |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
168 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
169 |
int32_t syms = (uint32_t)( (double) tDelta / (ts + clearingTime)); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
170 |
tDelta = tDelta - syms * (ts + clearingTime); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
171 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
172 |
// Align to pktRx |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
173 |
if (arrTime + Seconds (maxTapDelay) > it->GetArrivalTime ()) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
174 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
175 |
tDelta = ts + clearingTime - tDelta; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
176 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
177 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
178 |
double intPower = 0.0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
179 |
if (tDelta < ts) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
180 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
181 |
intPower += intPdp.SumTapsNc (Seconds (0), Seconds (ts - tDelta)); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
182 |
intPower += intPdp.SumTapsNc (Seconds (ts - tDelta + clearingTime), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
183 |
Seconds (2 * ts - tDelta + clearingTime)); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
184 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
185 |
else |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
186 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
187 |
Time start = Seconds (ts + clearingTime - tDelta); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
188 |
Time end = start + Seconds (ts); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
189 |
intPower += intPdp.SumTapsNc (start, end); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
190 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
191 |
start = start + Seconds (ts + clearingTime); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
192 |
end = start + Seconds (ts); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
193 |
intPower += intPdp.SumTapsNc (start, end); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
194 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
195 |
intKp += DbToKp (it->GetRxPowerDb ()) * intPower; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
196 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
197 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
198 |
double totalIntDb = KpToDb (isiUpa + intKp + DbToKp (ambNoiseDb)); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
199 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
200 |
NS_LOG_DEBUG ("Calculating SINR: RxPower = " << rxPowerDb << " dB. Effective Rx power " << effRxPowerDb << " dB. Number of interferers = " << arrivalList.size () << " Interference + noise power = " << totalIntDb << " dB. SINR = " << effRxPowerDb - totalIntDb << " dB."); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
201 |
return effRxPowerDb - totalIntDb; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
202 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
203 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
204 |
/*************** UanPhyPerGenDefault definition *****************/ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
205 |
UanPhyPerGenDefault::UanPhyPerGenDefault () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
206 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
207 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
208 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
209 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
210 |
UanPhyPerGenDefault::~UanPhyPerGenDefault () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
211 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
212 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
213 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
214 |
TypeId |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
215 |
UanPhyPerGenDefault::GetTypeId (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
216 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
217 |
static TypeId tid = TypeId ("ns3::UanPhyPerGenDefault") |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
218 |
.SetParent<Object> () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
219 |
.AddConstructor<UanPhyPerGenDefault> () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
220 |
.AddAttribute ("Threshold", "SINR cutoff for good packet reception", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
221 |
DoubleValue (8), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
222 |
MakeDoubleAccessor (&UanPhyPerGenDefault::m_thresh), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
223 |
MakeDoubleChecker<double> ()); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
224 |
return tid; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
225 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
226 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
227 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
228 |
// Default PER calculation simply compares SINR to a threshold which is configurable |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
229 |
// via an attribute. |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
230 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
231 |
UanPhyPerGenDefault::CalcPer (Ptr<Packet> pkt, double sinrDb, UanTxMode mode) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
232 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
233 |
if (sinrDb >= m_thresh) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
234 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
235 |
return 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
236 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
237 |
else |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
238 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
239 |
return 1; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
240 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
241 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
242 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
243 |
/*************** UanPhyPerUmodem definition *****************/ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
244 |
UanPhyPerUmodem::UanPhyPerUmodem () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
245 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
246 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
247 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
248 |
UanPhyPerUmodem::~UanPhyPerUmodem () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
249 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
250 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
251 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
252 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
253 |
TypeId UanPhyPerUmodem::GetTypeId (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
254 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
255 |
static TypeId tid = TypeId ("ns3::UanPhyPerUmodem") |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
256 |
.SetParent<Object> () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
257 |
.AddConstructor<UanPhyPerUmodem> () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
258 |
; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
259 |
return tid; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
260 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
261 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
262 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
263 |
UanPhyPerUmodem::NChooseK (uint32_t n, uint32_t k) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
264 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
265 |
double result; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
266 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
267 |
result = 1.0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
268 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
269 |
for (uint32_t i = std::max (k,n - k) + 1; i <= n; ++i) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
270 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
271 |
result *= i; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
272 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
273 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
274 |
for (uint32_t i = 2; i <= std::min (k,n - k); ++i) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
275 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
276 |
result /= i; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
277 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
278 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
279 |
return result; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
280 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
281 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
282 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
283 |
UanPhyPerUmodem::CalcPer (Ptr<Packet> pkt, double sinr, UanTxMode mode) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
284 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
285 |
uint32_t d[] = |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
286 |
{ 12, 14, 16, 18, 20, 22, 24, 26, 28 }; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
287 |
double Bd[] = |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
288 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
289 |
33, 281, 2179, 15035LLU, 105166LLU, 692330LLU, 4580007LLU, 29692894LLU, |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
290 |
190453145LLU |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
291 |
}; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
292 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
293 |
// double Rc = 1.0 / 2.0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
294 |
double ebno = std::pow (10.0, sinr / 10.0); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
295 |
double perror = 1.0 / (2.0 + ebno); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
296 |
double P[9]; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
297 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
298 |
if (sinr >= 10) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
299 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
300 |
return 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
301 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
302 |
if (sinr <= 6) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
303 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
304 |
return 1; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
305 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
306 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
307 |
for (uint32_t r = 0; r < 9; r++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
308 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
309 |
double sumd = 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
310 |
for (uint32_t k = 0; k < d[r]; k++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
311 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
312 |
sumd = sumd + NChooseK (d[r] - 1 + k, k) * std::pow (1 - perror, (double) k); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
313 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
314 |
P[r] = std::pow (perror, (double) d[r]) * sumd; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
315 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
316 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
317 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
318 |
double Pb = 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
319 |
for (uint32_t r = 0; r < 8; r++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
320 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
321 |
Pb = Pb + Bd[r] * P[r]; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
322 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
323 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
324 |
// cout << "Pb = " << Pb << endl; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
325 |
uint32_t bits = pkt->GetSize () * 8; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
326 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
327 |
double Ppacket = 1; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
328 |
double temp = NChooseK (bits, 0); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
329 |
temp *= std::pow ( (1 - Pb), (double) bits); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
330 |
Ppacket -= temp; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
331 |
temp = NChooseK (288, 1) * Pb * std::pow ( (1 - Pb), bits - 1.0); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
332 |
Ppacket -= temp; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
333 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
334 |
if (Ppacket > 1) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
335 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
336 |
return 1; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
337 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
338 |
else |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
339 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
340 |
return Ppacket; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
341 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
342 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
343 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
344 |
/*************** UanPhyGen definition *****************/ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
345 |
UanPhyGen::UanPhyGen () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
346 |
: UanPhy (), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
347 |
m_state (IDLE), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
348 |
m_channel (0), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
349 |
m_transducer (0), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
350 |
m_device (0), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
351 |
m_mac (0), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
352 |
m_rxGainDb (0), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
353 |
m_txPwrDb (0), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
354 |
m_rxThreshDb (0), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
355 |
m_ccaThreshDb (0), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
356 |
m_pktRx (0), |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
357 |
m_cleared (false), |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
358 |
m_disabled (false) |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
359 |
{ |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
360 |
m_energyCallback.Nullify (); |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
361 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
362 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
363 |
UanPhyGen::~UanPhyGen () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
364 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
365 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
366 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
367 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
368 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
369 |
UanPhyGen::Clear () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
370 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
371 |
if (m_cleared) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
372 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
373 |
return; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
374 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
375 |
m_cleared = true; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
376 |
m_listeners.clear (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
377 |
if (m_channel) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
378 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
379 |
m_channel->Clear (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
380 |
m_channel = 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
381 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
382 |
if (m_transducer) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
383 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
384 |
m_transducer->Clear (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
385 |
m_transducer = 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
386 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
387 |
if (m_device) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
388 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
389 |
m_device->Clear (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
390 |
m_device = 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
391 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
392 |
if (m_mac) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
393 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
394 |
m_mac->Clear (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
395 |
m_mac = 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
396 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
397 |
if (m_per) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
398 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
399 |
m_per->Clear (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
400 |
m_per = 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
401 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
402 |
if (m_sinr) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
403 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
404 |
m_sinr->Clear (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
405 |
m_sinr = 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
406 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
407 |
m_pktRx = 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
408 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
409 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
410 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
411 |
UanPhyGen::DoDispose () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
412 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
413 |
Clear (); |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
414 |
m_energyCallback.Nullify (); |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
415 |
UanPhy::DoDispose (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
416 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
417 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
418 |
UanModesList |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
419 |
UanPhyGen::GetDefaultModes (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
420 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
421 |
UanModesList l; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
422 |
l.AppendMode (UanTxModeFactory::CreateMode (UanTxMode::FSK,80,80,22000,4000,13,"FSK")); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
423 |
l.AppendMode (UanTxModeFactory::CreateMode (UanTxMode::PSK,200, 200, 22000, 4000, 4, "QPSK")); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
424 |
return l; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
425 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
426 |
TypeId |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
427 |
UanPhyGen::GetTypeId (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
428 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
429 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
430 |
static TypeId tid = TypeId ("ns3::UanPhyGen") |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
431 |
.SetParent<Object> () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
432 |
.AddConstructor<UanPhyGen> () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
433 |
.AddAttribute ("CcaThreshold", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
434 |
"Aggregate energy of incoming signals to move to CCA Busy state dB", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
435 |
DoubleValue (10), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
436 |
MakeDoubleAccessor (&UanPhyGen::m_ccaThreshDb), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
437 |
MakeDoubleChecker<double> ()) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
438 |
.AddAttribute ("RxThreshold", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
439 |
"Required SNR for signal acquisition in dB", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
440 |
DoubleValue (10), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
441 |
MakeDoubleAccessor (&UanPhyGen::m_rxThreshDb), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
442 |
MakeDoubleChecker<double> ()) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
443 |
.AddAttribute ("TxPower", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
444 |
"Transmission output power in dB", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
445 |
DoubleValue (190), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
446 |
MakeDoubleAccessor (&UanPhyGen::m_txPwrDb), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
447 |
MakeDoubleChecker<double> ()) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
448 |
.AddAttribute ("RxGain", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
449 |
"Gain added to incoming signal at receiver", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
450 |
DoubleValue (0), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
451 |
MakeDoubleAccessor (&UanPhyGen::m_rxGainDb), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
452 |
MakeDoubleChecker<double> ()) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
453 |
.AddAttribute ("SupportedModes", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
454 |
"List of modes supported by this PHY", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
455 |
UanModesListValue (UanPhyGen::GetDefaultModes ()), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
456 |
MakeUanModesListAccessor (&UanPhyGen::m_modes), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
457 |
MakeUanModesListChecker () ) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
458 |
.AddAttribute ("PerModel", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
459 |
"Functor to calculate PER based on SINR and TxMode", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
460 |
PointerValue (CreateObject<UanPhyPerGenDefault> ()), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
461 |
MakePointerAccessor (&UanPhyGen::m_per), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
462 |
MakePointerChecker<UanPhyPer> ()) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
463 |
.AddAttribute ("SinrModel", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
464 |
"Functor to calculate SINR based on pkt arrivals and modes", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
465 |
PointerValue (CreateObject<UanPhyCalcSinrDefault> ()), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
466 |
MakePointerAccessor (&UanPhyGen::m_sinr), |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
467 |
MakePointerChecker<UanPhyCalcSinr> ()) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
468 |
.AddTraceSource ("RxOk", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
469 |
"A packet was received successfully", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
470 |
MakeTraceSourceAccessor (&UanPhyGen::m_rxOkLogger)) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
471 |
.AddTraceSource ("RxError", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
472 |
"A packet was received unsuccessfully", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
473 |
MakeTraceSourceAccessor (&UanPhyGen::m_rxErrLogger)) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
474 |
.AddTraceSource ("Tx", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
475 |
"Packet transmission beginning", |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
476 |
MakeTraceSourceAccessor (&UanPhyGen::m_txLogger)) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
477 |
; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
478 |
return tid; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
479 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
480 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
481 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
482 |
void |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
483 |
UanPhyGen::SetEnergyModelCallback (DeviceEnergyModel::ChangeStateCallback cb) |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
484 |
{ |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
485 |
NS_LOG_FUNCTION (this); |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
486 |
m_energyCallback = cb; |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
487 |
} |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
488 |
|
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
489 |
void |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
490 |
UanPhyGen::UpdatePowerConsumption (const State state) |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
491 |
{ |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
492 |
NS_LOG_FUNCTION (this); |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
493 |
|
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
494 |
if (!m_energyCallback.IsNull ()) |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
495 |
{ |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
496 |
m_energyCallback (state); |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
497 |
} |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
498 |
} |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
499 |
|
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
500 |
void |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
501 |
UanPhyGen::EnergyDepletionHandler () |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
502 |
{ |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
503 |
NS_LOG_FUNCTION (this); |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
504 |
NS_LOG_DEBUG ("Energy depleted at node " << m_device->GetNode ()->GetId () << |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
505 |
", stopping rx/tx activities"); |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
506 |
|
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
507 |
m_disabled = true; |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
508 |
} |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
509 |
|
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
510 |
void |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
511 |
UanPhyGen::SendPacket (Ptr<Packet> pkt, uint32_t modeNum) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
512 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
513 |
NS_LOG_DEBUG ("PHY " << m_mac->GetAddress () << ": Transmitting packet"); |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
514 |
if (m_disabled) |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
515 |
{ |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
516 |
NS_LOG_DEBUG ("Energy depleted, node cannot transmit any packet. Dropping."); |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
517 |
return; |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
518 |
} |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
519 |
|
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
520 |
if (m_state == TX) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
521 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
522 |
NS_LOG_DEBUG ("PHY requested to TX while already Transmitting. Dropping packet."); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
523 |
return; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
524 |
} |
7433 | 525 |
else if (m_state == SLEEP) |
526 |
{ |
|
527 |
NS_LOG_DEBUG ("PHY requested to TX while sleeping. Dropping packet."); |
|
528 |
return; |
|
529 |
} |
|
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
530 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
531 |
UanTxMode txMode = GetMode (modeNum); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
532 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
533 |
if (m_pktRx != 0) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
534 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
535 |
m_minRxSinrDb = -1e30; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
536 |
m_pktRx = 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
537 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
538 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
539 |
m_transducer->Transmit (Ptr<UanPhy> (this), pkt, m_txPwrDb, txMode); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
540 |
m_state = TX; |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
541 |
UpdatePowerConsumption (TX); |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
542 |
double txdelay = pkt->GetSize () * 8.0 / txMode.GetDataRateBps (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
543 |
Simulator::Schedule (Seconds (txdelay), &UanPhyGen::TxEndEvent, this); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
544 |
NS_LOG_DEBUG ("PHY " << m_mac->GetAddress () << " notifying listeners"); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
545 |
NotifyListenersTxStart (Seconds (txdelay)); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
546 |
m_txLogger (pkt, m_txPwrDb, txMode); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
547 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
548 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
549 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
550 |
UanPhyGen::TxEndEvent () |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
551 |
{ |
7433 | 552 |
if (m_state == SLEEP || m_disabled == true) |
553 |
{ |
|
554 |
NS_LOG_DEBUG ("Transmission ended but node sleeping or dead"); |
|
555 |
return; |
|
556 |
} |
|
557 |
||
6615
14319edd3d2c
Bug 990 - Error with an NS_ASSERT at uan-phy-gen.cc
Salva Climent <jocliba@gmail.com>
parents:
6478
diff
changeset
|
558 |
NS_ASSERT (m_state == TX); |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
559 |
if (GetInterferenceDb ( (Ptr<Packet>) 0) > m_ccaThreshDb) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
560 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
561 |
m_state = CCABUSY; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
562 |
NotifyListenersCcaStart (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
563 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
564 |
else |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
565 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
566 |
m_state = IDLE; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
567 |
} |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
568 |
UpdatePowerConsumption (IDLE); |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
569 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
570 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
571 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
572 |
UanPhyGen::RegisterListener (UanPhyListener *listener) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
573 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
574 |
m_listeners.push_back (listener); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
575 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
576 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
577 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
578 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
579 |
UanPhyGen::StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
580 |
{ |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
581 |
if (m_disabled) |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
582 |
{ |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
583 |
NS_LOG_DEBUG ("Energy depleted, node cannot receive any packet. Dropping."); |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
584 |
return; |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
585 |
} |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
586 |
|
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
587 |
switch (m_state) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
588 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
589 |
case TX: |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
590 |
NS_ASSERT (false); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
591 |
break; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
592 |
case RX: |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
593 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
594 |
NS_ASSERT (m_pktRx); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
595 |
double newSinrDb = CalculateSinrDb (m_pktRx, m_pktRxArrTime, m_rxRecvPwrDb, m_pktRxMode, m_pktRxPdp); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
596 |
m_minRxSinrDb = (newSinrDb < m_minRxSinrDb) ? newSinrDb : m_minRxSinrDb; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
597 |
NS_LOG_DEBUG ("PHY " << m_mac->GetAddress () << ": Starting RX in RX mode. SINR of pktRx = " << m_minRxSinrDb); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
598 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
599 |
break; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
600 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
601 |
case CCABUSY: |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
602 |
case IDLE: |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
603 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
604 |
NS_ASSERT (!m_pktRx); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
605 |
bool hasmode = false; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
606 |
for (uint32_t i = 0; i < GetNModes (); i++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
607 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
608 |
if (txMode.GetUid () == GetMode (i).GetUid ()) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
609 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
610 |
hasmode = true; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
611 |
break; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
612 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
613 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
614 |
if (!hasmode) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
615 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
616 |
break; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
617 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
618 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
619 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
620 |
double newsinr = CalculateSinrDb (pkt, Simulator::Now (), rxPowerDb, txMode, pdp); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
621 |
NS_LOG_DEBUG ("PHY " << m_mac->GetAddress () << ": Starting RX in IDLE mode. SINR = " << newsinr); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
622 |
if (newsinr > m_rxThreshDb) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
623 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
624 |
m_state = RX; |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
625 |
UpdatePowerConsumption (RX); |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
626 |
m_rxRecvPwrDb = rxPowerDb; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
627 |
m_minRxSinrDb = newsinr; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
628 |
m_pktRx = pkt; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
629 |
m_pktRxArrTime = Simulator::Now (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
630 |
m_pktRxMode = txMode; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
631 |
m_pktRxPdp = pdp; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
632 |
double txdelay = pkt->GetSize () * 8.0 / txMode.GetDataRateBps (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
633 |
Simulator::Schedule (Seconds (txdelay), &UanPhyGen::RxEndEvent, this, pkt, rxPowerDb, txMode); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
634 |
NotifyListenersRxStart (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
635 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
636 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
637 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
638 |
break; |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
639 |
case SLEEP: |
7433 | 640 |
NS_LOG_DEBUG ("Sleep mode. Dropping packet."); |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
641 |
break; |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
642 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
643 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
644 |
if (m_state == IDLE && GetInterferenceDb ( (Ptr<Packet>) 0) > m_ccaThreshDb) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
645 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
646 |
m_state = CCABUSY; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
647 |
NotifyListenersCcaStart (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
648 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
649 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
650 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
651 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
652 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
653 |
UanPhyGen::RxEndEvent (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
654 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
655 |
if (pkt != m_pktRx) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
656 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
657 |
return; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
658 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
659 |
|
7433 | 660 |
if (m_disabled || m_state == SLEEP) |
661 |
{ |
|
662 |
NS_LOG_DEBUG ("Sleep mode or dead. Dropping packet"); |
|
663 |
m_pktRx = 0; |
|
664 |
return; |
|
665 |
} |
|
666 |
||
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
667 |
if (GetInterferenceDb ( (Ptr<Packet>) 0) > m_ccaThreshDb) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
668 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
669 |
m_state = CCABUSY; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
670 |
NotifyListenersCcaStart (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
671 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
672 |
else |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
673 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
674 |
m_state = IDLE; |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
675 |
UpdatePowerConsumption (IDLE); |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
676 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
677 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
678 |
UniformVariable pg; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
679 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
680 |
if (pg.GetValue (0, 1) > m_per->CalcPer (m_pktRx, m_minRxSinrDb, txMode)) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
681 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
682 |
m_rxOkLogger (pkt, m_minRxSinrDb, txMode); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
683 |
NotifyListenersRxGood (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
684 |
if (!m_recOkCb.IsNull ()) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
685 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
686 |
m_recOkCb (pkt, m_minRxSinrDb, txMode); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
687 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
688 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
689 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
690 |
else |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
691 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
692 |
m_rxErrLogger (pkt, m_minRxSinrDb, txMode); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
693 |
NotifyListenersRxBad (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
694 |
if (!m_recErrCb.IsNull ()) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
695 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
696 |
m_recErrCb (pkt, m_minRxSinrDb); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
697 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
698 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
699 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
700 |
m_pktRx = 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
701 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
702 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
703 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
704 |
UanPhyGen::SetReceiveOkCallback (RxOkCallback cb) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
705 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
706 |
m_recOkCb = cb; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
707 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
708 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
709 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
710 |
UanPhyGen::SetReceiveErrorCallback (RxErrCallback cb) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
711 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
712 |
m_recErrCb = cb; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
713 |
} |
6715
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
714 |
bool |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
715 |
UanPhyGen::IsStateSleep (void) |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
716 |
{ |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
717 |
return m_state == SLEEP; |
ba60c821ad35
Energy support for UAN module and Li-Ion energy model
Andrea Sacco <andrea.sacco85@gmail.com>
parents:
6615
diff
changeset
|
718 |
} |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
719 |
bool |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
720 |
UanPhyGen::IsStateIdle (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
721 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
722 |
return m_state == IDLE; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
723 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
724 |
bool |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
725 |
UanPhyGen::IsStateBusy (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
726 |
{ |
6781 | 727 |
return !IsStateIdle () && !IsStateSleep (); |
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
728 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
729 |
bool |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
730 |
UanPhyGen::IsStateRx (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
731 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
732 |
return m_state == RX; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
733 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
734 |
bool |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
735 |
UanPhyGen::IsStateTx (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
736 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
737 |
return m_state == TX; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
738 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
739 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
740 |
bool |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
741 |
UanPhyGen::IsStateCcaBusy (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
742 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
743 |
return m_state == CCABUSY; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
744 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
745 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
746 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
747 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
748 |
UanPhyGen::SetRxGainDb (double gain) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
749 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
750 |
m_rxGainDb = gain; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
751 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
752 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
753 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
754 |
UanPhyGen::SetTxPowerDb (double txpwr) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
755 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
756 |
m_txPwrDb = txpwr; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
757 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
758 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
759 |
UanPhyGen::SetRxThresholdDb (double thresh) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
760 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
761 |
m_rxThreshDb = thresh; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
762 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
763 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
764 |
UanPhyGen::SetCcaThresholdDb (double thresh) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
765 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
766 |
m_ccaThreshDb = thresh; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
767 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
768 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
769 |
UanPhyGen::GetRxGainDb (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
770 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
771 |
return m_rxGainDb; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
772 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
773 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
774 |
UanPhyGen::GetTxPowerDb (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
775 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
776 |
return m_txPwrDb; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
777 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
778 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
779 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
780 |
UanPhyGen::GetRxThresholdDb (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
781 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
782 |
return m_rxThreshDb; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
783 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
784 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
785 |
UanPhyGen::GetCcaThresholdDb (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
786 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
787 |
return m_ccaThreshDb; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
788 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
789 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
790 |
Ptr<UanChannel> |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
791 |
UanPhyGen::GetChannel (void) const |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
792 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
793 |
return m_channel; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
794 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
795 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
796 |
Ptr<UanNetDevice> |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
797 |
UanPhyGen::GetDevice (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
798 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
799 |
return m_device; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
800 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
801 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
802 |
Ptr<UanTransducer> |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
803 |
UanPhyGen::GetTransducer (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
804 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
805 |
return m_transducer; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
806 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
807 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
808 |
UanPhyGen::SetChannel (Ptr<UanChannel> channel) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
809 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
810 |
m_channel = channel; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
811 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
812 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
813 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
814 |
UanPhyGen::SetDevice (Ptr<UanNetDevice> device) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
815 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
816 |
m_device = device; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
817 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
818 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
819 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
820 |
UanPhyGen::SetMac (Ptr<UanMac> mac) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
821 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
822 |
m_mac = mac; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
823 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
824 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
825 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
826 |
UanPhyGen::SetTransducer (Ptr<UanTransducer> trans) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
827 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
828 |
m_transducer = trans; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
829 |
m_transducer->AddPhy (this); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
830 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
831 |
|
7433 | 832 |
void |
833 |
UanPhyGen::SetSleepMode (bool sleep) |
|
834 |
{ |
|
835 |
if (sleep) |
|
836 |
{ |
|
837 |
m_state = SLEEP; |
|
838 |
if (!m_energyCallback.IsNull ()) |
|
839 |
{ |
|
840 |
m_energyCallback (SLEEP); |
|
841 |
} |
|
842 |
} |
|
843 |
else |
|
844 |
{ |
|
845 |
m_state = IDLE; |
|
846 |
if (!m_energyCallback.IsNull ()) |
|
847 |
{ |
|
848 |
m_energyCallback (IDLE); |
|
849 |
} |
|
850 |
} |
|
851 |
} |
|
6478
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
852 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
853 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
854 |
UanPhyGen::NotifyTransStartTx (Ptr<Packet> packet, double txPowerDb, UanTxMode txMode) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
855 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
856 |
if (m_pktRx) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
857 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
858 |
m_minRxSinrDb = -1e30; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
859 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
860 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
861 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
862 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
863 |
UanPhyGen::NotifyIntChange (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
864 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
865 |
if (m_state == CCABUSY && GetInterferenceDb (Ptr<Packet> ()) < m_ccaThreshDb) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
866 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
867 |
m_state = IDLE; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
868 |
NotifyListenersCcaEnd (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
869 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
870 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
871 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
872 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
873 |
UanPhyGen::CalculateSinrDb (Ptr<Packet> pkt, Time arrTime, double rxPowerDb, UanTxMode mode, UanPdp pdp) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
874 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
875 |
double noiseDb = m_channel->GetNoiseDbHz ( (double) mode.GetCenterFreqHz () / 1000.0) + 10 * log10 (mode.GetBandwidthHz ()); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
876 |
return m_sinr->CalcSinrDb (pkt, arrTime, rxPowerDb, noiseDb, mode, pdp, m_transducer->GetArrivalList ()); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
877 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
878 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
879 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
880 |
UanPhyGen::GetInterferenceDb (Ptr<Packet> pkt) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
881 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
882 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
883 |
const UanTransducer::ArrivalList &arrivalList = m_transducer->GetArrivalList (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
884 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
885 |
UanTransducer::ArrivalList::const_iterator it = arrivalList.begin (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
886 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
887 |
double interfPower = 0; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
888 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
889 |
for (; it != arrivalList.end (); it++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
890 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
891 |
if (pkt != it->GetPacket ()) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
892 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
893 |
interfPower += DbToKp (it->GetRxPowerDb ()); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
894 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
895 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
896 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
897 |
return KpToDb (interfPower); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
898 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
899 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
900 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
901 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
902 |
UanPhyGen::DbToKp (double db) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
903 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
904 |
return pow (10, db / 10.0); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
905 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
906 |
double |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
907 |
UanPhyGen::KpToDb (double kp) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
908 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
909 |
return 10 * log10 (kp); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
910 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
911 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
912 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
913 |
UanPhyGen::NotifyListenersRxStart (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
914 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
915 |
ListenerList::const_iterator it = m_listeners.begin (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
916 |
for (; it != m_listeners.end (); it++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
917 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
918 |
(*it)->NotifyRxStart (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
919 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
920 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
921 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
922 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
923 |
UanPhyGen::NotifyListenersRxGood (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
924 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
925 |
ListenerList::const_iterator it = m_listeners.begin (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
926 |
for (; it != m_listeners.end (); it++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
927 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
928 |
(*it)->NotifyRxEndOk (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
929 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
930 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
931 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
932 |
UanPhyGen::NotifyListenersRxBad (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
933 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
934 |
ListenerList::const_iterator it = m_listeners.begin (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
935 |
for (; it != m_listeners.end (); it++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
936 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
937 |
(*it)->NotifyRxEndError (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
938 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
939 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
940 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
941 |
UanPhyGen::NotifyListenersCcaStart (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
942 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
943 |
ListenerList::const_iterator it = m_listeners.begin (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
944 |
for (; it != m_listeners.end (); it++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
945 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
946 |
(*it)->NotifyCcaStart (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
947 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
948 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
949 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
950 |
UanPhyGen::NotifyListenersCcaEnd (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
951 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
952 |
ListenerList::const_iterator it = m_listeners.begin (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
953 |
for (; it != m_listeners.end (); it++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
954 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
955 |
(*it)->NotifyCcaEnd (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
956 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
957 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
958 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
959 |
void |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
960 |
UanPhyGen::NotifyListenersTxStart (Time duration) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
961 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
962 |
ListenerList::const_iterator it = m_listeners.begin (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
963 |
for (; it != m_listeners.end (); it++) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
964 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
965 |
(*it)->NotifyTxStart (duration); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
966 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
967 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
968 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
969 |
uint32_t |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
970 |
UanPhyGen::GetNModes (void) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
971 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
972 |
return m_modes.GetNModes (); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
973 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
974 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
975 |
UanTxMode |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
976 |
UanPhyGen::GetMode (uint32_t n) |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
977 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
978 |
NS_ASSERT (n < m_modes.GetNModes ()); |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
979 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
980 |
return m_modes[n]; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
981 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
982 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
983 |
Ptr<Packet> |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
984 |
UanPhyGen::GetPacketRx (void) const |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
985 |
{ |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
986 |
return m_pktRx; |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
987 |
} |
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
988 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
989 |
|
b401db8531f5
Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
990 |
} // namespace ns3 |