--- a/src/propagation/examples/main-propagation-loss.cc Fri May 13 14:59:05 2011 -0400
+++ b/src/propagation/examples/main-propagation-loss.cc Fri May 13 14:59:24 2011 -0400
@@ -121,7 +121,7 @@
dataset.SetStyle("with linespoints");
dataset.SetExtra("pointtype 3 pointsize 0.5");
-
+
typedef std::map<double, unsigned int> rxPowerMapType;
// Take given number of samples from CalcRxPower() and show probability
@@ -141,7 +141,7 @@
double rxPowerDbm = model->CalcRxPower (txPowerDbm, a, b);
rxPowerDbm = dround(rxPowerDbm, 1.0);
- rxPowerMap[ rxPowerDbm ] ++;
+ rxPowerMap[ rxPowerDbm ]++;
Simulator::Stop (Seconds (0.01));
Simulator::Run ();
--- a/src/propagation/model/jakes-propagation-loss-model.cc Fri May 13 14:59:05 2011 -0400
+++ b/src/propagation/model/jakes-propagation-loss-model.cc Fri May 13 14:59:24 2011 -0400
@@ -54,9 +54,9 @@
JakesPropagationLossModel::PathCoefficients::PathCoefficients (Ptr<const JakesPropagationLossModel> jakes,
- Ptr<MobilityModel> receiver,
- uint8_t nRays,
- uint8_t nOscillators)
+ Ptr<MobilityModel> receiver,
+ uint8_t nRays,
+ uint8_t nOscillators)
: m_receiver (receiver),
m_nOscillators (nOscillators),
m_nRays (nRays)
@@ -99,7 +99,7 @@
{
uint16_t N = 4 * m_nOscillators + 2;
Time interval = Simulator::Now () - m_lastUpdate;
- ComplexNumber coef= {0.0, 0.0};
+ ComplexNumber coef= { 0.0, 0.0};
ComplexNumber fading;
double norm = 0.0;
for (uint8_t i = 0; i < m_nRays; i++)
@@ -116,8 +116,8 @@
fading.imag += jakes->m_amp[j].imag * cos (m_phases[i][j]);
norm += sqrt(pow (jakes->m_amp[j].real, 2) + pow(jakes->m_amp[j].imag, 2));
}
- coef.real += fading.real;
- coef.imag += fading.imag;
+ coef.real += fading.real;
+ coef.imag += fading.imag;
}
m_lastUpdate = Simulator::Now ();
double k = sqrt (pow (coef.real, 2) + pow (coef.imag, 2)) / norm;
@@ -136,27 +136,27 @@
.AddAttribute ("NumberOfRaysPerPath",
"The number of rays to use by default for compute the fading coeficent for a given path (default is 1)",
UintegerValue (1),
- MakeUintegerAccessor (&JakesPropagationLossModel::SetNRays,
+ MakeUintegerAccessor (&JakesPropagationLossModel::SetNRays,
&JakesPropagationLossModel::GetNRays),
- MakeUintegerChecker<uint8_t> ())
+ MakeUintegerChecker<uint8_t> ())
.AddAttribute ("NumberOfOscillatorsPerRay",
"The number of oscillators to use by default for compute the coeficent for a given ray of a given "
"path (default is 4)",
UintegerValue (4),
- MakeUintegerAccessor (&JakesPropagationLossModel::SetNOscillators,
+ MakeUintegerAccessor (&JakesPropagationLossModel::SetNOscillators,
&JakesPropagationLossModel::GetNOscillators),
- MakeUintegerChecker<uint8_t> ())
+ MakeUintegerChecker<uint8_t> ())
.AddAttribute ("DopplerFreq",
"The doppler frequency in Hz (f_d = v / lambda = v * f / c), the default is 0)",
DoubleValue (0.0),
- MakeDoubleAccessor (&JakesPropagationLossModel::m_fd),
- MakeDoubleChecker<double> ())
+ MakeDoubleAccessor (&JakesPropagationLossModel::m_fd),
+ MakeDoubleChecker<double> ())
.AddAttribute ("Distribution",
"The distribution to choose the initial phases.",
RandomVariableValue (ConstantVariable (1.0)),
MakeRandomVariableAccessor (&JakesPropagationLossModel::m_variable),
MakeRandomVariableChecker ())
- ;
+ ;
return tid;
}
@@ -164,15 +164,16 @@
: m_amp (0),
m_nRays (0),
m_nOscillators (0)
-{}
+{
+}
JakesPropagationLossModel::~JakesPropagationLossModel ()
{
delete [] m_amp;
- for (PathsList::reverse_iterator i = m_paths.rbegin (); i != m_paths.rend (); i++)
+ for (PathsList::reverse_iterator i = m_paths.rbegin (); i != m_paths.rend (); i++)
{
PathsSet *ps = *i;
- for (DestinationList::iterator r = ps->receivers.begin (); r != ps->receivers.end (); r++)
+ for (DestinationList::iterator r = ps->receivers.begin (); r != ps->receivers.end (); r++)
{
PathCoefficients *pc = *r;
delete pc;
--- a/src/propagation/model/jakes-propagation-loss-model.h Fri May 13 14:59:05 2011 -0400
+++ b/src/propagation/model/jakes-propagation-loss-model.h Fri May 13 14:59:24 2011 -0400
@@ -41,22 +41,22 @@
* \f[ u_s(t) = \frac{2}{\sqrt{N}}\sum_{n=0}^{M}b_n\cos(\omega_n t+\phi_n)\f]
* where
* \f[ a_n=\left \{ \begin{array}{ll}
- * \sqrt{2}\cos\beta_0 & n=0 \\
+ * \sqrt{2}\cos\beta_0 & n=0 \ \
* 2\cos\beta_n & n=1,2,\ldots,M
* \end{array}
* \right .\f]
* \f[ b_n=\left \{ \begin{array}{ll}
- * \sqrt{2}\sin\beta_0 & n=0 \\
+ * \sqrt{2}\sin\beta_0 & n=0 \ \
* 2\sin\beta_n & n=1,2,\ldots,M
* \end{array}
* \right .\f]
* \f[ \beta_n=\left \{ \begin{array}{ll}
- * \frac{\pi}{4} & n=0 \\
+ * \frac{\pi}{4} & n=0 \ \
* \frac{\pi n}{M} & n=1,2,\ldots,M
* \end{array}
* \right .\f]
* \f[ \omega_n=\left \{ \begin{array}{ll}
- * 2\pi f_d & n=0 \\
+ * 2\pi f_d & n=0 \ \
* 2\pi f_d \cos\frac{2\pi n}{N} & n=1,2,\ldots,M
* \end{array}
* \right .\f]
@@ -120,11 +120,11 @@
};
typedef std::vector<PathsSet *> PathsList;
-
+
static const double PI;
ComplexNumber* m_amp;
RandomVariable m_variable;
- double m_fd;
+ double m_fd;
mutable PathsList m_paths;
uint8_t m_nRays;
uint8_t m_nOscillators;
--- a/src/propagation/model/propagation-delay-model.cc Fri May 13 14:59:05 2011 -0400
+++ b/src/propagation/model/propagation-delay-model.cc Fri May 13 14:59:24 2011 -0400
@@ -31,16 +31,17 @@
{
static TypeId tid = TypeId ("ns3::PropagationDelayModel")
.SetParent<Object> ()
- ;
+ ;
return tid;
}
PropagationDelayModel::~PropagationDelayModel ()
-{}
+{
+}
NS_OBJECT_ENSURE_REGISTERED (RandomPropagationDelayModel);
-TypeId
+TypeId
RandomPropagationDelayModel::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::RandomPropagationDelayModel")
@@ -51,15 +52,17 @@
RandomVariableValue (UniformVariable (0.0, 1.0)),
MakeRandomVariableAccessor (&RandomPropagationDelayModel::m_variable),
MakeRandomVariableChecker ())
- ;
+ ;
return tid;
}
RandomPropagationDelayModel::RandomPropagationDelayModel ()
-{}
+{
+}
RandomPropagationDelayModel::~RandomPropagationDelayModel ()
-{}
-Time
+{
+}
+Time
RandomPropagationDelayModel::GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
{
return Seconds (m_variable.GetValue ());
@@ -77,25 +80,26 @@
DoubleValue (300000000.0),
MakeDoubleAccessor (&ConstantSpeedPropagationDelayModel::m_speed),
MakeDoubleChecker<double> ())
- ;
+ ;
return tid;
}
ConstantSpeedPropagationDelayModel::ConstantSpeedPropagationDelayModel ()
-{}
-Time
+{
+}
+Time
ConstantSpeedPropagationDelayModel::GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
{
double distance = a->GetDistanceFrom (b);
double seconds = distance / m_speed;
return Seconds (seconds);
}
-void
+void
ConstantSpeedPropagationDelayModel::SetSpeed (double speed)
{
m_speed = speed;
}
-double
+double
ConstantSpeedPropagationDelayModel::GetSpeed (void) const
{
return m_speed;
--- a/src/propagation/model/propagation-loss-model.cc Fri May 13 14:59:05 2011 -0400
+++ b/src/propagation/model/propagation-loss-model.cc Fri May 13 14:59:24 2011 -0400
@@ -41,24 +41,26 @@
{
static TypeId tid = TypeId ("ns3::PropagationLossModel")
.SetParent<Object> ()
- ;
+ ;
return tid;
}
PropagationLossModel::PropagationLossModel ()
: m_next (0)
-{}
+{
+}
PropagationLossModel::~PropagationLossModel ()
-{}
+{
+}
-void
+void
PropagationLossModel::SetNext (Ptr<PropagationLossModel> next)
{
m_next = next;
}
-double
+double
PropagationLossModel::CalcRxPower (double txPowerDbm,
Ptr<MobilityModel> a,
Ptr<MobilityModel> b) const
@@ -85,17 +87,19 @@
RandomVariableValue (ConstantVariable (1.0)),
MakeRandomVariableAccessor (&RandomPropagationLossModel::m_variable),
MakeRandomVariableChecker ())
- ;
+ ;
return tid;
}
RandomPropagationLossModel::RandomPropagationLossModel ()
: PropagationLossModel ()
-{}
+{
+}
RandomPropagationLossModel::~RandomPropagationLossModel ()
-{}
+{
+}
-double
+double
RandomPropagationLossModel::DoCalcRxPower (double txPowerDbm,
Ptr<MobilityModel> a,
Ptr<MobilityModel> b) const
@@ -132,49 +136,50 @@
MakeDoubleAccessor (&FriisPropagationLossModel::SetMinDistance,
&FriisPropagationLossModel::GetMinDistance),
MakeDoubleChecker<double> ())
- ;
+ ;
return tid;
}
FriisPropagationLossModel::FriisPropagationLossModel ()
-{}
-void
+{
+}
+void
FriisPropagationLossModel::SetSystemLoss (double systemLoss)
{
m_systemLoss = systemLoss;
}
-double
+double
FriisPropagationLossModel::GetSystemLoss (void) const
{
return m_systemLoss;
}
-void
+void
FriisPropagationLossModel::SetMinDistance (double minDistance)
{
m_minDistance = minDistance;
}
-double
+double
FriisPropagationLossModel::GetMinDistance (void) const
{
return m_minDistance;
}
-void
+void
FriisPropagationLossModel::SetLambda (double frequency, double speed)
{
m_lambda = speed / frequency;
}
-void
+void
FriisPropagationLossModel::SetLambda (double lambda)
{
m_lambda = lambda;
}
-double
+double
FriisPropagationLossModel::GetLambda (void) const
{
return m_lambda;
}
-double
+double
FriisPropagationLossModel::DbmToW (double dbm) const
{
double mw = pow(10.0,dbm/10.0);
@@ -429,32 +434,33 @@
DoubleValue (46.6777),
MakeDoubleAccessor (&LogDistancePropagationLossModel::m_referenceLoss),
MakeDoubleChecker<double> ())
- ;
+ ;
return tid;
-
+
}
LogDistancePropagationLossModel::LogDistancePropagationLossModel ()
-{}
+{
+}
-void
+void
LogDistancePropagationLossModel::SetPathLossExponent (double n)
{
m_exponent = n;
}
-void
+void
LogDistancePropagationLossModel::SetReference (double referenceDistance, double referenceLoss)
{
m_referenceDistance = referenceDistance;
m_referenceLoss = referenceLoss;
}
-double
+double
LogDistancePropagationLossModel::GetPathLossExponent (void) const
{
return m_exponent;
}
-
-double
+
+double
LogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm,
Ptr<MobilityModel> a,
Ptr<MobilityModel> b) const
@@ -480,8 +486,8 @@
*/
double pathLossDb = 10 * m_exponent * log10 (distance / m_referenceDistance);
double rxc = -m_referenceLoss - pathLossDb;
- NS_LOG_DEBUG ("distance="<<distance<<"m, reference-attenuation="<<-m_referenceLoss<<"dB, "<<
- "attenuation coefficient="<<rxc<<"db");
+ NS_LOG_DEBUG ("distance="<<distance<<"m, reference-attenuation="<< -m_referenceLoss<<"dB, "<<
+ "attenuation coefficient="<<rxc<<"db");
return txPowerDbm + rxc;
}
@@ -530,9 +536,9 @@
DoubleValue (46.6777),
MakeDoubleAccessor (&ThreeLogDistancePropagationLossModel::m_referenceLoss),
MakeDoubleChecker<double> ())
- ;
+ ;
return tid;
-
+
}
ThreeLogDistancePropagationLossModel::ThreeLogDistancePropagationLossModel ()
@@ -615,15 +621,16 @@
DoubleValue (0.75),
MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m2),
MakeDoubleChecker<double> ())
- ;
+ ;
return tid;
-
+
}
NakagamiPropagationLossModel::NakagamiPropagationLossModel ()
-{}
+{
+}
-double
+double
NakagamiPropagationLossModel::DoCalcRxPower (double txPowerDbm,
Ptr<MobilityModel> a,
Ptr<MobilityModel> b) const
@@ -646,7 +653,7 @@
{
m = m_m2;
}
-
+
// the current power unit is dBm, but Watt is put into the Nakagami /
// Rayleigh distribution.
double powerW = pow(10, (txPowerDbm - 30) / 10);
@@ -689,26 +696,28 @@
DoubleValue (-150.0),
MakeDoubleAccessor (&FixedRssLossModel::m_rss),
MakeDoubleChecker<double> ())
- ;
+ ;
return tid;
}
FixedRssLossModel::FixedRssLossModel ()
: PropagationLossModel ()
-{}
+{
+}
FixedRssLossModel::~FixedRssLossModel ()
-{}
+{
+}
-void
+void
FixedRssLossModel::SetRss (double rss)
{
m_rss = rss;
}
-double
+double
FixedRssLossModel::DoCalcRxPower (double txPowerDbm,
- Ptr<MobilityModel> a,
- Ptr<MobilityModel> b) const
+ Ptr<MobilityModel> a,
+ Ptr<MobilityModel> b) const
{
return m_rss;
}
@@ -727,7 +736,7 @@
DoubleValue (std::numeric_limits<double>::max ()),
MakeDoubleAccessor (&MatrixPropagationLossModel::m_default),
MakeDoubleChecker<double> ())
- ;
+ ;
return tid;
}
@@ -753,7 +762,7 @@
MobilityPair p = std::make_pair(ma, mb);
std::map<MobilityPair, double>::iterator i = m_loss.find (p);
-
+
if (i == m_loss.end ())
{
m_loss.insert (std::make_pair (p, loss));
@@ -775,7 +784,7 @@
Ptr<MobilityModel> b) const
{
std::map<MobilityPair, double>::const_iterator i = m_loss.find (std::make_pair (a, b));
-
+
if (i != m_loss.end ())
{
return txPowerDbm - i->second;
--- a/src/propagation/model/propagation-loss-model.h Fri May 13 14:59:05 2011 -0400
+++ b/src/propagation/model/propagation-loss-model.h Fri May 13 14:59:24 2011 -0400
@@ -319,7 +319,7 @@
double GetPathLossExponent (void) const;
void SetReference (double referenceDistance, double referenceLoss);
-
+
private:
LogDistancePropagationLossModel (const LogDistancePropagationLossModel &o);
LogDistancePropagationLossModel & operator = (const LogDistancePropagationLossModel &o);
@@ -353,9 +353,9 @@
*
* \f[\displaystyle L =
\begin{cases}
-0 & d < d_0 \\
-L_0 + 10 \cdot n_0 \log_{10}(\frac{d}{d_0}) & d_0 \leq d < d_1 \\
-L_0 + 10 \cdot n_0 \log_{10}(\frac{d_1}{d_0}) + 10 \cdot n_1 \log_{10}(\frac{d}{d_1}) & d_1 \leq d < d_2 \\
+0 & d < d_0 \ \
+L_0 + 10 \cdot n_0 \log_{10}(\frac{d}{d_0}) & d_0 \leq d < d_1 \ \
+L_0 + 10 \cdot n_0 \log_{10}(\frac{d_1}{d_0}) + 10 \cdot n_1 \log_{10}(\frac{d}{d_1}) & d_1 \leq d < d_2 \ \
L_0 + 10 \cdot n_0 \log_{10}(\frac{d_1}{d_0}) + 10 \cdot n_1 \log_{10}(\frac{d_2}{d_1}) + 10 \cdot n_2 \log_{10}(\frac{d}{d_2})& d_2 \leq d
\end{cases}\f]
*
@@ -489,10 +489,10 @@
{
public:
static TypeId GetTypeId (void);
-
+
MatrixPropagationLossModel ();
virtual ~MatrixPropagationLossModel ();
-
+
/**
* \brief Set loss (in dB, positive) between pair of ns-3 objects
* (typically, nodes).
@@ -505,15 +505,15 @@
void SetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double loss, bool symmetric = true);
/// Set default loss (in dB, positive) to be used, infinity if not set
void SetDefaultLoss (double);
-
+
private:
virtual double DoCalcRxPower (double txPowerDbm,
- Ptr<MobilityModel> a,
- Ptr<MobilityModel> b) const;
+ Ptr<MobilityModel> a,
+ Ptr<MobilityModel> b) const;
private:
/// default loss
double m_default;
-
+
typedef std::pair< Ptr<MobilityModel>, Ptr<MobilityModel> > MobilityPair;
/// Fixed loss between pair of nodes
std::map<MobilityPair, double> m_loss;
--- a/src/propagation/test/propagation-loss-model-test-suite.cc Fri May 13 14:59:05 2011 -0400
+++ b/src/propagation/test/propagation-loss-model-test-suite.cc Fri May 13 14:59:24 2011 -0400
@@ -136,10 +136,10 @@
public:
TwoRayGroundPropagationLossModelTestCase ();
virtual ~TwoRayGroundPropagationLossModelTestCase ();
-
+
private:
virtual void DoRun (void);
-
+
typedef struct
{
Vector m_position;
@@ -147,13 +147,13 @@
double m_pr; // W
double m_tolerance;
} TestVector;
-
+
TestVectors<TestVector> m_testVectors;
};
TwoRayGroundPropagationLossModelTestCase::TwoRayGroundPropagationLossModelTestCase ()
-: TestCase ("Check to see that the ns-3 TwoRayGround propagation loss model provides correct received power"),
-m_testVectors ()
+ : TestCase ("Check to see that the ns-3 TwoRayGround propagation loss model provides correct received power"),
+ m_testVectors ()
{
}
@@ -167,15 +167,15 @@
// wavelength at 2.4 GHz is 0.125m
Config::SetDefault ("ns3::TwoRayGroundPropagationLossModel::Lambda", DoubleValue (0.125));
Config::SetDefault ("ns3::TwoRayGroundPropagationLossModel::SystemLoss", DoubleValue (1.0));
-
+
// set antenna height to 1.5m above z coordinate
Config::SetDefault ("ns3::TwoRayGroundPropagationLossModel::HeightAboveZ", DoubleValue (1.5));
-
+
// Select a reference transmit power of 17.0206 dBm
// Pt = 10^(17.0206/10)/10^3 = .05035702 W
double txPowerW = 0.05035702;
double txPowerdBm = 10 * log10 (txPowerW) + 30;
-
+
//
// As with the Friis tests above, we want to test the propagation loss
// model calculations at a few chosen distances and compare the results
@@ -183,39 +183,39 @@
// value for agreement to be within 5e-16, as above.
//
TestVector testVector;
-
+
// Below the Crossover distance use Friis so this test should be the same as that above
// Crossover = (4 * PI * TxAntennaHeight * RxAntennaHeight) / Lamdba
// Crossover = (4 * PI * 1.5 * 1.5) / 0.125 = 226.1946m
-
+
testVector.m_position = Vector (100, 0, 0);
testVector.m_pt = txPowerdBm;
testVector.m_pr = 4.98265e-10;
testVector.m_tolerance = 5e-16;
m_testVectors.Add (testVector);
-
+
// These values are above the crossover distance and therefore use the Two Ray calculation
-
+
testVector.m_position = Vector (500, 0, 0);
testVector.m_pt = txPowerdBm;
testVector.m_pr = 4.07891862e-12;
testVector.m_tolerance = 5e-16;
m_testVectors.Add (testVector);
-
+
testVector.m_position = Vector (1000, 0, 0);
testVector.m_pt = txPowerdBm;
testVector.m_pr = 2.5493241375e-13;
testVector.m_tolerance = 5e-16;
m_testVectors.Add (testVector);
-
+
testVector.m_position = Vector (2000, 0, 0);
testVector.m_pt = txPowerdBm;
testVector.m_pr = 1.593327585938e-14;
testVector.m_tolerance = 5e-16;
m_testVectors.Add (testVector);
-
+
// Repeat the tests for non-zero z coordinates
-
+
// Pr = (0.05035702 * (1.5*1.5) * (2.5*2.5)) / (500*500*500*500) = 1.13303295e-11
// dCross = (4 * pi * 1.5 * 2.5) / 0.125 = 376.99m
testVector.m_position = Vector (500, 0, 1);
@@ -223,7 +223,7 @@
testVector.m_pr = 1.13303295e-11;
testVector.m_tolerance = 5e-16;
m_testVectors.Add (testVector);
-
+
// Pr = (0.05035702 * (1.5*1.5) * (5.5*5.5)) / (1000*1000*1000*1000) = 3.42742467375e-12
// dCross = (4 * pi * 1.5 * 5.5) / 0.125 = 829.38m
testVector.m_position = Vector (1000, 0, 4);
@@ -231,7 +231,7 @@
testVector.m_pr = 3.42742467375e-12;
testVector.m_tolerance = 5e-16;
m_testVectors.Add (testVector);
-
+
// Pr = (0.05035702 * (1.5*1.5) * (11.5*11.5)) / (2000*2000*2000*2000) = 9.36522547734e-13
// dCross = (4 * pi * 1.5 * 11.5) / 0.125 = 1734.15m
testVector.m_position = Vector (2000, 0, 10);
@@ -239,23 +239,23 @@
testVector.m_pr = 9.36522547734e-13;
testVector.m_tolerance = 5e-16;
m_testVectors.Add (testVector);
-
-
+
+
// Now, check that the received power values are expected
-
+
Ptr<MobilityModel> a = CreateObject<ConstantPositionMobilityModel> ();
a->SetPosition (Vector (0,0,0));
Ptr<MobilityModel> b = CreateObject<ConstantPositionMobilityModel> ();
-
+
Ptr<TwoRayGroundPropagationLossModel> lossModel = CreateObject<TwoRayGroundPropagationLossModel> ();
for (uint32_t i = 0; i < m_testVectors.GetN (); ++i)
- {
- testVector = m_testVectors.Get (i);
- b->SetPosition (testVector.m_position);
- double resultdBm = lossModel->CalcRxPower (testVector.m_pt, a, b);
- double resultW = pow (10.0, resultdBm / 10.0) / 1000;
- NS_TEST_EXPECT_MSG_EQ_TOL (resultW, testVector.m_pr, testVector.m_tolerance, "Got unexpected rcv power");
- }
+ {
+ testVector = m_testVectors.Get (i);
+ b->SetPosition (testVector.m_position);
+ double resultdBm = lossModel->CalcRxPower (testVector.m_pt, a, b);
+ double resultW = pow (10.0, resultdBm / 10.0) / 1000;
+ NS_TEST_EXPECT_MSG_EQ_TOL (resultW, testVector.m_pr, testVector.m_tolerance, "Got unexpected rcv power");
+ }
}
@@ -373,17 +373,17 @@
{
m[i] = CreateObject<ConstantPositionMobilityModel> ();
}
-
+
MatrixPropagationLossModel loss;
// no loss by default
- loss.SetDefaultLoss (0);
+ loss.SetDefaultLoss (0);
// -10 dB for 0 -> 1 and 1 -> 0
loss.SetLoss (m[0], m[1], 10);
// -30 dB from 0 to 2 and -100 dB from 2 to 0
- loss.SetLoss (m[0], m[2], 30, /*symmetric = */false);
- loss.SetLoss (m[2], m[0], 100, /*symmetric = */false);
+ loss.SetLoss (m[0], m[2], 30, /*symmetric = */ false);
+ loss.SetLoss (m[2], m[0], 100, /*symmetric = */ false);
// default from 1 to 2
-
+
NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[0], m[1]), -10, "Loss 0 -> 1 incorrect");
NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[1], m[0]), -10, "Loss 1 -> 0 incorrect");
NS_TEST_ASSERT_MSG_EQ (loss.CalcRxPower (0, m[0], m[2]), -30, "Loss 0 -> 2 incorrect");