View | Details | Raw Unified | Return to bug 2011
Collapse All | Expand All

(-)a/CHANGES.html (+3 lines)
 Lines 72-77    Link Here 
72
  </li>  
72
  </li>  
73
  <li>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. 
73
  <li>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. 
74
  </li>
74
  </li>
75
  <li> 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.
75
</ul>
76
</ul>
76
77
77
<h2>Changes to build system:</h2>
78
<h2>Changes to build system:</h2>
 Lines 80-85    Link Here 
80
81
81
<h2>Changed behavior:</h2>
82
<h2>Changed behavior:</h2>
82
<ul>
83
<ul>
84
  <li> Propagation delays for models using the default ConstantDelayPropagationModel will have changed slightly, according to the replacement of the 'Speed' attribute discussed above.
85
  </li>
83
</ul>
86
</ul>
84
87
85
<hr>
88
<hr>
(-)a/src/propagation/model/propagation-delay-model.cc (-16 / +9 lines)
 Lines 22-32    Link Here 
22
#include "ns3/double.h"
22
#include "ns3/double.h"
23
#include "ns3/string.h"
23
#include "ns3/string.h"
24
#include "ns3/pointer.h"
24
#include "ns3/pointer.h"
25
#include "ns3/global-value.h"
25
26
26
namespace ns3 {
27
namespace ns3 {
27
28
28
NS_OBJECT_ENSURE_REGISTERED (PropagationDelayModel);
29
NS_OBJECT_ENSURE_REGISTERED (PropagationDelayModel);
29
30
31
static GlobalValue g_speedOfLight ("SpeedOfLight",
32
                                   "The speed of light in a vacuum (m/s)",
33
                                   ns3::DoubleValue(299792458),
34
                                   ns3::MakeDoubleChecker<double> ());
35
30
TypeId 
36
TypeId 
31
PropagationDelayModel::GetTypeId (void)
37
PropagationDelayModel::GetTypeId (void)
32
{
38
{
 Lines 92-101    Link Here 
92
  static TypeId tid = TypeId ("ns3::ConstantSpeedPropagationDelayModel")
98
  static TypeId tid = TypeId ("ns3::ConstantSpeedPropagationDelayModel")
93
    .SetParent<PropagationDelayModel> ()
99
    .SetParent<PropagationDelayModel> ()
94
    .AddConstructor<ConstantSpeedPropagationDelayModel> ()
100
    .AddConstructor<ConstantSpeedPropagationDelayModel> ()
95
    .AddAttribute ("Speed", "The speed (m/s)",
96
                   DoubleValue (300000000.0),
97
                   MakeDoubleAccessor (&ConstantSpeedPropagationDelayModel::m_speed),
98
                   MakeDoubleChecker<double> ())
99
  ;
101
  ;
100
  return tid;
102
  return tid;
101
}
103
}
 Lines 107-124    Link Here 
107
ConstantSpeedPropagationDelayModel::GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
109
ConstantSpeedPropagationDelayModel::GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
108
{
110
{
109
  double distance = a->GetDistanceFrom (b);
111
  double distance = a->GetDistanceFrom (b);
110
  double seconds = distance / m_speed;
112
  DoubleValue speedValue;
111
  return Seconds (seconds);
113
  g_speedOfLight.GetValue (speedValue);
112
}
114
  return Seconds (distance/speedValue.Get ());
113
void
114
ConstantSpeedPropagationDelayModel::SetSpeed (double speed)
115
{
116
  m_speed = speed;
117
}
118
double
119
ConstantSpeedPropagationDelayModel::GetSpeed (void) const
120
{
121
  return m_speed;
122
}
115
}
123
116
124
int64_t
117
int64_t
(-)a/src/propagation/model/propagation-delay-model.h (-13 / +6 lines)
 Lines 73-79    Link Here 
73
/**
73
/**
74
 * \ingroup propagation
74
 * \ingroup propagation
75
 *
75
 *
76
 * \brief the propagation delay is random
76
 * \brief the propagation delay is random, defaulting to a U(0,1) random
77
 * variable.  The random variable can be changed via the attribute 'Variable'.
77
 */
78
 */
78
class RandomPropagationDelayModel : public PropagationDelayModel
79
class RandomPropagationDelayModel : public PropagationDelayModel
79
{
80
{
 Lines 85-91    Link Here 
85
  static TypeId GetTypeId (void);
86
  static TypeId GetTypeId (void);
86
87
87
  /**
88
  /**
88
   * Use the default parameters from PropagationDelayRandomDistribution.
89
   * Simply constructs the object
89
   */
90
   */
90
  RandomPropagationDelayModel ();
91
  RandomPropagationDelayModel ();
91
  virtual ~RandomPropagationDelayModel ();
92
  virtual ~RandomPropagationDelayModel ();
 Lines 98-104    Link Here 
98
/**
99
/**
99
 * \ingroup propagation
100
 * \ingroup propagation
100
 *
101
 *
101
 * \brief the propagation speed is constant
102
 * \brief the propagation speed is constant, defaulting to the global
103
 * value 'SpeedOfLight' (default speed of light in a vacuum)
102
 */
104
 */
103
class ConstantSpeedPropagationDelayModel : public PropagationDelayModel
105
class ConstantSpeedPropagationDelayModel : public PropagationDelayModel
104
{
106
{
 Lines 110-130    Link Here 
110
  static TypeId GetTypeId (void);
112
  static TypeId GetTypeId (void);
111
113
112
  /**
114
  /**
113
   * Use the default parameters from PropagationDelayConstantSpeed.
115
   * Simply constructs the object
114
   */
116
   */
115
  ConstantSpeedPropagationDelayModel ();
117
  ConstantSpeedPropagationDelayModel ();
116
  virtual Time GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
118
  virtual Time GetDelay (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
117
  /**
118
   * \param speed the new speed (m/s)
119
   */
120
  void SetSpeed (double speed);
121
  /**
122
   * \returns the current propagation speed (m/s).
123
   */
124
  double GetSpeed (void) const;
125
private:
119
private:
126
  virtual int64_t DoAssignStreams (int64_t stream);
120
  virtual int64_t DoAssignStreams (int64_t stream);
127
  double m_speed; //!< speed
128
};
121
};
129
122
130
} // namespace ns3
123
} // namespace ns3

Return to bug 2011