# A Middleware-Based Approach for Multi-Scale Mobility Simulation
## 3 The Model
### Model Components  
In the remainder of this paper, the following concepts definitions are considered. A mobility model is an abstract representation of a mobility system. A mobility simulation is an application of a particular mobility model to visualize its behavior over a given period of time. A simulation is a computer program that performs simulations [35]. A simulation can be described as a function \(y=f(u,params)\) with:  
* \(u=\{M_{\text{od}},G\}\) the generic input parameters that are considered by the middleware, with \(M_{\text{od}}\) the origin-destination matrix and \(G\) the transportation graph. * _params_ are all the other input parameters that are specific to each simulation (e.g., drivers' aggressiveness for a microscopic simulation). These parameters will be omitted in the remainder of the presentation, since the middleware does not consider them. * \(y\) the simulation's output \(=\{(G,t_{i})_{i=0\dots n},M_{\text{od},i\bar{i}}=0\dots n\}\), which shows the successive states of \(G\), and the remaining demand through time. The middleware is inserted between two simulations, and is described by an image of \(f\), taking as input one simulation outputs and providing the other simulation with new origin-destination and a new definition of \(G\). Thus, the only levers for the middleware to influence the behavior of the simulations to be composed are the definitions of the graphs and the travelers to be transported (whatever their representation). We propose an abstract description of the characteristics of a simulation in the form of Equation (2):  
\[\mathcal{S}=\langle\omega,\sigma,\theta,\mathcal{P}\rangle \tag{2}\]  
with \(\omega\) the internal representation of the entities (flows, groups, or individuals), \(\sigma\) the spatial representation of \(G\) (detailed or aggregated) and \(\theta\) the temporal scale (seconds, minutes or hours) and which determines the difference between each pair \((t_{i},t_{i+1})\) in \(u\). \(\mathcal{P}\) represents the simulation process. We propose an abstraction of mobility simulations, based on these three main functions, inspired by the four-stage models. Step 1 (trip generation), step 2 (trip distribution), and step 3 (modal choice--the choice of transportation mode) are merged into a single Demand function, since a simulation usually has origin-destination matrices as inputs. The second function is assign (which path the travelers take). The third function is Move, representing the dynamic positions of travelers at each time step. \(\mathcal{P}\) is then described by its three functions Equation (3):  
\[\mathcal{P}=\{\text{Demand, Assign, Move}\} \tag{3}\]  
* Demand management (Demand function). This function defines how the origins and destinations of travelers in \(M_{od}\) are handled. * The assignment (function Assign). Given a request, the assignment consists of determining the path travelers will take. Each simulation may have its own method of assigning travelers and the paths determined may be different from one simulation to another. The simulations usually look for a Wardrop's equilibrium situation where no traveler would gain from changing his currently chosen itinerary [36]. * Travel times (function Move). The travel time indicates the time it takes travelers to travel, with a certain speed, through each arc of the route to which they are assigned. Let the \(\bigotimes\) operator allow for coupling two simulations. It is defined as follows Equation (4):  
\[\mathcal{S}_{1}\bigotimes\mathcal{S}_{2}=\langle\omega_{1}\circ\omega_{2}, \sigma_{1}\bullet\sigma_{2},\theta_{1}\diamond\theta_{2},\mathcal{P}_{1} \oplus\mathcal{P}_{2}\rangle \tag{4}\]  
With \(\omega_{1}\) (resp. \(\omega_{2}\)), \(\sigma_{1}\) (resp. \(\sigma_{2}\)), \(\theta_{1}\) (resp. \(\theta_{2}\)), \(\mathcal{P}_{1}\) (resp. \(\mathcal{P}_{1}\)) the properties and processes of the simulation 1 (resp. simulation 2). A middleware composing two simulations has to implement the \(\bigotimes\) operator.