Digital Training Platform for Comprehensive Traffic Simulation

mtrapez@yandex.ru Abstract — The paper deals with the development of software for traffic flow simulation combining the widest spectrum of mathematical approaches used in this field. Macro- and microscopic models, models of cellular automata as well as different numerical methods of their computer implementation are incorpo-rated into a digital platform. Original developments of the authors of the paper such as quasi-gas dynamic traffic model and multilane cellular automata model take the main place. Potential users of the software are students and researchers. The platform possesses an intuitive graphical interface ensuring interactivity. Microsoft Visual Studio with C# is chosen as the development environment, the Unity 3D engine is employed for visualization and collaboration with WinForm projects. In the future, the platform can be transformed into a network computer laboratory providing access to information resources via


Introduction
Despite the long history of studying the dynamics of traffic flows, there are several reasons why this topic is still insufficiently studied. First, traffic flows are very diverse and changeable. Secondly, when trying to optimize traffic, one encounters some contradictions when it is necessary to improve the quality and speed of transport, and, on the other hand, to ensure the safety of all participants (especially pedestrians). Thirdly, weather conditions require serious adjustments, which also affects speed and quality of driving. Modeling a transport network taking into account all of the above factors is a complex and rather painstaking task. In addition, the modeling of traffic flows should allow solving both short-term problems and making forecasts with a long-term perspective.
Most often, the models describing the traffic flow are divided into two large classes: analog models (which, in particular, include macroscopic models), which are similar to the description of processes associated with the dynamics of gases and liquids. The second main class is microscopic models, when the movement of individual transport units participating in the traffic flow is considered. The latter are more often used to solve local problems on specific road sections, and macroscopic models can help with more global problems of the transport network.
In order to study various aspects of traffic flows using already existing as well as new models, the digital platform can serve as a good learning tool. It can include both the simplest macroscopic and microscopic models for studying the main characteristics of traffic flows, and more complex software tools for focusing on the detailed description of some processes. In addition, various algorithms for the numerical implementation of the models used can be presented in order to improve users' qualification in the field of computational mathematics. These problems, as well as a brief overview of existing mathematical models in different areas of transport modeling are the subject of this article.

Overview of models and packages for traffic simulation
Attempts to simulate traffic flows date back to the 50s of the 20th century and the first models were built by analogy with gas dynamic models. They were called macroscopic. For the first time macroscopic models were proposed by Lighthill-Whitham-Richards in 1955 [1]. They were the ones who used mathematical methods to model traffic jams. The flow of vehicles is considered as a flow of a weakly compressible fluid and the approximation of a continuous medium is used.
In a more complex form, for example in the Payne's model [2] the macroscopic model also includes the acceleration equation. As a further development of the physical approach to modeling traffic flows, in [3] a model based on the Boltzmann equation was proposed. The appearance of the first microscopic models also belongs to the beginning of the 50s. The simplest car-following model is the Newell model [4].
Models of cellular automata have become a separate area of research. These models in relation to traffic flows simulation were first developed in the works of K. Nagel and M. Schreckenberg [5].
Modern models are developing in all of the above directions and are much more realistic and complex in terms of driver behavior than their prototypes. They allow to take into account the specifics of cities and regions, to simulate traffic on complex transport networks of large cities and megalopolises.
In recent years different tools and simulators have been developed. There are a number of simulation tools available to support traffic research. For example, the commercial packages Simulation PTV Vissim [6] and Aimsun [7] as well as the open source traffic simulator MATSim [8] are well known. One of the recent developments is the open source traffic simulator SUMO [9] The software mentioned above uses microscopic models. In the paper [10] the hybrid Mesoscopic-Microscopic approach is under consideration. Also, a hybrid, but Submicroscopic-Microscopic method is used in the article [11] to describe lateral motion and vehicle interactions with more precision. Authors of the paper [12] consider the motion of the automated vehicles in mixed traffic, their interaction with the conventional traffic.
An interesting modern and promising direction is the modeling of traffic flows using neural networks. Authors of [13] use this approach for the short-term prediction of traffic flow dynamics. In the paper [14] the virtual traffic simulation is presented.
Models based on the cellular automata theory remain one of the main directions of transport modeling [15,16].
One of the interesting developments in recent years is a multi-lane cluster model of traffic flows [17], and its numerical implementation on a lane and a network, represented as a set of rings with common points.
Modern computer graphic tools provide great opportunities for visual modeling of traffic flows. This issue is discussed in the paper [18].
In addition, due to the most powerful multiprocessor computing systems that have appeared in recent times, it has become possible to carry out real time computations, using not only macroscopic, but also microscopic models. The first attempt of real-time simulation is presented in [19]. As for the papers devoted to the use of modern computing systems for modeling traffic flows on networks of large metropolitan areas, [20,21] are worth mentioning.
A brief overview shows that modern traffic simulation has many tools and possibilities. The digital platform can help to understand the existing variety of models and computing technologies in order for the selected software tools to help in the chosen direction of research.

