11#include "ns3/nstime.h"
25 auto it = pdp.
m_taps.begin();
26 for (; it != pdp.
m_taps.end(); it++)
28 os << (*it).GetAmp() <<
'|';
46 is >> resolution >> c1;
54 std::complex<double> amp;
55 pdp.
m_taps = std::vector<Tap>(ntaps);
56 for (
uint32_t i = 0; i < ntaps && !is.eof(); i++)
99 m_resolution(resolution)
104 : m_resolution(resolution)
106 m_taps.resize(amps.size());
108 for (
uint32_t index = 0; index < amps.size(); index++)
110 m_taps[index] =
Tap(arrTime, amps[index]);
116 : m_resolution(resolution)
118 m_taps.resize(amps.size());
120 for (
uint32_t index = 0; index < amps.size(); index++)
122 m_taps[index] =
Tap(arrTime, amps[index]);
135 if (
m_taps.size() <= index)
193 "Attempted to sum taps over time interval in "
194 "UanPdp with resolution 0 and multiple taps");
198 return m_taps[0].GetAmp();
200 return std::complex<double>(0.0, 0.0);
209 if (std::abs(
m_taps[i].GetAmp()) > maxAmp)
211 maxAmp = std::abs(
m_taps[i].GetAmp());
217 std::complex<double> sum = 0;
218 for (
uint32_t i = start; i < end; i++)
220 sum +=
m_taps[i].GetAmp();
231 "Attempted to sum taps over time interval in "
232 "UanPdp with resolution 0 and multiple taps");
236 return std::abs(
m_taps[0].GetAmp());
247 if (std::abs(
m_taps[i].GetAmp()) > maxAmp)
249 maxAmp = std::abs(
m_taps[i].GetAmp());
257 for (
uint32_t i = start; i < end; i++)
260 sum += std::abs(
m_taps[i].GetAmp());
271 "Attempted to sum taps over time interval in "
272 "UanPdp with resolution 0 and multiple taps");
276 return std::abs(
m_taps[0].GetAmp());
287 endIndex = std::min(endIndex,
GetNTaps());
289 for (
uint32_t i = stIndex; i < endIndex; i++)
291 sum += std::abs(
m_taps[i].GetAmp());
302 "Attempted to sum taps over time interval in "
303 "UanPdp with resolution 0 and multiple taps");
307 return m_taps[0].GetAmp();
311 return std::complex<double>(0.0);
318 endIndex = std::min(endIndex,
GetNTaps());
320 std::complex<double> sum = 0;
321 for (
uint32_t i = stIndex; i < endIndex; i++)
323 sum +=
m_taps[i].GetAmp();
332 std::vector<Tap> newTaps;
336 sumNc += std::abs(
m_taps[i].GetAmp());
341 newTaps.emplace_back(
m_taps[i].GetDelay(), (
m_taps[i].GetAmp() / sumNc));
A base class which provides memory management and object aggregation.
virtual void DoDispose()
Destructor implementation.
Holds PDP Tap information (amplitude and delay)
Time m_delay
The time delay.
std::complex< double > GetAmp() const
Get the complex amplitude of arrival.
Tap()
Default constructor.
Time GetDelay() const
Get the delay time, usually from first arrival of signal.
std::complex< double > m_amplitude
The amplitude.
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
bool IsZero() const
Exactly equivalent to t == 0.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
The power delay profile returned by propagation models.
static UanPdp CreateImpulsePdp()
Get a unit impulse PDP at time 0.
Iterator GetEnd() const
Get the end of the tap list (one beyond the last entry).
void SetResolution(Time resolution)
Set the time duration (resolution) between arrivals.
UanPdp NormalizeToSumNc() const
Creates a new UanPdp normalized to its non coherent sum.
void SetTap(std::complex< double > arrival, uint32_t index)
Set the arrival value for a tap.
std::vector< Tap > m_taps
The vector of Taps.
double SumTapsFromMaxNc(Time delay, Time duration) const
Compute the non-coherent sum of tap amplitudes starting after a delay from the maximum amplitude for ...
std::vector< Tap >::const_iterator Iterator
Convenience iterator typedef.
void SetNTaps(uint32_t nTaps)
Resize the tap vector.
Time GetResolution() const
Get the delay time resolution (time duration between arrivals).
UanPdp()
Create empty PDP object.
double SumTapsNc(Time begin, Time end) const
Compute the non-coherent sum of tap amplitudes between a start and end time.
Time m_resolution
The time resolution.
uint32_t GetNTaps() const
Get the number of taps.
const Tap & GetTap(uint32_t i) const
Get the Tap at the specified delay index.
Iterator GetBegin() const
Get the beginning of the tap vector.
std::complex< double > SumTapsC(Time begin, Time end) const
Compute the coherent sum of tap amplitudes between a start and end time.
std::complex< double > SumTapsFromMaxC(Time delay, Time duration) const
Compute the coherent sum of tap amplitudes starting after a delay from the maximum amplitude for a to...
~UanPdp()
Dummy destructor, see DoDispose.
Base class for implemented underwater propagation models.
virtual void Clear()
Clear all pointer references.
static TypeId GetTypeId()
Register this type.
void DoDispose() override
Destructor implementation.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
std::istream & operator>>(std::istream &is, Angles &a)