--- 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 */