3
Software implementation of a platform for traffic simulation

User requirements, interface, and platform functionality
The purpose is to develop software, combining the widest spectrum of mathematical approaches used in traffic flow modeling. Those are macro-and microscopic models, models of cellular automata as well as different numerical methods of their computer implementation. The software is mainly intended for learning, the potential users are students and researchers. Therefore, an important property of the platform being developed is interactivity, since the use of interactive educational resources increases the efficiency of mastering the subject. To ensure interactivity, an interface is needed, which must be developed in accordance with modern UI/UX design requirements. The key task of UI/UX design is to organize a comfortable and intuitive user interaction with the application. Preference is given to the graphical interface, which makes transparent the interconnection of the program components and helps the user to navigate the application quickly. When creating the application framework, scenarios of user behavior are worked out. These scenarios are the basis for the further development of the interface, filling it with content and adding functionality.
At presence the functional of the training platform consists of the following main models and calculation methods:

Microscopic models
Newell's Car-Following Model [26] Gipps' model [26] 4. Models of cellular automata (CA) [5,27] Multilane CA model based on Nagel-Schreckenberg model [24,25,21] Note, that the QGD traffic model and the multilane CA model are original developments of the authors of the present paper.
Each section includes a theoretical block and a set of test problems of varying complexity, allowing you to compare the corresponding models and methods. Graphical presentation of the results is provided.

Development environment, programming language and visualization tools
Taking into account the above statements, the following requirements were formulated for the application development environment and the programming language of this environment: • cross-platform; • free non-commercial use; • convenience of the interface; • ease of navigation; • object-oriented approach.
Microsoft Visual Studio, an environment for developing applications under Windows, with both console and graphical interface, fits these criteria. For visualization and collaboration with a WinForm project, the modern cross-platform Unity 3D engine [28] is best suited. It can be used to create applications and games for personal and laptop computers, game consoles and phones. The Unity development environment supports three programming languages, including C#, which connects through Microsoft Visual Studio. In addition, Unity has an extensive database of free 3D models that provide great visualization possibilities. When it comes to interoperability between Visual Studio and Unity, these frameworks support mutual integration, which enables them to be intelligently completed.

Experiments: Approbation of macro-and microscopic models, visualization of calculation results
The platform sections "Macroscopic models" and "Microscopic models" include the subsections "Theory", "Examples" and "Calculation methods". The well-known LWR model [26] with the parabolic fundamental diagram and the QGD traffic model with terms responsible for entry/exit and changing the number of lanes [24,25] are embedded. The user has the opportunity to compare results of some problems' solution, obtained on the basis of these models. One of the problems is to simulate the movement of vehicles on the road with complex geometry, shown in Figure 1 [26]. Users are invited to change the coordinates of bottlenecks (entrances/exits, narrowing of the road), initial conditions, input flows. The results for QGD model are shown in Figure 2 in the form of density profiles along the highway at four successive points in time. One can see the influence of different types of bottlenecks. In particular, the upstream propagation of the jam caused by the lane closure is observed.   Fig. 1

Experiments: Implementation and visualization of a cellular automata traffic model using Unity 3D
A significant part of the project is the development of visualization tools for a traffic flow model based on the CA theory, namely, the Nagel-Schreckenberg model, extended to the case of multi-lane traffic [24,25,21]. The primary task is to ensure the interaction of the code with visual components. Vehicles are generated in Unity 3D, the point of their appearance is the cell at the very beginning of the road. The visualized road section is located in a certain city, so various objects of urban infrastructure (cross-roads, houses, parks, etc.) were added to the project. The interaction of objects in Unity occurs through scripts that are attached to objects in the scene [29].
According to the technology of object-oriented programming, the main classes are distinguished: Cell, Machine, Model Parameters, Element Of Chance, Road, and Road-Controller -a class that unites all the others, it is this class that interacts with the graphics engine.
The CA model in Unity was tested using two tasks: single-lane traffic with traffic lights and two-lane traffic with lane changes. An example of visualization is shown in Figure 3.

Conclusion
In the course of the research, new unique software for modeling traffic flows was created, combining both classical models and methods, and some original contributions of the authors of the paper, which have advantages over the developments of other authors. Characteristic features of the proposed digital platform are interactivity, visual presentation of simulation results, modular structure. The software has great potential for further development due to the inclusion of modules that implement new models and tasks. In the future, the platform can be transformed into a networked computer laboratory that provides access to information resources via Internet.