author | Nicola Baldo <nbaldo@cttc.es> |
Fri, 26 Oct 2012 14:10:40 +0200 | |
changeset 9113 | 63eba52498e1 |
parent 9063 | 32755d0516f4 |
child 9653 | 382d27da8905 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7343
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
6349 | 2 |
/* |
3 |
* Copyright (c) 2009 CTTC |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License version 2 as |
|
7 |
* published by the Free Software Foundation; |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
* |
|
18 |
* Author: Nicola Baldo <nbaldo@cttc.es> |
|
19 |
*/ |
|
20 |
||
21 |
#include <ns3/object.h> |
|
22 |
#include <ns3/simulator.h> |
|
23 |
#include <ns3/log.h> |
|
24 |
#include <ns3/packet.h> |
|
25 |
#include <ns3/packet-burst.h> |
|
26 |
#include <ns3/net-device.h> |
|
27 |
#include <ns3/node.h> |
|
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
28 |
#include <ns3/double.h> |
6349 | 29 |
#include <ns3/mobility-model.h> |
30 |
#include <ns3/spectrum-phy.h> |
|
31 |
#include <ns3/spectrum-converter.h> |
|
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
32 |
#include <ns3/spectrum-propagation-loss-model.h> |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
33 |
#include <ns3/propagation-loss-model.h> |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
34 |
#include <ns3/propagation-delay-model.h> |
7836
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
35 |
#include <ns3/antenna-model.h> |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
36 |
#include <ns3/angles.h> |
6349 | 37 |
#include <iostream> |
38 |
#include <utility> |
|
39 |
#include "multi-model-spectrum-channel.h" |
|
40 |
||
41 |
||
42 |
NS_LOG_COMPONENT_DEFINE ("MultiModelSpectrumChannel"); |
|
43 |
||
44 |
||
45 |
namespace ns3 { |
|
46 |
||
47 |
||
48 |
NS_OBJECT_ENSURE_REGISTERED (MultiModelSpectrumChannel); |
|
49 |
||
50 |
||
51 |
std::ostream& operator<< (std::ostream& lhs, TxSpectrumModelInfoMap_t& rhs) |
|
52 |
{ |
|
53 |
for (TxSpectrumModelInfoMap_t::iterator it = rhs.begin (); |
|
54 |
it != rhs.end (); |
|
55 |
++it) |
|
56 |
{ |
|
57 |
SpectrumConverterMap_t::iterator jt; |
|
58 |
for (jt = it->second.m_spectrumConverterMap.begin (); |
|
59 |
jt != it->second.m_spectrumConverterMap.end (); |
|
60 |
++jt) |
|
61 |
{ |
|
62 |
lhs << "(" << it->first << "," << jt->first << ") "; |
|
63 |
} |
|
64 |
} |
|
65 |
return lhs; |
|
66 |
} |
|
67 |
||
68 |
TxSpectrumModelInfo::TxSpectrumModelInfo (Ptr<const SpectrumModel> txSpectrumModel) |
|
69 |
: m_txSpectrumModel (txSpectrumModel) |
|
70 |
{ |
|
71 |
} |
|
72 |
||
73 |
||
74 |
RxSpectrumModelInfo::RxSpectrumModelInfo (Ptr<const SpectrumModel> rxSpectrumModel) |
|
75 |
: m_rxSpectrumModel (rxSpectrumModel) |
|
76 |
{ |
|
77 |
} |
|
78 |
||
79 |
||
80 |
MultiModelSpectrumChannel::MultiModelSpectrumChannel () |
|
81 |
{ |
|
82 |
NS_LOG_FUNCTION (this); |
|
83 |
} |
|
84 |
||
85 |
void |
|
86 |
MultiModelSpectrumChannel::DoDispose () |
|
87 |
{ |
|
88 |
NS_LOG_FUNCTION (this); |
|
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
89 |
m_propagationDelay = 0; |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
90 |
m_propagationLoss = 0; |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
91 |
m_spectrumPropagationLoss = 0; |
6349 | 92 |
m_txSpectrumModelInfoMap.clear (); |
93 |
m_rxSpectrumModelInfoMap.clear (); |
|
6986
f2534c707213
fixed disposal of MultiModelSpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
6801
diff
changeset
|
94 |
SpectrumChannel::DoDispose (); |
6349 | 95 |
} |
96 |
||
97 |
TypeId |
|
98 |
MultiModelSpectrumChannel::GetTypeId (void) |
|
99 |
{ |
|
100 |
static TypeId tid = TypeId ("ns3::MultiModelSpectrumChannel") |
|
101 |
.SetParent<SpectrumChannel> () |
|
102 |
.AddConstructor<MultiModelSpectrumChannel> () |
|
7581 | 103 |
.AddAttribute ("MaxLossDb", |
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
104 |
"If a single-frequency PropagationLossModel is used, this value " |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
105 |
"represents the maximum loss in dB for which transmissions will be " |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
106 |
"passed to the receiving PHY. Signals for which the PropagationLossModel " |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
107 |
"returns a loss bigger than this value will not be propagated to the receiver. " |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
108 |
"This parameter is to be used to reduce " |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
109 |
"the computational load by not propagating signals that are far beyond " |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
110 |
"the interference range. Note that the default value corresponds to " |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
111 |
"considering all signals for reception. Tune this value with care. ", |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
112 |
DoubleValue (1.0e9), |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
113 |
MakeDoubleAccessor (&MultiModelSpectrumChannel::m_maxLossDb), |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
114 |
MakeDoubleChecker<double> ()) |
7836
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
115 |
.AddTraceSource ("PathLoss", |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
116 |
"This trace is fired " |
7554
e536a09d83ee
added PropagationLoss trace to SpectrumChannel implementations
Nicola Baldo <nbaldo@cttc.es>
parents:
7553
diff
changeset
|
117 |
"whenever a new path loss value is calculated. The first and second parameters " |
e536a09d83ee
added PropagationLoss trace to SpectrumChannel implementations
Nicola Baldo <nbaldo@cttc.es>
parents:
7553
diff
changeset
|
118 |
"to the trace are pointers respectively to the TX and RX SpectrumPhy instances, " |
e536a09d83ee
added PropagationLoss trace to SpectrumChannel implementations
Nicola Baldo <nbaldo@cttc.es>
parents:
7553
diff
changeset
|
119 |
"whereas the third parameters is the loss value in dB. Note that the loss value " |
7836
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
120 |
"reported by this trace is the single-frequency loss value obtained by evaluating " |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
121 |
"only the TX and RX AntennaModels and the PropagationLossModel. In particular, note that " |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
122 |
"SpectrumPropagationLossModel (even if present) is never used to evaluate the loss value " |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
123 |
"reported in this trace. ", |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
124 |
MakeTraceSourceAccessor (&MultiModelSpectrumChannel::m_pathLossTrace)) |
6349 | 125 |
; |
126 |
return tid; |
|
127 |
} |
|
128 |
||
129 |
||
130 |
||
131 |
void |
|
132 |
MultiModelSpectrumChannel::AddRx (Ptr<SpectrumPhy> phy) |
|
133 |
{ |
|
134 |
NS_LOG_FUNCTION (this << phy); |
|
135 |
||
136 |
Ptr<const SpectrumModel> rxSpectrumModel = phy->GetRxSpectrumModel (); |
|
137 |
||
138 |
NS_ASSERT_MSG ((0 != rxSpectrumModel), "phy->GetRxSpectrumModel () returned 0. Please check that the RxSpectrumModel is already set for the phy before calling MultiModelSpectrumChannel::AddRx (phy)"); |
|
139 |
||
140 |
SpectrumModelUid_t rxSpectrumModelUid = rxSpectrumModel->GetUid (); |
|
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
141 |
|
6349 | 142 |
std::vector<Ptr<SpectrumPhy> >::const_iterator it; |
143 |
||
9113
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
144 |
// remove a previous entry of this phy if it exists |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
145 |
// we need to scan for all rxSpectrumModel values since we don't |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
146 |
// know which spectrum model the phy had when it was previously added |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
147 |
// (it's probably different than the current one) |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
148 |
for (RxSpectrumModelInfoMap_t::iterator rxInfoIterator = m_rxSpectrumModelInfoMap.begin (); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
149 |
rxInfoIterator != m_rxSpectrumModelInfoMap.end (); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
150 |
++rxInfoIterator) |
6349 | 151 |
{ |
9113
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
152 |
std::set<Ptr<SpectrumPhy> >::iterator phyIt = rxInfoIterator->second.m_rxPhySet.find (phy); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
153 |
if (phyIt != rxInfoIterator->second.m_rxPhySet.end ()) |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
154 |
{ |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
155 |
rxInfoIterator->second.m_rxPhySet.erase (phyIt); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
156 |
--m_numDevices; |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
157 |
break; // there should be at most one entry |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
158 |
} |
6349 | 159 |
} |
9113
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
160 |
|
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
161 |
++m_numDevices; |
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
162 |
|
6349 | 163 |
RxSpectrumModelInfoMap_t::iterator rxInfoIterator = m_rxSpectrumModelInfoMap.find (rxSpectrumModelUid); |
164 |
||
165 |
if (rxInfoIterator == m_rxSpectrumModelInfoMap.end ()) |
|
166 |
{ |
|
167 |
// spectrum model unknown, add it to the list of RxSpectrumModels |
|
168 |
std::pair<RxSpectrumModelInfoMap_t::iterator, bool> ret; |
|
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
169 |
ret = m_rxSpectrumModelInfoMap.insert (std::make_pair (rxSpectrumModelUid, RxSpectrumModelInfo (rxSpectrumModel))); |
6349 | 170 |
NS_ASSERT (ret.second); |
9113
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
171 |
// also add the phy to the newly created set of SpectrumPhy for this RxSpectrumModel |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
172 |
std::pair<std::set<Ptr<SpectrumPhy> >::iterator, bool> ret2 = ret.first->second.m_rxPhySet.insert (phy); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
173 |
NS_ASSERT (ret2.second); |
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
174 |
|
6349 | 175 |
// and create the necessary converters for all the TX spectrum models that we know of |
176 |
for (TxSpectrumModelInfoMap_t::iterator txInfoIterator = m_txSpectrumModelInfoMap.begin (); |
|
177 |
txInfoIterator != m_txSpectrumModelInfoMap.end (); |
|
178 |
++txInfoIterator) |
|
179 |
{ |
|
180 |
Ptr<const SpectrumModel> txSpectrumModel = txInfoIterator->second.m_txSpectrumModel; |
|
6350 | 181 |
NS_LOG_LOGIC ("Creating converters between SpectrumModelUids " << txSpectrumModel->GetUid () << " and " << rxSpectrumModelUid ); |
6349 | 182 |
SpectrumConverter converter (txSpectrumModel, rxSpectrumModel); |
183 |
std::pair<SpectrumConverterMap_t::iterator, bool> ret2; |
|
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
184 |
ret2 = txInfoIterator->second.m_spectrumConverterMap.insert (std::make_pair (rxSpectrumModelUid, converter)); |
6349 | 185 |
NS_ASSERT (ret2.second); |
186 |
} |
|
187 |
} |
|
188 |
else |
|
189 |
{ |
|
190 |
// spectrum model is already known, just add the device to the corresponding list |
|
9113
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
191 |
std::pair<std::set<Ptr<SpectrumPhy> >::iterator, bool> ret2 = rxInfoIterator->second.m_rxPhySet.insert (phy); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
192 |
NS_ASSERT (ret2.second); |
6349 | 193 |
} |
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
194 |
|
6349 | 195 |
} |
196 |
||
197 |
||
198 |
TxSpectrumModelInfoMap_t::const_iterator |
|
199 |
MultiModelSpectrumChannel::FindAndEventuallyAddTxSpectrumModel (Ptr<const SpectrumModel> txSpectrumModel) |
|
200 |
{ |
|
201 |
NS_LOG_FUNCTION (this << txSpectrumModel); |
|
202 |
SpectrumModelUid_t txSpectrumModelUid = txSpectrumModel->GetUid (); |
|
203 |
TxSpectrumModelInfoMap_t::iterator txInfoIterator = m_txSpectrumModelInfoMap.find (txSpectrumModelUid); |
|
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
204 |
|
6349 | 205 |
if (txInfoIterator == m_txSpectrumModelInfoMap.end ()) |
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
206 |
{ |
6349 | 207 |
// first time we see this TX SpectrumModel |
208 |
// we add it to the list |
|
209 |
std::pair<TxSpectrumModelInfoMap_t::iterator, bool> ret; |
|
210 |
ret = m_txSpectrumModelInfoMap.insert (std::make_pair (txSpectrumModelUid, TxSpectrumModelInfo (txSpectrumModel))); |
|
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
211 |
NS_ASSERT (ret.second); |
6349 | 212 |
txInfoIterator = ret.first; |
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
213 |
|
6349 | 214 |
// and we create the converters for all the RX SpectrumModels that we know of |
215 |
for (RxSpectrumModelInfoMap_t::const_iterator rxInfoIterator = m_rxSpectrumModelInfoMap.begin (); |
|
216 |
rxInfoIterator != m_rxSpectrumModelInfoMap.end (); |
|
217 |
++rxInfoIterator) |
|
218 |
{ |
|
219 |
Ptr<const SpectrumModel> rxSpectrumModel = rxInfoIterator->second.m_rxSpectrumModel; |
|
220 |
SpectrumModelUid_t rxSpectrumModelUid = rxSpectrumModel->GetUid (); |
|
221 |
||
222 |
if (rxSpectrumModelUid != txSpectrumModelUid) |
|
223 |
{ |
|
224 |
NS_LOG_LOGIC ("Creating converters between SpectrumModelUids " << txSpectrumModelUid << " and " << rxSpectrumModelUid ); |
|
225 |
||
226 |
SpectrumConverter converter (txSpectrumModel, rxSpectrumModel); |
|
227 |
std::pair<SpectrumConverterMap_t::iterator, bool> ret2; |
|
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
228 |
ret2 = txInfoIterator->second.m_spectrumConverterMap.insert (std::make_pair (rxSpectrumModelUid, converter)); |
6349 | 229 |
NS_ASSERT (ret2.second); |
230 |
} |
|
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
231 |
} |
6349 | 232 |
} |
233 |
else |
|
234 |
{ |
|
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
235 |
NS_LOG_LOGIC ("SpectrumModelUid " << txSpectrumModelUid << " already present"); |
6349 | 236 |
} |
237 |
return txInfoIterator; |
|
238 |
} |
|
239 |
||
9113
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
240 |
|
6349 | 241 |
|
242 |
void |
|
7581 | 243 |
MultiModelSpectrumChannel::StartTx (Ptr<SpectrumSignalParameters> txParams) |
6349 | 244 |
{ |
7581 | 245 |
NS_LOG_FUNCTION (this << txParams); |
6349 | 246 |
|
7581 | 247 |
NS_ASSERT (txParams->txPhy); |
248 |
NS_ASSERT (txParams->psd); |
|
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
249 |
|
6349 | 250 |
|
7581 | 251 |
Ptr<MobilityModel> txMobility = txParams->txPhy->GetMobility (); |
252 |
SpectrumModelUid_t txSpectrumModelUid = txParams->psd->GetSpectrumModelUid (); |
|
6349 | 253 |
NS_LOG_LOGIC (" txSpectrumModelUid " << txSpectrumModelUid); |
254 |
||
255 |
// |
|
7581 | 256 |
TxSpectrumModelInfoMap_t::const_iterator txInfoIteratorerator = FindAndEventuallyAddTxSpectrumModel (txParams->psd->GetSpectrumModel ()); |
6349 | 257 |
NS_ASSERT (txInfoIteratorerator != m_txSpectrumModelInfoMap.end ()); |
258 |
||
259 |
NS_LOG_LOGIC ("converter map for TX SpectrumModel with Uid " << txInfoIteratorerator->first); |
|
260 |
NS_LOG_LOGIC ("converter map size: " << txInfoIteratorerator->second.m_spectrumConverterMap.size ()); |
|
261 |
NS_LOG_LOGIC ("converter map first element: " << txInfoIteratorerator->second.m_spectrumConverterMap.begin ()->first); |
|
262 |
||
263 |
for (RxSpectrumModelInfoMap_t::const_iterator rxInfoIterator = m_rxSpectrumModelInfoMap.begin (); |
|
264 |
rxInfoIterator != m_rxSpectrumModelInfoMap.end (); |
|
265 |
++rxInfoIterator) |
|
266 |
{ |
|
267 |
SpectrumModelUid_t rxSpectrumModelUid = rxInfoIterator->second.m_rxSpectrumModel->GetUid (); |
|
268 |
NS_LOG_LOGIC (" rxSpectrumModelUids " << rxSpectrumModelUid); |
|
269 |
||
270 |
Ptr <SpectrumValue> convertedTxPowerSpectrum; |
|
271 |
if (txSpectrumModelUid == rxSpectrumModelUid) |
|
272 |
{ |
|
7581 | 273 |
NS_LOG_LOGIC ("no spectrum conversion needed"); |
274 |
convertedTxPowerSpectrum = txParams->psd; |
|
6349 | 275 |
} |
276 |
else |
|
277 |
{ |
|
278 |
NS_LOG_LOGIC (" converting txPowerSpectrum SpectrumModelUids" << txSpectrumModelUid << " --> " << rxSpectrumModelUid); |
|
279 |
SpectrumConverterMap_t::const_iterator rxConverterIterator = txInfoIteratorerator->second.m_spectrumConverterMap.find (rxSpectrumModelUid); |
|
280 |
NS_ASSERT (rxConverterIterator != txInfoIteratorerator->second.m_spectrumConverterMap.end ()); |
|
7581 | 281 |
convertedTxPowerSpectrum = rxConverterIterator->second.Convert (txParams->psd); |
6349 | 282 |
} |
283 |
||
7581 | 284 |
|
9113
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
285 |
for (std::set<Ptr<SpectrumPhy> >::const_iterator rxPhyIterator = rxInfoIterator->second.m_rxPhySet.begin (); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
286 |
rxPhyIterator != rxInfoIterator->second.m_rxPhySet.end (); |
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
287 |
++rxPhyIterator) |
6349 | 288 |
{ |
289 |
NS_ASSERT_MSG ((*rxPhyIterator)->GetRxSpectrumModel ()->GetUid () == rxSpectrumModelUid, |
|
9113
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
290 |
"SpectrumModel change was not notified to MultiModelSpectrumChannel (i.e., AddRx should be called again after model is changed)"); |
7581 | 291 |
|
292 |
if ((*rxPhyIterator) != txParams->txPhy) |
|
6349 | 293 |
{ |
7581 | 294 |
NS_LOG_LOGIC (" copying signal parameters " << txParams); |
295 |
Ptr<SpectrumSignalParameters> rxParams = txParams->Copy (); |
|
296 |
rxParams->psd = Copy<SpectrumValue> (convertedTxPowerSpectrum); |
|
297 |
Time delay = MicroSeconds (0); |
|
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
298 |
|
7553
2b93d333dea6
Bug 1271 - stronger type checking in SpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents:
7385
diff
changeset
|
299 |
Ptr<MobilityModel> receiverMobility = (*rxPhyIterator)->GetMobility (); |
6349 | 300 |
|
301 |
if (txMobility && receiverMobility) |
|
302 |
{ |
|
7836
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
303 |
double pathLossDb = 0; |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
304 |
if (rxParams->txAntenna != 0) |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
305 |
{ |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
306 |
Angles txAngles (receiverMobility->GetPosition (), txMobility->GetPosition ()); |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
307 |
double txAntennaGain = rxParams->txAntenna->GetGainDb (txAngles); |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
308 |
NS_LOG_LOGIC ("txAntennaGain = " << txAntennaGain << " dB"); |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
309 |
pathLossDb -= txAntennaGain; |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
310 |
} |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
311 |
Ptr<AntennaModel> rxAntenna = (*rxPhyIterator)->GetRxAntenna (); |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
312 |
if (rxAntenna != 0) |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
313 |
{ |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
314 |
Angles rxAngles (txMobility->GetPosition (), receiverMobility->GetPosition ()); |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
315 |
double rxAntennaGain = rxAntenna->GetGainDb (rxAngles); |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
316 |
NS_LOG_LOGIC ("rxAntennaGain = " << rxAntennaGain << " dB"); |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
317 |
pathLossDb -= rxAntennaGain; |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
318 |
} |
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
319 |
if (m_propagationLoss) |
6349 | 320 |
{ |
7836
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
321 |
double propagationGainDb = m_propagationLoss->CalcRxPower (0, txMobility, receiverMobility); |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
322 |
NS_LOG_LOGIC ("propagationGainDb = " << propagationGainDb << " dB"); |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
323 |
pathLossDb -= propagationGainDb; |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
324 |
} |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
325 |
NS_LOG_LOGIC ("total pathLoss = " << pathLossDb << " dB"); |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
326 |
m_pathLossTrace (txParams->txPhy, *rxPhyIterator, pathLossDb); |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
327 |
if ( pathLossDb > m_maxLossDb) |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
328 |
{ |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
329 |
// beyond range |
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
330 |
continue; |
6349 | 331 |
} |
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
8591
diff
changeset
|
332 |
double pathGainLinear = std::pow (10.0, (-pathLossDb) / 10.0); |
7836
9cf68ee51869
integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents:
7581
diff
changeset
|
333 |
*(rxParams->psd) *= pathGainLinear; |
6349 | 334 |
|
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
335 |
if (m_spectrumPropagationLoss) |
6349 | 336 |
{ |
7581 | 337 |
rxParams->psd = m_spectrumPropagationLoss->CalcRxPowerSpectralDensity (rxParams->psd, txMobility, receiverMobility); |
6349 | 338 |
} |
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
339 |
|
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
340 |
if (m_propagationDelay) |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
341 |
{ |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
342 |
delay = m_propagationDelay->GetDelay (txMobility, receiverMobility); |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
343 |
} |
6349 | 344 |
} |
345 |
||
7553
2b93d333dea6
Bug 1271 - stronger type checking in SpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents:
7385
diff
changeset
|
346 |
Ptr<NetDevice> netDev = (*rxPhyIterator)->GetDevice (); |
2b93d333dea6
Bug 1271 - stronger type checking in SpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents:
7385
diff
changeset
|
347 |
if (netDev) |
6349 | 348 |
{ |
349 |
// the receiver has a NetDevice, so we expect that it is attached to a Node |
|
7553
2b93d333dea6
Bug 1271 - stronger type checking in SpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents:
7385
diff
changeset
|
350 |
uint32_t dstNode = netDev->GetNode ()->GetId (); |
6349 | 351 |
Simulator::ScheduleWithContext (dstNode, delay, &MultiModelSpectrumChannel::StartRx, this, |
7581 | 352 |
rxParams, *rxPhyIterator); |
6349 | 353 |
} |
354 |
else |
|
355 |
{ |
|
356 |
// the receiver is not attached to a NetDevice, so we cannot assume that it is attached to a node |
|
357 |
Simulator::Schedule (delay, &MultiModelSpectrumChannel::StartRx, this, |
|
7581 | 358 |
rxParams, *rxPhyIterator); |
6349 | 359 |
} |
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6986
diff
changeset
|
360 |
} |
6349 | 361 |
} |
362 |
||
363 |
} |
|
364 |
||
365 |
} |
|
366 |
||
367 |
void |
|
7581 | 368 |
MultiModelSpectrumChannel::StartRx (Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver) |
6349 | 369 |
{ |
370 |
NS_LOG_FUNCTION (this); |
|
7581 | 371 |
receiver->StartRx (params); |
6349 | 372 |
} |
373 |
||
374 |
||
375 |
||
376 |
uint32_t |
|
377 |
MultiModelSpectrumChannel::GetNDevices (void) const |
|
378 |
{ |
|
9113
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
379 |
return m_numDevices; |
6349 | 380 |
|
381 |
} |
|
382 |
||
383 |
||
384 |
Ptr<NetDevice> |
|
385 |
MultiModelSpectrumChannel::GetDevice (uint32_t i) const |
|
386 |
{ |
|
9113
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
387 |
NS_ASSERT (i < m_numDevices); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
388 |
// this method implementation is computationally intensive. This |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
389 |
// method would be faster if we actually used a std::vector for |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
390 |
// storing devices, which we don't due to the need to have fast |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
391 |
// SpectrumModel conversions and to allow PHY devices to changea |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
392 |
// SpectrumModel at run time. Note that having this method slow is |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
393 |
// acceptable as it is not used much at run time (often not at all). |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
394 |
// On the other hand, having slow SpectrumModel conversion would be |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
395 |
// less acceptable. |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
396 |
uint32_t j = 0; |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
397 |
for (RxSpectrumModelInfoMap_t::const_iterator rxInfoIterator = m_rxSpectrumModelInfoMap.begin (); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
398 |
rxInfoIterator != m_rxSpectrumModelInfoMap.end (); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
399 |
++rxInfoIterator) |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
400 |
{ |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
401 |
for (std::set<Ptr<SpectrumPhy> >::const_iterator phyIt = rxInfoIterator->second.m_rxPhySet.begin (); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
402 |
phyIt != rxInfoIterator->second.m_rxPhySet.end (); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
403 |
++phyIt) |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
404 |
{ |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
405 |
if (j == i) |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
406 |
{ |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
407 |
return (*phyIt)->GetDevice (); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
408 |
} |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
409 |
} |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
410 |
} |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
411 |
NS_FATAL_ERROR ("m_numDevice > actual number of devices"); |
63eba52498e1
make MultiModelSpectrumChannel support SpectrumModel changes at run time
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
412 |
return 0; |
6349 | 413 |
} |
414 |
||
415 |
||
416 |
||
417 |
void |
|
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
418 |
MultiModelSpectrumChannel::AddPropagationLossModel (Ptr<PropagationLossModel> loss) |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
419 |
{ |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
420 |
NS_LOG_FUNCTION (this << loss); |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
421 |
NS_ASSERT (m_propagationLoss == 0); |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
422 |
m_propagationLoss = loss; |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
423 |
} |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
424 |
|
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
425 |
void |
6349 | 426 |
MultiModelSpectrumChannel::AddSpectrumPropagationLossModel (Ptr<SpectrumPropagationLossModel> loss) |
427 |
{ |
|
7565
b62db8c69d56
fixed assertion in {Single,Multi}ModelSpectrumChannel::AddSpectrumPropagationLossModel
Nicola Baldo <nbaldo@cttc.es>
parents:
7554
diff
changeset
|
428 |
NS_ASSERT (m_spectrumPropagationLoss == 0); |
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
429 |
m_spectrumPropagationLoss = loss; |
6349 | 430 |
} |
431 |
||
432 |
void |
|
433 |
MultiModelSpectrumChannel::SetPropagationDelayModel (Ptr<PropagationDelayModel> delay) |
|
434 |
{ |
|
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
435 |
NS_ASSERT (m_propagationDelay == 0); |
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
436 |
m_propagationDelay = delay; |
6349 | 437 |
} |
438 |
||
6704
de8a506b7437
LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
6350
diff
changeset
|
439 |
Ptr<SpectrumPropagationLossModel> |
de8a506b7437
LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
6350
diff
changeset
|
440 |
MultiModelSpectrumChannel::GetSpectrumPropagationLossModel (void) |
de8a506b7437
LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
6350
diff
changeset
|
441 |
{ |
de8a506b7437
LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
6350
diff
changeset
|
442 |
NS_LOG_FUNCTION (this); |
7343
b3e668a5949c
added support for single-freq PropagationLossModel to SpectrumChannel
Nicola Baldo <nbaldo@cttc.es>
parents:
7142
diff
changeset
|
443 |
return m_spectrumPropagationLoss; |
6704
de8a506b7437
LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
6350
diff
changeset
|
444 |
} |
de8a506b7437
LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
6350
diff
changeset
|
445 |
|
6349 | 446 |
|
447 |
} // namespace ns3 |