HOME>> Behavior Simulator>> Mobility Model   [[Japanese]]

# 1 Overview of Our Mobility Model

## 1.1 Rule

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.

## 1.2 Sequence of rules

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.

1. Periodically check rules of its mobility model from the top of sequence.
2. If condition is satisfied, execute corresponding behavior based on specified probability.
3. If condition is not satisfied or in the case that a node doesn't execute corresponding behavior because of probability, check the next rule.
4. When behavior of a certain rule is executed, don't check the following rules.
``` [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.

• Reverse the order of Rule1 and Rule2
• Add a condition, "Dlist is not empty", to Rule1.

# 2 Modeling behavior with CPE description

## 2.1 Variable used in describing rules

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.

### Internal Variable

Variable Explanation
dstÅDp variable that the present destination point(cross-point ID) is stored
dstÅDr list that the sequence of path point to the present destination is stored
dstÅDt variable that the estimated time of arrival to the present destination is stored
dstÅDs variable that the residence time at the present destination is stored
Dlist list that the destinations the node will visit are stored

```ÅyExample of user defined internal variablesÅz
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
```

### External Variable

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

## 2.2 Condition and Action we provide

We provide the functions which are used in Condition and Action in order to be able to describe CPE model easily.

>Library

We will provide useful functions in addition.
You can also define new functions and use them.

## 2.3 How to describe rules

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.

Example Let's describe the next rules.
```  [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.
```
[Rule1]
You use the function "late" in Condition and the function "fast" in Action.
Therefore, you can describe Rule1 as follows. (We assume unit of time is second and unit of distance is meter.)
```   if (late(P, V, T, dst) && prob(70)) {V=fast(V, 0.5, dst); return;}
```
[Rule2]
You use the function "miss" in Condition. Because list Dlist stores the destinations the node will visit, in order to give up going to the destination and go to next destination, you pick up the head element of Dlist and substitute its element into variable dst. Then, you let the simulator calculate the path to the next destination. Therefore, you can describe Rule2 as follows.
```   if (miss(P, V, T, dst) && prob(20)) {
dst=pop(Dlist);
dst.r=shortest_path(P, dst.p);
return;
}
```

## 2.4 Example of source

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:

• If the node arrive at the destination, then it stays for the defined residence time, and goes to next destination.
• The node extends the stay residence time.
• If the node acquire the information of a shop, then it goes to the shop with probability 50%.
• If front region is crowded, the node detours with the probability according to time.
• If the node is not in time for estimated time of arrival, it hurries up in time or gives up.
In additionÅCwe assume unit of time is second and unit of distance is meter.

>source(piece abstract)

# 3 Sample movie

Under Construction. Please wait for a while.