DESERT 3.5.1
Loading...
Searching...
No Matches
woss-groupmobility-3d.h
Go to the documentation of this file.
1//
2// Copyright (c) 2012 Regents of the SIGNET lab, University of Padova.
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions
7// are met:
8// 1. Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// 2. Redistributions in binary form must reproduce the above copyright
11// notice, this list of conditions and the following disclaimer in the
12// documentation and/or other materials provided with the distribution.
13// 3. Neither the name of the University of Padova (SIGNET lab) nor the
14// names of its contributors may be used to endorse or promote products
15// derived from this software without specific prior written permission.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
40#ifndef _WOSS_GROUPMOBMODEL_3D_
41#define _WOSS_GROUPMOBMODEL_3D_
42
43#include <iostream>
44#include <cmath>
45#include "uw-woss-position.h"
46#include <plugin.h>
47
48#include "uwrandomlib.h"
49
50#define sgn(x) ( ((x)==0.0) ? 0.0 : ((x)/fabs(x)) )
51#define pi (4*atan(1.0))
52#define earth_radius 6371000.0
53
58class WossGroupMob3D : public WossPosition
59{
60
61 public:
70 virtual ~WossGroupMob3D();
71
77
83 virtual double getStartX();
84
90 virtual double getStartY();
91
97 virtual void setLat(double x_coord, double y_coord);
98
104 virtual void setLong(double x_coord, double y_coord);
105
110 virtual double getCharge() { return charge_; }
111
112 double newx, newy, newz;
113 double vx, vy, vz;
122 virtual int command(int argc, const char*const* argv);
123
124 protected:
125
129 class UpdatePositionTimer : public TimerHandler
130 {
131 public:
132
136 UpdatePositionTimer(WossGroupMob3D* mo) : TimerHandler() { mod = mo; }
137
142
146 virtual void schedule( double val) { resched(val); }
147
148 protected:
149
150 virtual void expire(Event* e);
154 };
159 virtual void update();
160
165 double Gaussian();
166
173 double distance(WossPosition* pos1, WossPosition* pos2);
174
181 double mirror_posx(double x_coord_node, double x_coord_leader);
182
189 double mirror_posy(double y_coord_node, double y_coord_leader);
190
197 double mirror_posz(double z_coord_node, double z_coord_leader);
198
199
206 double alpha_;
208 double speedMean_;
212 double pitchMean_;
214 double sigmaPitch_;
224 double updateTime_;
226 double speed_;
228 double direction_;
232 int maddr;
238 double start_x;
240 double start_y;
246 double pitch_;
248 double zmin_;
250 double speedM_;
252 double speedS_;
254 double eta_;
256 double beta_;
258 double charge_;
262 double galpha_;
264 int count;
268 WossPosition* leader_;
273};
274
275#endif // _WOSS_GROUPMBMODEL_3D_
276
277
Base class of UpdateTimerPosition class which is inherited from TimerHandler class.
virtual ~UpdatePositionTimer()
Destructor of UpdateTimerPosition class.
UpdatePositionTimer(WossGroupMob3D *mo)
Constructor of UpdateTimerPosition class.
virtual void schedule(double val)
Update Time is scheduled using this method.
WossGroupMob3D * mod
An Object pointer of WossGroupMob3D class.
virtual void expire(Event *e)
This method tell the node what to do when update timer expire.
Base class of Group Mobility Model.
double vz
new velocity of a node respectively in x-axis, y-axis and z-axis.
double alpha_
Parameter to be used to vary the randomness.
double eta_
A tunable variable which is the coefficient of the filter in that range between 0 and 1.
double mirror_posz(double z_coord_node, double z_coord_leader)
Approximate position at z-axis.
virtual void setLong(double x_coord, double y_coord)
Method that sets the longitude of the node after update.
double galpha_
It tells the intensity of the attraction filed.
double start_x
Internal variable.
string gm3dGroupTraceFile
Trace file information.
int maddr
Mac address of the node whose movement we would like to trace.
double speedM_
Mean of the speed which is used to compute a Gaussian random variable.
virtual void setLat(double x_coord, double y_coord)
Method that sets the latitude of the node after update.
UpdatePositionTimer update_position_timer
An object of UpdateTimerPosition class.
int wossgroup_debug_
Debug flag.
double updateTime_
Time between two update computation.
virtual double getStartX()
Method that return the starting projection of the node on the cartesian x-axis.
WossGroupMob3D()
Constructor of WossGroupMob3D class.
double pitchMean_
Defines the mean value of the shifting in z-axis.
virtual double getStartY()
Method that return the starting projection of the node on the cartesian y-axis.
double zmin_
Minimum z-axis value.
double speedMean_
Defines the mean value of the speed.
double newz
new position of a node respectively in x-axis, y-axis and z-axis.
double pitch_
Current value of the pitch.
virtual ~WossGroupMob3D()
Destructor of WossGroupMob3D class.
double leaderCharge_
Attraction charge of the leader.
double zFieldWidth_
Range of the z-axis of the field to be simulated.
double start_longitude
Starting longitude of the simualted area.
int count
A counting variable.
double Gaussian()
Method that returns a value from a normal random Gaussian variable (zero mean, unitary viariance)
double start_latitude
Starting latitude of the simualted area.
virtual double getCharge()
Attraction charge to the leader.
WossPosition * leader_
Position pointer of the leader.
BoundType
Defines the behaviour of the node when it reaches an edge of the simulation field.
double mirror_posy(double y_coord_node, double y_coord_leader)
Approximate position at y-axis.
virtual void update()
Method that updates both the position coordinates as function of the number of states to be evaluated...
double direction_
Current value of the direction.
double speedS_
Standard deviation of speed which is also used to compute a Gaussian random variable.
double mirror_posx(double x_coord_node, double x_coord_leader)
Approximate position at x-axis.
BoundType bound_
Defines the behaviour of the node when it reaches the edge.
int mtrace_
Flag to enable trace.
virtual int command(int argc, const char *const *argv)
TCL command intepreter.
double directionMean_
Defines the mean value of the direction.
double yFieldWidth_
Range of the y-axis of the field to be simulated.
double z_coord
position of the node.
double start_y
Internal variable.
double beta_
A variable which is employed to calculate attraction force towards the leader.
double xFieldWidth_
Range of the x-axis of the field to be simulated.
double sigmaPitch_
Standard deviation in the z-axis.
double distance(WossPosition *pos1, WossPosition *pos2)
Calculate the distance between two nodes.
double charge_
Attraction charge of the follower.
int mtrace_of_node_
The node whose movement pattern we want to trace.
double speed_
Current value of the speed.
Random function header.