53 TclObject*
create(
int,
const char*
const*) {
60 if (module->wossgm_debug_) cout << NOW <<
" WossGMMob3D::UpdateTimerPosition(" <<
module->maddr << "), timer expire, curr_state = UpdatePositionTime(), next_state = update()" << endl;
103 bind(
"zmin_", &
zmin_);
116 Tcl& tcl = Tcl::instance();
119 if(strcasecmp(argv[1],
"bound") == 0)
121 if (strcasecmp(argv[2],
"SPHERIC")==0)
125 if (strcasecmp(argv[2],
"THOROIDAL")==0)
129 if (strcasecmp(argv[2],
"HARDWALL")==0)
133 if (strcasecmp(argv[2],
"REBOUNCE")==0)
137 fprintf(stderr,
"WossGMMob3D::command(%s), unrecognized bound_ type (%s)\n",argv[1],argv[2]);
145 if(strcasecmp(argv[1],
"speedMean") == 0)
150 if(strcasecmp(argv[1],
"maddr") == 0)
152 maddr = atoi(argv[2]);
155 if(strcasecmp(argv[1],
"startLatitude") == 0)
160 if(strcasecmp(argv[1],
"startLongitude") == 0)
165 if(strcasecmp(argv[1],
"mtrace") == 0)
170 if(strcasecmp(argv[1],
"mTraceOfNode") == 0)
175 if(strcasecmp(argv[1],
"gm3dTraceFile") == 0)
182 if(strcasecmp(argv[1],
"start") == 0)
190 return Position::command(argc, argv);
213 lati = 90.0 - (asin (
x_coord / ((
earth_radius - WossPosition::getDepth()) * cos ( longi * M_PI / 180.0 ))) * 180.0 / M_PI);
215 WossPosition::setLatitude(lati);
223 WossPosition::setLongitude(longi);
228 double x1, x2, w, y1;
230 static int use_last = 0;
240 x1 = 2.0 * RNG::defaultrng()->uniform_double() - 1.0;
241 x2 = 2.0 * RNG::defaultrng()->uniform_double() - 1.0;
242 w = x1 * x1 + x2 * x2;
243 }
while ( w >= 1.0 );
245 w = sqrt( (-2.0 * log( w ) ) / w );
256 printf(
"WossGMMob3D::Update(%d), Update at (%.3f) old speed %.2f old direction %.2f \n",
maddr, NOW,
speed_,
direction_);
264 z_coord = WossPosition::getDepth();
412 cout << NOW <<
" WossGMMob3D::update(" <<
maddr <<
"), error in postion! Abort!! " << endl;
416 if (
wossgm_debug_) cout << NOW <<
" WossGMMob3D::Update("<<
maddr <<
"), newx value is: " <<
newx << endl;
417 if (
wossgm_debug_) cout << NOW <<
" WossGMMob3D::Update("<<
maddr <<
"), newy value is: " <<
newy << endl;
418 if (
wossgm_debug_) cout << NOW <<
" WossGMMob3D::Update("<<
maddr <<
"), newy value is: " <<
newz << endl;
429 WossPosition::setDepth(
z_coord);
434 printf(
"WossGMMob3D::Update(%d), now %f, updateTime %f\n",
maddr,NOW,
updateTime_);
439 saveInFile << NOW <<
"\t" << setprecision(12) <<
newx <<
"\t" << setprecision(12) <<
newy <<
"\t" << setprecision(12) <<
newz << endl;
double Gauss(double m, double sigma, int type)
TCL Hooks for the simulator.
TclObject * create(int, const char *const *)
WossGMMob3DClass()
Constructor of the 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.
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 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.
double z_coord
Previous position of the node.
WossGMMob3DClass class_wossgmmob3d
This is a Gauss-Markov random mobility model designed to use with WOSS (World Ocean Simulation System...