Fixed propagation loss model
authorGary Pei <guangyu.pei@boeing.com>
Thu, 28 May 2009 20:09:28 +0200
changeset 4469 af124ed35b94
parent 4468 6a799c8b72ff
child 4470 51b5c1a272d3
Fixed propagation loss model
src/devices/wifi/propagation-loss-model.cc
src/devices/wifi/propagation-loss-model.h
--- a/src/devices/wifi/propagation-loss-model.cc	Thu May 28 18:25:53 2009 +0200
+++ b/src/devices/wifi/propagation-loss-model.cc	Thu May 28 20:09:28 2009 +0200
@@ -505,4 +505,42 @@
 
 // ------------------------------------------------------------------------- //
 
+NS_OBJECT_ENSURE_REGISTERED (FixedRssLossModel);
+
+TypeId 
+FixedRssLossModel::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::FixedRssLossModel")
+    .SetParent<PropagationLossModel> ()
+    .AddConstructor<FixedRssLossModel> ()
+    .AddAttribute ("Rss", "The fixed receiver Rss.",
+                   DoubleValue (-150.0),
+                   MakeDoubleAccessor (&FixedRssLossModel::m_rss),
+                   MakeDoubleChecker<double> ())
+    ;
+  return tid;
+}
+FixedRssLossModel::FixedRssLossModel ()
+  : PropagationLossModel ()
+{}
+
+FixedRssLossModel::~FixedRssLossModel ()
+{}
+
+void 
+FixedRssLossModel::SetRss (double rss)
+{
+  m_rss = rss;
+}
+
+double 
+FixedRssLossModel::DoCalcRxPower (double txPowerDbm,
+                                           Ptr<MobilityModel> a,
+                                           Ptr<MobilityModel> b) const
+{
+  return m_rss;
+}
+
+// ------------------------------------------------------------------------- //
+
 } // namespace ns3
--- a/src/devices/wifi/propagation-loss-model.h	Thu May 28 18:25:53 2009 +0200
+++ b/src/devices/wifi/propagation-loss-model.h	Thu May 28 20:09:28 2009 +0200
@@ -17,6 +17,7 @@
  *
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  * Contributions: Timo Bingmann <timo.bingmann@student.kit.edu>
+ * Contributions: Gary Pei <guangyu.pei@boeing.com> for fixed RSS
  */
 
 #ifndef PROPAGATION_LOSS_MODEL_H
@@ -343,6 +344,32 @@
   GammaVariable         m_gammaRandomVariable;
 };
 
+/**
+ * \brief The propagation loss is fixed. The user can set received power level.
+ */ 
+class FixedRssLossModel : public PropagationLossModel
+{
+public:
+  static TypeId GetTypeId (void);
+
+  FixedRssLossModel ();
+  virtual ~FixedRssLossModel ();
+  /**
+   * \param RSS (dBm) the received signal strength
+   *
+   * Set the RSS.
+   */
+  void SetRss (double rss);
+
+private:
+  FixedRssLossModel (const FixedRssLossModel &o);
+  FixedRssLossModel & operator = (const FixedRssLossModel &o);
+  virtual double DoCalcRxPower (double txPowerDbm,
+                                Ptr<MobilityModel> a,
+                                Ptr<MobilityModel> b) const;
+  double m_rss;
+};
+
 } // namespace ns3
 
 #endif /* PROPAGATION_LOSS_MODEL_H */