Behavior of each node is described as sequence of rules in MobiREAL. We call this description method CPE description and mobility models described by CPE description CPE model. A rule is composed of (1) condition, (2) probability and (3) behavior. And a node behaves based on the corresponding probability if it satisfies a specified condition.
The following rule represents behavior that a node goes to a shop in sales based on 50% probability if it received bargain information.
< Condition > Receive bargain information from an application (a mobile terminal) < Probability > 50% < Action > Go to a shop in sales
A node can behave non-deterministicly to the same condition by using probability in a rule.
< Example > The following two rules can be described within one model.
[Rule 1]
< Condition > Cannot arrive at the destination in time
< Probability > 70%
< Action > (In a hurry) Speed up
[Rule 2]
< Condition > Cannot arrive at the destination in time
< Probability > 20%
< Action > Give up to go there and go to another destination
The condition can be also represented as a logical expression such that "a node cannot arrive at a destination and current position is within 50m from the destination."
MobiREAL provides several functions and values so that users can easily describe condition, probability and behavior. Please refer < 2.3 > about these functions and values.
Mobility models are described by sequence of rules which we mention in < 1.1 > .
Nodes determine their behavior based on these mobility models as below.
[Rules] < Condition > < Probability > < Action > [Rule1] < Arrived > < 100% > < Go to one of destinations in Dlist > [Rule2] < Crowded > < 30% > < Detour > [Rule3] < Almost late > < 80% > < Hurry > [Rule4] < Almost late > < 100% > < Give up to go to the destination and go to another >
We explain details with the above table.
At first, a node checks the condition of Rule1 and
if it satisfies the condition, it executes the behavior of Rule1
at 100% probability (i.e. inevitably).
If not, then it checks the condition of Rule2.
And if it satisfies that,
it executes the behavior of Rule2 at 30% probability.
If not or it doesn't execute corresponding behavior because of probability,
then it checks Rule3.
In this way, a node checks the next rule sequentially
if it doesn't execute the behavior of checking rule.
A node finishes checking rules
and moves with the velocity vector which is same to the last
after executing behavior of a rule or checking all rules.
But the velocity vector can be changed by
Collision Avoidance.
Of course, you need to set the order of rules and each probability carefully when you describe a rules.
< Example> Think about a mobility model where 2 rules are described as the following order
[Rule 1]
< Condition > Arrived at the destination
< Probability > 100%
< Behavior > Go to one of destinations in Dlist
[Rule 2]
< Condition > Arrived at the destination and Dlist is empty
< Probability > 100%
< Behavior > Go to the position where the node was generated
If the condition of Rule1 is satisfied, the node inevitably executes the behavior of Rule1 in this mobility model bacause corresponding probability is 100%. However, the condition of Rule2 includes that of Rule1. Since a mobility model doesn't check the following rules after executing behavior of a certain rule, the behavior of Rule2 is never executed.
Consequently, some techniques like the followings are needed.
When you describe rules, you use the defined variables.
These variables are composed of internal variables and external variables.
The internal variables can be accessed(and updated) only from inside of CPE model, and
the external variables can be from the outside of CPE model.
You can also define new internal variables and use them.
| Variable | Explanation |
|---|---|
| dst.p | variable that the present destination point(cross-point ID) is stored |
| dst.r | list that the sequence of path point to the present destination is stored |
| dst.t | variable that the estimated time of arrival to the present destination is stored |
| dst.s | variable that the residence time at the present destination is stored |
| Dlist | list that the destinations the node will visit are stored |
【Example of user defined internal variables】 staying : flag which intend staying at the destination overstaying : flag which intend extending the stay residence time at the destination sst variable that the clock when the node arrives at the destination is stored
| Variable | Explanation |
|---|---|
| T | simulation clock |
| E | surroundings information(e.g nodes or obstacles) |
| AO | output data form the network system to the node |
| AI | input data of the node to the network system |
| P | position |
| V | velocity vector |
You need describe rules as a member function "rule" in each mobility class with C++. Format of a rule is as follows.
if (Condition && Probability) {Action; return;}
So you can describe sequence of rules as CPE Model.
[Rule1]
< Condition > The node might be late for the estimated time of arrival at the destination, but the node arrives in time if it hurries up.
< Probability > 70%
< Action > Speed up by 0.5m/s(hurry up).
[Rule2]
< Condition > Even if the node hurries up, it is not in the estimated time of arrival.
< Probability > 20%
< Action > The node gives up going to the destination, and it goes to next destination.
if (late(P, V, T, dst) && prob(70)) {V=fast(V, 0.5, dst); return;}
if (miss(P, V, T, dst) && prob(20)) {
dst=pop(Dlist);
dst.r=shortest_path(P, dst.p);
return;
}
In this subsection, We describe the example of CPE Model with variables and functions in < 2.3 >. The node of CPE Model circulars a number of destinations. This CPE Model is a multipurpose model which has these features: