position.h -> mobility-model.h
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 04 Jul 2007 10:15:18 +0200
changeset 1580 0d2cf8839aee
parent 1579 a4187ed1e45e
child 1581 95a193d3ac1d
position.h -> mobility-model.h
SConstruct
samples/main-grid-topology.cc
samples/main-random-walk.cc
src/node/grid-topology.cc
src/node/mobility-model-notifier.h
src/node/mobility-model.cc
src/node/mobility-model.h
src/node/position.cc
src/node/position.h
src/node/random-direction-mobility-model.cc
src/node/random-direction-mobility-model.h
src/node/random-direction-position.cc
src/node/random-direction-position.h
src/node/random-mobility-model.cc
src/node/random-mobility-model.h
src/node/random-rectangle-topology.cc
src/node/random-walk-mobility-model.cc
src/node/random-walk-mobility-model.h
src/node/random-walk-position.cc
src/node/random-walk-position.h
src/node/static-mobility-model.cc
src/node/static-mobility-model.h
src/node/static-position.cc
src/node/static-position.h
src/node/static-speed-mobility-model.cc
src/node/static-speed-mobility-model.h
src/node/static-speed-position.cc
src/node/static-speed-position.h
--- a/SConstruct	Wed Jul 04 10:04:08 2007 +0200
+++ b/SConstruct	Wed Jul 04 10:15:18 2007 +0200
@@ -248,14 +248,14 @@
     'udp.cc',
     'ipv4.cc',
     'application.cc',
-    'position.cc',
+    'mobility-model.cc',
     'mobility-model-notifier.cc',
-    'static-position.cc',
-    'static-speed-position.cc',
+    'static-mobility-model.cc',
+    'static-speed-mobility-model.cc',
     'grid-topology.cc',
     'random-rectangle-topology.cc',
-    'random-walk-position.cc',
-    'random-direction-position.cc',
+    'random-walk-mobility-model.cc',
+    'random-direction-mobility-model.cc',
     ])
 node.add_inst_headers ([
     'node.h',
@@ -273,14 +273,14 @@
     'udp.h',
     'ipv4.h',
     'application.h',
-    'position.h',
+    'mobility-model.h',
     'mobility-model-notifier.h',
-    'static-position.h',
-    'static-speed-position.h',
+    'static-mobility-model.h',
+    'static-speed-mobility-model.h',
     'grid-topology.h',
     'random-rectangle-topology.h',
-    'random-walk-position.h',
-    'random-direction-position.h',
+    'random-walk-mobility-model.h',
+    'random-direction-mobility-model.h',
     ])
 
 applications = build.Ns3Module ('applications', 'src/applications')
--- a/samples/main-grid-topology.cc	Wed Jul 04 10:04:08 2007 +0200
+++ b/samples/main-grid-topology.cc	Wed Jul 04 10:15:18 2007 +0200
@@ -2,7 +2,7 @@
 
 #include "ns3/ptr.h"
 #include "ns3/grid-topology.h"
-#include "ns3/static-position.h"
+#include "ns3/static-mobility-model.h"
 #include "ns3/internet-node.h"
 #include "ns3/command-line.h"
 
--- a/samples/main-random-walk.cc	Wed Jul 04 10:04:08 2007 +0200
+++ b/samples/main-random-walk.cc	Wed Jul 04 10:15:18 2007 +0200
@@ -1,9 +1,9 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 
 #include "ns3/ptr.h"
-#include "ns3/position.h"
+#include "ns3/mobility-model.h"
 #include "ns3/mobility-model-notifier.h"
-#include "ns3/random-walk-position.h"
+#include "ns3/random-walk-mobility-model.h"
 #include "ns3/default-value.h"
 #include "ns3/command-line.h"
 #include "ns3/simulator.h"
