StaticMobilityModel -> ConstantPositionMobilityModel, StaticSpeedMobilityModel -> ConstantVelocityMobilityModel
--- a/examples/third.cc Wed Mar 04 18:55:32 2009 +0100
+++ b/examples/third.cc Tue Mar 10 14:18:32 2009 +0100
@@ -120,7 +120,7 @@
"Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
mobility.Install (wifiStaNodes);
- mobility.SetMobilityModel ("ns3::StaticMobilityModel");
+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (wifiApNode);
InternetStackHelper stack;
--- a/examples/wifi-adhoc.cc Wed Mar 04 18:55:32 2009 +0100
+++ b/examples/wifi-adhoc.cc Tue Mar 10 14:18:32 2009 +0100
@@ -128,7 +128,7 @@
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
positionAlloc->Add (Vector (5.0, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
- mobility.SetMobilityModel ("ns3::StaticMobilityModel");
+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (c);
--- a/examples/wifi-wired-bridging.cc Wed Mar 04 18:55:32 2009 +0100
+++ b/examples/wifi-wired-bridging.cc Tue Mar 10 14:18:32 2009 +0100
@@ -119,7 +119,7 @@
// setup the AP.
- mobility.SetMobilityModel ("ns3::StaticMobilityModel");
+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (backboneNodes.Get (i));
wifi.SetMac ("ns3::NqapWifiMac",
"Ssid", SsidValue (ssid),
--- a/samples/main-grid-topology.cc Wed Mar 04 18:55:32 2009 +0100
+++ b/samples/main-grid-topology.cc Tue Mar 10 14:18:32 2009 +0100
@@ -32,7 +32,7 @@
// each object will be attached a static position.
// i.e., once set by the "position allocator", the
// position will never change.
- mobility.SetMobilityModel ("ns3::StaticMobilityModel");
+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
// finalize the setup by attaching to each object
// in the input array a position and initializing
--- a/samples/main-propagation-loss.cc Wed Mar 04 18:55:32 2009 +0100
+++ b/samples/main-propagation-loss.cc Tue Mar 10 14:18:32 2009 +0100
@@ -18,7 +18,7 @@
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/propagation-loss-model.h"
-#include "ns3/static-mobility-model.h"
+#include "ns3/constant-position-mobility-model.h"
#include "ns3/config.h"
#include "ns3/string.h"
@@ -27,8 +27,8 @@
static void
PrintOne (double minTxpower, double maxTxpower, double stepTxpower, double min, double max, double step)
{
- Ptr<StaticMobilityModel> a = CreateObject<StaticMobilityModel> ();
- Ptr<StaticMobilityModel> b = CreateObject<StaticMobilityModel> ();
+ Ptr<ConstantPositionMobilityModel> a = CreateObject<ConstantPositionMobilityModel> ();
+ Ptr<ConstantPositionMobilityModel> b = CreateObject<ConstantPositionMobilityModel> ();
Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
Ptr<PropagationLossModel> model = log;
--- a/samples/main-random-topology.cc Wed Mar 04 18:55:32 2009 +0100
+++ b/samples/main-random-topology.cc Tue Mar 10 14:18:32 2009 +0100
@@ -29,7 +29,7 @@
"X", StringValue ("100.0"),
"Y", StringValue ("100.0"),
"Rho", StringValue ("Uniform:0:30"));
- mobility.SetMobilityModel ("ns3::StaticMobilityModel");
+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (c);
Config::Connect ("/NodeList/*/$ns3::MobilityModelNotifier/CourseChange",
--- a/src/devices/wifi/propagation-loss-model.cc Wed Mar 04 18:55:32 2009 +0100
+++ b/src/devices/wifi/propagation-loss-model.cc Tue Mar 10 14:18:32 2009 +0100
@@ -22,7 +22,6 @@
#include "propagation-loss-model.h"
#include "ns3/log.h"
#include "ns3/mobility-model.h"
-#include "ns3/static-mobility-model.h"
#include "ns3/boolean.h"
#include "ns3/double.h"
#include <math.h>
--- a/src/devices/wifi/wifi-phy-test.cc Wed Mar 04 18:55:32 2009 +0100
+++ b/src/devices/wifi/wifi-phy-test.cc Tue Mar 10 14:18:32 2009 +0100
@@ -7,7 +7,7 @@
#include "yans-error-rate-model.h"
#include "ns3/ptr.h"
#include "ns3/mobility-model.h"
-#include "ns3/static-mobility-model.h"
+#include "ns3/constant-position-mobility-model.h"
#include "ns3/vector.h"
#include "ns3/packet.h"
#include "ns3/simulator.h"
@@ -75,9 +75,9 @@
m_output.received = 0;
m_input = input;
- Ptr<MobilityModel> posTx = CreateObject<StaticMobilityModel> ();
+ Ptr<MobilityModel> posTx = CreateObject<ConstantPositionMobilityModel> ();
posTx->SetPosition (Vector (0.0, 0.0, 0.0));
- Ptr<MobilityModel> posRx = CreateObject<StaticMobilityModel> ();
+ Ptr<MobilityModel> posRx = CreateObject<ConstantPositionMobilityModel> ();
posRx->SetPosition (Vector (m_input.distance, 0.0, 0.0));
Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
@@ -207,11 +207,11 @@
Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
channel->SetPropagationLossModel (log);
- Ptr<MobilityModel> posTxA = CreateObject<StaticMobilityModel> ();
+ Ptr<MobilityModel> posTxA = CreateObject<ConstantPositionMobilityModel> ();
posTxA->SetPosition (Vector (input.xA, 0.0, 0.0));
- Ptr<MobilityModel> posTxB = CreateObject<StaticMobilityModel> ();
+ Ptr<MobilityModel> posTxB = CreateObject<ConstantPositionMobilityModel> ();
posTxB->SetPosition (Vector (input.xB, 0.0, 0.0));
- Ptr<MobilityModel> posRx = CreateObject<StaticMobilityModel> ();
+ Ptr<MobilityModel> posRx = CreateObject<ConstantPositionMobilityModel> ();
posRx->SetPosition (Vector (0, 0.0, 0.0));
Ptr<YansWifiPhy> txA = CreateObject<YansWifiPhy> ();
--- a/src/devices/wifi/wifi-test.cc Wed Mar 04 18:55:32 2009 +0100
+++ b/src/devices/wifi/wifi-test.cc Tue Mar 10 14:18:32 2009 +0100
@@ -9,7 +9,7 @@
#include "propagation-loss-model.h"
#include "error-rate-model.h"
#include "yans-error-rate-model.h"
-#include "ns3/static-mobility-model.h"
+#include "ns3/constant-position-mobility-model.h"
#include "ns3/node.h"
#include "ns3/simulator.h"
#include "ns3/test.h"
@@ -51,7 +51,7 @@
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
- Ptr<StaticMobilityModel> mobility = CreateObject<StaticMobilityModel> ();
+ Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> ();
Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
Ptr<ErrorRateModel> error = CreateObject<YansErrorRateModel> ();
phy->SetErrorRateModel (error);
--- a/src/helper/mobility-helper.cc Wed Mar 04 18:55:32 2009 +0100
+++ b/src/helper/mobility-helper.cc Tue Mar 10 14:18:32 2009 +0100
@@ -37,7 +37,7 @@
m_position = CreateObject<RandomRectanglePositionAllocator>
("X", RandomVariableValue (ConstantVariable (0.0)),
"Y", RandomVariableValue (ConstantVariable (0.0)));
- m_mobility.SetTypeId ("ns3::StaticMobilityModel");
+ m_mobility.SetTypeId ("ns3::ConstantPositionMobilityModel");
}
MobilityHelper::~MobilityHelper ()
{}
--- a/src/helper/ns2-mobility-helper.cc Wed Mar 04 18:55:32 2009 +0100
+++ b/src/helper/ns2-mobility-helper.cc Tue Mar 10 14:18:32 2009 +0100
@@ -23,7 +23,7 @@
#include "ns3/simulator.h"
#include "ns3/node-list.h"
#include "ns3/node.h"
-#include "ns3/static-speed-mobility-model.h"
+#include "ns3/constant-velocity-mobility-model.h"
#include "ns2-mobility-helper.h"
NS_LOG_COMPONENT_DEFINE ("Ns2MobilityHelper");
@@ -37,7 +37,7 @@
-Ptr<StaticSpeedMobilityModel>
+Ptr<ConstantVelocityMobilityModel>
Ns2MobilityHelper::GetMobilityModel (std::string idString, const ObjectStore &store) const
{
std::istringstream iss;
@@ -49,10 +49,10 @@
{
return 0;
}
- Ptr<StaticSpeedMobilityModel> model = object->GetObject<StaticSpeedMobilityModel> ();
+ Ptr<ConstantVelocityMobilityModel> model = object->GetObject<ConstantVelocityMobilityModel> ();
if (model == 0)
{
- model = CreateObject<StaticSpeedMobilityModel> ();
+ model = CreateObject<ConstantVelocityMobilityModel> ();
object->AggregateObject (model);
}
return model;
@@ -85,7 +85,7 @@
{
continue;
}
- Ptr<StaticSpeedMobilityModel> model = GetMobilityModel (line.substr (startNodeId + 1,
+ Ptr<ConstantVelocityMobilityModel> model = GetMobilityModel (line.substr (startNodeId + 1,
endNodeId - startNodeId),
store);
if (model == 0)
@@ -130,7 +130,7 @@
double ySpeed = ReadDouble (line.substr (xSpeedEnd + 1, ySpeedEnd - xSpeedEnd - 1));
double zSpeed = ReadDouble (line.substr (ySpeedEnd + 1, std::string::npos));
NS_LOG_DEBUG ("at=" << at << "xSpeed=" << xSpeed << ", ySpeed=" << ySpeed << ", zSpeed=" << zSpeed);
- Simulator::Schedule (Seconds (at), &StaticSpeedMobilityModel::SetVelocity, model,
+ Simulator::Schedule (Seconds (at), &ConstantVelocityMobilityModel::SetVelocity, model,
Vector (xSpeed, ySpeed, zSpeed));
}
}
--- a/src/helper/ns2-mobility-helper.h Wed Mar 04 18:55:32 2009 +0100
+++ b/src/helper/ns2-mobility-helper.h Tue Mar 10 14:18:32 2009 +0100
@@ -27,7 +27,7 @@
namespace ns3 {
-class StaticSpeedMobilityModel;
+class ConstantVelocityMobilityModel;
/**
* \brief a topology object which can read ns2's movement files
@@ -71,7 +71,7 @@
virtual Ptr<Object> Get (uint32_t i) const = 0;
};
void LayoutObjectStore (const ObjectStore &store) const;
- Ptr<StaticSpeedMobilityModel> GetMobilityModel (std::string idString, const ObjectStore &store) const;
+ Ptr<ConstantVelocityMobilityModel> GetMobilityModel (std::string idString, const ObjectStore &store) const;
double ReadDouble (std::string valueString) const;
std::string m_filename;
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/constant-position-mobility-model.cc Tue Mar 10 14:18:32 2009 +0100
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ *
+ * 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 "constant-position-mobility-model.h"
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (ConstantPositionMobilityModel);
+
+TypeId
+ConstantPositionMobilityModel::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::ConstantPositionMobilityModel")
+ .SetParent<MobilityModel> ()
+ .AddConstructor<ConstantPositionMobilityModel> ()
+ ;
+ return tid;
+}
+
+ConstantPositionMobilityModel::ConstantPositionMobilityModel ()
+{}
+ConstantPositionMobilityModel::~ConstantPositionMobilityModel ()
+{}
+
+Vector
+ConstantPositionMobilityModel::DoGetPosition (void) const
+{
+ return m_position;
+}
+void
+ConstantPositionMobilityModel::DoSetPosition (const Vector &position)
+{
+ m_position = position;
+ NotifyCourseChange ();
+}
+Vector
+ConstantPositionMobilityModel::DoGetVelocity (void) const
+{
+ return Vector (0.0, 0.0, 0.0);
+}
+
+}; // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/constant-position-mobility-model.h Tue Mar 10 14:18:32 2009 +0100
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ *
+ * 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_MOBILITY_MODEL_H
+#define STATIC_MOBILITY_MODEL_H
+
+#include "mobility-model.h"
+#include "vector.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 ConstantPositionMobilityModel : public MobilityModel
+{
+public:
+ static TypeId GetTypeId (void);
+ /**
+ * Create a position located at coordinates (0,0,0)
+ */
+ ConstantPositionMobilityModel ();
+ virtual ~ConstantPositionMobilityModel ();
+
+private:
+ virtual Vector DoGetPosition (void) const;
+ virtual void DoSetPosition (const Vector &position);
+ virtual Vector DoGetVelocity (void) const;
+
+ Vector m_position;
+};
+
+}; // namespace ns3
+
+#endif /* STATIC_MOBILITY_MODEL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/constant-velocity-mobility-model.cc Tue Mar 10 14:18:32 2009 +0100
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006, 2007 INRIA
+ *
+ * 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 "constant-velocity-mobility-model.h"
+#include "ns3/simulator.h"
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (ConstantVelocityMobilityModel);
+
+TypeId ConstantVelocityMobilityModel::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::ConstantVelocityMobilityModel")
+ .SetParent<MobilityModel> ()
+ .AddConstructor<ConstantVelocityMobilityModel> ();
+ return tid;
+}
+
+ConstantVelocityMobilityModel::ConstantVelocityMobilityModel ()
+{}
+
+ConstantVelocityMobilityModel::~ConstantVelocityMobilityModel ()
+{}
+
+void
+ConstantVelocityMobilityModel::SetVelocity (const Vector &speed)
+{
+ m_helper.Update ();
+ m_helper.SetVelocity (speed);
+ m_helper.Unpause ();
+ NotifyCourseChange ();
+}
+
+
+Vector
+ConstantVelocityMobilityModel::DoGetPosition (void) const
+{
+ m_helper.Update ();
+ return m_helper.GetCurrentPosition ();
+}
+void
+ConstantVelocityMobilityModel::DoSetPosition (const Vector &position)
+{
+ m_helper.SetPosition (position);
+ NotifyCourseChange ();
+}
+Vector
+ConstantVelocityMobilityModel::DoGetVelocity (void) const
+{
+ return m_helper.GetVelocity ();
+}
+
+}; // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/constant-velocity-mobility-model.h Tue Mar 10 14:18:32 2009 +0100
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006, 2007 INRIA
+ *
+ * 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_MOBILITY_MODEL_H
+#define STATIC_SPEED_MOBILITY_MODEL_H
+
+#include <stdint.h>
+#include "mobility-model.h"
+#include "ns3/nstime.h"
+#include "static-speed-helper.h"
+
+namespace ns3 {
+
+/**
+ * \brief a position model for which the current speed does not
+ * change once it has been set and until it is set again
+ * explicitely to a new value.
+ */
+class ConstantVelocityMobilityModel : public MobilityModel
+{
+public:
+ static TypeId GetTypeId (void);
+ /**
+ * Create position located at coordinates (0,0,0) with
+ * speed (0,0,0).
+ */
+ ConstantVelocityMobilityModel ();
+ virtual ~ConstantVelocityMobilityModel ();
+
+ /**
+ * \param speed the new speed to set.
+ *
+ * Set the current speed now to (dx,dy,dz)
+ * Unit is meters/s
+ */
+ void SetVelocity (const Vector &speed);
+private:
+ virtual Vector DoGetPosition (void) const;
+ virtual void DoSetPosition (const Vector &position);
+ virtual Vector DoGetVelocity (void) const;
+ void Update (void) const;
+ StaticSpeedHelper m_helper;
+};
+
+}; // namespace ns3
+
+#endif /* STATIC_SPEED_POSITION */
--- a/src/mobility/mobility.h Wed Mar 04 18:55:32 2009 +0100
+++ b/src/mobility/mobility.h Tue Mar 10 14:18:32 2009 +0100
@@ -9,10 +9,10 @@
* listeners to the course changes of a mobility model
*
* The mobility models themselves are:
- * - ns3::StaticMobilityModel: a model which maintains a constant position
+ * - ns3::ConstantPositionMobilityModel: a model which maintains a constant position
* until it is changed by the user.
*
- * - ns3::StaticSpeedMobilityModel: a model which maintains a constant speed
+ * - ns3::ConstantVelocityMobilityModel: a model which maintains a constant speed
* until it is changed by the user.
*
* - ns3::HierarchicalMobilityModel: a model which calculates the current
--- a/src/mobility/static-mobility-model.cc Wed Mar 04 18:55:32 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006,2007 INRIA
- *
- * 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 {
-
-NS_OBJECT_ENSURE_REGISTERED (StaticMobilityModel);
-
-TypeId
-StaticMobilityModel::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::StaticMobilityModel")
- .SetParent<MobilityModel> ()
- .AddConstructor<StaticMobilityModel> ()
- ;
- return tid;
-}
-
-StaticMobilityModel::StaticMobilityModel ()
-{}
-StaticMobilityModel::~StaticMobilityModel ()
-{}
-
-Vector
-StaticMobilityModel::DoGetPosition (void) const
-{
- return m_position;
-}
-void
-StaticMobilityModel::DoSetPosition (const Vector &position)
-{
- m_position = position;
- NotifyCourseChange ();
-}
-Vector
-StaticMobilityModel::DoGetVelocity (void) const
-{
- return Vector (0.0, 0.0, 0.0);
-}
-
-}; // namespace ns3
--- a/src/mobility/static-mobility-model.h Wed Mar 04 18:55:32 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006,2007 INRIA
- *
- * 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_MOBILITY_MODEL_H
-#define STATIC_MOBILITY_MODEL_H
-
-#include "mobility-model.h"
-#include "vector.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 TypeId GetTypeId (void);
- /**
- * Create a position located at coordinates (0,0,0)
- */
- StaticMobilityModel ();
- virtual ~StaticMobilityModel ();
-
-private:
- virtual Vector DoGetPosition (void) const;
- virtual void DoSetPosition (const Vector &position);
- virtual Vector DoGetVelocity (void) const;
-
- Vector m_position;
-};
-
-}; // namespace ns3
-
-#endif /* STATIC_MOBILITY_MODEL_H */
--- a/src/mobility/static-speed-mobility-model.cc Wed Mar 04 18:55:32 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006, 2007 INRIA
- *
- * 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 {
-
-NS_OBJECT_ENSURE_REGISTERED (StaticSpeedMobilityModel);
-
-TypeId StaticSpeedMobilityModel::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::StaticSpeedMobilityModel")
- .SetParent<MobilityModel> ()
- .AddConstructor<StaticSpeedMobilityModel> ();
- return tid;
-}
-
-StaticSpeedMobilityModel::StaticSpeedMobilityModel ()
-{}
-
-StaticSpeedMobilityModel::~StaticSpeedMobilityModel ()
-{}
-
-void
-StaticSpeedMobilityModel::SetVelocity (const Vector &speed)
-{
- m_helper.Update ();
- m_helper.SetVelocity (speed);
- m_helper.Unpause ();
- NotifyCourseChange ();
-}
-
-
-Vector
-StaticSpeedMobilityModel::DoGetPosition (void) const
-{
- m_helper.Update ();
- return m_helper.GetCurrentPosition ();
-}
-void
-StaticSpeedMobilityModel::DoSetPosition (const Vector &position)
-{
- m_helper.SetPosition (position);
- NotifyCourseChange ();
-}
-Vector
-StaticSpeedMobilityModel::DoGetVelocity (void) const
-{
- return m_helper.GetVelocity ();
-}
-
-}; // namespace ns3
--- a/src/mobility/static-speed-mobility-model.h Wed Mar 04 18:55:32 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006, 2007 INRIA
- *
- * 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_MOBILITY_MODEL_H
-#define STATIC_SPEED_MOBILITY_MODEL_H
-
-#include <stdint.h>
-#include "mobility-model.h"
-#include "ns3/nstime.h"
-#include "static-speed-helper.h"
-
-namespace ns3 {
-
-/**
- * \brief a position model for which the current speed does not
- * change once it has been set and until it is set again
- * explicitely to a new value.
- */
-class StaticSpeedMobilityModel : public MobilityModel
-{
-public:
- static TypeId GetTypeId (void);
- /**
- * Create position located at coordinates (0,0,0) with
- * speed (0,0,0).
- */
- StaticSpeedMobilityModel ();
- virtual ~StaticSpeedMobilityModel ();
-
- /**
- * \param speed the new speed to set.
- *
- * Set the current speed now to (dx,dy,dz)
- * Unit is meters/s
- */
- void SetVelocity (const Vector &speed);
-private:
- virtual Vector DoGetPosition (void) const;
- virtual void DoSetPosition (const Vector &position);
- virtual Vector DoGetVelocity (void) const;
- void Update (void) const;
- StaticSpeedHelper m_helper;
-};
-
-}; // namespace ns3
-
-#endif /* STATIC_SPEED_POSITION */
--- a/src/mobility/wscript Wed Mar 04 18:55:32 2009 +0100
+++ b/src/mobility/wscript Tue Mar 10 14:18:32 2009 +0100
@@ -8,9 +8,9 @@
'mobility-model.cc',
'position-allocator.cc',
'rectangle.cc',
- 'static-mobility-model.cc',
+ 'constant-position-mobility-model.cc',
'static-speed-helper.cc',
- 'static-speed-mobility-model.cc',
+ 'constant-velocity-mobility-model.cc',
'random-waypoint-mobility-model.cc',
'random-walk-2d-mobility-model.cc',
'random-direction-2d-mobility-model.cc',
@@ -24,9 +24,9 @@
'mobility-model.h',
'position-allocator.h',
'rectangle.h',
- 'static-mobility-model.h',
+ 'constant-position-mobility-model.h',
'static-speed-helper.h',
- 'static-speed-mobility-model.h',
+ 'constant-velocity-mobility-model.h',
'random-waypoint-mobility-model.h',
'random-walk-2d-mobility-model.h',
'random-direction-2d-mobility-model.h',