A Discrete-Event Network Simulator
API
uan-prop-model.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 University of Washington
4  *
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
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Leonard Tracy <lentracy@gmail.com>
19  */
20 
21 #ifndef UAN_PROP_MODEL_H
22 #define UAN_PROP_MODEL_H
23 
24 #include "ns3/object.h"
25 #include "ns3/mobility-model.h"
26 #include "ns3/nstime.h"
27 
28 
29 #include <vector>
30 #include <complex>
31 #include <utility>
32 
33 namespace ns3 {
34 
35 class UanTxMode;
36 
42 class Tap
43 {
44 public:
48  Tap ();
55  Tap (Time delay, std::complex<double> amp);
61  std::complex<double> GetAmp (void) const;
66  Time GetDelay (void) const;
67 
68 private:
69  std::complex<double> m_amplitude;
71 
72 }; // class Tap
73 
74 
91 class UanPdp
92 {
93 public:
97  typedef std::vector<Tap>::const_iterator Iterator;
101  UanPdp ();
108  UanPdp (std::vector<Tap> taps, Time resolution);
115  UanPdp (std::vector<std::complex<double > > arrivals, Time resolution);
122  UanPdp (std::vector<double> arrivals, Time resolution);
124  ~UanPdp ();
125 
136  void SetTap (std::complex<double> arrival, uint32_t index);
142  void SetNTaps (uint32_t nTaps);
148  void SetResolution (Time resolution);
154  Iterator GetBegin (void) const;
160  Iterator GetEnd (void) const;
166  uint32_t GetNTaps (void) const;
173  const Tap &GetTap (uint32_t i) const;
179  Time GetResolution (void) const;
193  double SumTapsNc (Time begin, Time end) const;
207  std::complex<double> SumTapsC (Time begin, Time end) const;
221  double SumTapsFromMaxNc (Time delay, Time duration) const;
235  std::complex<double> SumTapsFromMaxC (Time delay, Time duration) const;
236 
242  UanPdp NormalizeToSumNc (void);
243 
249  static UanPdp CreateImpulsePdp (void);
250 
251 private:
252  friend std::ostream &operator<< (std::ostream &os, const UanPdp &pdp);
253  friend std::istream &operator>> (std::istream &is, UanPdp &pdp);
254 
255  std::vector<Tap> m_taps;
257 
258 }; // class UanPdp
259 
260 
270 std::ostream &operator<< (std::ostream &os, const UanPdp &pdp);
280 std::istream &operator>> (std::istream &is, UanPdp &pdp);
281 
282 
288 class UanPropModel : public Object
289 {
290 public:
295  static TypeId GetTypeId (void);
296 
305  virtual double GetPathLossDb (Ptr<MobilityModel> a, Ptr<MobilityModel> b, UanTxMode txMode) = 0;
306 
325 
327  virtual void Clear (void);
328 
329  virtual void DoDispose (void);
330 
331 }; // class UanPropModel
332 
333 } // namespace ns3
334 
335 #endif /* UAN_PROP_MODEL_H */
Holds PDP Tap information (amplitude and delay)
~UanPdp()
Dummy destructor, see DoDispose.
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
Definition: angles.cc:48
std::complex< double > SumTapsC(Time begin, Time end) const
Compute the coherent sum of tap amplitudes between a start and end time.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
std::vector< Tap >::const_iterator Iterator
Convenience iterator typedef.
uint32_t GetNTaps(void) const
Get the number of taps.
friend std::istream & operator>>(std::istream &is, UanPdp &pdp)
Reads in list of arrivals from stream is.
friend std::ostream & operator<<(std::ostream &os, const UanPdp &pdp)
Writes PDP to stream as list of arrivals.
static UanPdp CreateImpulsePdp(void)
Get a unit impulse PDP at time 0.
virtual void Clear(void)
Clear all pointer references.
Base class for implemented underwater propagation models.
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 ...
UanPdp NormalizeToSumNc(void)
Creates a new UanPdp normalized to its non coherent sum.
virtual UanPdp GetPdp(Ptr< MobilityModel > a, Ptr< MobilityModel > b, UanTxMode mode)=0
Get the PDP for the path between two nodes.
UanPdp()
Create empty PDP object.
void SetTap(std::complex< double > arrival, uint32_t index)
Set the arrival value for a tap.
Time m_resolution
The time resolution.
Tap()
Default constructor.
virtual Time GetDelay(Ptr< MobilityModel > a, Ptr< MobilityModel > b, UanTxMode mode)=0
Finds propagation delay between nodes a and b.
The power delay profile returned by propagation models.
std::complex< double > GetAmp(void) const
Get the complex amplitude of arrival.
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:41
void SetResolution(Time resolution)
Set the time duration (resolution) between arrivals.
void SetNTaps(uint32_t nTaps)
Resize the tap vector.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time GetDelay(void) const
Get the delay time, usually from first arrival of signal.
Time GetResolution(void) const
Get the delay time resolution (time duration between arrivals).
Iterator GetEnd(void) const
Get the end of the tap list (one beyond the last entry).
virtual void DoDispose(void)
Destructor implementation.
Time m_delay
The time delay.
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...
A base class which provides memory management and object aggregation.
Definition: object.h:87
Iterator GetBegin(void) const
Get the beginning of the tap vector.
const Tap & GetTap(uint32_t i) const
Get the Tap at the specified delay index.
double SumTapsNc(Time begin, Time end) const
Compute the non-coherent sum of tap amplitudes between a start and end time.
virtual double GetPathLossDb(Ptr< MobilityModel > a, Ptr< MobilityModel > b, UanTxMode txMode)=0
Computes pathloss between nodes a and b.
static TypeId GetTypeId(void)
Register this type.
a unique identifier for an interface.
Definition: type-id.h:58
std::complex< double > m_amplitude
The amplitude.