--- a/src/node/grid-topology.cc	Wed Jul 04 10:04:08 2007 +0200
+++ b/src/node/grid-topology.cc	Wed Jul 04 10:15:18 2007 +0200
@@ -19,7 +19,7 @@
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 #include "grid-topology.h"
-#include "static-position.h"
+#include "static-mobility-model.h"
 
 namespace ns3 {
 
--- a/src/node/mobility-model-notifier.h	Wed Jul 04 10:04:08 2007 +0200
+++ b/src/node/mobility-model-notifier.h	Wed Jul 04 10:15:18 2007 +0200
@@ -24,7 +24,7 @@
 #include "ns3/object.h"
 #include "ns3/component-manager.h"
 #include "ns3/callback.h"
-#include "position.h"
+#include "mobility-model.h"
 
 namespace ns3 {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/mobility-model.cc	Wed Jul 04 10:15:18 2007 +0200
@@ -0,0 +1,123 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "mobility-model.h"
+#include "mobility-model-notifier.h"
+#include <math.h>
+
+namespace ns3 {
+
+const InterfaceId MobilityModel::iid = MakeInterfaceId ("MobilityModel", Object::iid);
+
+MobilityModel::MobilityModel ()
+{
+  SetInterfaceId (MobilityModel::iid);
+}
+
+MobilityModel::~MobilityModel ()
+{}
+
+void
+MobilityModel::Get (double &x, double &y, double &z) const
+{
+  DoGet (x,y,z);
+}
+double 
+MobilityModel::GetX (void) const
+{
+  double x,y,z;
+  DoGet (x,y,z);
+  return x;
+}
+double 
+MobilityModel::GetY (void) const
+{
+  double x, y, z;
+  DoGet (x,y,z);
+  return y;
+}
+double 
+MobilityModel::GetZ (void) const
+{
+  double x, y, z;
+  DoGet (x,y,z);
+  return z;
+}
+
+void 
+MobilityModel::Set (double x, double y, double z)
+{
+  DoSet (x, y, z);
+}
+void 
+MobilityModel::SetXY (double x, double y)
+{
+  double currentX, currentY, currentZ;
+  DoGet (currentX, currentY, currentZ);
+  DoSet (x, y, currentZ);
+ }
+void 
+MobilityModel::SetX (double x)
+{
+  double currentX, currentY, currentZ;
+  DoGet (currentX, currentY, currentZ);
+  DoSet (x, currentY, currentZ);
+}
+void 
+MobilityModel::SetY (double y)
+{
+  double currentX, currentY, currentZ;
+  DoGet (currentX, currentY, currentZ);
+  DoSet (currentX, y, currentZ);
+}
+void 
+MobilityModel::SetZ (double z)
+{
+  double currentX, currentY, currentZ;
+  DoGet (currentX, currentY, currentZ);
+  DoSet (currentX, currentY, z);
+}
+
+
+double 
+MobilityModel::GetDistanceFrom (const MobilityModel &position) const
+{
+  double ox,oy,oz;
+  double x,y,z;
+  position.DoGet (ox,oy,oz);
+  DoGet (x,y,z);
+  double dx = ox - x;
+  double dy = oy - y;
+  double dz = oz - z;
+  return sqrt (dx*dx+dy*dy+dz*dz);
+}
+
+void
+MobilityModel::NotifyCourseChange (void) const
+{
+  Ptr<MobilityModelNotifier> notifier = 
+    QueryInterface<MobilityModelNotifier> (MobilityModelNotifier::iid);
+  if (notifier != 0)
+    {
+      notifier->Notify (this);
+    }
+}
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/mobility-model.h	Wed Jul 04 10:15:18 2007 +0200
@@ -0,0 +1,108 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef POSITION_H
+#define POSITION_H
+
+#include "ns3/object.h"
+
+namespace ns3 {
+
+/**
+ * \brief keep track of the current position of an object
+ *
+ * All space coordinates in this class and its subclasses are
+ * understood to be meters or meters/s. i.e., they are all
+ * metric international units.
+ */
+class MobilityModel : public Object
+{
+public:
+  static const InterfaceId iid;
+  MobilityModel ();
+  virtual ~MobilityModel () = 0;
+
+  /**
+   * \param x reference to floating-point variable for x coordinate.
+   * \param y reference to floating-point variable for y coordinate.
+   * \param z reference to floating-point variable for z coordinate.
+   *
+   * Store in the x, y, and z variables the current coordinates
+   * managed by this position object.
+   * Unit is meters
+   */
+  void Get (double &x, double &y, double &z) const;
+  /**
+   * \returns the current x coordinate
+   *
+   * Unit is meters
+   */
+  double GetX (void) const;
+  /**
+   * \returns the current y coordinate
+   *
+   * Unit is meters
+   */
+  double GetY (void) const;
+  /**
+   * \returns the current z coordinate
+   *
+   * Unit is meters
+   */
+  double GetZ (void) const;
+
+  void Add (double dx, double dy, double dz);
+
+  void Set (double x, double y, double z);
+  void SetXY (double x, double y);
+  void SetX (double x);
+  void SetY (double y);
+  void SetZ (double z);
+  /**
+   * \param position a reference to another position object instance
+   * \returns the distance between the two objects.
+   *
+   * Unit is meters
+   */
+  double GetDistanceFrom (const MobilityModel &position) const;
+protected:
+  /**
+   * Must be invoked by subclasses when the course of the
+   * position changes to notify course change listeners.
+   */
+  void NotifyCourseChange (void) const;
+private:
+  /**
+   * \param x reference to floating-point variable for x coordinate.
+   * \param y reference to floating-point variable for y coordinate.
+   * \param z reference to floating-point variable for z coordinate.
+   *
+   * Store in the x, y, and z variables the current coordinates
+   * managed by this position object. Concrete subclasses of this 
+   * base class must implement this method.
+   * Unit is meters
+   */
+  virtual void DoGet (double &x, double &y, double &z) const = 0;
+  virtual void DoSet (double x, double y, double z) = 0;
+};
+
+}; // namespace ns3
+
+#endif /* POSITION_H */
--- a/src/node/position.cc	Wed Jul 04 10:04:08 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006,2007 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "position.h"
-#include "mobility-model-notifier.h"
-#include <math.h>
-
-namespace ns3 {
-
-const InterfaceId MobilityModel::iid = MakeInterfaceId ("MobilityModel", Object::iid);
-
-MobilityModel::MobilityModel ()
-{
-  SetInterfaceId (MobilityModel::iid);
-}
-
-MobilityModel::~MobilityModel ()
-{}
-
-void
-MobilityModel::Get (double &x, double &y, double &z) const
-{
-  DoGet (x,y,z);
-}
-double 
-MobilityModel::GetX (void) const
-{
-  double x,y,z;
-  DoGet (x,y,z);
-  return x;
-}
-double 
-MobilityModel::GetY (void) const
-{
-  double x, y, z;
-  DoGet (x,y,z);
-  return y;
-}
-double 
-MobilityModel::GetZ (void) const
-{
-  double x, y, z;
-  DoGet (x,y,z);
-  return z;
-}
-
-void 
-MobilityModel::Set (double x, double y, double z)
-{
-  DoSet (x, y, z);
-}
-void 
-MobilityModel::SetXY (double x, double y)
-{
-  double currentX, currentY, currentZ;
-  DoGet (currentX, currentY, currentZ);
-  DoSet (x, y, currentZ);
- }
-void 
-MobilityModel::SetX (double x)
-{
-  double currentX, currentY, currentZ;
-  DoGet (currentX, currentY, currentZ);
-  DoSet (x, currentY, currentZ);
-}
-void 
-MobilityModel::SetY (double y)
-{
-  double currentX, currentY, currentZ;
-  DoGet (currentX, currentY, currentZ);
-  DoSet (currentX, y, currentZ);
-}
-void 
-MobilityModel::SetZ (double z)
-{
-  double currentX, currentY, currentZ;
-  DoGet (currentX, currentY, currentZ);
-  DoSet (currentX, currentY, z);
-}
-
-
-double 
-MobilityModel::GetDistanceFrom (const MobilityModel &position) const
-{
-  double ox,oy,oz;
-  double x,y,z;
-  position.DoGet (ox,oy,oz);
-  DoGet (x,y,z);
-  double dx = ox - x;
-  double dy = oy - y;
-  double dz = oz - z;
-  return sqrt (dx*dx+dy*dy+dz*dz);
-}
-
-void
-MobilityModel::NotifyCourseChange (void) const
-{
-  Ptr<MobilityModelNotifier> notifier = 
-    QueryInterface<MobilityModelNotifier> (MobilityModelNotifier::iid);
-  if (notifier != 0)
-    {
-      notifier->Notify (this);
-    }
-}
-
-} // namespace ns3
--- a/src/node/position.h	Wed Jul 04 10:04:08 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006,2007 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef POSITION_H
-#define POSITION_H
-
-#include "ns3/object.h"
-
-namespace ns3 {
-
-/**
- * \brief keep track of the current position of an object
- *
- * All space coordinates in this class and its subclasses are
- * understood to be meters or meters/s. i.e., they are all
- * metric international units.
- */
-class MobilityModel : public Object
-{
-public:
-  static const InterfaceId iid;
-  MobilityModel ();
-  virtual ~MobilityModel () = 0;
-
-  /**
-   * \param x reference to floating-point variable for x coordinate.
-   * \param y reference to floating-point variable for y coordinate.
-   * \param z reference to floating-point variable for z coordinate.
-   *
-   * Store in the x, y, and z variables the current coordinates
-   * managed by this position object.
-   * Unit is meters
-   */
-  void Get (double &x, double &y, double &z) const;
-  /**
-   * \returns the current x coordinate
-   *
-   * Unit is meters
-   */
-  double GetX (void) const;
-  /**
-   * \returns the current y coordinate
-   *
-   * Unit is meters
-   */
-  double GetY (void) const;
-  /**
-   * \returns the current z coordinate
-   *
-   * Unit is meters
-   */
-  double GetZ (void) const;
-
-  void Add (double dx, double dy, double dz);
-
-  void Set (double x, double y, double z);
-  void SetXY (double x, double y);
-  void SetX (double x);
-  void SetY (double y);
-  void SetZ (double z);
-  /**
-   * \param position a reference to another position object instance
-   * \returns the distance between the two objects.
-   *
-   * Unit is meters
-   */
-  double GetDistanceFrom (const MobilityModel &position) const;
-protected:
-  /**
-   * Must be invoked by subclasses when the course of the
-   * position changes to notify course change listeners.
-   */
-  void NotifyCourseChange (void) const;
-private:
-  /**
-   * \param x reference to floating-point variable for x coordinate.
-   * \param y reference to floating-point variable for y coordinate.
-   * \param z reference to floating-point variable for z coordinate.
-   *
-   * Store in the x, y, and z variables the current coordinates
-   * managed by this position object. Concrete subclasses of this 
-   * base class must implement this method.
-   * Unit is meters
-   */
-  virtual void DoGet (double &x, double &y, double &z) const = 0;
-  virtual void DoSet (double x, double y, double z) = 0;
-};
-
-}; // namespace ns3
-
-#endif /* POSITION_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/random-direction-mobility-model.cc	Wed Jul 04 10:15:18 2007 +0200
@@ -0,0 +1,339 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "ns3/random-variable-default-value.h"
+#include "ns3/rectangle-default-value.h"
+#include "ns3/simulator.h"
+#include <algorithm>
+#include <cmath>
+#include "random-direction-mobility-model.h"
+
+namespace ns3 {
+
+const double RandomDirectionMobilityModel::PI = 3.1415;
+const InterfaceId RandomDirectionMobilityModel::iid = 
+  MakeInterfaceId ("RandomDirectionMobilityModel", MobilityModel::iid);
+const ClassId RandomDirectionMobilityModel::cid = 
+  MakeClassId<RandomDirectionMobilityModel,double,double> ("RandomDirectionMobilityModel",
+						      RandomDirectionMobilityModel::iid);
+
+
+static RandomVariableDefaultValue 
+  g_speedVariable ("RandomDirectionSpeed",
+		   "A random variable to control the speed of a RandomDirection mobility model.",
+		   "Uniform:1:2");
+
+static RandomVariableDefaultValue
+  g_pauseVariable ("RandomDirectionPause",
+		   "A random variable to control the duration of of the pause of a RandomDiretion mobility model.",
+		   "Constant:2");
+
+static RectangleDefaultValue
+  g_rectangle ("RandomDirectionArea",
+	       "The bounding area for the RandomDirection model.",
+	       -100, 100, -100, 100);
+
+
+RandomDirectionParameters::RandomDirectionParameters ()
+  : m_xMin (g_rectangle.GetMinX ()),
+    m_xMax (g_rectangle.GetMaxX ()),
+    m_yMin (g_rectangle.GetMinY ()),
+    m_yMax (g_rectangle.GetMaxY ()),
+    m_speedVariable (g_speedVariable.GetCopy ()),
+    m_pauseVariable (g_pauseVariable.GetCopy ())
+{}
+RandomDirectionParameters::RandomDirectionParameters (double xMin, double xMax, double yMin, double yMax)
+  : m_xMin (xMin),
+    m_xMax (xMax),
+    m_yMin (yMin),
+    m_yMax (yMax),
+    m_speedVariable (g_speedVariable.GetCopy ()),
+    m_pauseVariable (g_pauseVariable.GetCopy ())
+{}
+RandomDirectionParameters::RandomDirectionParameters (double xMin, double xMax, double yMin, double yMax,
+						      const RandomVariable &speedVariable,
+						      const RandomVariable &pauseVariable)
+  : m_xMin (xMin),
+    m_xMax (xMax),
+    m_yMin (yMin),
+    m_yMax (yMax),
+    m_speedVariable (speedVariable.Copy ()),
+    m_pauseVariable (pauseVariable.Copy ())
+{}
+
+RandomDirectionParameters::~RandomDirectionParameters ()
+{
+  delete m_speedVariable;
+  delete m_pauseVariable;
+  m_speedVariable = 0;
+  m_pauseVariable = 0;
+}
+
+void 
+RandomDirectionParameters::SetSpeed (const RandomVariable &speedVariable)
+{
+  delete m_speedVariable;
+  m_speedVariable = speedVariable.Copy ();
+}
+void 
+RandomDirectionParameters::SetPause (const RandomVariable &pauseVariable)
+{
+  delete m_pauseVariable;
+  m_pauseVariable = pauseVariable.Copy ();
+}
+void 
+RandomDirectionParameters::SetBounds (double xMin, double xMax, double yMin, double yMax)
+{
+  m_xMin = xMin;
+  m_yMin = yMin;
+  m_xMax = xMax;
+  m_yMax = yMax;
+}
+
+Ptr<RandomDirectionParameters> 
+RandomDirectionMobilityModel::GetDefaultParameters (void)
+{
+  static Ptr<RandomDirectionParameters> parameters = Create<RandomDirectionParameters> ();
+  if (parameters->m_xMin != g_rectangle.GetMinX () ||
+      parameters->m_yMin != g_rectangle.GetMinY () ||
+      parameters->m_xMax != g_rectangle.GetMaxX () ||
+      parameters->m_yMax != g_rectangle.GetMaxY () ||
+      g_speedVariable.IsDirty () ||
+      g_pauseVariable.IsDirty ())
+    {
+      parameters = Create<RandomDirectionParameters> ();
+      g_speedVariable.ClearDirtyFlag ();
+      g_pauseVariable.ClearDirtyFlag ();
+    }
+  return parameters;
+}
+
+
+RandomDirectionMobilityModel::RandomDirectionMobilityModel ()
+  : m_parameters (GetDefaultParameters ()),
+    m_x (0.0),
+    m_y (0.0),
+    m_dx (0.0),
+    m_dy (0.0),
+    m_prevTime (Simulator::Now ()),
+    m_pauseStart (Simulator::Now ())
+{
+  SetInterfaceId (RandomDirectionMobilityModel::iid);
+  InitializeDirectionAndSpeed ();
+}
+bool
+RandomDirectionMobilityModel::CheckMobilityModel (void) const
+{
+  return 
+    m_x <= m_parameters->m_xMax && 
+    m_x >= m_parameters->m_xMin &&
+    m_y <= m_parameters->m_yMax && 
+    m_y >= m_parameters->m_yMin;
+}
+
+RandomDirectionMobilityModel::RandomDirectionMobilityModel (double x, double y)
+  : m_parameters (GetDefaultParameters ()),
+    m_x (x),
+    m_y (y),
+    m_dx (0.0),
+    m_dy (0.0),
+    m_prevTime (Simulator::Now ()),
+    m_pauseStart (Simulator::Now ())
+{
+  SetInterfaceId (RandomDirectionMobilityModel::iid);
+  NS_ASSERT (CheckMobilityModel ());
+  InitializeDirectionAndSpeed ();
+}
+RandomDirectionMobilityModel::RandomDirectionMobilityModel (Ptr<RandomDirectionParameters> parameters)
+  : m_parameters (parameters),
+    m_x (0.0),
+    m_y (0.0),
+    m_dx (0.0),
+    m_dy (0.0),
+    m_prevTime (Simulator::Now ()),
+    m_pauseStart (Simulator::Now ())
+{
+  SetInterfaceId (RandomDirectionMobilityModel::iid);
+  InitializeDirectionAndSpeed ();
+  NS_ASSERT (CheckMobilityModel ());
+}
+RandomDirectionMobilityModel::RandomDirectionMobilityModel (Ptr<RandomDirectionParameters> parameters,
+						  double x, double y)
+  : m_parameters (parameters),
+    m_x (x),
+    m_y (y),
+    m_dx (0.0),
+    m_dy (0.0),
+    m_prevTime (Simulator::Now ()),
+    m_pauseStart (Simulator::Now ())
+{
+  SetInterfaceId (RandomDirectionMobilityModel::iid);
+  InitializeDirectionAndSpeed ();
+  NS_ASSERT (CheckMobilityModel ());
+}
+void 
+RandomDirectionMobilityModel::DoDispose (void)
+{
+  m_parameters = 0;
+  // chain up.
+  MobilityModel::DoDispose ();
+}
+enum RandomDirectionMobilityModel::Side
+RandomDirectionMobilityModel::CalculateIntersection (double &x, double &y)
+{
+  double xMin = m_parameters->m_xMin;
+  double xMax = m_parameters->m_xMax;
+  double yMin = m_parameters->m_yMin;
+  double yMax = m_parameters->m_yMax;
+  double xMaxY = m_y + (xMax - m_x) / m_dx * m_dy;
+  double xMinY = m_y + (xMin - m_x) / m_dx * m_dy;
+  double yMaxX = m_x + (yMax - m_y) / m_dy * m_dx;
+  double yMinX = m_x + (yMin - m_y) / m_dy * m_dx;
+  bool xMaxOk = xMaxY <= yMax && xMaxY >= yMin;
+  bool xMinOk = xMinY <= yMax && xMinY >= yMin;
+  bool yMaxOk = yMaxX <= xMax && yMaxX >= xMin;
+  bool yMinOk = yMinX <= xMax && yMinX >= xMin;
+  if (xMaxOk && m_dx >= 0)
+    {
+      x = xMax;
+      y = xMaxY;
+      return RandomDirectionMobilityModel::RIGHT;
+    }
+  else if (xMinOk && m_dx <= 0)
+    {
+      x = xMin;
+      y = xMinY;
+      return RandomDirectionMobilityModel::LEFT;
+    }
+  else if (yMaxOk && m_dy >= 0)
+    {
+      x = yMaxX;
+      y = yMax;
+      return RandomDirectionMobilityModel::TOP;
+    }
+  else if (yMinOk && m_dy <= 0)
+    {
+      x = yMinX;
+      y = yMin;
+      return RandomDirectionMobilityModel::BOTTOM;
+    }
+  else
+    {
+      NS_ASSERT (false);
+      // quiet compiler
+      return RandomDirectionMobilityModel::RIGHT;
+    }
+}
+void
+RandomDirectionMobilityModel::InitializeDirectionAndSpeed (void)
+{
+  double direction = UniformVariable::GetSingleValue (0, 2 * PI);
+  SetDirectionAndSpeed (direction);
+}
+void
+RandomDirectionMobilityModel::SetDirectionAndSpeed (double direction)
+{
+  double speed = m_parameters->m_speedVariable->GetValue ();
+  m_dx = std::cos (direction) * speed;
+  m_dy = std::sin (direction) * speed;
+  double x, y;
+  m_side = CalculateIntersection (x, y);
+  double deltaX = x - m_x;
+  double deltaY = y - m_y;
+  double distance = sqrt (deltaX * deltaX + deltaY * deltaY);
+  double seconds = distance / speed;
+  double pause = m_parameters->m_pauseVariable->GetValue ();
+  m_pauseStart = Simulator::Now () + Seconds (seconds);
+  m_prevTime = Simulator::Now ();
+  m_event = Simulator::Schedule (Seconds (seconds + pause),
+				 &RandomDirectionMobilityModel::ResetDirectionAndSpeed, this);
+}
+void
+RandomDirectionMobilityModel::ResetDirectionAndSpeed (void)
+{
+  Update ();
+  double direction = UniformVariable::GetSingleValue (0, PI);
+  switch (m_side)
+    {
+    case RandomDirectionMobilityModel::RIGHT:
+      direction += PI / 2;
+      break;
+    case RandomDirectionMobilityModel::LEFT:
+      direction += - PI / 2;
+      break;
+    case RandomDirectionMobilityModel::TOP:
+      direction += PI;
+      break;
+    case RandomDirectionMobilityModel::BOTTOM:
+      direction += 0.0;
+      break;
+    }
+  SetDirectionAndSpeed (direction);
+  NotifyCourseChange ();
+}
+void
+RandomDirectionMobilityModel::Update (void) const
+{
+  Time end = std::min (Simulator::Now (), m_pauseStart);
+  if (m_prevTime >= end)
+    {
+      return;
+    }
+  Time deltaTime = end - m_prevTime;
+  m_prevTime = Simulator::Now ();
+  double deltaS = deltaTime.GetSeconds ();
+  NS_ASSERT (CheckMobilityModel ());
+  m_x += m_dx * deltaS;
+  m_y += m_dy * deltaS;
+  // round to closest boundaries.
+  m_x = std::min (m_x, m_parameters->m_xMax);
+  m_x = std::max (m_x, m_parameters->m_xMin);
+  m_y = std::min (m_y, m_parameters->m_yMax);
+  m_y = std::max (m_y, m_parameters->m_yMin);
+  NS_ASSERT (CheckMobilityModel ());
+}
+void 
+RandomDirectionMobilityModel::DoGet (double &x, double &y, double &z) const
+{
+  Update ();
+  x = m_x;
+  y = m_y;
+  z = 0;
+}
+void
+RandomDirectionMobilityModel::DoSet (double x, double y, double z)
+{
+  bool changed = false;
+  if (m_x != x || m_y != y)
+    {
+      changed = true;
+    }
+  m_x = x;
+  m_y = y;
+  m_prevTime = Simulator::Now ();
+  m_pauseStart = Simulator::Now ();
+  Simulator::Remove (m_event);
+  InitializeDirectionAndSpeed ();
+  NotifyCourseChange ();
+}
+
+
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/random-direction-mobility-model.h	Wed Jul 04 10:15:18 2007 +0200
@@ -0,0 +1,103 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef RANDOM_DIRECTION_POSITION_H
+#define RANDOM_DIRECTION_POSITION_H
+
+#include "ns3/object.h"
+#include "ns3/ptr.h"
+#include "ns3/nstime.h"
+#include "ns3/event-id.h"
+#include "ns3/component-manager.h"
+#include "mobility-model.h"
+
+namespace ns3 {
+
+class RandomVariable;
+
+class RandomDirectionParameters : public Object
+{
+ public:
+  RandomDirectionParameters ();
+  RandomDirectionParameters (double xMin, double xMax, double yMin, double yMax);
+  RandomDirectionParameters (double xMin, double xMax, double yMin, double yMax,
+			     const RandomVariable &speedVariable,
+			     const RandomVariable &pauseVariable);
+  virtual ~RandomDirectionParameters ();
+
+  void SetSpeed (const RandomVariable &speedVariable);
+  void SetPause (const RandomVariable &pauseVariable);
+  void SetBounds (double xMin, double xMax, double yMin, double yMax);
+ private:
+  friend class RandomDirectionMobilityModel;
+  double m_xMin;
+  double m_xMax;
+  double m_yMin;
+  double m_yMax;
+  RandomVariable *m_speedVariable;
+  RandomVariable *m_pauseVariable;
+  std::string m_speedVariableValue;
+  std::string m_pauseVariableValue;
+};
+
+class RandomDirectionMobilityModel : public MobilityModel
+{
+ public:
+  static const InterfaceId iid;
+  static const ClassId cid;
+
+  RandomDirectionMobilityModel ();
+  RandomDirectionMobilityModel (double x, double y);
+  RandomDirectionMobilityModel (Ptr<RandomDirectionParameters> parameters);
+  RandomDirectionMobilityModel (Ptr<RandomDirectionParameters> parameters, 
+			   double x, double y);
+ private:
+  enum Side {
+    TOP,
+    BOTTOM,
+    LEFT,
+    RIGHT
+  };
+  static Ptr<RandomDirectionParameters> GetDefaultParameters (void);
+  void ResetDirectionAndSpeed (void);
+  void SetDirectionAndSpeed (double direction);
+  void InitializeDirectionAndSpeed (void);
+  void Update (void) const;
+  bool CheckMobilityModel (void) const;
+  enum RandomDirectionMobilityModel::Side CalculateIntersection (double &x, double &y);
+  virtual void DoDispose (void);
+  virtual void DoGet (double &x, double &y, double &z) const;
+  virtual void DoSet (double x, double y, double z);
+
+  static const double PI;
+  Ptr<RandomDirectionParameters> m_parameters;
+  mutable double m_x;
+  mutable double m_y;
+  double m_dx;
+  double m_dy;
+  mutable Time m_prevTime;
+  Time m_pauseStart;
+  EventId m_event;
+  enum Side m_side;
+};
+
+} // namespace ns3
+
+#endif /* RANDOM_DIRECTION_POSITION_H */
--- a/src/node/random-direction-position.cc	Wed Jul 04 10:04:08 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "ns3/random-variable-default-value.h"
-#include "ns3/rectangle-default-value.h"
-#include "ns3/simulator.h"
-#include <algorithm>
-#include <cmath>
-#include "random-direction-position.h"
-
-namespace ns3 {
-
-const double RandomDirectionMobilityModel::PI = 3.1415;
-const InterfaceId RandomDirectionMobilityModel::iid = 
-  MakeInterfaceId ("RandomDirectionMobilityModel", MobilityModel::iid);
-const ClassId RandomDirectionMobilityModel::cid = 
-  MakeClassId<RandomDirectionMobilityModel,double,double> ("RandomDirectionMobilityModel",
-						      RandomDirectionMobilityModel::iid);
-
-
-static RandomVariableDefaultValue 
-  g_speedVariable ("RandomDirectionSpeed",
-		   "A random variable to control the speed of a RandomDirection mobility model.",
-		   "Uniform:1:2");
-
-static RandomVariableDefaultValue
-  g_pauseVariable ("RandomDirectionPause",
-		   "A random variable to control the duration of of the pause of a RandomDiretion mobility model.",
-		   "Constant:2");
-
-static RectangleDefaultValue
-  g_rectangle ("RandomDirectionArea",
-	       "The bounding area for the RandomDirection model.",
-	       -100, 100, -100, 100);
-
-
-RandomDirectionParameters::RandomDirectionParameters ()
-  : m_xMin (g_rectangle.GetMinX ()),
-    m_xMax (g_rectangle.GetMaxX ()),
-    m_yMin (g_rectangle.GetMinY ()),
-    m_yMax (g_rectangle.GetMaxY ()),
-    m_speedVariable (g_speedVariable.GetCopy ()),
-    m_pauseVariable (g_pauseVariable.GetCopy ())
-{}
-RandomDirectionParameters::RandomDirectionParameters (double xMin, double xMax, double yMin, double yMax)
-  : m_xMin (xMin),
-    m_xMax (xMax),
-    m_yMin (yMin),
-    m_yMax (yMax),
-    m_speedVariable (g_speedVariable.GetCopy ()),
-    m_pauseVariable (g_pauseVariable.GetCopy ())
-{}
-RandomDirectionParameters::RandomDirectionParameters (double xMin, double xMax, double yMin, double yMax,
-						      const RandomVariable &speedVariable,
-						      const RandomVariable &pauseVariable)
-  : m_xMin (xMin),
-    m_xMax (xMax),
-    m_yMin (yMin),
-    m_yMax (yMax),
-    m_speedVariable (speedVariable.Copy ()),
-    m_pauseVariable (pauseVariable.Copy ())
-{}
-
-RandomDirectionParameters::~RandomDirectionParameters ()
-{
-  delete m_speedVariable;
-  delete m_pauseVariable;
-  m_speedVariable = 0;
-  m_pauseVariable = 0;
-}
-
-void 
-RandomDirectionParameters::SetSpeed (const RandomVariable &speedVariable)
-{
-  delete m_speedVariable;
-  m_speedVariable = speedVariable.Copy ();
-}
-void 
-RandomDirectionParameters::SetPause (const RandomVariable &pauseVariable)
-{
-  delete m_pauseVariable;
-  m_pauseVariable = pauseVariable.Copy ();
-}
-void 
-RandomDirectionParameters::SetBounds (double xMin, double xMax, double yMin, double yMax)
-{
-  m_xMin = xMin;
-  m_yMin = yMin;
-  m_xMax = xMax;
-  m_yMax = yMax;
-}
-
-Ptr<RandomDirectionParameters> 
-RandomDirectionMobilityModel::GetDefaultParameters (void)
-{
-  static Ptr<RandomDirectionParameters> parameters = Create<RandomDirectionParameters> ();
-  if (parameters->m_xMin != g_rectangle.GetMinX () ||
-      parameters->m_yMin != g_rectangle.GetMinY () ||
-      parameters->m_xMax != g_rectangle.GetMaxX () ||
-      parameters->m_yMax != g_rectangle.GetMaxY () ||
-      g_speedVariable.IsDirty () ||
-      g_pauseVariable.IsDirty ())
-    {
-      parameters = Create<RandomDirectionParameters> ();
-      g_speedVariable.ClearDirtyFlag ();
-      g_pauseVariable.ClearDirtyFlag ();
-    }
-  return parameters;
-}
-
-
-RandomDirectionMobilityModel::RandomDirectionMobilityModel ()
-  : m_parameters (GetDefaultParameters ()),
-    m_x (0.0),
-    m_y (0.0),
-    m_dx (0.0),
-    m_dy (0.0),
-    m_prevTime (Simulator::Now ()),
-    m_pauseStart (Simulator::Now ())
-{
-  SetInterfaceId (RandomDirectionMobilityModel::iid);
-  InitializeDirectionAndSpeed ();
-}
-bool
-RandomDirectionMobilityModel::CheckMobilityModel (void) const
-{
-  return 
-    m_x <= m_parameters->m_xMax && 
-    m_x >= m_parameters->m_xMin &&
-    m_y <= m_parameters->m_yMax && 
-    m_y >= m_parameters->m_yMin;
-}
-
-RandomDirectionMobilityModel::RandomDirectionMobilityModel (double x, double y)
-  : m_parameters (GetDefaultParameters ()),
-    m_x (x),
-    m_y (y),
-    m_dx (0.0),
-    m_dy (0.0),
-    m_prevTime (Simulator::Now ()),
-    m_pauseStart (Simulator::Now ())
-{
-  SetInterfaceId (RandomDirectionMobilityModel::iid);
-  NS_ASSERT (CheckMobilityModel ());
-  InitializeDirectionAndSpeed ();
-}
-RandomDirectionMobilityModel::RandomDirectionMobilityModel (Ptr<RandomDirectionParameters> parameters)
-  : m_parameters (parameters),
-    m_x (0.0),
-    m_y (0.0),
-    m_dx (0.0),
-    m_dy (0.0),
-    m_prevTime (Simulator::Now ()),
-    m_pauseStart (Simulator::Now ())
-{
-  SetInterfaceId (RandomDirectionMobilityModel::iid);
-  InitializeDirectionAndSpeed ();
-  NS_ASSERT (CheckMobilityModel ());
-}
-RandomDirectionMobilityModel::RandomDirectionMobilityModel (Ptr<RandomDirectionParameters> parameters,
-						  double x, double y)
-  : m_parameters (parameters),
-    m_x (x),
-    m_y (y),
-    m_dx (0.0),
-    m_dy (0.0),
-    m_prevTime (Simulator::Now ()),
-    m_pauseStart (Simulator::Now ())
-{
-  SetInterfaceId (RandomDirectionMobilityModel::iid);
-  InitializeDirectionAndSpeed ();
-  NS_ASSERT (CheckMobilityModel ());
-}
-void 
-RandomDirectionMobilityModel::DoDispose (void)
-{
-  m_parameters = 0;
-  // chain up.
-  MobilityModel::DoDispose ();
-}
-enum RandomDirectionMobilityModel::Side
-RandomDirectionMobilityModel::CalculateIntersection (double &x, double &y)
-{
-  double xMin = m_parameters->m_xMin;
-  double xMax = m_parameters->m_xMax;
-  double yMin = m_parameters->m_yMin;
-  double yMax = m_parameters->m_yMax;
-  double xMaxY = m_y + (xMax - m_x) / m_dx * m_dy;
-  double xMinY = m_y + (xMin - m_x) / m_dx * m_dy;
-  double yMaxX = m_x + (yMax - m_y) / m_dy * m_dx;
-  double yMinX = m_x + (yMin - m_y) / m_dy * m_dx;
-  bool xMaxOk = xMaxY <= yMax && xMaxY >= yMin;
-  bool xMinOk = xMinY <= yMax && xMinY >= yMin;
-  bool yMaxOk = yMaxX <= xMax && yMaxX >= xMin;
-  bool yMinOk = yMinX <= xMax && yMinX >= xMin;
-  if (xMaxOk && m_dx >= 0)
-    {
-      x = xMax;
-      y = xMaxY;
-      return RandomDirectionMobilityModel::RIGHT;
-    }
-  else if (xMinOk && m_dx <= 0)
-    {
-      x = xMin;
-      y = xMinY;
-      return RandomDirectionMobilityModel::LEFT;
-    }
-  else if (yMaxOk && m_dy >= 0)
-    {
-      x = yMaxX;
-      y = yMax;
-      return RandomDirectionMobilityModel::TOP;
-    }
-  else if (yMinOk && m_dy <= 0)
-    {
-      x = yMinX;
-      y = yMin;
-      return RandomDirectionMobilityModel::BOTTOM;
-    }
-  else
-    {
-      NS_ASSERT (false);
-      // quiet compiler
-      return RandomDirectionMobilityModel::RIGHT;
-    }
-}
-void
-RandomDirectionMobilityModel::InitializeDirectionAndSpeed (void)
-{
-  double direction = UniformVariable::GetSingleValue (0, 2 * PI);
-  SetDirectionAndSpeed (direction);
-}
-void
-RandomDirectionMobilityModel::SetDirectionAndSpeed (double direction)
-{
-  double speed = m_parameters->m_speedVariable->GetValue ();
-  m_dx = std::cos (direction) * speed;
-  m_dy = std::sin (direction) * speed;
-  double x, y;
-  m_side = CalculateIntersection (x, y);
-  double deltaX = x - m_x;
-  double deltaY = y - m_y;
-  double distance = sqrt (deltaX * deltaX + deltaY * deltaY);
-  double seconds = distance / speed;
-  double pause = m_parameters->m_pauseVariable->GetValue ();
-  m_pauseStart = Simulator::Now () + Seconds (seconds);
-  m_prevTime = Simulator::Now ();
-  m_event = Simulator::Schedule (Seconds (seconds + pause),
-				 &RandomDirectionMobilityModel::ResetDirectionAndSpeed, this);
-}
-void
-RandomDirectionMobilityModel::ResetDirectionAndSpeed (void)
-{
-  Update ();
-  double direction = UniformVariable::GetSingleValue (0, PI);
-  switch (m_side)
-    {
-    case RandomDirectionMobilityModel::RIGHT:
-      direction += PI / 2;
-      break;
-    case RandomDirectionMobilityModel::LEFT:
-      direction += - PI / 2;
-      break;
-    case RandomDirectionMobilityModel::TOP:
-      direction += PI;
-      break;
-    case RandomDirectionMobilityModel::BOTTOM:
-      direction += 0.0;
-      break;
-    }
-  SetDirectionAndSpeed (direction);
-  NotifyCourseChange ();
-}
-void
-RandomDirectionMobilityModel::Update (void) const
-{
-  Time end = std::min (Simulator::Now (), m_pauseStart);
-  if (m_prevTime >= end)
-    {
-      return;
-    }
-  Time deltaTime = end - m_prevTime;
-  m_prevTime = Simulator::Now ();
-  double deltaS = deltaTime.GetSeconds ();
-  NS_ASSERT (CheckMobilityModel ());
-  m_x += m_dx * deltaS;
-  m_y += m_dy * deltaS;
-  // round to closest boundaries.
-  m_x = std::min (m_x, m_parameters->m_xMax);
-  m_x = std::max (m_x, m_parameters->m_xMin);
-  m_y = std::min (m_y, m_parameters->m_yMax);
-  m_y = std::max (m_y, m_parameters->m_yMin);
-  NS_ASSERT (CheckMobilityModel ());
-}
-void 
-RandomDirectionMobilityModel::DoGet (double &x, double &y, double &z) const
-{
-  Update ();
-  x = m_x;
-  y = m_y;
-  z = 0;
-}
-void
-RandomDirectionMobilityModel::DoSet (double x, double y, double z)
-{
-  bool changed = false;
-  if (m_x != x || m_y != y)
-    {
-      changed = true;
-    }
-  m_x = x;
-  m_y = y;
-  m_prevTime = Simulator::Now ();
-  m_pauseStart = Simulator::Now ();
-  Simulator::Remove (m_event);
-  InitializeDirectionAndSpeed ();
-  NotifyCourseChange ();
-}
-
-
-
-} // namespace ns3
--- a/src/node/random-direction-position.h	Wed Jul 04 10:04:08 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef RANDOM_DIRECTION_POSITION_H
-#define RANDOM_DIRECTION_POSITION_H
-
-#include "ns3/object.h"
-#include "ns3/ptr.h"
-#include "ns3/nstime.h"
-#include "ns3/event-id.h"
-#include "ns3/component-manager.h"
-#include "position.h"
-
-namespace ns3 {
-
-class RandomVariable;
-
-class RandomDirectionParameters : public Object
-{
- public:
-  RandomDirectionParameters ();
-  RandomDirectionParameters (double xMin, double xMax, double yMin, double yMax);
-  RandomDirectionParameters (double xMin, double xMax, double yMin, double yMax,
-			     const RandomVariable &speedVariable,
-			     const RandomVariable &pauseVariable);
-  virtual ~RandomDirectionParameters ();
-
-  void SetSpeed (const RandomVariable &speedVariable);
-  void SetPause (const RandomVariable &pauseVariable);
-  void SetBounds (double xMin, double xMax, double yMin, double yMax);
- private:
-  friend class RandomDirectionMobilityModel;
-  double m_xMin;
-  double m_xMax;
-  double m_yMin;
-  double m_yMax;
-  RandomVariable *m_speedVariable;
-  RandomVariable *m_pauseVariable;
-  std::string m_speedVariableValue;
-  std::string m_pauseVariableValue;
-};
-
-class RandomDirectionMobilityModel : public MobilityModel
-{
- public:
-  static const InterfaceId iid;
-  static const ClassId cid;
-
-  RandomDirectionMobilityModel ();
-  RandomDirectionMobilityModel (double x, double y);
-  RandomDirectionMobilityModel (Ptr<RandomDirectionParameters> parameters);
-  RandomDirectionMobilityModel (Ptr<RandomDirectionParameters> parameters, 
-			   double x, double y);
- private:
-  enum Side {
-    TOP,
-    BOTTOM,
-    LEFT,
-    RIGHT
-  };
-  static Ptr<RandomDirectionParameters> GetDefaultParameters (void);
-  void ResetDirectionAndSpeed (void);
-  void SetDirectionAndSpeed (double direction);
-  void InitializeDirectionAndSpeed (void);
-  void Update (void) const;
-  bool CheckMobilityModel (void) const;
-  enum RandomDirectionMobilityModel::Side CalculateIntersection (double &x, double &y);
-  virtual void DoDispose (void);
-  virtual void DoGet (double &x, double &y, double &z) const;
-  virtual void DoSet (double x, double y, double z);
-
-  static const double PI;
-  Ptr<RandomDirectionParameters> m_parameters;
-  mutable double m_x;
-  mutable double m_y;
-  double m_dx;
-  double m_dy;
-  mutable Time m_prevTime;
-  Time m_pauseStart;
-  EventId m_event;
-  enum Side m_side;
-};
-
-} // namespace ns3
-
-#endif /* RANDOM_DIRECTION_POSITION_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/random-mobility-model.cc	Wed Jul 04 10:15:18 2007 +0200
@@ -0,0 +1,195 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "random-walk-mobility-model.h"
+#include "ns3/default-value.h"
+#include "ns3/time-default-value.h"
+#include "ns3/simulator.h"
+#include "ns3/debug.h"
+#include <cmath>
+
+NS_DEBUG_COMPONENT_DEFINE ("RandomWalk");
+
+namespace ns3 {
+
+const InterfaceId RandomWalkMobilityModel::iid = 
+  MakeInterfaceId ("RandomWalkMobilityModel", MobilityModel::iid);
+const ClassId RandomWalkMobilityModel::cid = 
+  MakeClassId<RandomWalkMobilityModel, double, double> ("RandomWalkMobilityModel", RandomWalkMobilityModel::iid);
+
+
+static IntegerDefaultValue<double> g_minSpeed ("RandomWalkMinSpeed", 
+					       "Minimum speed used during a random walk", 
+					       0.1);
+static IntegerDefaultValue<double> g_maxSpeed ("RandomWalkMaxSpeed", 
+					       "Maximum speed used during a random walk",
+					       0.5);
+static EnumDefaultValue<RandomWalkMobilityModelParameters::Mode> g_mode 
+  ("RandomWalkMode",
+   "The mode indicates the condition used to "
+   "change the current speed and direction",
+   RandomWalkMobilityModelParameters::MODE_DISTANCE, "Distance",
+   RandomWalkMobilityModelParameters::MODE_TIME, "Time",
+   0, 0);
+static IntegerDefaultValue<double> g_modeDistance ("RandomWalkModeDistance",
+						   "Distance to walk before changing direction and speed.",
+						   10);
+static TimeDefaultValue g_modeTime ("RandomWalkModeTime",
+				    "Time to walk before changing direction and speed.",
+				    Seconds (1));
+
+RandomWalkMobilityModelParameters::RandomWalkMobilityModelParameters ()
+  : m_minSpeed (g_minSpeed.GetValue ()),
+    m_maxSpeed (g_maxSpeed.GetValue ()),
+    m_mode (g_mode.GetValue ()),
+    m_modeDistance (g_modeDistance.GetValue ()),
+    m_modeTime (g_modeTime.GetValue ())
+{}
+bool 
+RandomWalkMobilityModelParameters::IsDefault (void) const
+{
+  if (m_minSpeed != g_minSpeed.GetValue () ||
+      m_maxSpeed != g_maxSpeed.GetValue () ||
+      m_mode != g_mode.GetValue () ||
+      m_modeDistance != g_modeDistance.GetValue () ||
+      m_modeTime != g_modeTime.GetValue ())
+    {
+      return false;
+    }
+  return true;
+}
+
+void
+RandomWalkMobilityModelParameters::SetSpeedBounds (double minSpeed, double maxSpeed)
+{
+  m_minSpeed = minSpeed;
+  m_maxSpeed = maxSpeed;
+}
+
+
+UniformVariable RandomWalkMobilityModel::m_randomDirection (0.0, 2*3.141592);
+
+Ptr<RandomWalkMobilityModelParameters> 
+RandomWalkMobilityModel::GetDefaultParameters (void)
+{
+  static Ptr<RandomWalkMobilityModelParameters> parameters = Create<RandomWalkMobilityModelParameters> ();
+  if (!parameters->IsDefault ())
+    {
+      parameters = Create<RandomWalkMobilityModelParameters> ();
+    }
+  return parameters;
+}
+
+RandomWalkMobilityModel::RandomWalkMobilityModel ()
+  : m_x (0.0),
+    m_y (0.0),
+    m_dx (0.0),
+    m_dy (0.0),
+    m_prevTime (Simulator::Now ()),
+    m_parameters (RandomWalkMobilityModel::GetDefaultParameters ())
+{
+  SetInterfaceId (RandomWalkMobilityModel::iid);
+  Reset ();
+}
+
+RandomWalkMobilityModel::RandomWalkMobilityModel (double x, double y)
+  : m_x (x),
+    m_y (y),
+    m_dx (0.0),
+    m_dy (0.0),
+    m_prevTime (Simulator::Now ()),
+    m_parameters (RandomWalkMobilityModel::GetDefaultParameters ())
+{
+  SetInterfaceId (RandomWalkMobilityModel::iid);
+  Reset ();
+}
+
+void
+RandomWalkMobilityModel::Reset (void)
+{
+  Update ();
+  double speed = UniformVariable::GetSingleValue (m_parameters->m_minSpeed, 
+						  m_parameters->m_maxSpeed);
+  NS_DEBUG ("min="<< m_parameters->m_minSpeed << ", max=" << m_parameters->m_maxSpeed <<
+            ", speed=" << speed);
+  double direction = m_randomDirection.GetValue ();
+  double dx = std::cos (direction) * speed;
+  double dy = std::sin (direction) * speed;
+  m_dx = dx;
+  m_dy = dy;
+  Time delay;
+  if (m_parameters->m_mode == RandomWalkMobilityModelParameters::MODE_TIME)
+    {
+      delay = m_parameters->m_modeTime;
+    }
+  else
+    {
+      double distance = m_parameters->m_modeDistance;
+      delay = Seconds (distance / sqrt (m_dx * m_dx + m_dy * m_dy));
+    }
+  NotifyCourseChange ();
+  NS_DEBUG ("change speed at " << Simulator::Now () << " in " << delay);
+  Simulator::Schedule (delay, &RandomWalkMobilityModel::Reset, this);
+}
+
+void
+RandomWalkMobilityModel::Update (void) const
+{
+  Time deltaTime = Simulator::Now () - m_prevTime;
+  m_prevTime = Simulator::Now ();
+  double deltaS = deltaTime.GetSeconds ();
+  m_x += m_dx * deltaS;
+  m_y += m_dy * deltaS;
+}
+
+void
+RandomWalkMobilityModel::DoDispose (void)
+{
+  m_parameters = 0;
+  // chain up
+  MobilityModel::DoDispose ();
+}
+void 
+RandomWalkMobilityModel::DoGet (double &x, double &y, double &z) const
+{
+  Update ();
+  x = m_x;
+  y = m_y;
+  z = 0;
+}
+void
+RandomWalkMobilityModel::DoSet (double x, double y, double z)
+{
+  bool changed = false;
+  if (m_x != x || m_y != y)
+    {
+      changed = true;
+    }
+  m_x = x;
+  m_y = y;
+  m_prevTime = Simulator::Now ();
+  if (changed)
+    {
+      NotifyCourseChange ();
+    }
+}
+
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/random-mobility-model.h	Wed Jul 04 10:15:18 2007 +0200
@@ -0,0 +1,131 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef RANDOM_WALK_POSITION_H
+#define RANDOM_WALK_POSITION_H
+
+#include "ns3/object.h"
+#include "ns3/mobility-model.h"
+#include "ns3/nstime.h"
+#include "ns3/random-variable.h"
+#include "ns3/component-manager.h"
+
+namespace ns3 {
+
+/**
+ * \brief parameters to control a random walk model
+ */
+class RandomWalkMobilityModelParameters : public Object
+{
+ public:
+  enum Mode {
+    MODE_DISTANCE,
+    MODE_TIME
+  };
+  /**
+   * Instantiate a set of RandomWalk parameters initialized
+   * with the Bind default values.
+   */
+  RandomWalkMobilityModelParameters ();
+  /**
+   * \param minSpeed the minimum speed
+   * \param maxSpeed the maximum speed
+   *
+   * The speed of any node is chosen such that minSpeed <= speed <= maxSpeed
+   */
+  void SetSpeedBounds (double minSpeed, double maxSpeed);
+  /**
+   * \param distance the distance before a direction change
+   *
+   * Unit is meters
+   */
+  void SetModeDistance (double distance);
+  /**
+   * \param time the delay before a direction change.
+   */
+  void SetModeTime (Time time);
+ private:
+  bool IsDefault (void) const;
+  friend class RandomWalkMobilityModel;
+  double m_minSpeed;
+  double m_maxSpeed;
+  enum Mode m_mode;
+  double m_modeDistance;
+  Time m_modeTime;
+};
+
+/**
+ * \brief an unbounded 2D random walk position model
+ *
+ * Each instance moves with a speed and direction choosen at random
+ * in the intervals [minspeed,maxspeed] and [0,2pi] until
+ * either a fixed distance has been walked or until a fixed amount
+ * of time.
+ *
+ * The parameters of the model can be specified either with the ns3::Bind
+ * function and the variables "RandomWalkMinSpeed", "RandomWalkMaxSpeed",
+ * "RandomWalkMode", "RandomWalkModeDistance", and, "RandomWalkModeTime" or
+ * with an instance of the RandomWalkMobilityModelParameters class which
+ * must be fed to the RandomWalkMobilityModel constructors.
+ */
+class RandomWalkMobilityModel : public MobilityModel 
+{
+ public:
+  static const InterfaceId iid;
+  static const ClassId cid;
+  /**
+   * Create a new position object located at position (0,0,0)
+   */
+  RandomWalkMobilityModel ();
+  /**
+   * Create a new position object located at position (x,y,0)
+   */
+  RandomWalkMobilityModel (double x, double y);
+  /**
+   * Create a new position object located at position (0,0,0)
+   */
+  RandomWalkMobilityModel (Ptr<RandomWalkMobilityModelParameters> parameters);
+  /**
+   * Create a new position object located at position (x,y,0)
+   */
+  RandomWalkMobilityModel (Ptr<RandomWalkMobilityModelParameters> parameters,
+		      double x, double y);
+ private:
+  virtual void DoDispose (void);
+  virtual void DoGet (double &x, double &y, double &z) const;
+  virtual void DoSet (double x, double y, double z);
+
+  void Reset (void);
+  void Update (void) const;
+  static Ptr<RandomWalkMobilityModelParameters> GetDefaultParameters (void);
+  static UniformVariable m_randomDirection;
+
+  mutable double m_x;
+  mutable double m_y;
+  double m_dx;
+  double m_dy;
+  mutable Time m_prevTime;
+  Ptr<RandomWalkMobilityModelParameters> m_parameters;
+};
+
+
+} // namespace ns3
+
+#endif /* RANDOM_WALK_POSITION_H */
--- a/src/node/random-rectangle-topology.cc	Wed Jul 04 10:04:08 2007 +0200
+++ b/src/node/random-rectangle-topology.cc	Wed Jul 04 10:15:18 2007 +0200
@@ -19,7 +19,7 @@
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 #include "random-rectangle-topology.h"
-#include "static-position.h"
+#include "static-mobility-model.h"
 #include "ns3/random-variable-default-value.h"
 
 namespace ns3 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/random-walk-mobility-model.cc	Wed Jul 04 10:15:18 2007 +0200
@@ -0,0 +1,195 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "random-walk-mobility-model.h"
+#include "ns3/default-value.h"
+#include "ns3/time-default-value.h"
+#include "ns3/simulator.h"
+#include "ns3/debug.h"
+#include <cmath>
+
+NS_DEBUG_COMPONENT_DEFINE ("RandomWalk");
+
+namespace ns3 {
+
+const InterfaceId RandomWalkMobilityModel::iid = 
+  MakeInterfaceId ("RandomWalkMobilityModel", MobilityModel::iid);
+const ClassId RandomWalkMobilityModel::cid = 
+  MakeClassId<RandomWalkMobilityModel, double, double> ("RandomWalkMobilityModel", RandomWalkMobilityModel::iid);
+
+
+static IntegerDefaultValue<double> g_minSpeed ("RandomWalkMinSpeed", 
+					       "Minimum speed used during a random walk", 
+					       0.1);
+static IntegerDefaultValue<double> g_maxSpeed ("RandomWalkMaxSpeed", 
+					       "Maximum speed used during a random walk",
+					       0.5);
+static EnumDefaultValue<RandomWalkMobilityModelParameters::Mode> g_mode 
+  ("RandomWalkMode",
+   "The mode indicates the condition used to "
+   "change the current speed and direction",
+   RandomWalkMobilityModelParameters::MODE_DISTANCE, "Distance",
+   RandomWalkMobilityModelParameters::MODE_TIME, "Time",
+   0, 0);
+static IntegerDefaultValue<double> g_modeDistance ("RandomWalkModeDistance",
+						   "Distance to walk before changing direction and speed.",
+						   10);
+static TimeDefaultValue g_modeTime ("RandomWalkModeTime",
+				    "Time to walk before changing direction and speed.",
+				    Seconds (1));
+
+RandomWalkMobilityModelParameters::RandomWalkMobilityModelParameters ()
+  : m_minSpeed (g_minSpeed.GetValue ()),
+    m_maxSpeed (g_maxSpeed.GetValue ()),
+    m_mode (g_mode.GetValue ()),
+    m_modeDistance (g_modeDistance.GetValue ()),
+    m_modeTime (g_modeTime.GetValue ())
+{}
+bool 
+RandomWalkMobilityModelParameters::IsDefault (void) const
+{
+  if (m_minSpeed != g_minSpeed.GetValue () ||
+      m_maxSpeed != g_maxSpeed.GetValue () ||
+      m_mode != g_mode.GetValue () ||
+      m_modeDistance != g_modeDistance.GetValue () ||
+      m_modeTime != g_modeTime.GetValue ())
+    {
+      return false;
+    }
+  return true;
+}
+
+void
+RandomWalkMobilityModelParameters::SetSpeedBounds (double minSpeed, double maxSpeed)
+{
+  m_minSpeed = minSpeed;
+  m_maxSpeed = maxSpeed;
+}
+
+
+UniformVariable RandomWalkMobilityModel::m_randomDirection (0.0, 2*3.141592);
+
+Ptr<RandomWalkMobilityModelParameters> 
+RandomWalkMobilityModel::GetDefaultParameters (void)
+{
+  static Ptr<RandomWalkMobilityModelParameters> parameters = Create<RandomWalkMobilityModelParameters> ();
+  if (!parameters->IsDefault ())
+    {
+      parameters = Create<RandomWalkMobilityModelParameters> ();
+    }
+  return parameters;
+}
+
+RandomWalkMobilityModel::RandomWalkMobilityModel ()
+  : m_x (0.0),
+    m_y (0.0),
+    m_dx (0.0),
+    m_dy (0.0),
+    m_prevTime (Simulator::Now ()),
+    m_parameters (RandomWalkMobilityModel::GetDefaultParameters ())
+{
+  SetInterfaceId (RandomWalkMobilityModel::iid);
+  Reset ();
+}
+
+RandomWalkMobilityModel::RandomWalkMobilityModel (double x, double y)
+  : m_x (x),
+    m_y (y),
+    m_dx (0.0),
+    m_dy (0.0),
+    m_prevTime (Simulator::Now ()),
+    m_parameters (RandomWalkMobilityModel::GetDefaultParameters ())
+{
+  SetInterfaceId (RandomWalkMobilityModel::iid);
+  Reset ();
+}
+
+void
+RandomWalkMobilityModel::Reset (void)
+{
+  Update ();
+  double speed = UniformVariable::GetSingleValue (m_parameters->m_minSpeed, 
+						  m_parameters->m_maxSpeed);
+  NS_DEBUG ("min="<< m_parameters->m_minSpeed << ", max=" << m_parameters->m_maxSpeed <<
+            ", speed=" << speed);
+  double direction = m_randomDirection.GetValue ();
+  double dx = std::cos (direction) * speed;
+  double dy = std::sin (direction) * speed;
+  m_dx = dx;
+  m_dy = dy;
+  Time delay;
+  if (m_parameters->m_mode == RandomWalkMobilityModelParameters::MODE_TIME)
+    {
+      delay = m_parameters->m_modeTime;
+    }
+  else
+    {
+      double distance = m_parameters->m_modeDistance;
+      delay = Seconds (distance / sqrt (m_dx * m_dx + m_dy * m_dy));
+    }
+  NotifyCourseChange ();
+  NS_DEBUG ("change speed at " << Simulator::Now () << " in " << delay);
+  Simulator::Schedule (delay, &RandomWalkMobilityModel::Reset, this);
+}
+
+void
+RandomWalkMobilityModel::Update (void) const
+{
+  Time deltaTime = Simulator::Now () - m_prevTime;
+  m_prevTime = Simulator::Now ();
+  double deltaS = deltaTime.GetSeconds ();
+  m_x += m_dx * deltaS;
+  m_y += m_dy * deltaS;
+}
+
+void
+RandomWalkMobilityModel::DoDispose (void)
+{
+  m_parameters = 0;
+  // chain up
+  MobilityModel::DoDispose ();
+}
+void 
+RandomWalkMobilityModel::DoGet (double &x, double &y, double &z) const
+{
+  Update ();
+  x = m_x;
+  y = m_y;
+  z = 0;
+}
+void
+RandomWalkMobilityModel::DoSet (double x, double y, double z)
+{
+  bool changed = false;
+  if (m_x != x || m_y != y)
+    {
+      changed = true;
+    }
+  m_x = x;
+  m_y = y;
+  m_prevTime = Simulator::Now ();
+  if (changed)
+    {
+      NotifyCourseChange ();
+    }
+}
+
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/random-walk-mobility-model.h	Wed Jul 04 10:15:18 2007 +0200
@@ -0,0 +1,131 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef RANDOM_WALK_POSITION_H
+#define RANDOM_WALK_POSITION_H
+
+#include "ns3/object.h"
+#include "ns3/mobility-model.h"
+#include "ns3/nstime.h"
+#include "ns3/random-variable.h"
+#include "ns3/component-manager.h"
+
+namespace ns3 {
+
+/**
+ * \brief parameters to control a random walk model
+ */
+class RandomWalkMobilityModelParameters : public Object
+{
+ public:
+  enum Mode {
+    MODE_DISTANCE,
+    MODE_TIME
+  };
+  /**
+   * Instantiate a set of RandomWalk parameters initialized
+   * with the Bind default values.
+   */
+  RandomWalkMobilityModelParameters ();
+  /**
+   * \param minSpeed the minimum speed
+   * \param maxSpeed the maximum speed
+   *
+   * The speed of any node is chosen such that minSpeed <= speed <= maxSpeed
+   */
+  void SetSpeedBounds (double minSpeed, double maxSpeed);
+  /**
+   * \param distance the distance before a direction change
+   *
+   * Unit is meters
+   */
+  void SetModeDistance (double distance);
+  /**
+   * \param time the delay before a direction change.
+   */
+  void SetModeTime (Time time);
+ private:
+  bool IsDefault (void) const;
+  friend class RandomWalkMobilityModel;
+  double m_minSpeed;
+  double m_maxSpeed;
+  enum Mode m_mode;
+  double m_modeDistance;
+  Time m_modeTime;
+};
+
+/**
+ * \brief an unbounded 2D random walk position model
+ *
+ * Each instance moves with a speed and direction choosen at random
+ * in the intervals [minspeed,maxspeed] and [0,2pi] until
+ * either a fixed distance has been walked or until a fixed amount
+ * of time.
+ *
+ * The parameters of the model can be specified either with the ns3::Bind
+ * function and the variables "RandomWalkMinSpeed", "RandomWalkMaxSpeed",
+ * "RandomWalkMode", "RandomWalkModeDistance", and, "RandomWalkModeTime" or
+ * with an instance of the RandomWalkMobilityModelParameters class which
+ * must be fed to the RandomWalkMobilityModel constructors.
+ */
+class RandomWalkMobilityModel : public MobilityModel 
+{
+ public:
+  static const InterfaceId iid;
+  static const ClassId cid;
+  /**
+   * Create a new position object located at position (0,0,0)
+   */
+  RandomWalkMobilityModel ();
+  /**
+   * Create a new position object located at position (x,y,0)
+   */
+  RandomWalkMobilityModel (double x, double y);
+  /**
+   * Create a new position object located at position (0,0,0)
+   */
+  RandomWalkMobilityModel (Ptr<RandomWalkMobilityModelParameters> parameters);
+  /**
+   * Create a new position object located at position (x,y,0)
+   */
+  RandomWalkMobilityModel (Ptr<RandomWalkMobilityModelParameters> parameters,
+		      double x, double y);
+ private:
+  virtual void DoDispose (void);
+  virtual void DoGet (double &x, double &y, double &z) const;
+  virtual void DoSet (double x, double y, double z);
+
+  void Reset (void);
+  void Update (void) const;
+  static Ptr<RandomWalkMobilityModelParameters> GetDefaultParameters (void);
+  static UniformVariable m_randomDirection;
+
+  mutable double m_x;
+  mutable double m_y;
+  double m_dx;
+  double m_dy;
+  mutable Time m_prevTime;
+  Ptr<RandomWalkMobilityModelParameters> m_parameters;
+};
+
+
+} // namespace ns3
+
+#endif /* RANDOM_WALK_POSITION_H */
--- a/src/node/random-walk-position.cc	Wed Jul 04 10:04:08 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006,2007 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "random-walk-position.h"
-#include "ns3/default-value.h"
-#include "ns3/time-default-value.h"
-#include "ns3/simulator.h"
-#include "ns3/debug.h"
-#include <cmath>
-
-NS_DEBUG_COMPONENT_DEFINE ("RandomWalk");
-
-namespace ns3 {
-
-const InterfaceId RandomWalkMobilityModel::iid = 
-  MakeInterfaceId ("RandomWalkMobilityModel", MobilityModel::iid);
-const ClassId RandomWalkMobilityModel::cid = 
-  MakeClassId<RandomWalkMobilityModel, double, double> ("RandomWalkMobilityModel", RandomWalkMobilityModel::iid);
-
-
-static IntegerDefaultValue<double> g_minSpeed ("RandomWalkMinSpeed", 
-					       "Minimum speed used during a random walk", 
-					       0.1);
-static IntegerDefaultValue<double> g_maxSpeed ("RandomWalkMaxSpeed", 
-					       "Maximum speed used during a random walk",
-					       0.5);
-static EnumDefaultValue<RandomWalkMobilityModelParameters::Mode> g_mode 
-  ("RandomWalkMode",
-   "The mode indicates the condition used to "
-   "change the current speed and direction",
-   RandomWalkMobilityModelParameters::MODE_DISTANCE, "Distance",
-   RandomWalkMobilityModelParameters::MODE_TIME, "Time",
-   0, 0);
-static IntegerDefaultValue<double> g_modeDistance ("RandomWalkModeDistance",
-						   "Distance to walk before changing direction and speed.",
-						   10);
-static TimeDefaultValue g_modeTime ("RandomWalkModeTime",
-				    "Time to walk before changing direction and speed.",
-				    Seconds (1));
-
-RandomWalkMobilityModelParameters::RandomWalkMobilityModelParameters ()
-  : m_minSpeed (g_minSpeed.GetValue ()),
-    m_maxSpeed (g_maxSpeed.GetValue ()),
-    m_mode (g_mode.GetValue ()),
-    m_modeDistance (g_modeDistance.GetValue ()),
-    m_modeTime (g_modeTime.GetValue ())
-{}
-bool 
-RandomWalkMobilityModelParameters::IsDefault (void) const
-{
-  if (m_minSpeed != g_minSpeed.GetValue () ||
-      m_maxSpeed != g_maxSpeed.GetValue () ||
-      m_mode != g_mode.GetValue () ||
-      m_modeDistance != g_modeDistance.GetValue () ||
-      m_modeTime != g_modeTime.GetValue ())
-    {
-      return false;
-    }
-  return true;
-}
-
-void
-RandomWalkMobilityModelParameters::SetSpeedBounds (double minSpeed, double maxSpeed)
-{
-  m_minSpeed = minSpeed;
-  m_maxSpeed = maxSpeed;
-}
-
-
-UniformVariable RandomWalkMobilityModel::m_randomDirection (0.0, 2*3.141592);
-
-Ptr<RandomWalkMobilityModelParameters> 
-RandomWalkMobilityModel::GetDefaultParameters (void)
-{
-  static Ptr<RandomWalkMobilityModelParameters> parameters = Create<RandomWalkMobilityModelParameters> ();
-  if (!parameters->IsDefault ())
-    {
-      parameters = Create<RandomWalkMobilityModelParameters> ();
-    }
-  return parameters;
-}
-
-RandomWalkMobilityModel::RandomWalkMobilityModel ()
-  : m_x (0.0),
-    m_y (0.0),
-    m_dx (0.0),
-    m_dy (0.0),
-    m_prevTime (Simulator::Now ()),
-    m_parameters (RandomWalkMobilityModel::GetDefaultParameters ())
-{
-  SetInterfaceId (RandomWalkMobilityModel::iid);
-  Reset ();
-}
-
-RandomWalkMobilityModel::RandomWalkMobilityModel (double x, double y)
-  : m_x (x),
-    m_y (y),
-    m_dx (0.0),
-    m_dy (0.0),
-    m_prevTime (Simulator::Now ()),
-    m_parameters (RandomWalkMobilityModel::GetDefaultParameters ())
-{
-  SetInterfaceId (RandomWalkMobilityModel::iid);
-  Reset ();
-}
-
-void
-RandomWalkMobilityModel::Reset (void)
-{
-  Update ();
-  double speed = UniformVariable::GetSingleValue (m_parameters->m_minSpeed, 
-						  m_parameters->m_maxSpeed);
-  NS_DEBUG ("min="<< m_parameters->m_minSpeed << ", max=" << m_parameters->m_maxSpeed <<
-            ", speed=" << speed);
-  double direction = m_randomDirection.GetValue ();
-  double dx = std::cos (direction) * speed;
-  double dy = std::sin (direction) * speed;
-  m_dx = dx;
-  m_dy = dy;
-  Time delay;
-  if (m_parameters->m_mode == RandomWalkMobilityModelParameters::MODE_TIME)
-    {
-      delay = m_parameters->m_modeTime;
-    }
-  else
-    {
-      double distance = m_parameters->m_modeDistance;
-      delay = Seconds (distance / sqrt (m_dx * m_dx + m_dy * m_dy));
-    }
-  NotifyCourseChange ();
-  NS_DEBUG ("change speed at " << Simulator::Now () << " in " << delay);
-  Simulator::Schedule (delay, &RandomWalkMobilityModel::Reset, this);
-}
-
-void
-RandomWalkMobilityModel::Update (void) const
-{
-  Time deltaTime = Simulator::Now () - m_prevTime;
-  m_prevTime = Simulator::Now ();
-  double deltaS = deltaTime.GetSeconds ();
-  m_x += m_dx * deltaS;
-  m_y += m_dy * deltaS;
-}
-
-void
-RandomWalkMobilityModel::DoDispose (void)
-{
-  m_parameters = 0;
-  // chain up
-  MobilityModel::DoDispose ();
-}
-void 
-RandomWalkMobilityModel::DoGet (double &x, double &y, double &z) const
-{
-  Update ();
-  x = m_x;
-  y = m_y;
-  z = 0;
-}
-void
-RandomWalkMobilityModel::DoSet (double x, double y, double z)
-{
-  bool changed = false;
-  if (m_x != x || m_y != y)
-    {
-      changed = true;
-    }
-  m_x = x;
-  m_y = y;
-  m_prevTime = Simulator::Now ();
-  if (changed)
-    {
-      NotifyCourseChange ();
-    }
-}
-
-
-} // namespace ns3
--- a/src/node/random-walk-position.h	Wed Jul 04 10:04:08 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006,2007 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef RANDOM_WALK_POSITION_H
-#define RANDOM_WALK_POSITION_H
-
-#include "ns3/object.h"
-#include "ns3/position.h"
-#include "ns3/nstime.h"
-#include "ns3/random-variable.h"
-#include "ns3/component-manager.h"
-
-namespace ns3 {
-
-/**
- * \brief parameters to control a random walk model
- */
-class RandomWalkMobilityModelParameters : public Object
-{
- public:
-  enum Mode {
-    MODE_DISTANCE,
-    MODE_TIME
-  };
-  /**
-   * Instantiate a set of RandomWalk parameters initialized
-   * with the Bind default values.
-   */
-  RandomWalkMobilityModelParameters ();
-  /**
-   * \param minSpeed the minimum speed
-   * \param maxSpeed the maximum speed
-   *
-   * The speed of any node is chosen such that minSpeed <= speed <= maxSpeed
-   */
-  void SetSpeedBounds (double minSpeed, double maxSpeed);
-  /**
-   * \param distance the distance before a direction change
-   *
-   * Unit is meters
-   */
-  void SetModeDistance (double distance);
-  /**
-   * \param time the delay before a direction change.
-   */
-  void SetModeTime (Time time);
- private:
-  bool IsDefault (void) const;
-  friend class RandomWalkMobilityModel;
-  double m_minSpeed;
-  double m_maxSpeed;
-  enum Mode m_mode;
-  double m_modeDistance;
-  Time m_modeTime;
-};
-
-/**
- * \brief an unbounded 2D random walk position model
- *
- * Each instance moves with a speed and direction choosen at random
- * in the intervals [minspeed,maxspeed] and [0,2pi] until
- * either a fixed distance has been walked or until a fixed amount
- * of time.
- *
- * The parameters of the model can be specified either with the ns3::Bind
- * function and the variables "RandomWalkMinSpeed", "RandomWalkMaxSpeed",
- * "RandomWalkMode", "RandomWalkModeDistance", and, "RandomWalkModeTime" or
- * with an instance of the RandomWalkMobilityModelParameters class which
- * must be fed to the RandomWalkMobilityModel constructors.
- */
-class RandomWalkMobilityModel : public MobilityModel 
-{
- public:
-  static const InterfaceId iid;
-  static const ClassId cid;
-  /**
-   * Create a new position object located at position (0,0,0)
-   */
-  RandomWalkMobilityModel ();
-  /**
-   * Create a new position object located at position (x,y,0)
-   */
-  RandomWalkMobilityModel (double x, double y);
-  /**
-   * Create a new position object located at position (0,0,0)
-   */
-  RandomWalkMobilityModel (Ptr<RandomWalkMobilityModelParameters> parameters);
-  /**
-   * Create a new position object located at position (x,y,0)
-   */
-  RandomWalkMobilityModel (Ptr<RandomWalkMobilityModelParameters> parameters,
-		      double x, double y);
- private:
-  virtual void DoDispose (void);
-  virtual void DoGet (double &x, double &y, double &z) const;
-  virtual void DoSet (double x, double y, double z);
-
-  void Reset (void);
-  void Update (void) const;
-  static Ptr<RandomWalkMobilityModelParameters> GetDefaultParameters (void);
-  static UniformVariable m_randomDirection;
-
-  mutable double m_x;
-  mutable double m_y;
-  double m_dx;
-  double m_dy;
-  mutable Time m_prevTime;
-  Ptr<RandomWalkMobilityModelParameters> m_parameters;
-};
-
-
-} // namespace ns3
-
-#endif /* RANDOM_WALK_POSITION_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/static-mobility-model.cc	Wed Jul 04 10:15:18 2007 +0200
@@ -0,0 +1,72 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "static-mobility-model.h"
+
+namespace ns3 {
+
+const InterfaceId StaticMobilityModel::iid = MakeInterfaceId ("StaticMobilityModel", MobilityModel::iid);
+const ClassId StaticMobilityModel::cid = MakeClassId<StaticMobilityModel,double, double> ("StaticMobilityModel", 
+                                                                                StaticMobilityModel::iid);
+
+StaticMobilityModel::StaticMobilityModel ()
+  : m_x (0.0), m_y (0.0), m_z (0.0)
+{
+  SetInterfaceId (StaticMobilityModel::iid);
+}
+StaticMobilityModel::StaticMobilityModel (double x, double y)
+  : m_x (x), m_y (y), m_z (0.0)
+{
+  SetInterfaceId (StaticMobilityModel::iid);
+}
+StaticMobilityModel::StaticMobilityModel (double x, double y, double z)
+  : m_x (x), m_y (y), m_z (z)
+{
+  SetInterfaceId (StaticMobilityModel::iid);
+}
+StaticMobilityModel::~StaticMobilityModel ()
+{}
+
+void 
+StaticMobilityModel::DoGet (double &x, double &y, double &z) const
+{
+  x = m_x;
+  y = m_y;
+  z = m_z;
+}
+void 
+StaticMobilityModel::DoSet (double x, double y, double z)
+{
+  bool changed = false;
+  if (m_x != x || m_y != y || m_z != z)
+    {
+      changed = true;
+    }
+  m_x = x;
+  m_y = y;
+  m_z = z;
+  if (changed)
+    {
+      NotifyCourseChange ();
+    }
+}
+
+
+}; // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/static-mobility-model.h	Wed Jul 04 10:15:18 2007 +0200
@@ -0,0 +1,72 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef STATIC_POSITION_H
+#define STATIC_POSITION_H
+
+#include "ns3/component-manager.h"
+#include "mobility-model.h"
+
+namespace ns3 {
+
+/**
+ * \brief a position model for which the current position does not
+ *        change once it has been set and until it is set again 
+ *        explicitely to a new value.
+ */
+class StaticMobilityModel : public MobilityModel 
+{
+public:
+  static const InterfaceId iid;
+  static const ClassId cid;
+  /**
+   * Create a position located at coordinates (0,0,0)
+   */
+  StaticMobilityModel ();
+  /**
+   * \param x x coordinate
+   * \param y y coordinate
+   *
+   * Create a position located at coordinates (x,y,0).
+   * Unit is meters
+   */
+  StaticMobilityModel (double x, double y);
+  /**
+   * \param x x coordinate
+   * \param y y coordinate
+   * \param z z coordinate
+   *
+   * Create a position located at coordinates (x,y,z).
+   * Unit is meters
+   */
+  StaticMobilityModel (double x, double y, double z);
+  virtual ~StaticMobilityModel ();
+
+private:
+  virtual void DoGet (double &x, double &y, double &z) const;
+  virtual void DoSet (double x, double y, double z);
+  double m_x;
+  double m_y;
+  double m_z;
+};
+
+}; // namespace ns3
+
+#endif /* STATIC_POSITION_H */
--- a/src/node/static-position.cc	Wed Jul 04 10:04:08 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "static-position.h"
-
-namespace ns3 {
-
-const InterfaceId StaticMobilityModel::iid = MakeInterfaceId ("StaticMobilityModel", MobilityModel::iid);
-const ClassId StaticMobilityModel::cid = MakeClassId<StaticMobilityModel,double, double> ("StaticMobilityModel", 
-                                                                                StaticMobilityModel::iid);
-
-StaticMobilityModel::StaticMobilityModel ()
-  : m_x (0.0), m_y (0.0), m_z (0.0)
-{
-  SetInterfaceId (StaticMobilityModel::iid);
-}
-StaticMobilityModel::StaticMobilityModel (double x, double y)
-  : m_x (x), m_y (y), m_z (0.0)
-{
-  SetInterfaceId (StaticMobilityModel::iid);
-}
-StaticMobilityModel::StaticMobilityModel (double x, double y, double z)
-  : m_x (x), m_y (y), m_z (z)
-{
-  SetInterfaceId (StaticMobilityModel::iid);
-}
-StaticMobilityModel::~StaticMobilityModel ()
-{}
-
-void 
-StaticMobilityModel::DoGet (double &x, double &y, double &z) const
-{
-  x = m_x;
-  y = m_y;
-  z = m_z;
-}
-void 
-StaticMobilityModel::DoSet (double x, double y, double z)
-{
-  bool changed = false;
-  if (m_x != x || m_y != y || m_z != z)
-    {
-      changed = true;
-    }
-  m_x = x;
-  m_y = y;
-  m_z = z;
-  if (changed)
-    {
-      NotifyCourseChange ();
-    }
-}
-
-
-}; // namespace ns3
--- a/src/node/static-position.h	Wed Jul 04 10:04:08 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006,2007 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef STATIC_POSITION_H
-#define STATIC_POSITION_H
-
-#include "ns3/component-manager.h"
-#include "position.h"
-
-namespace ns3 {
-
-/**
- * \brief a position model for which the current position does not
- *        change once it has been set and until it is set again 
- *        explicitely to a new value.
- */
-class StaticMobilityModel : public MobilityModel 
-{
-public:
-  static const InterfaceId iid;
-  static const ClassId cid;
-  /**
-   * Create a position located at coordinates (0,0,0)
-   */
-  StaticMobilityModel ();
-  /**
-   * \param x x coordinate
-   * \param y y coordinate
-   *
-   * Create a position located at coordinates (x,y,0).
-   * Unit is meters
-   */
-  StaticMobilityModel (double x, double y);
-  /**
-   * \param x x coordinate
-   * \param y y coordinate
-   * \param z z coordinate
-   *
-   * Create a position located at coordinates (x,y,z).
-   * Unit is meters
-   */
-  StaticMobilityModel (double x, double y, double z);
-  virtual ~StaticMobilityModel ();
-
-private:
-  virtual void DoGet (double &x, double &y, double &z) const;
-  virtual void DoSet (double x, double y, double z);
-  double m_x;
-  double m_y;
-  double m_z;
-};
-
-}; // namespace ns3
-
-#endif /* STATIC_POSITION_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/static-speed-mobility-model.cc	Wed Jul 04 10:15:18 2007 +0200
@@ -0,0 +1,136 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006, 2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "static-speed-mobility-model.h"
+#include "ns3/simulator.h"
+
+namespace ns3 {
+
+const InterfaceId StaticSpeedMobilityModel::iid = MakeInterfaceId ("StaticSpeedMobilityModel", MobilityModel::iid);
+const ClassId StaticSpeedMobilityModel::cid = 
+  MakeClassId<StaticSpeedMobilityModel,double, double> ("StaticSpeedMobilityModel", 
+                                              StaticSpeedMobilityModel::iid);
+
+
+StaticSpeedMobilityModel::StaticSpeedMobilityModel ()
+  : m_x (0.0),
+    m_y (0.0),
+    m_z (0.0),
+    m_dx (0.0),
+    m_dy (0.0),
+    m_dz (0.0),
+    m_prevTime (Simulator::Now ())
+{
+  SetInterfaceId (StaticSpeedMobilityModel::iid);
+}
+StaticSpeedMobilityModel::StaticSpeedMobilityModel (double x, double y, double z)
+  : m_x (x),
+    m_y (y),
+    m_z (z),
+    m_dx (0.0),
+    m_dy (0.0),
+    m_dz (0.0),
+    m_prevTime (Simulator::Now ())
+{
+  SetInterfaceId (StaticSpeedMobilityModel::iid);
+}
+StaticSpeedMobilityModel::StaticSpeedMobilityModel (double x, double y)
+  : m_x (x),
+    m_y (y),
+    m_z (0.0),
+    m_dx (0.0),
+    m_dy (0.0),
+    m_dz (0.0),
+    m_prevTime (Simulator::Now ())
+{
+  SetInterfaceId (StaticSpeedMobilityModel::iid);
+}
+StaticSpeedMobilityModel::StaticSpeedMobilityModel (double x, double y, double z,
+                                          double dx, double dy, double dz)
+  : m_x (x),
+    m_y (y),
+    m_z (z),
+    m_dx (dx),
+    m_dy (dy),
+    m_dz (dz),
+    m_prevTime (Simulator::Now ())
+{
+  SetInterfaceId (StaticSpeedMobilityModel::iid);
+}
+
+StaticSpeedMobilityModel::~StaticSpeedMobilityModel ()
+{}
+
+void 
+StaticSpeedMobilityModel::SetSpeed (double dx, double dy, double dz)
+{
+  bool changed = false;
+  Update ();
+  if (m_dx != dx || m_dy != dy || m_dz != dz)
+    {
+      changed = true;
+    }
+  m_dx = dx;
+  m_dy = dy;
+  m_dz = dz;
+  if (changed)
+    {
+      NotifyCourseChange ();
+    }
+}
+
+void
+StaticSpeedMobilityModel::Update (void) const
+{
+  Time deltaTime = Simulator::Now () - m_prevTime;
+  m_prevTime = Simulator::Now ();
+  double deltaS = deltaTime.GetSeconds ();
+  m_x += m_dx * deltaS;
+  m_y += m_dy * deltaS;
+  m_z += m_dz * deltaS;
+}
+
+void 
+StaticSpeedMobilityModel::DoGet (double &x, double &y, double &z) const
+{
+  Update ();
+  x = m_x;
+  y = m_y;
+  z = m_z;
+}
+void 
+StaticSpeedMobilityModel::DoSet (double x, double y, double z)
+{
+  bool changed = false;
+  Update ();
+  if (m_x != x || m_y != y || m_z != z)
+    {
+      changed = true;
+    }
+  m_x = x;
+  m_y = y;
+  m_z = z;
+  if (changed)
+    {
+      NotifyCourseChange ();
+    }
+}
+
+}; // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/static-speed-mobility-model.h	Wed Jul 04 10:15:18 2007 +0200
@@ -0,0 +1,100 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006, 2007 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef STATIC_SPEED_POSITION_H
+#define STATIC_SPEED_POSITION_H
+
+#include <stdint.h>
+#include "mobility-model.h"
+#include "ns3/nstime.h"
+#include "ns3/component-manager.h"
+
+namespace ns3 {
+
+class StaticSpeedMobilityModel : public MobilityModel 
+{
+public:
+  static const InterfaceId iid;
+  static const ClassId cid;
+  /**
+   * Create position located at coordinates (0,0,0) with
+   * speed (0,0,0).
+   */
+  StaticSpeedMobilityModel ();
+  /**
+   * \param x x coordinate
+   * \param y y coordinate
+   *
+   * Create a position located at coordinates (x,y,0) with
+   * speed (0,0,0).
+   * Unit is meters
+   */
+  StaticSpeedMobilityModel (double x, double y);
+  /**
+   * \param x x coordinate
+   * \param y y coordinate
+   * \param z z coordinate
+   *
+   * Create a position located at coordinates (x,y,z) with
+   * speed (0,0,0).
+   * Unit is meters
+   */
+  StaticSpeedMobilityModel (double x, double y, double z);
+  /**
+   * \param x x coordinate
+   * \param y y coordinate
+   * \param z z coordinate
+   * \param dx x coordinate speed
+   * \param dy y coordinate speed
+   * \param dz z coordinate speed
+   *
+   * Create a position located at coordinates (x,y,z) with
+   * speed (dx,dy,dz).
+   * Unit is meters and meters/s
+   */
+  StaticSpeedMobilityModel (double x, double y, double z,
+                       double dx, double dy, double dz);
+  virtual ~StaticSpeedMobilityModel ();
+
+  /*
+   * \param dx x coordinate speed
+   * \param dy y coordinate speed
+   * \param dz z coordinate speed
+   *
+   * Set the current speed now to (dx,dy,dz)
+   * Unit is meters/s
+   */
+  void SetSpeed (double dx, double dy, double dz);
+private:
+  virtual void DoGet (double &x, double &y, double &z) const;
+  virtual void DoSet (double x, double y, double z);
+  void Update (void) const;
+  mutable double m_x;
+  mutable double m_y;
+  mutable double m_z;
+  double m_dx;
+  double m_dy;
+  double m_dz;
+  mutable Time m_prevTime;
+};
+
+}; // namespace ns3
+
+#endif /* STATIC_SPEED_POSITION */
--- a/src/node/static-speed-position.cc	Wed Jul 04 10:04:08 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006, 2007 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "static-speed-position.h"
-#include "ns3/simulator.h"
-
-namespace ns3 {
-
-const InterfaceId StaticSpeedMobilityModel::iid = MakeInterfaceId ("StaticSpeedMobilityModel", MobilityModel::iid);
-const ClassId StaticSpeedMobilityModel::cid = 
-  MakeClassId<StaticSpeedMobilityModel,double, double> ("StaticSpeedMobilityModel", 
-                                              StaticSpeedMobilityModel::iid);
-
-
-StaticSpeedMobilityModel::StaticSpeedMobilityModel ()
-  : m_x (0.0),
-    m_y (0.0),
-    m_z (0.0),
-    m_dx (0.0),
-    m_dy (0.0),
-    m_dz (0.0),
-    m_prevTime (Simulator::Now ())
-{
-  SetInterfaceId (StaticSpeedMobilityModel::iid);
-}
-StaticSpeedMobilityModel::StaticSpeedMobilityModel (double x, double y, double z)
-  : m_x (x),
-    m_y (y),
-    m_z (z),
-    m_dx (0.0),
-    m_dy (0.0),
-    m_dz (0.0),
-    m_prevTime (Simulator::Now ())
-{
-  SetInterfaceId (StaticSpeedMobilityModel::iid);
-}
-StaticSpeedMobilityModel::StaticSpeedMobilityModel (double x, double y)
-  : m_x (x),
-    m_y (y),
-    m_z (0.0),
-    m_dx (0.0),
-    m_dy (0.0),
-    m_dz (0.0),
-    m_prevTime (Simulator::Now ())
-{
-  SetInterfaceId (StaticSpeedMobilityModel::iid);
-}
-StaticSpeedMobilityModel::StaticSpeedMobilityModel (double x, double y, double z,
-                                          double dx, double dy, double dz)
-  : m_x (x),
-    m_y (y),
-    m_z (z),
-    m_dx (dx),
-    m_dy (dy),
-    m_dz (dz),
-    m_prevTime (Simulator::Now ())
-{
-  SetInterfaceId (StaticSpeedMobilityModel::iid);
-}
-
-StaticSpeedMobilityModel::~StaticSpeedMobilityModel ()
-{}
-
-void 
-StaticSpeedMobilityModel::SetSpeed (double dx, double dy, double dz)
-{
-  bool changed = false;
-  Update ();
-  if (m_dx != dx || m_dy != dy || m_dz != dz)
-    {
-      changed = true;
-    }
-  m_dx = dx;
-  m_dy = dy;
-  m_dz = dz;
-  if (changed)
-    {
-      NotifyCourseChange ();
-    }
-}
-
-void
-StaticSpeedMobilityModel::Update (void) const
-{
-  Time deltaTime = Simulator::Now () - m_prevTime;
-  m_prevTime = Simulator::Now ();
-  double deltaS = deltaTime.GetSeconds ();
-  m_x += m_dx * deltaS;
-  m_y += m_dy * deltaS;
-  m_z += m_dz * deltaS;
-}
-
-void 
-StaticSpeedMobilityModel::DoGet (double &x, double &y, double &z) const
-{
-  Update ();
-  x = m_x;
-  y = m_y;
-  z = m_z;
-}
-void 
-StaticSpeedMobilityModel::DoSet (double x, double y, double z)
-{
-  bool changed = false;
-  Update ();
-  if (m_x != x || m_y != y || m_z != z)
-    {
-      changed = true;
-    }
-  m_x = x;
-  m_y = y;
-  m_z = z;
-  if (changed)
-    {
-      NotifyCourseChange ();
-    }
-}
-
-}; // namespace ns3
--- a/src/node/static-speed-position.h	Wed Jul 04 10:04:08 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006, 2007 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef STATIC_SPEED_POSITION_H
-#define STATIC_SPEED_POSITION_H
-
-#include <stdint.h>
-#include "position.h"
-#include "ns3/nstime.h"
-#include "ns3/component-manager.h"
-
-namespace ns3 {
-
-class StaticSpeedMobilityModel : public MobilityModel 
-{
-public:
-  static const InterfaceId iid;
-  static const ClassId cid;
-  /**
-   * Create position located at coordinates (0,0,0) with
-   * speed (0,0,0).
-   */
-  StaticSpeedMobilityModel ();
-  /**
-   * \param x x coordinate
-   * \param y y coordinate
-   *
-   * Create a position located at coordinates (x,y,0) with
-   * speed (0,0,0).
-   * Unit is meters
-   */
-  StaticSpeedMobilityModel (double x, double y);
-  /**
-   * \param x x coordinate
-   * \param y y coordinate
-   * \param z z coordinate
-   *
-   * Create a position located at coordinates (x,y,z) with
-   * speed (0,0,0).
-   * Unit is meters
-   */
-  StaticSpeedMobilityModel (double x, double y, double z);
-  /**
-   * \param x x coordinate
-   * \param y y coordinate
-   * \param z z coordinate
-   * \param dx x coordinate speed
-   * \param dy y coordinate speed
-   * \param dz z coordinate speed
-   *
-   * Create a position located at coordinates (x,y,z) with
-   * speed (dx,dy,dz).
-   * Unit is meters and meters/s
-   */
-  StaticSpeedMobilityModel (double x, double y, double z,
-                       double dx, double dy, double dz);
-  virtual ~StaticSpeedMobilityModel ();
-
-  /*
-   * \param dx x coordinate speed
-   * \param dy y coordinate speed
-   * \param dz z coordinate speed
-   *
-   * Set the current speed now to (dx,dy,dz)
-   * Unit is meters/s
-   */
-  void SetSpeed (double dx, double dy, double dz);
-private:
-  virtual void DoGet (double &x, double &y, double &z) const;
-  virtual void DoSet (double x, double y, double z);
-  void Update (void) const;
-  mutable double m_x;
-  mutable double m_y;
-  mutable double m_z;
-  double m_dx;
-  double m_dy;
-  double m_dz;
-  mutable Time m_prevTime;
-};
-
-}; // namespace ns3
-
-#endif /* STATIC_SPEED_POSITION */