From 636e47d2192eacbd6fa296eab01d09ca013aad52 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Mon, 1 Oct 2007 17:10:46 +0100 Subject: [PATCH] Adapt to StaticSpeedHelper change --- .../random-waypoint-mobility-model.cc | 27 ++++++++++++++++--- src/mobility/random-waypoint-mobility-model.h | 1 - 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/mobility/random-waypoint-mobility-model.cc b/src/mobility/random-waypoint-mobility-model.cc index 4db4f2e11..5d34abc16 100644 --- a/src/mobility/random-waypoint-mobility-model.cc +++ b/src/mobility/random-waypoint-mobility-model.cc @@ -1,3 +1,22 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 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 + */ #include #include "ns3/simulator.h" #include "ns3/random-variable.h" @@ -98,13 +117,15 @@ RandomWaypointMobilityModel::RandomWaypointMobilityModel (Ptrm_pause->GetValue ()); + m_helper.Pause (); + NotifyCourseChange (); + m_event = Simulator::Schedule (pause, &RandomWaypointMobilityModel::Start, this); } void RandomWaypointMobilityModel::Start (void) { - m_pause = Seconds (m_parameters->m_pause->GetValue ()); Position m_current = m_helper.GetCurrentPosition (); Position destination = m_parameters->m_position->Get (); double speed = m_parameters->m_speed->GetValue (); @@ -113,7 +134,7 @@ RandomWaypointMobilityModel::Start (void) double dz = (destination.z - m_current.z); double k = speed / std::sqrt (dx*dx + dy*dy + dz*dz); - m_helper.Reset (Speed (k*dx, k*dy, k*dz), m_pause); + m_helper.Reset (Speed (k*dx, k*dy, k*dz)); Time travelDelay = Seconds (CalculateDistance (destination, m_current) / speed); m_event = Simulator::Schedule (travelDelay, &RandomWaypointMobilityModel::BeginPause, this); diff --git a/src/mobility/random-waypoint-mobility-model.h b/src/mobility/random-waypoint-mobility-model.h index 147302383..1b083835b 100644 --- a/src/mobility/random-waypoint-mobility-model.h +++ b/src/mobility/random-waypoint-mobility-model.h @@ -105,7 +105,6 @@ private: StaticSpeedHelper m_helper; Ptr m_parameters; EventId m_event; - Time m_pause; }; } // namespace ns3