LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2009 University of Washington | 3 * Copyright (c) 2009 University of Washington |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #include <vector> | 29 #include <vector> |
30 #include <complex> | 30 #include <complex> |
31 #include <utility> | 31 #include <utility> |
32 | 32 |
33 namespace ns3 { | 33 namespace ns3 { |
34 | 34 |
35 class UanTxMode; | 35 class UanTxMode; |
36 | 36 |
37 /** | 37 /** |
38 * \class Tap | 38 * \ingroup uan |
39 * \brief Holds PDP Tap information (amplitude and delay) | 39 * |
| 40 * Holds PDP Tap information (amplitude and delay) |
40 */ | 41 */ |
41 class Tap | 42 class Tap |
42 { | 43 { |
43 public: | 44 public: |
44 /** | 45 /** |
45 * Default constructor. Creates Tap with delay=0, amp=0 | 46 * Default constructor. Creates Tap with delay=0, amp=0 |
46 */ | 47 */ |
47 Tap (); | 48 Tap (); |
48 /** | 49 /** |
| 50 * Constructor |
| 51 * |
49 * \param delay Time delay (usually from first arrival) of signal | 52 * \param delay Time delay (usually from first arrival) of signal |
50 * \param amp Complex amplitude of arrival | 53 * \param amp Complex amplitude of arrival |
51 */ | 54 */ |
52 Tap (Time delay, std::complex<double> amp); | 55 Tap (Time delay, std::complex<double> amp); |
53 /** | 56 /** |
54 * \returns Complex amplitude of arrival | 57 * Get the complex amplitude of arrival. |
| 58 * |
| 59 * \return The amplitude. |
55 */ | 60 */ |
56 std::complex<double> GetAmp (void) const; | 61 std::complex<double> GetAmp (void) const; |
57 /** | 62 /** |
58 * \returns Time delay (usually from first arrival) of signal | 63 * Get the delay time, usually from first arrival of signal. |
| 64 * \return The time delay. |
59 */ | 65 */ |
60 Time GetDelay (void) const; | 66 Time GetDelay (void) const; |
61 | 67 |
62 private: | 68 private: |
63 std::complex<double> m_amplitude; | 69 std::complex<double> m_amplitude; //!< The amplitude. |
64 Time m_delay; | 70 Time m_delay; //!< The time delay. |
65 }; | 71 |
66 | 72 }; // class Tap |
67 /** | 73 |
68 * \class UanPdp | 74 ·· |
| 75 /** |
| 76 * \ingroup uan |
| 77 * |
| 78 * The power delay profile returned by propagation models. |
69 * | 79 * |
70 * Container class to describe power delay profile returned | 80 * Container class to describe power delay profile returned |
71 * from UAN propagation models using tapped delay line model. | 81 * from UAN propagation models using tapped delay line model. |
72 * This should model a channel impulse response as a set of | 82 * This should model a channel impulse response as a set of |
73 * equally spaced signal arrivals. | 83 * equally spaced signal arrivals. |
74 * | 84 * |
75 * Generally, the profile should be normalized, such that | 85 * Generally, the profile should be normalized, such that |
76 * the sum of all taps should equal 1. The received signal | 86 * the sum of all taps should equal 1. The received signal |
77 * power on any interval (t1, t2) can then be found from | 87 * power on any interval (t1, t2) can then be found from |
78 * summing the taps on the interval and multiplying by | 88 * summing the taps on the interval and multiplying by |
79 * the total received power at the receiver. | 89 * the total received power at the receiver. |
80 * | |
81 * | |
82 */ | 90 */ |
83 class UanPdp | 91 class UanPdp |
84 { | 92 { |
85 public: | 93 public: |
86 /** | 94 /** |
87 * \brief Iterator is a standard template library constant interator | 95 * Convenience iterator typedef. |
88 */ | 96 */ |
89 typedef std::vector<Tap>::const_iterator Iterator; | 97 typedef std::vector<Tap>::const_iterator Iterator; |
90 /** | 98 /** |
91 * \brief Create empty PDP object | 99 * Create empty PDP object. |
92 */ | 100 */ |
93 UanPdp (); | 101 UanPdp (); |
94 /** | 102 /** |
95 * \brief Create PDP object from a vector of Tap objects | 103 * Create PDP object from a vector of Tap objects. |
96 * \param taps Taps to include in this PDP | 104 * |
97 * \param resolution Resolution of PDP object | 105 * \param taps Taps to include in this PDP. |
| 106 * \param resolution Resolution of PDP object. |
98 */ | 107 */ |
99 UanPdp (std::vector<Tap> taps, Time resolution); | 108 UanPdp (std::vector<Tap> taps, Time resolution); |
100 /** | 109 /** |
101 * \brief Create PDP object from vector of arrival amplitudes | 110 * Create PDP object from vector of arrival amplitudes. |
102 * \param arrivals Vector of complex amplitude arrivals | 111 * |
103 * \param resolution Time duration between arrivals in vector | 112 * \param arrivals Vector of complex amplitude arrivals. |
| 113 * \param resolution Time duration between arrivals in vector. |
104 */ | 114 */ |
105 UanPdp (std::vector<std::complex<double > > arrivals, Time resolution); | 115 UanPdp (std::vector<std::complex<double > > arrivals, Time resolution); |
106 /** | 116 /** |
107 * \brief Create PDP object from real valued arrival amplitudes | 117 * Create PDP object from real valued arrival amplitudes. |
108 * \param arrivals vector of real valued arrivals | 118 * |
109 * \param resolution Time duration between arrivals in vector | 119 * \param arrivals Vector of real valued arrivals. |
| 120 * \param resolution Time duration between arrivals in vector. |
110 */ | 121 */ |
111 UanPdp (std::vector<double> arrivals, Time resolution); | 122 UanPdp (std::vector<double> arrivals, Time resolution); |
| 123 /** Dummy destructor, see DoDispose. */ |
112 ~UanPdp (); | 124 ~UanPdp (); |
113 | 125 |
114 /** | 126 /** |
115 * \param arrival complex arrival value | 127 * Set the arrival value for a tap. |
116 * \param index index of arrival | 128 * |
| 129 * The delay time is the index multiplied by the resolution. |
| 130 * The tap vector will be expanded to accomadate the requested |
| 131 * index. |
| 132 * |
| 133 * \param arrival Complex arrival value. |
| 134 * \param index Index of arrival. |
117 */ | 135 */ |
118 void SetTap (std::complex<double> arrival, uint32_t index); | 136 void SetTap (std::complex<double> arrival, uint32_t index); |
119 /** | 137 /** |
120 * \param nTaps number of taps in this PDP | 138 * Resize the tap vector. |
| 139 * |
| 140 * \param nTaps Number of taps in this PDP |
121 */ | 141 */ |
122 void SetNTaps (uint32_t nTaps); | 142 void SetNTaps (uint32_t nTaps); |
123 /** | 143 /** |
124 * \param resolution Resolution of PDP (time between arrivals) | 144 * Set the time duration (resolution) between arrivals. |
| 145 * |
| 146 * \param resolution The resolution. |
125 */ | 147 */ |
126 void SetResolution (Time resolution); | 148 void SetResolution (Time resolution); |
127 /** | 149 /** |
128 * \returns Iterator positioned at first arrival | 150 * Get the beginning of the tap vector. |
| 151 * |
| 152 * \return Iterator positioned at first arrival. |
129 */ | 153 */ |
130 Iterator GetBegin (void) const; | 154 Iterator GetBegin (void) const; |
131 /** | 155 /** |
132 * \returns Iterator positioned after last arrival | 156 * Get the end of the tap list (one beyond the last entry). |
| 157 * |
| 158 * \return Iterator positioned after last arrival |
133 */ | 159 */ |
134 Iterator GetEnd (void) const; | 160 Iterator GetEnd (void) const; |
135 /** | 161 /** |
136 * \returns Number of taps in PDP | 162 * Get the number of taps. |
| 163 * |
| 164 * \return Number of taps in PDP. |
137 */ | 165 */ |
138 uint32_t GetNTaps (void) const; | 166 uint32_t GetNTaps (void) const; |
139 /** | 167 /** |
140 * \returns Tap object at index i | 168 * Get the Tap at the specified delay index. |
141 * \param i Index number of tap to return (0 based) | 169 * |
| 170 * \param i Index number of tap to return (0 based). |
| 171 * \return Tap object at index i. |
142 */ | 172 */ |
143 const Tap &GetTap (uint32_t i) const; | 173 const Tap &GetTap (uint32_t i) const; |
144 /** | 174 /** |
145 * \returns Resolution of PDP (time duration between arrivals) | 175 * Get the delay time resolution (time duration between arrivals). |
| 176 *· |
| 177 * \return Resolution of PDP. |
146 */ | 178 */ |
147 Time GetResolution (void) const; | 179 Time GetResolution (void) const; |
148 /** | 180 /** |
149 * \param begin Time value to begin summing arrivals | 181 * Compute the non-coherent sum of tap amplitudes |
150 * \param end Time value to end summing arrivals | 182 * between a start and end time. |
151 * \returns Returns Non-coherent sum of arrivals between two time values | |
152 * | 183 * |
153 * Assuming that Tap at index 0 arrives at time 0, | 184 * Assuming that Tap at index 0 arrives at time 0, |
154 * this function sums non-coherently (sums amplitude of arrivals | 185 * this function sums non-coherently (sums amplitude of arrivals |
155 * ignoring phase difference) all arrivals between a start | 186 * ignoring phase difference) all arrivals between a start |
156 * and end time. | 187 * and end time. |
| 188 * |
| 189 * \param begin Time value to begin summing arrivals. |
| 190 * \param end Time value to end summing arrivals. |
| 191 * \return Non-coherent sum of arrivals between two time values. |
157 */ | 192 */ |
158 double SumTapsNc (Time begin, Time end) const; | 193 double SumTapsNc (Time begin, Time end) const; |
159 /** | 194 /** |
160 * \param begin Time value to begin summing arrivals | 195 * Compute the coherent sum of tap amplitudes |
161 * \param end Time value to end summing arrivals | 196 * between a start and end time. |
162 * \returns Returns coherent sum of arrivals between two time values | |
163 * | 197 * |
164 * Assuming that Tap at index 0 arrives at time 0, | 198 * Assuming that Tap at index 0 arrives at time 0, |
165 * this function sums coherently (sums amplitude of arrivals | 199 * this function sums coherently (sums amplitude of arrivals |
166 * considering phase difference) all arrivals between a start | 200 * considering phase difference) all arrivals between a start |
167 * and end time. | 201 * and end time. |
| 202 * |
| 203 * \param begin Time value to begin summing arrivals. |
| 204 * \param end Time value to end summing arrivals. |
| 205 * \return Coherent sum of arrivals between two time values. |
168 */ | 206 */ |
169 std::complex<double> SumTapsC (Time begin, Time end) const; | 207 std::complex<double> SumTapsC (Time begin, Time end) const; |
170 /** | 208 /** |
171 * \param delay Time duratation after max to begin summing arrivals | 209 * Compute the non-coherent sum of tap amplitudes |
172 * \param duration Time duration to sum arrivals for | 210 * starting after a delay from the maximum amplitude |
173 * \returns non-coherent sum of arrivals after max in given window | 211 * for a total time duration. |
174 * | 212 * |
175 * this function sums non-coherently (sums amplitude of arrivals | 213 * This function sums non-coherently (sums amplitude of arrivals |
176 * ignoring phase difference) all arrivals in a given duration | 214 * ignoring phase difference) all arrivals in a given duration |
177 * starting the given time after the maximum amplitude arrival received | 215 * starting the given time after the maximum amplitude arrival received. |
| 216 * |
| 217 * \param delay Time duratation after max to begin summing arrivals. |
| 218 * \param duration Time duration to sum arrivals for. |
| 219 * \return Non-coherent sum of arrivals after max in given window. |
178 */ | 220 */ |
179 double SumTapsFromMaxNc (Time delay, Time duration) const; | 221 double SumTapsFromMaxNc (Time delay, Time duration) const; |
180 /** | 222 /** |
181 * \param delay Time duratation after max to begin summing arrivals | 223 * Compute the coherent sum of tap amplitudes |
182 * \param duration Time duration to sum arrivals for | 224 * starting after a delay from the maximum amplitude |
183 * \returns coherent sum of arrivals after max in given window | 225 * for a total duration. |
184 * | 226 * |
185 * this function sums coherently (sums amplitude of arrivals | 227 * this function sums coherently (sums amplitude of arrivals |
186 * considering phase difference) all arrivals in a given duration | 228 * considering phase difference) all arrivals in a given duration |
187 * starting the given time after the maximum amplitude arrival received | 229 * starting the given time after the maximum amplitude arrival received |
| 230 * |
| 231 * \param delay Time duratation after max to begin summing arrivals. |
| 232 * \param duration Time duration to sum arrivals for. |
| 233 * \return Coherent sum of arrivals after max in given window. |
188 */ | 234 */ |
189 std::complex<double> SumTapsFromMaxC (Time delay, Time duration) const; | 235 std::complex<double> SumTapsFromMaxC (Time delay, Time duration) const; |
190 | 236 |
191 /** | 237 /** |
192 * Creates a normalized PDP to its non coherent sum | 238 * Creates a new UanPdp normalized to its non coherent sum. |
| 239 * \see SumTapsNc |
193 * \returns the new PDP | 240 * \returns the new PDP |
194 */ | 241 */ |
195 UanPdp NormalizeToSumNc (void); | 242 UanPdp NormalizeToSumNc (void); |
196 ·· | 243 |
197 /** | 244 /** |
198 * \returns A PDP with a singlue unit impulse arrival at time 0 | 245 * Get a unit impulse PDP at time 0. |
| 246 * |
| 247 * \return The unit impulse. |
199 */· | 248 */· |
200 static UanPdp CreateImpulsePdp (void); | 249 static UanPdp CreateImpulsePdp (void); |
| 250 ·· |
201 private: | 251 private: |
202 friend std::ostream &operator<< (std::ostream &os, UanPdp &pdp); | 252 friend std::ostream &operator<< (std::ostream &os, const UanPdp &pdp); |
203 friend std::istream &operator>> (std::istream &is, UanPdp &pdp); | 253 friend std::istream &operator>> (std::istream &is, UanPdp &pdp); |
204 std::vector<Tap> m_taps; | 254 ·· |
205 Time m_resolution; | 255 std::vector<Tap> m_taps; //!< The vector of Taps. |
206 | 256 Time m_resolution; //!< The time resolution. |
207 }; | 257 |
208 /** | 258 }; // class UanPdp |
209 * \brief Writes PDP to stream as list of arrivals | 259 |
210 */ | 260 |
211 std::ostream &operator<< (std::ostream &os, UanPdp &pdp); | 261 /** |
212 /** | 262 * \ingroup uan |
213 * \brief Reads in list of arrivals from stream is | 263 * |
214 */ | 264 * Writes PDP to stream as list of arrivals |
215 std::istream &operator>> (std::ostream &is, UanPdp &pdp); | 265 * |
216 | 266 * \param os The output stream. |
217 /** | 267 * \param pdp The PDP. |
218 * \class UanPropModel | 268 * \return The output stream. |
| 269 */ |
| 270 std::ostream &operator<< (std::ostream &os, const UanPdp &pdp); |
| 271 /** |
| 272 * \ingroup uan |
| 273 * |
| 274 * Reads in list of arrivals from stream is |
| 275 * |
| 276 * \param is The input stream. |
| 277 * \param pdp The PDP variable to set. |
| 278 * \return The input stream. |
| 279 */ |
| 280 std::istream &operator>> (std::istream &is, UanPdp &pdp);·· |
| 281 |
| 282 ·· |
| 283 /** |
| 284 * \ingroup uan |
219 * | 285 * |
220 * Base class for implemented underwater propagation models | 286 * Base class for implemented underwater propagation models |
221 */ | 287 */ |
222 class UanPropModel : public Object | 288 class UanPropModel : public Object |
223 { | 289 { |
224 public: | 290 public: |
| 291 /** |
| 292 * Register this type. |
| 293 * \return The object TypeId. |
| 294 */ |
225 static TypeId GetTypeId (void); | 295 static TypeId GetTypeId (void); |
226 | 296 |
227 /** | 297 /** |
228 * Computes pathloss between nodes a and b. | 298 * Computes pathloss between nodes a and b. |
229 * \returns Pathloss in dB re 1 uPa | 299 * |
230 * \param a Ptr to mobility model of node a | 300 * \param a Ptr to mobility model of node a |
231 * \param b Ptr to mobility model of node b | 301 * \param b Ptr to mobility model of node b |
232 * \param txMode TX mode of transmission between a and b | 302 * \param txMode TX mode of transmission between a and b |
| 303 * \return Pathloss in dB re 1 uPa |
233 */ | 304 */ |
234 virtual double GetPathLossDb (Ptr<MobilityModel> a, Ptr<MobilityModel> b, UanT
xMode txMode) = 0; | 305 virtual double GetPathLossDb (Ptr<MobilityModel> a, Ptr<MobilityModel> b, UanT
xMode txMode) = 0; |
235 | 306 |
236 /** | 307 /** |
237 * \returns PDP for link between nodes a and b | 308 * Get the PDP for the path between two nodes. |
238 * \param a Ptr to mobility model of node a | 309 * |
239 * \param b Ptr to mobility model of node b | 310 * \param a Ptr to mobility model of node a. |
240 * \param mode TX mode of transmission from a to b | 311 * \param b Ptr to mobility model of node b. |
| 312 * \param mode TX mode of transmission from a to b. |
| 313 * \return PDP for link between nodes a and b. |
241 */ | 314 */ |
242 virtual UanPdp GetPdp (Ptr<MobilityModel> a, Ptr<MobilityModel> b, UanTxMode m
ode) = 0; | 315 virtual UanPdp GetPdp (Ptr<MobilityModel> a, Ptr<MobilityModel> b, UanTxMode m
ode) = 0; |
243 /** | 316 /** |
244 * Finds propagation delay between nodes a and b | 317 * Finds propagation delay between nodes a and b. |
245 * \param a Ptr to mobility model of node a | 318 * |
246 * \param b Ptr to mobility model of node b | 319 * \param a Ptr to mobility model of node a. |
247 * \param mode TX mode of transmission | 320 * \param b Ptr to mobility model of node b. |
248 * \returns Propagation delay | 321 * \param mode TX mode of transmission. |
| 322 * \return Propagation delay. |
249 */ | 323 */ |
250 virtual Time GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b, UanTxMode m
ode) = 0; | 324 virtual Time GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b, UanTxMode m
ode) = 0; |
251 | 325 |
252 /** | 326 /** Clear all pointer references. */ |
253 * Clears all pointer references | |
254 */ | |
255 virtual void Clear (void); | 327 virtual void Clear (void); |
256 | 328 |
257 virtual void DoDispose (void); | 329 virtual void DoDispose (void); |
258 }; | 330 |
259 | 331 }; // class UanPropModel |
260 } | 332 |
| 333 } // namespace ns3 |
261 | 334 |
262 #endif /* UAN_PROP_MODEL_H */ | 335 #endif /* UAN_PROP_MODEL_H */ |
LEFT | RIGHT |