diff -r 2198f9c998cc CHANGES.html --- a/CHANGES.html Thu Oct 16 13:26:10 2014 -0700 +++ b/CHANGES.html Fri Oct 17 11:13:20 2014 -0700 @@ -72,6 +72,7 @@
  • PointerValue attribute types in class UanChannel (NoiseModel), UanPhyGen (PerModel and SinrModel), UanPhyDual (PerModelPhy1, PerModelPhy2, SinrModelPhy1, and SinrModelPhy2), and SimpleNetDevice (TxQueue), were changed from PointerValue type to StringValue type, making them configurable via the Config subsystem.
  • +
  • The 'Speed' attribute of the ConstantDelayPropagationModel (previously using the value 300000000 (m/s)) has been replaced by the GlobalValue 'SpeedOfLight', defaulting to 299792458 (m/s). The 'SetSpeed()' and 'GetSpeed()' methods of this class have also been removed.

    Changes to build system:

    @@ -80,6 +81,8 @@

    Changed behavior:


    diff -r 2198f9c998cc src/propagation/model/propagation-delay-model.cc --- a/src/propagation/model/propagation-delay-model.cc Thu Oct 16 13:26:10 2014 -0700 +++ b/src/propagation/model/propagation-delay-model.cc Fri Oct 17 11:13:20 2014 -0700 @@ -22,11 +22,17 @@ #include "ns3/double.h" #include "ns3/string.h" #include "ns3/pointer.h" +#include "ns3/global-value.h" namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (PropagationDelayModel); +static GlobalValue g_speedOfLight ("SpeedOfLight", + "The speed of light in a vacuum (m/s)", + ns3::DoubleValue(299792458), + ns3::MakeDoubleChecker ()); + TypeId PropagationDelayModel::GetTypeId (void) { @@ -92,10 +98,6 @@ static TypeId tid = TypeId ("ns3::ConstantSpeedPropagationDelayModel") .SetParent () .AddConstructor () - .AddAttribute ("Speed", "The speed (m/s)", - DoubleValue (300000000.0), - MakeDoubleAccessor (&ConstantSpeedPropagationDelayModel::m_speed), - MakeDoubleChecker ()) ; return tid; } @@ -107,18 +109,9 @@ ConstantSpeedPropagationDelayModel::GetDelay (Ptr a, Ptr b) const { double distance = a->GetDistanceFrom (b); - double seconds = distance / m_speed; - return Seconds (seconds); -} -void -ConstantSpeedPropagationDelayModel::SetSpeed (double speed) -{ - m_speed = speed; -} -double -ConstantSpeedPropagationDelayModel::GetSpeed (void) const -{ - return m_speed; + DoubleValue speedValue; + g_speedOfLight.GetValue (speedValue); + return Seconds (distance/speedValue.Get ()); } int64_t diff -r 2198f9c998cc src/propagation/model/propagation-delay-model.h --- a/src/propagation/model/propagation-delay-model.h Thu Oct 16 13:26:10 2014 -0700 +++ b/src/propagation/model/propagation-delay-model.h Fri Oct 17 11:13:20 2014 -0700 @@ -73,7 +73,8 @@ /** * \ingroup propagation * - * \brief the propagation delay is random + * \brief the propagation delay is random, defaulting to a U(0,1) random + * variable. The random variable can be changed via the attribute 'Variable'. */ class RandomPropagationDelayModel : public PropagationDelayModel { @@ -85,7 +86,7 @@ static TypeId GetTypeId (void); /** - * Use the default parameters from PropagationDelayRandomDistribution. + * Simply constructs the object */ RandomPropagationDelayModel (); virtual ~RandomPropagationDelayModel (); @@ -98,7 +99,8 @@ /** * \ingroup propagation * - * \brief the propagation speed is constant + * \brief the propagation speed is constant, defaulting to the global + * value 'SpeedOfLight' (default speed of light in a vacuum) */ class ConstantSpeedPropagationDelayModel : public PropagationDelayModel { @@ -110,21 +112,12 @@ static TypeId GetTypeId (void); /** - * Use the default parameters from PropagationDelayConstantSpeed. + * Simply constructs the object */ ConstantSpeedPropagationDelayModel (); virtual Time GetDelay (Ptr a, Ptr b) const; - /** - * \param speed the new speed (m/s) - */ - void SetSpeed (double speed); - /** - * \returns the current propagation speed (m/s). - */ - double GetSpeed (void) const; private: virtual int64_t DoAssignStreams (int64_t stream); - double m_speed; //!< speed }; } // namespace ns3