equal
deleted
inserted
replaced
211 double maxAmp = -1; |
211 double maxAmp = -1; |
212 uint32_t maxTapIndex = 0; |
212 uint32_t maxTapIndex = 0; |
213 |
213 |
214 for (uint32_t i = 0; i < GetNTaps (); i++) |
214 for (uint32_t i = 0; i < GetNTaps (); i++) |
215 { |
215 { |
216 if (abs (m_taps[i].GetAmp ()) > maxAmp) |
216 if (std::abs (m_taps[i].GetAmp ()) > maxAmp) |
217 { |
217 { |
218 maxAmp = abs (m_taps[i].GetAmp ()); |
218 maxAmp = std::abs (m_taps[i].GetAmp ()); |
219 maxTapIndex = i; |
219 maxTapIndex = i; |
220 } |
220 } |
221 } |
221 } |
222 uint32_t start = maxTapIndex + static_cast<uint32_t> (delay.GetSeconds () / m_resolution.GetSeconds ()); |
222 uint32_t start = maxTapIndex + static_cast<uint32_t> (delay.GetSeconds () / m_resolution.GetSeconds ()); |
223 uint32_t end = std::min (start + numTaps, GetNTaps ()); |
223 uint32_t end = std::min (start + numTaps, GetNTaps ()); |
234 if (m_resolution <= Seconds (0)) |
234 if (m_resolution <= Seconds (0)) |
235 { |
235 { |
236 NS_ASSERT_MSG (GetNTaps () == 1, "Attempted to sum taps over time interval in " |
236 NS_ASSERT_MSG (GetNTaps () == 1, "Attempted to sum taps over time interval in " |
237 "UanPdp with resolution 0 and multiple taps"); |
237 "UanPdp with resolution 0 and multiple taps"); |
238 |
238 |
239 return abs (m_taps[0].GetAmp ()); |
239 return std::abs (m_taps[0].GetAmp ()); |
240 } |
240 } |
241 |
241 |
242 uint32_t numTaps = static_cast<uint32_t> (duration.GetSeconds () / m_resolution.GetSeconds () + 0.5); |
242 uint32_t numTaps = static_cast<uint32_t> (duration.GetSeconds () / m_resolution.GetSeconds () + 0.5); |
243 double maxAmp = -1; |
243 double maxAmp = -1; |
244 uint32_t maxTapIndex = 0; |
244 uint32_t maxTapIndex = 0; |
245 |
245 |
246 for (uint32_t i = 0; i < GetNTaps (); i++) |
246 for (uint32_t i = 0; i < GetNTaps (); i++) |
247 { |
247 { |
248 if (abs (m_taps[i].GetAmp ()) > maxAmp) |
248 if (std::abs (m_taps[i].GetAmp ()) > maxAmp) |
249 { |
249 { |
250 maxAmp = abs (m_taps[i].GetAmp ()); |
250 maxAmp = std::abs (m_taps[i].GetAmp ()); |
251 maxTapIndex = i; |
251 maxTapIndex = i; |
252 } |
252 } |
253 } |
253 } |
254 |
254 |
255 |
255 |
257 uint32_t end = std::min (start + numTaps, GetNTaps ()); |
257 uint32_t end = std::min (start + numTaps, GetNTaps ()); |
258 double sum = 0; |
258 double sum = 0; |
259 for (uint32_t i = start; i < end; i++) |
259 for (uint32_t i = start; i < end; i++) |
260 |
260 |
261 { |
261 { |
262 sum += abs (m_taps[i].GetAmp ()); |
262 sum += std::abs (m_taps[i].GetAmp ()); |
263 } |
263 } |
264 return sum; |
264 return sum; |
265 } |
265 } |
266 double |
266 double |
267 UanPdp::SumTapsNc (Time begin, Time end) const |
267 UanPdp::SumTapsNc (Time begin, Time end) const |
271 NS_ASSERT_MSG (GetNTaps () == 1, "Attempted to sum taps over time interval in " |
271 NS_ASSERT_MSG (GetNTaps () == 1, "Attempted to sum taps over time interval in " |
272 "UanPdp with resolution 0 and multiple taps"); |
272 "UanPdp with resolution 0 and multiple taps"); |
273 |
273 |
274 if (begin <= Seconds (0.0) && end >= Seconds (0.0)) |
274 if (begin <= Seconds (0.0) && end >= Seconds (0.0)) |
275 { |
275 { |
276 return abs (m_taps[0].GetAmp ()); |
276 return std::abs (m_taps[0].GetAmp ()); |
277 } |
277 } |
278 else |
278 else |
279 { |
279 { |
280 return 0.0; |
280 return 0.0; |
281 } |
281 } |
286 |
286 |
287 endIndex = std::min (endIndex, GetNTaps ()); |
287 endIndex = std::min (endIndex, GetNTaps ()); |
288 double sum = 0; |
288 double sum = 0; |
289 for (uint32_t i = stIndex; i < endIndex; i++) |
289 for (uint32_t i = stIndex; i < endIndex; i++) |
290 { |
290 { |
291 sum += abs (m_taps[i].GetAmp ()); |
291 sum += std::abs (m_taps[i].GetAmp ()); |
292 } |
292 } |
293 return sum; |
293 return sum; |
294 |
294 |
295 } |
295 } |
296 |
296 |