Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(241)

Unified Diff: src/devices/uan/uan-prop-model.h

Issue 87043: underwater acoustic device
Patch Set: Created 14 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/devices/uan/uan-prop-model.h
===================================================================
new file mode 100644
--- /dev/null
+++ b/src/devices/uan/uan-prop-model.h
@@ -0,0 +1,150 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2009 University of Washington
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Leonard Tracy <lentracy@u.washington.edu>
+ *
+ *
+ */
+
+
+#ifndef UANPROPMODEL_H_
+#define UANPROPMODEL_H_
+
+#include "ns3/object.h"
+#include "ns3/mobility-model.h"
+#include "ns3/nstime.h"
+
+
+#include <vector>
+#include <complex>
+#include <utility>
+
+namespace ns3
+{
+
+class UanTxMode;
+
+/**
+ * \class Tap
+ * \brief Holds PDP Tap information (amplitude and delay)
+ */
+class Tap {
+public:
+ /**
+ * Default constructor. Creates Tap with delay=0, amp=0
+ */
+ Tap ();
+ /**
+ * \param delay Time delay (usually from first arrival) of signal
+ * \param amp Complex amplitude of arrival
+ */
+ Tap (Time delay, std::complex<double> amp);
+ /**
+ * \returns Complex amplitude of arrival
+ */
+ std::complex<double> GetAmp (void) const;
+ /**
+ * \returns Time delay (usually from first arrival) of signal
+ */
+ Time GetDelay (void) const;
+
+private:
+ std::complex<double> m_amplitude;
+ Time m_delay;
+};
+
+/**
+ * \class UanPdp
+ *
+ * Container class to describe power delay profile returned
+ * from UAN propagation models using tapped delay line model.
+ * This should model a channel impulse response as a set of
+ * equally spaced signal arrivals.
+ *
+ * Generally, the profile should be normalized, such that
+ * the sum of all taps should equal 1. The received signal
+ * power on any interval (t1, t2) can then be found from
+ * summing the taps on the interval and multiplying by
+ * the total received power at the receiver.
+ *
+ *
+ */
+class UanPdp {
craigdo1 2009/07/11 00:10:52 Doxygen, doxygen, doxygen.
+public:
+ typedef std::vector<Tap>::const_iterator Iterator;
+ UanPdp ();
+ UanPdp (uint32_t numTaps, Time resolution);
+ UanPdp (std::vector<Tap> taps, Time resolution);
+ UanPdp (std::vector<std::complex<double > >, Time resolution);
+ UanPdp (std::vector<double>, Time resolution);
+ ~UanPdp ();
+
+ void SetTap (std::complex<double>, uint32_t index);
+ void SetNTaps (uint32_t nTaps);
+ void SetResolution (Time resolution);
+ Iterator GetBegin (void) const;
+ Iterator GetEnd (void) const;
+ uint32_t GetNTaps (void) const;
+ const Tap &GetTap(uint32_t i) const;
+ Time GetResolution (void) const;
+ double SumTapsNc (Time begin, Time end) const;
+ std::complex<double> SumTapsC (Time begin, Time end) const;
+ double SumTapsFromMaxNc (Time delay, Time duration) const;
+ std::complex<double> SumTapsFromMaxC (Time delay, Time duration) const;
+
+ static UanPdp CreateImpulsePdp (void);
+private:
+ friend std::ostream &operator<< (std::ostream &os, UanPdp &pdp);
+ friend std::istream &operator>> (std::istream &is, UanPdp &pdp);
+ std::vector<Tap> m_taps;
+ Time m_resolution;
+
+};
+std::ostream &operator<< (std::ostream &os, UanPdp &pdp);
+std::istream &operator>> (std::ostream &is, UanPdp &pdp);
+
+/**
+ * \class UanPropagationModel
+ *
+ * Base class for implemented underwater propagation models
+ */
+class UanPropagationModel : public ns3::Object
+{
+public:
+
+
+ /**
+ * Computes pathloss between nodes a and b.
+ * \returns Pathloss in dB re 1 uPa
+ */
+ virtual double GetPathLossDb (Ptr<MobilityModel> a, Ptr<MobilityModel> b, UanTxMode txMode)=0;
+
+ /**
+ * \returns PDP for link between nodes a and b
+ */
+ virtual UanPdp GetPdp (Ptr<MobilityModel> a, Ptr<MobilityModel> b, UanTxMode mode)=0;
+ /**
+ * Finds propagation delay between nodes a and b
+ * \returns Propagation delay
+ */
+ virtual Time GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b, UanTxMode mode)=0;
+
+};
+
+}
+
+#endif /*UANPROPMODEL_H_*/

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b