Node mobility in MIRACLE is ruled by two classes named BMPosition and GMPosition, derived from Position class. The former utilizes a Basic Movement (BM) model and the latter uses a Gauss-Markov (GM) model.
These models are those we provide with the MIRACLE release, but you can feel free to create your own!
The Basic Movement model moves nodes in uniform straightforward way. Nodes are moved by setting their destination by using the Tcl command setdest, which accepts as inputs the coordinates of the destination and the speed (in meters per second) of the node. The true position of the node is updated only when needed, e.g. when the destination is changed or a calculation (as freespace attenuation or upon a getPosition() call) is requested by an external module. In this model no control is added about borders of simulation field, so this means that a node, reached the setdest coordinates, will move in that direction and will not stop since a new destination is set.
The GMPosition Model is more complex than the previous one. In this case, nodes perform direction changes autonomously and a control of the behavior at borders is provided. Nodes adopting this mobility model requires mean direction (in radians) and a mean speed as inputs.
Speed and direction are calculated form mean values given as inputs multiplicating them by a random value, according to the following law (the law for direction is the same):
speed_ = (alpha_*speed_) + (((1.0-alpha_))*speedMean_) +
As could be seen, the current (in this case) speed is calculated from previous value of speed and the mean speed, given as input. The incidence of the mean value is controlled by the alpha parameter, which assumes values between 0 and 1. So the variations of speed are due to the ``old'' current speed and a random value provided by the Gaussian() function. It must be noticed that even if speedMean_ is 0, the current speed could be non-zero. As in the previous model, position update is calculated when needed, but in this case every step from previous update is computed (because a gaussian walk is made of several gaussian steps). The time resolution of each step is provided by the updateTime_ variable.
There are four different behaviors for nodes reaching boundaries. These are REBOUNCE, HARDWALL, SPHERIC and THOROIDAL. In the first case the node rebounces on the border line, it means that if at least one of the coordinates exceeds the x or y field width it will be carried back in the field by a value equal to the difference between the exceeding coordinate and the field maximal coordinate. For example, if the simulation field is 100 meters wide and the new coordinate is 102 meters, then rebounce algo will carry back coordinate to 98 which is 100 - (102 - 100).
The HARDWALL behavior expects that the node stops its movement at the border of the field, if trepassed. In case of SPHERIC behavior the node will be put on the other side of the field, like an overflow. In the last case, THOROIDAL, the node is put at the centre of the field.