22 #include "ns3/nstime.h"
36 auto it = pdp.
m_taps.begin();
37 for (; it != pdp.
m_taps.end(); it++)
39 os << (*it).GetAmp() <<
'|';
57 is >> resolution >> c1;
65 std::complex<double> amp;
66 pdp.
m_taps = std::vector<Tap>(ntaps);
67 for (uint32_t i = 0; i < ntaps && !is.eof(); i++)
110 m_resolution(resolution)
115 : m_resolution(resolution)
117 m_taps.resize(amps.size());
119 for (uint32_t index = 0; index < amps.size(); index++)
121 m_taps[index] =
Tap(arrTime, amps[index]);
127 : m_resolution(resolution)
129 m_taps.resize(amps.size());
131 for (uint32_t index = 0; index < amps.size(); index++)
133 m_taps[index] =
Tap(arrTime, amps[index]);
146 if (
m_taps.size() <= index)
189 return static_cast<uint32_t
>(
m_taps.size());
204 "Attempted to sum taps over time interval in "
205 "UanPdp with resolution 0 and multiple taps");
209 return m_taps[0].GetAmp();
211 return std::complex<double>(0.0, 0.0);
214 uint32_t numTaps = (duration /
m_resolution + 0.5).GetHigh();
216 uint32_t maxTapIndex = 0;
218 for (uint32_t i = 0; i <
GetNTaps(); i++)
220 if (std::abs(
m_taps[i].GetAmp()) > maxAmp)
222 maxAmp = std::abs(
m_taps[i].GetAmp());
228 std::complex<double> sum = 0;
229 for (uint32_t i =
start; i < end; i++)
231 sum +=
m_taps[i].GetAmp();
242 "Attempted to sum taps over time interval in "
243 "UanPdp with resolution 0 and multiple taps");
247 return std::abs(
m_taps[0].GetAmp());
252 uint32_t numTaps = (duration /
m_resolution + 0.5).GetHigh();
254 uint32_t maxTapIndex = 0;
256 for (uint32_t i = 0; i <
GetNTaps(); i++)
258 if (std::abs(
m_taps[i].GetAmp()) > maxAmp)
260 maxAmp = std::abs(
m_taps[i].GetAmp());
268 for (uint32_t i =
start; i < end; i++)
271 sum += std::abs(
m_taps[i].GetAmp());
282 "Attempted to sum taps over time interval in "
283 "UanPdp with resolution 0 and multiple taps");
287 return std::abs(
m_taps[0].GetAmp());
295 uint32_t stIndex = (begin /
m_resolution + 0.5).GetHigh();
296 uint32_t endIndex = (end /
m_resolution + 0.5).GetHigh();
300 for (uint32_t i = stIndex; i < endIndex; i++)
302 sum += std::abs(
m_taps[i].GetAmp());
313 "Attempted to sum taps over time interval in "
314 "UanPdp with resolution 0 and multiple taps");
318 return m_taps[0].GetAmp();
322 return std::complex<double>(0.0);
326 uint32_t stIndex = (begin /
m_resolution + 0.5).GetHigh();
327 uint32_t endIndex = (end /
m_resolution + 0.5).GetHigh();
331 std::complex<double> sum = 0;
332 for (uint32_t i = stIndex; i < endIndex; i++)
334 sum +=
m_taps[i].GetAmp();
343 std::vector<Tap> newTaps;
345 for (uint32_t i = 0; i <
GetNTaps(); i++)
347 sumNc += std::abs(
m_taps[i].GetAmp());
350 for (uint32_t i = 0; i <
GetNTaps(); i++)
352 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::istream & operator>>(std::istream &is, Angles &a)
std::ostream & operator<<(std::ostream &os, const Angles &a)