Index: src/propagation/model/thz-propagation-loss-model.h |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/src/propagation/model/thz-propagation-loss-model.h |
@@ -0,0 +1,327 @@ |
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
+/* |
+ * Copyright (c) 2015 Portland state university |
+ * |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License version 2 as |
+ * published by the Free Software Foundation; |
+ * |
+ * 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, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ * Author: Farnoosh Moshir <moshir2@cs.pdx.edu> |
+ * Suresh Singh <singh@cs.pdx.edu> |
+ */ |
+ |
+#ifndef THZ_PROPAGATION_LOSS_MODEL_H |
+#define THZ_PROPAGATION_LOSS_MODEL_H |
+ |
+#include <ns3/propagation-loss-model.h> |
+ |
+ |
+namespace ns3 { |
+ |
+ |
+/** |
+ * \ingroup propagation |
+ * |
+ * \brief a THz directional propagation loss model |
+ * |
+ * The THz directional propagation loss model is described in "Pulsed Terahertz |
+ * Time-Domain Communication" and in "Ultrafast Pulsed THz Communication" by |
+ * "Farnoosh Moshir" and "Suresh Singh". |
+ * |
+ * The equation is described as: |
+ * \f$ P_r = \frac{P_t G_t G_r exp(-d K(f, h))}{L} \f$ |
+ * |
+ * With: |
+ * - \f$ P_r \f$ : reception power (W) |
+ * - \f$ P_t \f$ : transmission power (W) |
+ * - \f$ G_t \f$ : transmission gain (unit-less) |
+ * - \f$ G_r \f$ : reception gain (unit-less) |
+ * - \f$ d \f$ : distance (m) |
+ * - \f$ K(f, h) \f$ : Attenuation coefficient of frequency f and humidity h |
+ * - \f$ L \f$ : system loss (unit-less) |
+ * |
+ * In the implementation, \f$ \lambda \f$ is calculated as |
+ * \f$ \frac{C}{f} \f$, where \f$ C = 299792458\f$ m/s is the speed of light in |
+ * vacuum, and \f$ f \f$ is the frequency in Hz which can be configured by |
+ * the user via the Frequency attribute. |
+ * |
+ * This model is used for the cases where Tx and Rx both use collimated lenses. As a |
+ * result, the signal has the minimum divergence. However, in THz domain atmospheric |
+ * molecules cause signal attenuation. |
+ * |
+ * \f$ K(f, h)$\f is the attenuation coefficient for frequency \f$ f \f$ and |
+ * relative humidity \f$ h \f$ and corresponds to attenuation resulting from |
+ * water vapor, oxygen, nitrogen, and carbon dioxide. \f$ K(f, h)$\f is found |
+ * based on Van Vleck-Weisskopt (VVW) line shape model for freauencies up to 2 THz. |
+ * The required parameters have been derived from HITRAN database. |
+ * |
+ * This calculated atmospheric attenuation coefficient is given in file |
+ * "absorptionTable.txt".The file has three columns. The first Column corresponds to |
+ * 0% relative humidity. The second column corresponds to 40%, and the third column |
+ * corresponds to 80% relative humidity. |
+ * |
+ * There are 5121 rows in the file. Each row corresponds to a specific frequency (Hz) |
+ * in the range of 1 Hz to 2 THz frequency. |
+ * |
+ * variable m_freqLastInd corresponds to the total number of rows in the file and |
+ * variable m_freqEnd corresponds to the highest frequency (Hz) that is used in |
+ * this model. |
+ */ |
+ |
+class ThzDirectionalPropagationLossModel : public PropagationLossModel |
+{ |
+public: |
+ static TypeId GetTypeId (void); |
+ ThzDirectionalPropagationLossModel (); |
+ /** |
+ * \param frequency (Hz) |
+ * |
+ * Set the carrier frequency used in the Direction THz model |
+ * calculation. |
+ */ |
+ void SetFrequency (double frequency); |
+ /** |
+ * \param systemLoss (dimension-less) |
+ * |
+ * Set the system loss used by the Direction THz propagation model. |
+ */ |
+ void SetSystemLoss (double systemLoss); |
+ |
+ /** |
+ * \param minLoss the minimum loss (dB) |
+ * |
+ * no matter how short the distance, the total propagation loss (in |
+ * dB) will always be greater or equal than this value |
+ */ |
+ void SetMinLoss (double minLoss); |
+ |
+ /** |
+ * \param humidity the relative humidity |
+ * |
+ * set the humidty of the environment |
+ */ |
+ void SetHumidity (uint32_t humidity); |
+ |
+ /** |
+ * \param lastInd the highest index of the frequencies (number of rows in absorptionTable.txt file) |
+ * |
+ * set the last available frequency index |
+ */ |
+ void SetFreqLastInd(uint32_t lastInd); |
+ |
+ /** |
+ * \param freqEnd the highest frequency that can be used in this model |
+ * |
+ * set the highest frequency that can be used in this model |
+ */ |
+ void SetFreqEnd(double freqEnd); |
+ |
+ /** |
+ * \return the minimum loss. |
+ */ |
+ double GetMinLoss (void) const; |
+ |
+ /** |
+ * \returns the current frequency (Hz) |
+ */ |
+ double GetFrequency (void) const; |
+ /** |
+ * \returns the current system loss (dimension-less) |
+ */ |
+ double GetSystemLoss (void) const; |
+ |
+ /** |
+ * /return the relative humidity of the environment |
+ */ |
+ uint32_t GetHumidity (void) const; |
+ |
+ /** |
+ * /return the highest index of the frequencies (umber of rows in absorptionTable.txt file) |
+ */ |
+ uint32_t GetFreqLastInd (void) const; |
+ |
+ /** |
+ * /return the highest frequency that can be used in this model |
+ */ |
+ double GetFreqEnd (void) const; |
+ |
+ |
+private: |
+ ThzDirectionalPropagationLossModel (const ThzDirectionalPropagationLossModel &o); |
+ ThzDirectionalPropagationLossModel & operator = (const ThzDirectionalPropagationLossModel &o); |
+ virtual double DoCalcRxPower (double txPowerDbm, |
+ Ptr<MobilityModel> a, |
+ Ptr<MobilityModel> b) const; |
+ virtual int64_t DoAssignStreams (int64_t stream); |
+ double DbmToW (double dbm) const; |
+ double DbmFromW (double w) const; |
+ double FindAttenuationCoefficient() const; |
+ |
+ |
+ double m_lambda; |
+ double m_frequency; |
+ double m_systemLoss; |
+ double m_minLoss; |
+ uint32_t m_humidity; |
+ uint32_t m_freqLastInd; |
+ double m_freqEnd; |
+}; |
+ |
+/** |
+ * \ingroup propagation |
+ * |
+ * \brief a THz omni directional propagation loss model |
+ * |
+ * The equation is described as: |
+ * \f$ P_r = \frac{P_t G_t G_r \lambda^2}{L} exp(-d K(f, h)) \f$ |
+ * |
+ * With: |
+ * - \f$ P_r \f$ : reception power (W) |
+ * - \f$ P_t \f$ : transmission power (W) |
+ * - \f$ G_t \f$ : transmission gain (unit-less) |
+ * - \f$ G_r \f$ : reception gain (unit-less) |
+ * - \f$ \lambda \f$ : wavelength (m) |
+ * - \f$ d \f$ : distance (m) |
+ * - \f$ K(f, h) \f$ : Attenuation coefficient of frequency f and humidity h |
+ * - \f$ L \f$ : system loss (unit-less) |
+ * |
+ * In the implementation, \f$ \lambda \f$ is calculated as |
+ * \f$ \frac{C}{f} \f$, where \f$ C = 299792458\f$ m/s is the speed of light in |
+ * vacuum, and \f$ f \f$ is the frequency in Hz which can be configured by |
+ * the user via the Frequency attribute. |
+ * |
+ * This model is used for the cases where Tx and Rx both use omni directional. |
+ * Therefore, the free space path loss from Friis model and atmospheric attenuation |
+ * resulting from molecules in the air should be considered. |
+ * |
+ * \f$ K(f, h)$\f is the attenuation coefficient for frequency \f$ f \f$ and |
+ * relative humidity \f$ h \f$ and corresponds to attenuation resulting from |
+ * water vapor, oxygen, nitrogen, and carbon dioxide. \f$ K(f, h)$\f is found |
+ * based on Van Vleck-Weisskopt (VVW) line shape model for freauencies up to 2 THz |
+ * frequency. The required parameters have been derived from HITRAN database. |
+ * |
+ * This calculated atmospheric attenuation coefficient is given in file |
+ * "absorptionTable.txt".The file has three columns. The first Column corresponds to |
+ * 0% relative humidity. The second column corresponds to 40%, and the third column |
+ * corresponds to 80% relative humidity. |
+ * |
+ * There are 5121 rows in the file. Each row corresponds to a specific frequency (Hz) |
+ * in the range of 1 Hz to 2 THz frequency. |
+ * |
+ * variable m_freqLastInd corresponds to the total number of rows in the file and |
+ * variable m_freqEnd corresponds to the highest frequency (Hz) that is used in |
+ * this model. |
+ */ |
+class ThzOmniDirectionalPropagationLossModel : public PropagationLossModel |
+{ |
+public: |
+ static TypeId GetTypeId (void); |
+ ThzOmniDirectionalPropagationLossModel (); |
+ /** |
+ * \param frequency (Hz) |
+ * |
+ * Set the carrier frequency used in the Direction THz model |
+ * calculation. |
+ */ |
+ void SetFrequency (double frequency); |
+ /** |
+ * \param systemLoss (dimension-less) |
+ * |
+ * Set the system loss used by the Direction THz propagation model. |
+ */ |
+ void SetSystemLoss (double systemLoss); |
+ |
+ /** |
+ * \param minLoss the minimum loss (dB) |
+ * |
+ * no matter how short the distance, the total propagation loss (in |
+ * dB) will always be greater or equal than this value |
+ */ |
+ void SetMinLoss (double minLoss); |
+ |
+ /** |
+ * \param humidity the relative humidity |
+ * |
+ * set the humidty of the environment |
+ */ |
+ void SetHumidity (uint32_t humidity); |
+ |
+ /** |
+ * \param lastInd the highest index of the frequencies (number of rows in absorptionTable.txt file) |
+ * |
+ * set the last available frequency index |
+ */ |
+ void SetFreqLastInd(uint32_t lastInd); |
+ |
+ /** |
+ * \param freqEnd the highest frequency that can be used in this model |
+ * |
+ * set the highest frequency that can be used in this model |
+ */ |
+ void SetFreqEnd(double freqEnd); |
+ |
+ |
+ /** |
+ * \return the minimum loss. |
+ */ |
+ double GetMinLoss (void) const; |
+ |
+ /** |
+ * \returns the current frequency (Hz) |
+ */ |
+ double GetFrequency (void) const; |
+ /** |
+ * \returns the current system loss (dimension-less) |
+ */ |
+ double GetSystemLoss (void) const; |
+ |
+ /** |
+ * /return the relative humidity of the environment |
+ */ |
+ uint32_t GetHumidity (void) const; |
+ |
+ /** |
+ * /return the highest index of the frequencies (umber of rows in absorptionTable.txt file) |
+ */ |
+ uint32_t GetFreqLastInd (void) const; |
+ |
+ /** |
+ * /return the highest frequency that can be used in this model |
+ */ |
+ double GetFreqEnd (void) const; |
+ |
+ |
+private: |
+ ThzOmniDirectionalPropagationLossModel (const ThzOmniDirectionalPropagationLossModel &o); |
+ ThzOmniDirectionalPropagationLossModel & operator = (const ThzOmniDirectionalPropagationLossModel &o); |
+ virtual double DoCalcRxPower (double txPowerDbm, |
+ Ptr<MobilityModel> a, |
+ Ptr<MobilityModel> b) const; |
+ virtual int64_t DoAssignStreams (int64_t stream); |
+ double DbmToW (double dbm) const; |
+ double DbmFromW (double w) const; |
+ double FindAttenuationCoefficient() const; |
+ |
+ |
+ static const double PI; |
+ double m_lambda; |
+ double m_frequency; |
+ double m_systemLoss; |
+ double m_minLoss; |
+ uint32_t m_humidity; |
+ uint32_t m_freqLastInd; |
+ double m_freqEnd; |
+}; |
+ |
+} // namespace ns3 |
+ |
+#endif /* THZ_PROPAGATION_LOSS_MODEL_H */ |