DESERT 3.5.1
Loading...
Searching...
No Matches
woss-gmmobility-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
41#ifndef _WOSS_GMMOBMODEL_3D_
42#define _WOSS_GMMOBMODEL_3D_
43
44#include <iostream>
45#include <cmath>
46#include <string>
47#include <plugin.h>
48#include <uw-woss-position.h>
49#include "uwrandomlib.h"
50
51
52#define sgn(x) ( ((x)==0.0) ? 0.0 : ((x)/fabs(x)) )
53#define pi (4*atan(1.0))
54#define earth_radius 6371000.0
55
56//extern double Gauss(double,double,int); // gaussian random variable with average standard deviation
57
67class WossGMMob3D : public WossPosition
68{
69 public:
77 virtual ~WossGMMob3D();
83 virtual double getStartX();
84
90 virtual double getStartY();
91
96
101 virtual void setLat(double x_coord, double y_coord);
102 virtual void setLong(double x_coord, double y_coord);
103
104 double newx, newy, newz;
105 double vx, vy, vz;
120 virtual int command(int argc, const char*const* argv);
121
122 protected:
123
127 class UpdateTimerPosition : public TimerHandler
128 {
129 public:
130
134 UpdateTimerPosition(WossGMMob3D* m) : TimerHandler() { module = m; }
135
140
144 virtual void schedule( double val) { resched(val); }
145
146 protected:
147
148 virtual void expire(Event* e);
150 WossGMMob3D* module;
152 };
153
158 virtual void update();
159
164 double Gaussian();
165
166
173 double alpha_;
175 double alphaPitch_;
177 double speedMean_;
181 double pitchMean_;
183 double sigmaPitch_;
192 double updateTime_;
196 double speed_;
198 double direction_;
202 int maddr;
208 double start_x;
210 double start_y;
216 double pitch_;
218 double zmin_;
225};
226
227#endif /*_WOSS_GMMOBMODEL_3D_*/
Base class of UpdateTimerPosition class which is inherited from TimerHandler class.
UpdateTimerPosition(WossGMMob3D *m)
Constructor of UpdateTimerPosition class.
virtual void schedule(double val)
Update Time is scheduled using this method.
virtual void expire(Event *e)
This method tell the node what to do when update timer expire.
virtual ~UpdateTimerPosition()
Destructor of UpdateTimerPosition class.
This class implements the Gauss Markov mobility model.
double direction_
Current value of the direction.
double speedMean_
Defines the mean value of the speed.
double Gaussian()
Method that returns a value from a normal random Gaussian variable.
double sigmaPitch_
Standard deviation in the z-axis.
int maddr
Mac address of the node whose movement we would like to trace.
BoundType
Enumeration BoundType.
BoundType bound_
Defines the behaviour of the node when it reaches the edge.
int mtrace_
Flag to enable trace.
virtual void setLong(double x_coord, double y_coord)
double alphaPitch_
Parameter to be used to vary the randomness in z-axis.
double vz
new velocity of a node respectively in x-axis, y-axis and z-axis.
double yFieldWidth_
Range of the y-axis of the field to be simulated.
virtual int command(int argc, const char *const *argv)
TCL command intepreter Moreover it inherits all the OTcl method of Position.
virtual double getStartX()
Method that return the current projection of the node on the x-axis.
virtual double getStartY()
Method that return the current projection of the node on the y-axis.
string gm3dTraceFile
Trace file information.
double alpha_
Parameter to be used to vary the randomness.
virtual ~WossGMMob3D()
Destructor of WossGMMob3D class.
int wossgm_debug_
Debug flag.
double newz
new position of a node respectively in x-axis, y-axis and z-axis.
virtual void update()
Method that updates both the position coordinates as function of the number of states to be evaluated...
double zFieldWidth_
Range of the z-axis of the field to be simulated.
double xFieldWidth_
Range of the x-axis of the field to be simulated.
double nextUpdateTime_
Intenal variable used to evaluate the steps to be computed.
double start_y
Internal variable.
double pitchMean_
Defines the mean value of the shifting in z-axis.
virtual void setLat(double x_coord, double y_coord)
Method that return the starting curtesian coordinates of the node on the x-axis and y-axis.
int mtrace_of_node_
The node whose movement pattern we want to trace.
WossGMMob3D()
Constructor of WossGMMob3D class.
double speed_
Current value of the speed.
UpdateTimerPosition update_timer_position
An object of UpdateTimerPosition class.
double updateTime_
Time between two update computation.
double zmin_
Minimum z-axis value.
double start_longitude
Starting longitude of the simualted area.
double directionMean_
Defines the mean value of the direction.
double start_x
Internal variable.
double pitch_
Current value of the pitch.
double start_latitude
Starting latitude of the simualted area.
Uwrandomlib randlib
double z_coord
Previous position of the node.
Random function header.