DESERT 3.5.1
Loading...
Searching...
No Matches
uwgmposition.h
Go to the documentation of this file.
1//
2// Copyright (c) 2017 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//
29
40#ifndef _UWGAUSSMARKOVMOBMODEL_
41#define _UWGAUSSMARKOVMOBMODEL_
42
43#include "node-core.h"
44
45#define sgn(x) (((x) == 0.0) ? 0.0 : ((x) / fabs(x)))
46#define pi (4 * atan(1.0))
47
55
59class UwGMPosition : public Position
60{
61
62public:
67
71 virtual ~UwGMPosition();
72
83 virtual int command(int argc, const char *const *argv);
84
85protected:
93 virtual double getX();
94
102 virtual double getY();
103
111 virtual double getZ();
112
119 double alpha_;
122 double alphaPitch_;
123 double speedMean_;
126 double pitchMean_;
137 double updateTime_;
138 double
141 double speed_;
142 double direction_;
143 double pitch_;
144 int debug_;
146private:
152 virtual void update(double now);
158 double Gaussian();
159
160 double vx;
161 double vy;
162 double vz;
163};
164
165#endif // _UWGAUSSMARKOVMOBMODEL_
UwGMPosition class implements the Gauss Markov 3D mobility model.
virtual void update(double now)
Method that updates both the position coordinates as function of the number of states to be evaluated...
double Gaussian()
Method that returns a value from a normal random Gaussian variable (zero mean, unitary viariance)
double vx
Temporary variable.
double vz
Temporary variable.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
double alpha_
Parameter to be used to vary the randomness: 0: totally random values (Brownian motion),...
int debug_
Flag to enable or disable dirrefent levels of debug.
double speedMean_
Defines the mean value of the speed, when it is setted to zero the node moves anyway.
double pitchMean_
Mean value for the pitch.
double direction_
Current value of the direction.
virtual ~UwGMPosition()
Destructor of UwGMPosition class.
virtual double getX()
Returns the current projection of the node on the x-axis.
UwGMPosition()
Constructor of UwGMPosition class.
BoundType bound_
double directionMean_
Defines the mean value of the direction.
double yFieldWidth_
Range of the y-axis of the field to be simulated, in meters.
double nextUpdateTime_
Internal variable used to evaluate the steps to be computed.
virtual double getY()
Returns the current projection of the node on the y-axis.
double vy
Temporary variable.
virtual double getZ()
Returns the current projection of the node on the z-axis.
double speed_
Current value of the speed.
double xFieldWidth_
Range of the x-axis of the field to be simulated, in meters.
double zFieldWidth_
Range of the z-axis of the field to be simulated, in meters.
double updateTime_
Defines the behaviour of the node when it reaches the edge: SPHERIC: return in the simulation field o...
double pitch_
Current value of the pitch.
double alphaPitch_
Pitch of alpha variable.
BoundType
Defines the behaviour of the node when it reaches an edge of the simulation field.
@ THOROIDAL
@ SPHERIC
@ REBOUNCE
@ HARDWALL