DESERT 3.5.1
Loading...
Searching...
No Matches
woss-groupmobility-3d.cpp
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
37#include <node-core.h>
38#include<rng.h>
39#include<cmath>
40#include<fstream>
41#include<iomanip>
42#include<string>
44
45
46
50static class WossGroupMob3DClass : public TclClass {
51public:
55 WossGroupMob3DClass() : TclClass("WOSS/GroupMob3D") {}
56 TclObject* create(int, const char*const*) {
57 return (new WossGroupMob3D);
58 }
60
62
63 if (mod->wossgroup_debug_) cout << NOW << " WossGroupMob3D::UpdateTimerPosition(" << mod->maddr << "), timer expire, curr_state = UpdatePositionTime(), next_state = update()" << endl;
64
65 mod -> update();
66
67}
68
71 xFieldWidth_(0),
72 yFieldWidth_(0),
73 zFieldWidth_(0.0),
74 alpha_(0),
75 speedMean_(0),
78 updateTime_(0),
80 speed_(0),
81 maddr(-1),
82 start_latitude(0.0),
83 start_longitude(0.0),
84 start_x(0.0),
85 start_y(0.0),
86 mtrace_(0),
88 pitch_(0.0),
89 pitchMean_(0.0),
90 sigmaPitch_(0.0),
91 speedM_(0.0),
92 speedS_(0.0),
93 eta_(0.0),
94 charge_(0.0),
95 beta_(0.0),
96 direction_(0.0),
97 galpha_(0.0),
98 count(0),
99 zmin_(0.0),
100 vx(0.0),
101 vy(0.0),
102 vz(0.0),
103 x_coord(0.0),
104 y_coord(0.0),
105 z_coord(0.0),
106 newx(0),
107 newy(0),
108 newz(0),
109 leader_(0)
110{
111 bind("xFieldWidth_", &xFieldWidth_);
112 bind("yFieldWidth_", &yFieldWidth_);
113 bind("zFieldWidth_", &zFieldWidth_);
114 bind("alpha_", &alpha_);
115 bind("updateTime_", &updateTime_);
116 bind("directionMean_", &directionMean_);
117 bind("pitchMean_", &pitchMean_);
118 bind("sigmaPitch_", &sigmaPitch_);
119 bind("zmin_", &zmin_);
120 bind("wossgroup_debug_", &wossgroup_debug_);
121 bind("speedM_", &speedM_);
122 bind("speedS_", &speedS_);
123 bind("eta_", &eta_);
124 bind("charge_", &charge_);
125 bind("leaderCharge_", &leaderCharge_);
126 bind("galpha_", &galpha_);
127
128 count = 0;
130}
131
135
136int WossGroupMob3D::command(int argc, const char*const* argv)
137{
138 Tcl& tcl = Tcl::instance();
139 if(argc == 3)
140 {
141 if(strcasecmp(argv[1], "bound") == 0)
142 {
143 if (strcasecmp(argv[2],"SPHERIC")==0)
144 bound_ = SPHERIC;
145 else
146 {
147 if (strcasecmp(argv[2],"THOROIDAL")==0)
149 else
150 {
151 if (strcasecmp(argv[2],"HARDWALL")==0)
153 else
154 {
155 if (strcasecmp(argv[2],"REBOUNCE")==0)
157 else
158 {
159 fprintf(stderr,"GMPosition::command(%s), unrecognized bound_ type (%s)\n",argv[1],argv[2]);
160 exit(1);
161 }
162 }
163 }
164 }
165 return TCL_OK;
166 }
167 if(strcasecmp(argv[1], "speedMean") == 0)
168 {
169 speedMean_ = speed_ = atof(argv[2]);
170 return TCL_OK;
171 }
172 if(strcasecmp(argv[1], "maddr") == 0)
173 {
174 maddr = atoi(argv[2]);
175 return TCL_OK;
176 }
177 if(strcasecmp(argv[1], "startLatitude") == 0)
178 {
179 start_latitude = atof(argv[2]);
180 return TCL_OK;
181 }
182 if(strcasecmp(argv[1], "startLongitude") == 0)
183 {
184 start_longitude = atof(argv[2]);
185 return TCL_OK;
186 }
187 if(strcasecmp(argv[1], "mtrace") == 0)
188 {
189 mtrace_ = atoi(argv[2]);
190 return TCL_OK;
191 }
192 if(strcasecmp(argv[1], "mTraceOfNode") == 0)
193 {
194 mtrace_of_node_ = atoi(argv[2]);
195 return TCL_OK;
196 }
197 if(strcasecmp(argv[1], "leader") == 0)
198 {
199 WossPosition* lead = (WossPosition*)TclObject::lookup(argv[2]);
200 leader_ = lead;
201 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::command(" << maddr << "), pointer of the leader is: " << leader_ << endl;
202 return TCL_OK;
203 }
204 if(strcasecmp(argv[1], "gm3dGroupTraceFile") == 0)
205 {
206 gm3dGroupTraceFile = argv[2];
207 return TCL_OK;
208 }
209 }
210 else if(argc == 2) {
211 if(strcasecmp(argv[1], "start") == 0)
212 {
213 update();
214 return TCL_OK;
215 }
216
217 }
218
219 return Position::command(argc, argv);
220}
221
222double WossGroupMob3D::distance(WossPosition* pos1, WossPosition* pos2)
223{
224 double xdiff, ydiff, zdiff;
225 double dist;
226
227 xdiff = pos1->getX() - pos2->getX();
228 ydiff = pos1->getY() - pos2->getY();
229 zdiff = pos1->getZ() - pos2->getZ();
230
231 if (bound_==SPHERIC) {
232
233 xdiff = (fabs(xdiff)<((xFieldWidth_)/2))? xdiff : (xFieldWidth_ - fabs(xdiff));
234 ydiff = (fabs(ydiff)<((yFieldWidth_)/2))? ydiff : (yFieldWidth_ - fabs(ydiff));
235 zdiff = (fabs(zdiff)<((zFieldWidth_)/2))? zdiff : (zFieldWidth_ - fabs(zdiff));
236
237 }
238
239 dist = (sqrt(xdiff*xdiff + ydiff*ydiff + zdiff*zdiff));
240
241 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::distance(" << maddr << "), distance between leader and follower is: " << dist << endl;
242
243 return dist;
244
245}
246
247double WossGroupMob3D::mirror_posx(double x_coord_node, double x_coord_leader)
248{
249 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::mirror_posx(" << maddr << "), calculating mirror position x " << endl;
250
251 double d, dref;
252
253 d = fabs(x_coord_node - x_coord_leader);
254 dref = (xFieldWidth_)/2.0;
255
256 if ((d>dref) && (bound_==SPHERIC))
257 return ( x_coord_leader - (xFieldWidth_)*(sgn(x_coord_leader - x_coord_node)) );
258 return x_coord_leader;
259
260}
261
262double WossGroupMob3D::mirror_posy(double y_coord_node, double y_coord_leader)
263{
264 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::mirror_posy(" << maddr << "), calculating mirror position y " << endl;
265
266 double d, dref;
267
268 d = fabs(y_coord_node - y_coord_leader);
269 dref = (yFieldWidth_)/2.0;
270
271 if ((d>dref) && (bound_==SPHERIC))
272 return ( y_coord_leader - (yFieldWidth_)*(sgn(y_coord_leader - y_coord_node)) );
273 return y_coord_leader;
274
275}
276
277double WossGroupMob3D::mirror_posz(double z_coord_node, double z_coord_leader)
278{
279 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::mirror_posz(" << maddr << "), calculating mirror position z " << endl;
280
281 double d, dref;
282
283 d = fabs(z_coord_node - z_coord_leader);
284 dref = (zFieldWidth_)/2.0;
285
286 if ((d>dref) && (bound_==SPHERIC))
287 return ( z_coord_leader - (zFieldWidth_)*(sgn(z_coord_leader - z_coord_node)) );
288 return z_coord_leader;
289
290}
291
293{
294 double x1, x2, w, y1;
295 static double y2;
296 static int cache = 0;
297
298 if (wossgroup_debug_) cout << "value of cache(" << maddr << "): " << cache << endl;
299
300 if (cache)
301 {
302 y1 = y2;
303 cache = 0;
304 }
305 else
306 {
307 do
308 {
309 x1 = 2.0 * RNG::defaultrng()->uniform_double() - 1.0;
310 x2 = 2.0 * RNG::defaultrng()->uniform_double() - 1.0;
311 w = x1 * x1 + x2 * x2;
312 } while ( w >= 1.0 );
313
314 w = sqrt( (-2.0 * log( w ) ) / w );
315 y1 = x1 * w;
316 y2 = x2 * w;
317 cache = 1;
318 }
319 if (wossgroup_debug_) cout << "value of y1(" << maddr << "): " << y1 << endl;
320 return(y1);
321}
322
323
325{
326 start_x = (earth_radius - WossPosition::getDepth()) * sin((90.0 - start_latitude) * M_PI / 180.0) * cos (start_longitude * M_PI / 180.0);
327 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::getStartX(" << maddr << "), values of x0: " << setprecision(12) << start_x << endl;
328 return start_x;
329
330}
331
333{
334 start_y = (earth_radius - WossPosition::getDepth()) * sin((90.0 - start_latitude) * M_PI / 180.0) * sin (start_longitude * M_PI / 180.0);
335 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::getStartY(" << maddr << "), values of y0: " << setprecision(12) << start_y << endl;
336 return start_y;
337
338}
339
340void WossGroupMob3D::setLat(double x_coord, double y_coord)
341{
342 double lati, longi;
343 longi = atan2(y_coord,x_coord) * 180.0 / M_PI;
344 lati = 90.0 - (asin ( x_coord / ((earth_radius - WossPosition::getDepth()) * cos ( longi * M_PI / 180.0 ))) * 180.0 / M_PI);
345 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::setLatitude(" << maddr << "), new latitude value: " << setprecision(12) << lati << endl;
346 WossPosition::setLatitude(lati);
347}
348
349void WossGroupMob3D::setLong(double x_coord, double y_coord)
350{
351 double longi;
352 longi = atan2(y_coord,x_coord) * 180.0 / M_PI;
353 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::setLongitude(" << maddr << "), new longitude value: " << setprecision(12) << longi << endl;
354 WossPosition::setLongitude(longi);
355}
356
358{
359 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::update(" << maddr << "), updating value. " << endl;
360
361 double pr_pitch_;
362
363 // calculate new sample of speed and direction
365 printf("GMPosition::Update(%d), Update at (%.3f) old speed %.2f old direction %.2f old pitch %.2f\n", maddr, NOW, speed_, direction_, pitch_);
366
367 if (wossgroup_debug_) printf ("previous x-coord(%d) value: %.6f \n", maddr, WossPosition::getX());
368 x_coord = WossPosition::getX() - getStartX();
369 if (wossgroup_debug_) printf ("x-coord(%d) value: %.6f \n", maddr, x_coord);
370
371 if (wossgroup_debug_) printf ("previous y-coord(%d) value: %.6f \n", maddr, WossPosition::getY());
372 y_coord = WossPosition::getY() - getStartY();
373 if (wossgroup_debug_) printf ("y-coord(%d) value: %.6f \n", maddr, y_coord);
374
375 if (wossgroup_debug_) printf ("previous z-coord(%d) value: %.6f \n", maddr, WossPosition::getDepth());
376 z_coord = WossPosition::getDepth();
377 if (wossgroup_debug_) printf ("z-coord(%d) value: %.6f \n", maddr, z_coord);
378
379 if (speedMean_ == 0) {
380 newx = x_coord;
381 newy = y_coord;
382 newz = z_coord;
383 }
384 else {
385 speed_ = (alpha_*speed_) + (((1.0-alpha_))*speedMean_) + (sqrt(1.0-pow(alpha_,2.0))*Gaussian());
386 direction_ = (alpha_*direction_) + (((1.0-alpha_))*directionMean_) + (sqrt(1.0-pow(alpha_,2.0))*Gaussian());
388
389 pr_pitch_ = pitch_;
390
392 printf("GMPosition::Update(%d), new speed %.2f new direction %.2f new pitch %.2f\n", maddr, speed_, direction_, pitch_);
393
394 //calculate velocity
395
396 vx = speed_ * cos(direction_) * cos(pitch_);
397 if (wossgroup_debug_) cout << "velocity in x(" << maddr << "): " << vx << endl;
398 vy = speed_ * sin(direction_) * cos(pitch_);
399 if (wossgroup_debug_) cout << "velocity in y(" << maddr << "): " << vy << endl;
400 vz = speed_ * sin(pitch_);
401 if (wossgroup_debug_) cout << "velocity in z(" << maddr << "): " << vz << endl;
402
403 // calculate new position
404 newx = x_coord + (vx * updateTime_);
405 if (wossgroup_debug_) cout << "newx(" << maddr << ") value: " << newx << endl;
406 newy = y_coord + (vy * updateTime_);
407 if (wossgroup_debug_) cout << "newy(" << maddr << ") value: " << newy << endl;
408 newz = z_coord + (vz * updateTime_);
409 if (wossgroup_debug_) cout << "newz(" << maddr << ") value: " << newz << endl;
410
411 //Add leader Attraction
412
413 if (leader_ != 0) {
414
415 double cx, cy, cz, dist, gamma;
416
417 //gamma = direction_;
418
419 cx = mirror_posx(newx, (leader_->getX() - getStartX()));
420 cy = mirror_posy(newy, (leader_->getY() - getStartY()));
421 cz = mirror_posz(newz, (leader_->getDepth()));
422
423 dist = distance(leader_,this);
424 if((galpha_ < 0) && (dist < 1)) dist = 1.0;
425
426 beta_ = ((1.0 - eta_) * beta_) + (eta_ * randlib.Gauss(speedM_,speedS_,0));
427
428 double rho = updateTime_ * beta_ * charge_ * leaderCharge_ * pow(dist, -galpha_);
429
430 if ((cx - newx) == 0) direction_ = pi / 2 * sgn (cy - newy);
431 else direction_ = atan ((cy - newy) / (cx - newx));
432 if ((cx - newx) < 0.0) direction_ += (newy - cy) >= 0.0 ? pi : - pi;
433 if (((cx - newx) == 0) && ((cy - newy) == 0) && ((cz - newz) == 0)) pitch_ = pitch_ / pi;
434
435 if (wossgroup_debug_) cout << "Value of rho: " << rho << endl;
436 if (wossgroup_debug_) cout << "Value of direction: " << gamma << endl;
437
438 if (pr_pitch_ == pitch_) {
439 newx += rho * cos(direction_);
440 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::update(" << maddr << "), new x-coord value (after leader attraction): " << setprecision(12) << newx << endl;
441 newy += rho * sin(direction_);
442 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::update(" << maddr << "), new y-coord value (after leader attraction): " << setprecision(12) << newy << endl;
443 }
444 else {
445 newx += rho * cos(direction_) * cos(pitch_);
446 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::update(" << maddr << "), new x-coord value (after leader attraction): " << setprecision(12) << newx << endl;
447
448 newy += rho * sin(direction_) * cos(pitch_);
449 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::update(" << maddr << "), new x-coord value (after leader attraction): " << setprecision(12) << newy << endl;
450
451 newz += rho * sin(pitch_);
452 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::update(" << maddr << "), new z-coord value (after leader attraction): " << setprecision(12) << newz << endl;
453 }
454
455 }
456
457 // verify whether the new position has to be re-computed in order
458 // to maintain node position within the simulation
459
460 if ((newy > yFieldWidth_) || ( newy < 0))
461 {
462 switch (bound_)
463 {
464 case SPHERIC:
467 break;
468 case THOROIDAL:
472
473 newx = xFieldWidth_/2;
474 newy = yFieldWidth_/2;
475 newz = zFieldWidth_/2;
476
477 break;
478 case HARDWALL:
479 newy = newy<0?0:yFieldWidth_;
480 break;
481 case REBOUNCE:
482 if (newy>yFieldWidth_)
483 {
484 newy = 2*yFieldWidth_ - newy;
486 }else{
487 newy = 0 - newy;
488 y_coord = 0 - y_coord;
489 }
490 direction_ *= -1;
491 break;
492 }
493 }
494
495 if ((newx > xFieldWidth_) || ( newx < 0))
496 {
497 switch (bound_)
498 {
499 case SPHERIC:
502 break;
503 case THOROIDAL:
507
508 newx = xFieldWidth_/2;
509 newy = yFieldWidth_/2;
510 newz = zFieldWidth_/2;
511
512 break;
513 case HARDWALL:
514 newx = newx<0?0:xFieldWidth_;
515 break;
516 case REBOUNCE:
517 if (newx > xFieldWidth_)
518 {
519 newx = 2*xFieldWidth_ - newx;
521 }else{
522 newx = 0 - newx;
523 x_coord = 0 - x_coord;
524 }
525 if (newy==y_coord)
526 {
527 if (newx>x_coord)
528 direction_ = 0;
529 else
530 direction_ = pi;
531 }else{
532 if (newy>y_coord)
534 else
536 }
537 break;
538 }
539 }
540
541 if ((newz > zFieldWidth_) || ( newz < zmin_))
542 {
543 switch (bound_)
544 {
545 case SPHERIC:
548 break;
549 case THOROIDAL:
553
554 newx = xFieldWidth_/2;
555 newy = yFieldWidth_/2;
556 newz = zFieldWidth_/2;
557
558 break;
559 case HARDWALL:
560 newz = newz<0?0:zFieldWidth_;
561 break;
562 case REBOUNCE:
563 if (newz > zFieldWidth_)
564 {
565 newz = 2*zFieldWidth_ - newz;
567 }else{
568 newz = 2*zmin_ - newz;
569 z_coord = 2*zmin_ - z_coord;
570 }
571 break;
572 }
573 }
574
575 if ((newx < 0.0)||(newx > xFieldWidth_)||(newy < 0.0)||(newy > yFieldWidth_)||(newz < zmin_)||(newz > zFieldWidth_)) {
576 cout << NOW << " WossGroupMob3D::update(" << maddr << "), error in postion! Abort!! " << endl;
577 update();
578 }
579
580 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::update(" << maddr << "), new x-coord value (after wrapping): " << setprecision(12) << newx << endl;
581 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::update(" << maddr << "), new y-coord value (after wrapping): " << setprecision(12) << newy << endl;
582 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::update(" << maddr << "), new z-coord value (after wrapping): " << setprecision(12) << newz << endl;
583
584 x_coord = newx + getStartX();
585 Position::setX(x_coord);
586 y_coord = newy + getStartY();
587 Position::setY(y_coord);
588 z_coord = newz;
589 Position::setZ(z_coord);
590 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::update(" << maddr << "), new cartesian x-coord value: " << setprecision(12) << x_coord << endl;
591 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::update(" << maddr << "), new cartesian y-coord value: " << setprecision(12) << y_coord << endl;
592 if (wossgroup_debug_) cout << NOW << " WossGroupMob3D::update(" << maddr << "), new depth value: " << setprecision(12) << z_coord << endl;
593
595 }
596
599 WossPosition::setDepth(z_coord);
600
602 printf(" WossGroupMob3D::Update(%d), now %f, updateTime %f\n", maddr,NOW, updateTime_);
603
604 if (mtrace_) {
605 if (maddr == mtrace_of_node_) {
606 ofstream saveInFile(gm3dGroupTraceFile.c_str(), ios::app);
607 saveInFile << NOW << "\t" << setprecision(12) << newx << "\t" << setprecision(12) << newy << "\t" << WossPosition::getDepth() << endl;
608 saveInFile.close();
609 }
610 }
611
613}
double Gauss(double m, double sigma, int type)
TCL Hooks for the simulator.
WossGroupMob3DClass()
Class constructor.
TclObject * create(int, const char *const *)
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.
WossPosition * leader_
Position pointer of the leader.
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.
WossGroupMob3DClass class_wossgroupmob3D
This is a implementation of a leader-follower mobility model for WOSS (World Ocean Simulation System)...
#define pi
#define earth_radius
#define sgn(x)