|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #include "ns3/nstime.h"
36 for (; it != pdp.
m_taps.end (); it++)
38 os << (*it).GetAmp () <<
'|';
56 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++)
115 m_resolution (resolution)
120 : m_resolution (resolution)
122 m_taps.resize (amps.size ());
124 for (uint32_t index = 0; index < amps.size (); index++)
126 m_taps[index] =
Tap (arrTime, amps[index]);
132 : m_resolution (resolution)
134 m_taps.resize (amps.size ());
136 for (uint32_t index = 0; index < amps.size (); index++)
138 m_taps[index] =
Tap (arrTime, amps[index]);
151 if (
m_taps.size () <= index)
153 m_taps.resize (index + 1);
190 return static_cast<uint32_t
> (
m_taps.size ());
205 "UanPdp with resolution 0 and multiple taps");
208 return std::complex<double> (0.0, 0.0);
211 uint32_t numTaps = (duration /
m_resolution + 0.5).GetHigh ();
213 uint32_t maxTapIndex = 0;
215 for (uint32_t i = 0; i <
GetNTaps (); i++)
217 if (std::abs (
m_taps[i].GetAmp ()) > maxAmp)
219 maxAmp = std::abs (
m_taps[i].GetAmp ());
225 std::complex<double> sum = 0;
226 for (uint32_t i =
start; i < end; i++)
228 sum +=
m_taps[i].GetAmp ();
238 "UanPdp with resolution 0 and multiple taps");
240 if (delay.
IsZero ())
return std::abs (
m_taps[0].GetAmp ());
244 uint32_t numTaps = (duration /
m_resolution + 0.5).GetHigh ();
246 uint32_t maxTapIndex = 0;
248 for (uint32_t i = 0; i <
GetNTaps (); i++)
250 if (std::abs (
m_taps[i].GetAmp ()) > maxAmp)
252 maxAmp = std::abs (
m_taps[i].GetAmp ());
261 for (uint32_t i =
start; i < end; i++)
264 sum += std::abs (
m_taps[i].GetAmp ());
274 "UanPdp with resolution 0 and multiple taps");
278 return std::abs (
m_taps[0].GetAmp ());
286 uint32_t stIndex = (begin /
m_resolution + 0.5).GetHigh ();
287 uint32_t endIndex = (end /
m_resolution + 0.5).GetHigh ();
291 for (uint32_t i = stIndex; i < endIndex; i++)
293 sum += std::abs (
m_taps[i].GetAmp ());
307 "UanPdp with resolution 0 and multiple taps");
311 return m_taps[0].GetAmp ();
315 return std::complex<double> (0.0);
319 uint32_t stIndex = (begin /
m_resolution + 0.5).GetHigh ();
320 uint32_t endIndex = (end /
m_resolution + 0.5).GetHigh ();
324 std::complex<double> sum = 0;
325 for (uint32_t i = stIndex; i < endIndex; i++)
327 sum +=
m_taps[i].GetAmp ();
336 std::vector<Tap> newTaps;
338 for (uint32_t i = 0; i <
GetNTaps (); i++)
340 sumNc += std::abs (
m_taps[i].GetAmp ());
343 for (uint32_t i = 0; i <
GetNTaps (); i++)
345 newTaps.push_back (
Tap (
m_taps[i].GetDelay (), (
m_taps[i].GetAmp () / sumNc)));
366 .SetGroupName (
"Uan")
Iterator GetEnd(void) const
Get the end of the tap list (one beyond the last entry).
a unique identifier for an interface.
double SumTapsFromMaxNc(Time delay, Time duration) const
Compute the non-coherent sum of tap amplitudes starting after a delay from the maximum amplitude for ...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
UanPdp()
Create empty PDP object.
Tap()
Default constructor.
The power delay profile returned by propagation models.
void SetTap(std::complex< double > arrival, uint32_t index)
Set the arrival value for a tap.
Time m_delay
The time delay.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetNTaps(uint32_t nTaps)
Resize the tap vector.
std::vector< Tap >::const_iterator Iterator
Convenience iterator typedef.
virtual void DoDispose(void)
Destructor implementation.
Iterator GetBegin(void) const
Get the beginning of the tap vector.
void SetResolution(Time resolution)
Set the time duration (resolution) between arrivals.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
std::complex< double > SumTapsC(Time begin, Time end) const
Compute the coherent sum of tap amplitudes between a start and end time.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
std::vector< Tap > m_taps
The vector of Taps.
double SumTapsNc(Time begin, Time end) const
Compute the non-coherent sum of tap amplitudes between a start and end time.
const Tap & GetTap(uint32_t i) const
Get the Tap at the specified delay index.
A base class which provides memory management and object aggregation.
bool IsZero(void) const
Exactly equivalent to t == 0.
Holds PDP Tap information (amplitude and delay)
static UanPdp CreateImpulsePdp(void)
Get a unit impulse PDP at time 0.
UanPdp NormalizeToSumNc(void) const
Creates a new UanPdp normalized to its non coherent sum.
Simulation virtual time values and global simulation resolution.
std::complex< double > GetAmp(void) const
Get the complex amplitude of arrival.
static TypeId GetTypeId(void)
Register this type.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
virtual void Clear(void)
Clear all pointer references.
Time GetDelay(void) const
Get the delay time, usually from first arrival of signal.
uint32_t GetNTaps(void) const
Get the number of taps.
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...
Time Seconds(double value)
Construct a Time in the indicated unit.
Base class for implemented underwater propagation models.
Time GetResolution(void) const
Get the delay time resolution (time duration between arrivals).
~UanPdp()
Dummy destructor, see DoDispose.
std::complex< double > m_amplitude
The amplitude.
Time m_resolution
The time resolution.
std::ostream & operator<<(std::ostream &os, const Angles &a)
virtual void DoDispose(void)
Destructor implementation.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
std::istream & operator>>(std::istream &is, Angles &a)