9.3.1. World

In general, the simulation world consists of a graph *G* = (*P*,*S*) with nodes *P* representing places or spatial regions and edges *S* representing streets. Here, the world consists of a simplified street map arranging streets orthogonally in a regular grid, although the traffic simulation is not limited to any specific map or graph geometry. An example street map is shown in Figure 13. Streets have a major orientation (horizontal or vertical) and consist of three tracks (ride, left, and middle). A vehicle can move in directions north (*N*), south (*S*), east (*E*), and west (*W*).

**Figure 13.** A typical simulation world consisting of a street map, traffic signals, places, and different vehicle classes (red: individual, blue: shared, and green: public).

9.3.2. Interaction and Mobility Model

The model parameters of vehicles and their driver agent or passengers (digital twins) are defined in Definition 3. They can be set with default values, by Monte Carlo simulation, or they can be selected and derived from crowd sensing surveys from real humans (in real-time).

**Definition 3.** *Typical model parameters of drivers and automatic vehicles.*

```
parameters = { 
    class : string "driver"|"passenger"|"co-driver"|.., 
    sub-class : string, 
    security-distance į : string "correct"|"lower"|"higher" | [0,2], 
    driving-style İ : string "normal"|"risk"|"defense", 
    sharing ȍ : number [0,1], 
    group Ȗ : number [1,100], 
    straight-routing ı : number [0,1], 
    ignore-signal Ȥ : number [0,1], 
    position : {x : number,y : number}, 
    from : {x : number,y : number}, 
    destination : {x : number,y : number}, 
    duration-expectation IJ : number [1,100], 
   }
```
The *sub-class* parameter set can address specific classes like gender, age, or more general attributes like citizen status, or living conditions. The *security-distance* behaviour (between vehicles), the *driving-style* parameter, and the *straight-routing* parameter (for route planning) are only relevant for the *driver* class. A *straight-routing* = 0 parameter results in a zig-zag routing, otherwise a longer straight-line routing is used following the current street as long as possible (range depends on parameter value). The *ignore-signal* parameter is a probability to ignore stop signals (red signal), e.g., if the signal state changes.

A typical survey job script is shown in Example 3, showing a job being passed to a crowd sensing agent. It is used to derive the actual position, e.g., of a mobile device, motion, and to get information about the user (e.g., passenger or driver). Finally, a parameter set for the behaviour model is derived and digital twins are created.

**Example 3.** *A typical crowd sensing script job (JavaScript) for tra*ffi*c flow exploration passed to a crowd sensing agent.*

```
job = { 
 script:[ 
 {sensor:'GPS' }, 
 {sensor:'ACCEL' }, 
 {question:'Where are you?', 
 choices:['Building','Street','Walkway', 
 'Anywhere','Other place']}, 
 {question:'Is this position $1 correct?', 
 choices:['Yes','No'], 
 cond : function (s) {return script[0].answer}, 
 eval : function (s) {return gps2loc(script[0].answer)} 
 } 
 {question:'How do you rate traffic density?', 
 choices:['Full','Medium','Low'], 
 cond : function (s) { return s[2].answer=='Street' && 
 s[3].answer=='Yes'}, 
 }, 
 {question:'Do you like fast driving?', 
 choices:['Yes','No'], 
 cond : function (s) { return s[2].answer=='Street'}, 
 }, 
 {question:'Do you like risks?',
```

```
 choices:['Yes','Maybe','No'], 
 }, 
 {question:'How old are you?'}, 
 {question:'Do you use a navigation device?', 
 choices:['Yes','No'], 
 cond : function (s) { return s[2].answer=='Street'}, 
 ... 
 {message:'Thank you!'} 
 ], 
 action: function (script) { 
 // create digital-twin from script data;
 .. 
 } 
}
```