A GPU-based microscopic traffic simulation system

CN117350017BActive Publication Date: 2026-10-23TSINGHUA UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311116322.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-31
Publication Date
2026-10-23
Estimated Expiration
2043-08-31

AI Technical Summary

Technical Problem

但是,针对目前缺乏相关研究

Benefits of technology

[0052]本发明提供的一种基于GPU的微观交通模拟系统,包括:主机端、设备端和路径规划服务端;所述主机端工作在CPU上,包括:数据载入单元和路径规划请求与响应转发单元;所述设备端工作在GPU上,包括:交通运行模拟单元;所述数据载入单元,用于载入微观交通模拟的初始数据,并转发给所述设备端;其中,所述初始数据包括:城市道路网数据、城市感兴趣区域数据以及每一个待模拟车辆的出行时刻表;所述路径规划请求与响应转发单元,用于实现所述设备端与所述路径规划服务端之间的路径规划请求与响应的转发;所述交通运行模拟单元,用于基于所述初始数据,对城市感兴趣区域中的待模拟车辆进行第一交通运行模拟仿真,对城市道路网中的待模拟车辆进行第二交通运行模拟仿真;其中,所述第一交通运行模拟仿真具体为在每一时刻检查当前全局时钟与相应车辆出发时间是否重合,并在重合时向所述主机端发送包含相应车辆出发地与目的地的路径规划请求以得到对应的路径规划响应;所述第二交通运行模拟仿真具体为根据城市道路网信息、城市感兴趣区域信息和相应车辆的路径规划,模拟相应车辆的交通运行;所述路径规划服务端,用于根据所述主机端转发的路径规划请求,向所述主机端发送路径规划响应。本发明考虑到CPU擅长处理复杂的分支跳转与差异化的并行任务,可以进行磁盘读写、网络传输等I/O操作,但总体算力有限;GPU擅长处理海量的同质化的并行任务,能提供海量算力,但执行复杂的分支跳转和差异化并行任务时会降低其执行效率,而且不能直接进行磁盘读写、网络传输等I/O操作。因此,设计主机端、设备端和路径规划服务端分别执行微观交通模拟任务的数据读取、模拟仿真、路径规划三个子任务,并将主机端设置在CPU上,将设备端设置在GPU上,从而完成GPU算力充分利用与微观交通模拟的计算加速,进而大幅提高微观交通模拟任务执行效率,充分发挥微观交通模拟的应用价值。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117350017B_ABST
    Figure CN117350017B_ABST
Patent Text Reader

Abstract

The application provides a GPU-based microscopic traffic simulation system, comprising a host end, a device end and a path planning service end; the host end loads initial data and transmits the initial data to the device end, and also forwards path planning requests and responses between the device end and the path planning service end; the device end sends a path planning request of a vehicle to be simulated to the host end to obtain a path planning response, and uses the initial data and the path planning of the vehicle to be simulated to complete traffic running simulation and simulation of the vehicle to be simulated; after receiving the path planning request from the host end, the path planning service end feeds back a path planning response to the host end. According to the characteristics of CPU and GPU, the microscopic traffic simulation task is divided into three sub-tasks of initial data reading, simulation and path planning, and is completed on CPU, GPU and the path planning server, so that the GPU computing power is fully utilized and the calculation of microscopic traffic simulation is accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of traffic simulation technology, and in particular to a GPU-based microscopic traffic simulation system. Background Technology

[0002] Microscopic traffic simulation refers to the simulation of urban traffic operations by modeling the microscopic behaviors of each individual traffic participant and the interrelationships between multiple participants. It aims to recreate sub-second, fine-grained traffic conditions at the city scale. Typical applications of microscopic traffic simulation include urban lane planning and urban traffic capacity calculation, demonstrating significant social value. However, completing such city-level sub-second, fine-grained microscopic traffic simulations requires substantial computational resources. Therefore, microscopic traffic simulation systems must be able to fully utilize these resources to complete the simulation tasks.

[0003] However, current microscopic traffic simulation systems mainly use multi-threaded computation, such as CityFlow[1] and QarSUMO[2]. Compared with the single-threaded microscopic traffic simulation system SUMO[3], multi-threaded microscopic traffic simulation systems can more effectively utilize the CPU computing resources of a single computer. However, in city-level sub-second fine-grained microscopic traffic simulation tasks, the CPU computing resources of a single computer cannot support the rapid execution of the simulation task, which limits the downstream work such as analysis, iteration, and model training based on the simulation task execution results. As a computing acceleration device, GPU can provide super-large computing power. Applying GPU to the simulation computation of microscopic traffic simulation systems can provide a solution for the rapid execution of city-level sub-second fine-grained microscopic traffic simulation tasks. However, there is currently a lack of relevant research.

[0004] Therefore, for micro-traffic simulation, how to reasonably design a GPU-based micro-traffic simulation system has become an important problem that urgently needs to be solved. Summary of the Invention

[0005] To address the aforementioned issues, this invention provides a GPU-based micro-traffic simulation system. Based on the characteristics of CPUs and GPUs, the micro-traffic simulation task is broken down into three sub-tasks: initial data reading, simulation, and route planning. These sub-tasks are completed on the CPU, GPU, and route planning server, respectively, thereby fully utilizing GPU computing power and accelerating the computation of micro-traffic simulation.

[0006] In a first aspect, the present invention provides a GPU-based microscopic traffic simulation system, the system comprising: a host terminal, a device terminal, and a route planning server;

[0007] The host unit operates on the CPU and includes: a data loading unit and a path planning request and response forwarding unit;

[0008] The device operates on a GPU and includes: a traffic operation simulation unit;

[0009] The data loading unit is used to load the initial data of the micro-traffic simulation and forward it to the device; wherein, the initial data includes: urban road network data, urban area of ​​interest data, and travel timetable of each vehicle to be simulated;

[0010] The path planning request and response forwarding unit is used to forward path planning requests and responses between the device and the path planning server.

[0011] The traffic operation simulation unit is used to perform a first traffic operation simulation on vehicles to be simulated in the urban region of interest based on the initial data, and a second traffic operation simulation on vehicles to be simulated in the urban road network. Specifically, the first traffic operation simulation involves checking whether the current global clock coincides with the departure time of the corresponding vehicle at each moment, and sending a route planning request containing the departure and destination of the corresponding vehicle to the host terminal when they coincide to obtain the corresponding route planning response. Specifically, the second traffic operation simulation involves simulating the traffic operation of the corresponding vehicle based on the urban road network information, the urban region of interest information, and the route planning of the corresponding vehicle.

[0012] The route planning server is used to send a route planning response to the host based on the route planning request forwarded by the host.

[0013] According to the GPU-based microscopic traffic simulation system provided by the present invention, the urban road network data includes static data of each lane in the urban road network;

[0014] The city region of interest data includes, but is not limited to: static data for each region of interest in the city;

[0015] The travel timetable for each of the vehicles to be simulated includes, but is not limited to, the departure time, departure point, and destination of each vehicle to be simulated;

[0016] The static data for each lane includes, but is not limited to: the ID of each lane, local coordinate system coordinates, connecting intersections, next lane, speed limit, traffic restrictions, and name;

[0017] The static data for each region of interest includes, but is not limited to: the ID of each region of interest, local coordinate system coordinates, local coordinate system coordinates of the connection point with the lane, type, and name.

[0018] According to the GPU-based microscopic traffic simulation system provided by the present invention, the data loading unit includes:

[0019] A data loading subunit is used to read the initial data from a pre-configured database or hard disk;

[0020] The data format conversion subunit is used to represent the topological association relationship stored as ID in the initial data as a variable mapping relationship in the program, and then convert it into a data format suitable for the device to obtain the first data;

[0021] A data forwarding subunit is used to send the first data to the device.

[0022] According to the GPU-based microscopic traffic simulation system provided by the present invention, the data loading unit is further configured to determine the urban road network topology based on the initial data;

[0023] The path planning request and response forwarding unit includes:

[0024] The route planning request forwarding subunit is used to parse the route planning request sent by the device to obtain the target origin and target destination; it is also used to request the route planning server to perform route planning between the target origin and the target destination via remote call.

[0025] The path planning response forwarding subunit is used to parse the path planning response sent by the path planning server to obtain the target path plan; it is also used to mark the distance from the destination on the target path plan based on the urban road network topology, and send the marked target path plan to the device.

[0026] According to the GPU-based microscopic traffic simulation system provided by the present invention, the second traffic operation simulation is completed recursively using a multi-round iterative simulation method, and the device further includes: an index construction unit;

[0027] The index construction unit is used to determine the main chain-branch chain list of each lane in the current simulation iteration based on the main chain, the list of leaving vehicles, and the list of joining vehicles for each lane in the previous simulation iteration; it is also used to generate the vehicle index of each vehicle to be simulated in each lane in the current simulation iteration based on the main chain-branch chain list of each lane in the current simulation iteration.

[0028] The initial main chain of each lane is determined by the initial position of each vehicle to be simulated;

[0029] The main chain of each lane's main chain-branch chain list is an ordered chain list formed by arranging the vehicles to be simulated in each lane in an orderly manner according to their positions; the branch chain is represented by pointers to indicate the vehicles closest to the vehicle in front of or behind it in each adjacent lane of the lane in which the vehicle to be simulated is located.

[0030] The vehicle index is used to represent the vehicles closest to the vehicle in its own lane and in each adjacent lane.

[0031] According to the GPU-based microscopic traffic simulation system provided by the present invention, the device further includes: a storage unit;

[0032] The storage unit includes a static data storage subunit and a dynamic data storage subunit;

[0033] The static data storage subunit is used to store the first array, the second array, and the third array;

[0034] The dynamic data storage subunit is used to store the first linked list, the second linked list, and the third linked list;

[0035] The first array is an array composed of static data of all lanes in the urban road network;

[0036] The second array is an array composed of static data of all regions of interest in the city;

[0037] The third array is an array composed of static data of all vehicles to be simulated; the static data of each vehicle to be simulated includes the real-time position and speed of each vehicle to be simulated.

[0038] The first linked list is a linked list organized by the vehicle indices of all vehicles to be simulated during this round of simulation iteration;

[0039] The second linked list is a linked list composed of the travel time schedules of all vehicles to be simulated;

[0040] The third linked list is a linked list organized from the path plans of all vehicles to be simulated.

[0041] According to the GPU-based microscopic traffic simulation system provided by the present invention, the step of simulating the traffic operation of corresponding vehicles based on urban road network information, urban region of interest information, and corresponding vehicle path planning includes:

[0042] In each simulation iteration, based on the stored data in the storage unit, the driving behavior of each vehicle to be simulated in the urban road network is determined; wherein, the driving behavior includes: turning and going straight;

[0043] Based on the driving behavior of each vehicle to be simulated in the urban road network, the speed and position changes of each vehicle to be simulated in the urban road network are simulated.

[0044] According to the GPU-based microscopic traffic simulation system provided by the present invention, the step of sending a route planning response to the host based on the route planning request forwarded by the host includes:

[0045] Determine the target origin and target destination in the path planning request forwarded by the host;

[0046] The shortest path algorithm is used to calculate the shortest travel time between the target origin and the target destination;

[0047] Road condition information is marked on the driving route, and the marked driving route is sent to the host as a route planning response.

[0048] According to the GPU-based micro-traffic simulation system provided by the present invention, the route planning server dynamically expands the number of local servers through distributed cluster technology;

[0049] Each server is used to handle a portion of the path planning requests.

[0050] According to the GPU-based microscopic traffic simulation system provided by the present invention, the traffic operation simulation unit is also used to perform third traffic operation simulation on the vehicles to be simulated in the urban road network.

[0051] Specifically, the third traffic operation simulation involves sending a route planning request containing the vehicle's origin and the changed destination to the host terminal when there is a need to change the destination, in order to obtain the corresponding route planning response, and modifying the third linked list accordingly.

[0052] This invention provides a GPU-based microscopic traffic simulation system, comprising: a host terminal, a device terminal, and a route planning server. The host terminal operates on a CPU and includes: a data loading unit and a route planning request and response forwarding unit. The device terminal operates on a GPU and includes: a traffic operation simulation unit. The data loading unit is used to load initial data for microscopic traffic simulation and forward it to the device terminal. The initial data includes: urban road network data, urban area of ​​interest data, and travel timetables for each vehicle to be simulated. The route planning request and response forwarding unit is used to forward route planning requests and responses between the device terminal and the route planning server. The traffic operation simulation unit is used to... The invention uses initial data to perform a first traffic operation simulation on vehicles within a region of interest (ROI) in the city, and a second traffic operation simulation on vehicles within the city's road network. Specifically, the first traffic operation simulation checks at each moment whether the current global clock coincides with the departure time of the corresponding vehicle, and if so, sends a path planning request containing the vehicle's departure and destination to the host to obtain a corresponding path planning response. The second traffic operation simulation simulates the traffic operation of the corresponding vehicle based on the city's road network information, ROI information, and the corresponding vehicle's path plan. The path planning server sends a path planning response to the host based on the path planning request forwarded by the host. This invention considers that CPUs excel at handling complex branch jumps and differentiated parallel tasks, and can perform disk read / write, network transmission, and other I / O operations, but their overall computing power is limited. GPUs excel at handling massive amounts of homogeneous parallel tasks and can provide massive computing power, but their execution efficiency decreases when executing complex branch jumps and differentiated parallel tasks, and they cannot directly perform disk read / write, network transmission, and other I / O operations. Therefore, the host, device, and route planning server are designed to execute the three sub-tasks of micro-traffic simulation: data reading, simulation, and route planning, respectively. The host is set on the CPU, and the device is set on the GPU, thereby making full use of GPU computing power and accelerating the computation of micro-traffic simulation, which in turn greatly improves the execution efficiency of micro-traffic simulation tasks and fully realizes the application value of micro-traffic simulation. Attached Figure Description

[0053] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0054] Figure 1This is a schematic diagram of the structure of the GPU-based microscopic traffic simulation system provided by the present invention;

[0055] Figure 2 This is a schematic diagram of the host terminal structure provided by the present invention;

[0056] Figure 3 This is a schematic diagram of the device end provided by the present invention;

[0057] Figure 4 This is a schematic diagram of the structure of the path planning server provided by the present invention;

[0058] Figure 5 This is a schematic diagram of an embodiment provided by the present invention. Detailed Implementation

[0059] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0060] The following is combined Figures 1-5 The present invention describes a GPU-based microscopic traffic simulation system.

[0061] Currently, most microscopic traffic simulations employ single-threaded or multi-threaded implementations. However, the CPU resources of a single computer are insufficient to support sub-second, fine-grained microscopic traffic simulation tasks at the city level, resulting in low execution efficiency and limiting downstream applications. GPUs, as common computing acceleration devices, can provide significantly greater computing power than CPUs. Using GPUs in microscopic traffic simulations would greatly improve the execution efficiency of these tasks. However, relevant research is currently lacking. Therefore, this invention provides a GPU-based microscopic traffic simulation system, such as... Figure 1 As shown, the system includes: a host terminal, a device terminal, and a path planning server.

[0062] The host unit operates on the CPU and includes: a data loading unit and a path planning request and response forwarding unit;

[0063] The device operates on a GPU and includes: a traffic operation simulation unit;

[0064] The data loading unit is used to load the initial data of the micro-traffic simulation and forward it to the device; wherein, the initial data includes: urban road network data, urban area of ​​interest data, and travel timetable of each vehicle to be simulated;

[0065] The path planning request and response forwarding unit is used to forward path planning requests and responses between the device and the path planning server.

[0066] The traffic operation simulation unit is used to perform a first traffic operation simulation on vehicles to be simulated in the urban region of interest based on the initial data, and a second traffic operation simulation on vehicles to be simulated in the urban road network. Specifically, the first traffic operation simulation involves checking whether the current global clock coincides with the departure time of the corresponding vehicle at each moment, and sending a route planning request containing the departure and destination of the corresponding vehicle to the host terminal when they coincide to obtain the corresponding route planning response. Specifically, the second traffic operation simulation involves simulating the traffic operation of the corresponding vehicle based on the urban road network information, the urban region of interest information, and the route planning of the corresponding vehicle.

[0067] The route planning server is used to send a route planning response to the host based on the route planning request forwarded by the host.

[0068] This invention, based on the characteristics of microscopic traffic simulation tasks and CPUs and GPUs, designs a GPU-based microscopic traffic simulation system to fully utilize GPU computing power and accelerate the computation of microscopic traffic simulation. Specifically, this invention decomposes the microscopic traffic simulation task into three sub-tasks: data reading, simulation, and path planning. Data reading includes reading, format conversion, and storage of initial data, which includes: urban road network, area of ​​interest (AOI), and travel plans of the vehicles to be simulated. Simulation includes simulation calculations of the vehicles, lanes, and AOI, as well as the construction of index structures for auxiliary calculations. Path planning provides the vehicles to be simulated with the shortest feasible path from the starting point to the destination, as well as road condition information.

[0069] To design a reasonable GPU-based micro-traffic simulation system, the characteristics of CPUs and GPUs must first be considered. CPUs excel at handling complex branching and differentiated parallel tasks, and can perform I / O operations such as disk read / write and network transfer, but their overall computing power is limited. GPUs excel at handling massive amounts of homogeneous parallel tasks, providing massive computing power, but their efficiency decreases when executing complex branching and differentiated parallel tasks, and they cannot directly perform I / O operations such as disk read / write and network transfer. Therefore, in a GPU-based micro-traffic simulation system, tasks with complex branching, high differentiation, and requiring input / output (I / O) operations should be placed on the host (i.e., CPU), while computationally intensive and homogeneous tasks should be placed on the device (i.e., GPU). Appropriate and streamlined data transfer and synchronization should be used to coordinate the tasks on the host and device sides. Furthermore, although GPUs are weaker than CPUs at handling branching and logical operations, considering the time cost of data transfer and synchronization, processing some branching and logical operations on the device side is superior to transferring them to the host CPU for processing and then retrieving them.

[0070] Therefore, in the GPU-based micro-traffic simulation system, this invention designs three functional modules—host, device, and route planning server—to execute the three sub-tasks of data reading, simulation, and route planning, respectively. The host operates on the CPU, the device operates on the GPU, and the route planning server uses distributed computing technology to operate on a computing cluster.

[0071] This invention considers that CPUs excel at handling complex branching and differentiated parallel tasks, and can perform I / O operations such as disk read / write and network transmission, but their overall computing power is limited. GPUs excel at handling massive amounts of homogeneous parallel tasks and can provide massive computing power, but their execution efficiency decreases when executing complex branching and differentiated parallel tasks, and they cannot directly perform I / O operations such as disk read / write and network transmission. Therefore, this invention designs a host-side, device-side, and route planning server to execute the three sub-tasks of micro-traffic simulation tasks: data reading, simulation, and route planning. The host-side is located on the CPU, and the device-side is located on the GPU, thereby fully utilizing the GPU's computing power and accelerating the computation of micro-traffic simulation, significantly improving the execution efficiency of micro-traffic simulation tasks and fully realizing the application value of micro-traffic simulation.

[0072] Specifically, the urban road network data includes static data for each lane in the urban road network;

[0073] The city region of interest data includes, but is not limited to: static data for each region of interest in the city;

[0074] The travel timetable for each of the vehicles to be simulated includes, but is not limited to, the departure time, departure point, and destination of each vehicle to be simulated;

[0075] The static data for each lane includes, but is not limited to: the ID of each lane, local coordinate system coordinates, connecting intersections, next lane, speed limit, traffic restrictions, and name;

[0076] The static data for each region of interest includes, but is not limited to: the ID of each region of interest, local coordinate system coordinates, local coordinate system coordinates of the connection point with the lane, type, and name.

[0077] It should be noted that static data and dynamic data are relative terms. Static data refers to data whose total storage space in memory remains constant, while dynamic data refers to data whose total storage space in memory changes.

[0078] Furthermore, the data loading unit includes:

[0079] A data loading subunit is used to read the initial data from a pre-configured database or hard disk;

[0080] The data format conversion subunit is used to represent the topological association relationship stored as ID in the initial data as a variable mapping relationship in the program, and then convert it into a data format suitable for the device to obtain the first data;

[0081] A data forwarding subunit is used to send the first data to the device.

[0082] Furthermore, the data loading unit is also used to determine the urban road network topology based on the initial data;

[0083] The path planning request and response forwarding unit includes:

[0084] The route planning request forwarding subunit is used to parse the route planning request sent by the device to obtain the target origin and target destination; it is also used to request the route planning server to perform route planning between the target origin and the target destination via remote call.

[0085] The path planning response forwarding subunit is used to parse the path planning response sent by the path planning server to obtain the target path plan; it is also used to mark the distance from the destination on the target path plan based on the urban road network topology, and send the marked target path plan to the device.

[0086] Figure 2 This is a schematic diagram of the host side structure, such as... Figure 2As shown, the host side mainly includes I / O operations such as initial data reading and path planning request / response forwarding.

[0087] The initial data reading process involves reading the initial data stream from a pre-configured database or disk, parsing the binary data stream to obtain the stored urban road network data, urban AOI data, and the travel plan table of the vehicles to be simulated. Next, the topological relationships stored as IDs in the initial data are converted into variable mapping relationships in the program and stored. Finally, the data is converted into a device-optimized data structure and sent to the device. This part of the task is an initialization task, and its execution efficiency is relatively unrequired. Furthermore, because it uses I / O operations that can only be performed on the host side and has complex processing logic, this part of the task is executed on the host side.

[0088] Additionally, the path planning request / response forwarding process involves receiving the path planning request data stream transmitted from the device to the host, parsing the binary data stream into a format that the host can process, obtaining information such as the start and end points of the path planning request, and then submitting a remote procedure call request to the path planning server via network communication on the host side. After receiving the response from the path planning server, the host side parses and converts the result, serializes it into a transmittable format, and sends it to the device side, completing the entire path planning request / response forwarding task. Since this part involves network communication I / O operations and relies on the host-side remote procedure call library, it is primarily executed on the host side and runs in parallel with the simulation tasks on the device side.

[0089] Furthermore, the second traffic operation simulation is completed recursively using a multi-round iterative simulation method, and the device also includes an index construction unit;

[0090] The index construction unit is used to determine the main chain-branch chain list of each lane in the current simulation iteration based on the main chain, the list of leaving vehicles, and the list of joining vehicles for each lane in the previous simulation iteration; it is also used to generate the vehicle index of each vehicle to be simulated in each lane in the current simulation iteration based on the main chain-branch chain list of each lane in the current simulation iteration.

[0091] The initial main chain of each lane is determined by the initial position of each vehicle to be simulated;

[0092] The main chain of each lane's main chain-branch chain list is an ordered chain list formed by arranging the vehicles to be simulated in each lane in an orderly manner according to their positions; the branch chain is represented by pointers to indicate the vehicles closest to the vehicle in front of or behind it in each adjacent lane of the lane in which the vehicle to be simulated is located.

[0093] The vehicle index is used to represent the lane in which the corresponding vehicle is located, as well as the vehicles closest to it in its own lane and in each adjacent lane.

[0094] In the microscopic traffic simulation process, the program needs to iteratively perform each round of simulation, recursively completing the entire simulation process. In each simulation iteration, the program first constructs a vehicle index. Since vehicles need to perceive information such as the relative positions and speeds of surrounding vehicles when driving in the urban road network, one aspect of index construction is to create an index for vehicles to query their surrounding vehicles. In addition, vehicles move between different lanes, and another aspect of index construction is to assign vehicles to the index of their current lane. After completing the vehicle index construction, the program enters the simulation calculation process. During the simulation calculation, the vehicle relies on the topological structure information of the urban road network, the path planning to the destination, and the constructed index structure. By comprehensively considering the driving conditions of surrounding vehicles, the objective conditions of the lane network, the destination location, and the path, the program calculates the vehicle's driving behavior (going straight or changing lanes), and then updates the vehicle's position and speed based on the driving behavior, thereby achieving the purpose of microscopic traffic simulation.

[0095] Since vehicles may enter or leave lanes and exchange relative positions in each simulation iteration, index construction is used to redefine the attribution relationship between vehicles and lanes and the relative relationships between vehicles under the new vehicle position relationships, so that subsequent vehicle simulation calculations can proceed normally. In simpler terms, in the previous simulation iteration, vehicles record their lane departures in the corresponding lane's departure list and their lane entry in the corresponding lane's entry list. During the vehicle index construction process in this simulation iteration, using lanes as the basic parallel unit on the GPU device, the departure vehicle list of each lane is scanned, the corresponding vehicle nodes are deleted from the "main chain" of each lane in the previous simulation iteration, and reordered according to position to obtain the first linked list for each lane; the entry vehicle list of each lane is scanned and arranged into an ordered linked list to obtain the second linked list for each lane; the first and second linked lists of each lane are then combined in an ordered manner to obtain the "main chain" of each lane in this simulation iteration. For the "branch" of a lane, since the positional relationship between vehicles in different lanes is likely to change, each lane is paired with its left / right lane to form a "branch". Since the "main" of both lanes is already an ordered linked list, we can start from the first car in each lane and scan forward alternately to get the car in front and behind each car in the left / right lane that is closest to us.

[0096] Furthermore, the device also includes: a storage unit;

[0097] The storage unit includes a static data storage subunit and a dynamic data storage subunit;

[0098] The static data storage subunit is used to store the first array, the second array, and the third array;

[0099] The dynamic data storage subunit is used to store the first linked list, the second linked list, and the third linked list;

[0100] The first array is an array composed of static data of all lanes in the urban road network;

[0101] The second array is an array composed of static data of all regions of interest in the city;

[0102] The third array is an array composed of static data of all vehicles to be simulated; the static data of each vehicle to be simulated includes the real-time position and speed of each vehicle to be simulated.

[0103] The first linked list is a linked list organized by the vehicle indices of all vehicles to be simulated during this round of simulation iteration;

[0104] The second linked list is a linked list composed of the travel time schedules of all vehicles to be simulated;

[0105] The third linked list is a linked list organized from the path plans of all vehicles to be simulated.

[0106] To execute microscopic traffic simulation tasks correctly and efficiently on GPUs, suitable storage units need to be designed to provide the GPU with the necessary data for the simulation. In microscopic traffic simulations, the simulated objects can be divided into two categories: fixed objects and moving objects. Fixed objects mainly refer to things whose spatial location remains constant in urban traffic simulations, including lanes (including intersections) and areas of interest (AOIs). Moving objects mainly refer to things whose spatial location changes over time in urban traffic simulations; these are the main objects of the simulation and primarily include the participants in urban traffic—vehicles. The static data of fixed objects is the cornerstone of microscopic traffic simulation. Lanes in the city constitute the space for vehicle movement, and AOIs constitute the space for vehicle storage. The topological connections between lanes and AOIs support the simulation of vehicle movement within the urban road network. The static data (speed and position) and dynamic data (vehicle index, travel timetable, and route planning) of moving objects are crucial for supporting microscopic traffic simulations and are the basis for vehicles to make traffic behavior decisions. Therefore, the storage unit needs to store the static data of lanes, areas of interest, and vehicles, as well as the dynamic data of vehicles. Since the total amount of storage space occupied by static data in memory remains constant, while the total amount of storage space occupied by dynamic data in memory changes, arrays are chosen as the storage format for static data, and linked lists are used as the storage format for dynamic data. Furthermore, linked lists are stored in a dynamic memory heap.

[0107] Furthermore, the step of simulating the traffic operation of corresponding vehicles based on urban road network information, urban area of ​​interest information, and corresponding vehicle route planning includes:

[0108] In each simulation iteration, based on the stored data in the storage unit, the driving behavior of each vehicle to be simulated in the urban road network is determined; wherein, the driving behavior includes: turning and going straight;

[0109] Based on the driving behavior of each vehicle to be simulated in the urban road network, the speed and position changes of each vehicle to be simulated in the urban road network are simulated.

[0110] In short, the simulation of a vehicle on the lane mainly determines the driving behavior based on information such as the relative distance and speed with surrounding vehicles, the speed limit of the current lane, the distance from the destination, the speed limit of the next lane, and path planning. Finally, the simulation calculates the vehicle's next speed, position, and other information based on the driving behavior.

[0111] Furthermore, the traffic operation simulation unit is also used to perform third-party traffic operation simulation on the vehicles to be simulated in the urban road network;

[0112] Specifically, the third traffic operation simulation involves sending a route planning request containing the vehicle's origin and the changed destination to the host terminal when there is a need to change the destination, in order to obtain the corresponding route planning response, and modifying the third linked list accordingly.

[0113] In other words, when the vehicle to be simulated needs to change its destination, the vehicle will trigger a route planning request as needed to obtain a new route planning response, and the relevant data in the storage unit will be changed accordingly.

[0114] all in all, Figure 3 This is a structural diagram of the device, such as... Figure 3 As shown, the device side is mainly responsible for all simulation calculations, the construction and maintenance of the corresponding index structure, and the encapsulation and unpacking of data transmission with the host side.

[0115] In other words, in the GPU-based microscopic traffic simulation system of this invention, the vehicle simulation calculations are highly homogeneous. All vehicles in the lanes execute the second traffic operation simulation completely identically. Simultaneously, the first traffic operation simulation, where vehicles wait in the AOI to reach the next departure time, is also highly homogeneous; that is, at each moment, the relationship between the current global clock and the departure time is checked, and the corresponding path planning result is requested upon reaching the departure time. Therefore, combining the characteristics of CPU and GPU, the device handles all simulation calculation logic. Beyond simulation calculations, the device constructs and maintains a vehicle index structure to achieve efficient, parallel, and conflict-free data access and acquisition, adapted to the GPU architecture. The device also provides data encapsulation and decapsulation. Encapsulation refers to storing data in a bitstream according to the agreed-upon format when data exchange with the host is required, such as when requesting path planning services, and then sending it to the host for subsequent operations. Decapsulation refers to receiving the bitstream sent by the host, reading and parsing it according to the agreed-upon format to obtain the corresponding data content, and performing different processing and copying it to the corresponding storage space based on the data content type. Finally, the device side also provides a dynamic memory management mechanism based on the actual hardware and supporting framework to facilitate data storage, access, and rewriting.

[0116] Specifically, sending a path planning response to the host based on the path planning request forwarded by the host includes:

[0117] Determine the target origin and target destination in the path planning request forwarded by the host;

[0118] The shortest path algorithm is used to calculate the shortest travel time between the target origin and the target destination;

[0119] Road condition information is marked on the driving route, and the marked driving route is sent to the host as a route planning response.

[0120] Furthermore, the path planning server dynamically expands the number of local servers through distributed cluster technology;

[0121] Each server is used to handle a portion of the path planning requests.

[0122] Figure 4 This is a schematic diagram of the route planning server. The route planning server is responsible for using the shortest path algorithm to provide the shortest travel time from the starting point to the destination based on the starting point and destination specified in the request, and returning the result as a response to the requester.

[0123] Throughout the system, the route planning server exhibits three key characteristics: high standardization, statelessness, and one-off nature. High standardization means the route planning service is independent of various algorithms in the microscopic traffic simulation; as long as the requester provides the start and end points, the route planning service can be applied to different traffic simulation models and algorithms. Statelessness means the route planning service does not need to maintain current-moment data or determine subsequent behavior based on previous data, unlike simulation algorithms. Its calculations rely solely on the start and end points input by the requester. One-off nature stems from the fact that vehicles only request route planning at the start of each journey, not during the journey itself. Therefore, for microscopic traffic simulation, the demand for the route planning service is one-off, meaning that if vehicles depart simultaneously, the requests are concentrated and sudden.

[0124] To address these characteristics, the route planning server exists as a network program independent of the microscopic traffic simulation. It provides services via remote procedure calls (RPCs) and utilizes distributed clustering technology to dynamically expand or reduce the number of program instances based on request volume. The route planning server employs a standard interface based on RPCs and leverages clustering technology to dynamically add or remove processing units. This effectively addresses the issues of concentration and suddenness caused by the one-off nature of the system, fully utilizing computing power while avoiding resource waste during idle periods.

[0125] To more clearly illustrate the technical solution of the present invention, two specific embodiments of the present invention are given below. Obviously, those skilled in the art can obtain other embodiments based on the following text without any creative effort.

[0126] Implementation method 1: The user wants to use this simulation framework to simulate the sub-second micro-traffic operation of location A throughout the day on June 1, 2022.

[0127] like Figure 5 As shown, firstly, the user obtained urban road network data, urban AOI data, and travel timetables of the vehicles to be simulated in location A on June 1, 2022, through other means, and stored them in a MongoDB database in JSON format. The main contents of this data are shown in Table 1:

[0128] Table 1

[0129]

[0130] Users implement host-side functions using the C++ programming language, device-side functions using CUDA programming, and path planning server-side functions using the Golang programming language, Protobuf serialization tool, and gRPC remote procedure call.

[0131] The host computer connects to the MongoDB database via the MongoDB C++ SDK and reads three data tables from the database sim: beijing5_map, beijing5_aoi, and beijing5_20220601_traffic, to obtain urban road network data, urban AOI data, and travel timetables of the vehicles to be simulated.

[0132] The host first converts the IDs in the city road network data and city AOI data into pointer structures in C++ and stores them in the global variable map for later use. Secondly, the host converts the data read from beijing5_map and beijing5_aoi into C++ structures and arranges them in order of ID into multiple arrays, thus allowing the host to call the CUDA API to transmit them to the device.

[0133] In addition, for the route planning request forwarding part, the host side copies the route planning request array stored in the specified location on the device side to the host side by calling the CUDA API, then parses it into a Protobuf structure, and sends it to the route planning server using gRPC asynchronous request method.

[0134] In response to the path planning server, the host receives the Protobuf structure, completes and supplements the auxiliary information of the device with the help of the global variable map, stores it in the long array buffer, and sends it to the device through the CUDA API.

[0135] The device-side functional modules are implemented using the C++ / CUDA programming language and framework. For simulation calculations, the device-side implementation includes UpdateVehicle<<<num_vehicles> >>、UpdateRoad<<<num_roads> >>、UpdateAOI<<<num_aois> Multiple kernel functions, such as >>, are used to implement simulation and computational acceleration of vehicles, lanes, and AOIs on GPU devices.

[0136] For index building, the device-side implementation includes BuildVehicleEnvIndex<<<num_roads> >>、BuildVehicleBelongingIndex<<<num_roads> Several kernel functions, such as >>, are used to construct auxiliary index structures for the simulated vehicle, including determining its positional relationships with other vehicles in front and behind it, and identifying its lane. Additionally, the device-side kernel functions, which do not perform parallel acceleration, handle the unpacking of data from the host and the repackaging of data destined for the host.

[0137] The route planning server leverages the excellent network service implementation capabilities of the Golang language. It uses the Protobuf format to define the remote procedure call interface for the route planning network service. Its request format is a triple (start_point, end_point, traffic_type), and the response format is a list of lane IDs passed in sequence. The remote procedure call service is started via gRPC and deployed in a cloud cluster using Kubernetes technology. Horizontal scaling tools are used to monitor the CPU usage of functional modules to dynamically adjust the number of nodes.

[0138] In terms of execution logic, the route planning server first loads urban road network data and urban AOI data from the MongoDB database. Then, it calls the route planning algorithm according to the gRPC request, obtains the result, and then sends it back to the requester via the network.

[0139] After the host, device, and route planning server are all correctly implemented, the user can configure the input data address and route planning server IP, start the host and device, and then simulate the sub-second micro-traffic operation of location A throughout the day on June 1, 2022.

[0140] Implementation Method 2: The user wants to use this simulation framework to simulate the sub-second micro-traffic operation in area B throughout the day on January 18, 2021.

[0141] First, the user obtained urban road network data, urban AOI data, and travel schedules of the vehicles to be simulated for area B on January 18, 2021, through other means. These data were stored in a disk file in JSON format. The main contents of this data are shown in Table 2.

[0142] Table 2

[0143]

[0144]

[0145] Users implement host-side functions using the C programming language, device-side functions using the OpenCL programming framework, and path planning server-side functions using the Python programming language, Protobuf serialization tool, and gRPC remote procedure call framework.

[0146] The host computer reads three files from the disk via a disk file read / write interface: hangzhou_map.json, hangzhou_aoi.json, and hangzhou_20210118_traffic.json, located in the folder data / . These files provide urban road network data, urban AOI data, and the travel schedules of the vehicles to be simulated. First, the host computer converts the IDs in the urban road network and urban AOI data into pointer structures in C and stores them in the global variable `map` for later use. Second, the host computer converts the data read from hangzhou_map.json and hangzhou_aoi.json into C structures and arranges them in ID order into multiple arrays, allowing the host computer to call the OpenCL API to transmit this data to the device. Additionally, for the route planning request forwarding, the host computer copies the route planning request array stored on the device to the host computer via the OpenCL API, parses it into a Protobuf structure, and sends it to the route planning server using gRPC asynchronous requests. In response to the path planning server, the host receives the Protobuf structure, completes and supplements the auxiliary information of the device with the help of the global variable map, stores it in the long array buffer, and sends it to the device through OpenCLAPI.

[0147] The device side is implemented using the C / OpenCL programming language and framework. For simulation calculations, the device side implementation includes UpdateVehicle and UpdateRoad<<<num_roads> The system includes several kernel functions such as >> and UpdateAOI to accelerate the simulation and computation of vehicles, lanes, and AOI on the GPU device. For index building, the device implements several kernel functions, including BuildVehicleEnvIndex and BuildVehicleBelongingIndex, to build auxiliary index structures such as the positional relationship of the vehicle to be simulated in front of and behind other vehicles and which lane the vehicle to be simulated is in. In addition, the device also includes some kernel functions that do not perform parallel acceleration to unpack the data sent from the host and encapsulate the data sent to the host.

[0148] The route planning server is implemented in Python and uses Protobuf to define the remote procedure call interface for the route planning network service. Its request format is a triple (start_point, end_point, traffic_type), and the response format is a list of lane IDs traversed in sequence. The remote procedure call service is started via gRPC and deployed on multiple hosts using Docker. A scaling tool monitors the CPU usage of the functional modules to dynamically adjust the number of hosts. Logically, the route planning server first loads urban road network data and urban AOI data from files. Then, it invokes the route planning algorithm according to the gRPC request, obtains the result, and sends it back to the requester via the network.

[0149] After the host, device, and route planning server are all correctly implemented, the user can configure the input data address and the IP of the route planning service module, start the host and device modules, and then simulate the sub-second micro-traffic operation of location B throughout the day on January 18, 2021.

[0150] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0151] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A GPU-based microscopic traffic simulation system, characterized in that, The system includes: a host terminal, a device terminal, and a path planning server; The host unit operates on the CPU and includes: a data loading unit and a path planning request and response forwarding unit; The device operates on a GPU and includes: a traffic operation simulation unit; The data loading unit is used to load the initial data of the micro-traffic simulation and forward it to the device; wherein, the initial data includes: urban road network data, urban area of ​​interest data, and travel timetable of each vehicle to be simulated; The path planning request and response forwarding unit is used to forward path planning requests and responses between the device and the path planning server. The traffic operation simulation unit is used to perform a first traffic operation simulation on vehicles to be simulated in the urban region of interest based on the initial data, and a second traffic operation simulation on vehicles to be simulated in the urban road network. Specifically, the first traffic operation simulation involves checking whether the current global clock coincides with the departure time of the corresponding vehicle at each moment, and sending a route planning request containing the departure and destination of the corresponding vehicle to the host terminal when they coincide to obtain the corresponding route planning response. Specifically, the second traffic operation simulation involves simulating the traffic operation of the corresponding vehicle based on the urban road network information, the urban region of interest information, and the route planning of the corresponding vehicle. The route planning server is used to send a route planning response to the host based on the route planning request forwarded by the host. The second traffic operation simulation is completed recursively using a multi-round iterative simulation method, and the device also includes an index construction unit; The index construction unit is used to determine the main chain-branch chain list of each lane in the current simulation iteration based on the main chain, the list of leaving vehicles, and the list of joining vehicles for each lane in the previous simulation iteration; it is also used to generate the vehicle index of each vehicle to be simulated in each lane in the current simulation iteration based on the main chain-branch chain list of each lane in the current simulation iteration. The initial main chain of each lane is determined by the initial position of each vehicle to be simulated; The main chain of each lane's main chain-branch chain list is an ordered chain list formed by arranging the vehicles to be simulated in each lane in an orderly manner according to their positions; the branch chain is represented by pointers to indicate the vehicles closest to the vehicle in front of or behind it in each adjacent lane of the lane in which the vehicle to be simulated is located. The vehicle index is used to represent the lane in which the corresponding vehicle is located and the vehicles closest to it in its own lane and in each of its adjacent lanes. The device also includes: a storage unit; The storage unit includes a static data storage subunit and a dynamic data storage subunit; The static data storage subunit is used to store the first array, the second array, and the third array; The dynamic data storage subunit is used to store the first linked list, the second linked list, and the third linked list; The first array is an array composed of static data of all lanes in the urban road network; The second array is an array composed of static data of all regions of interest in the city; The third array is an array composed of static data of all vehicles to be simulated; the static data of each vehicle to be simulated includes the real-time position and speed of each vehicle to be simulated; The first linked list is a linked list organized by the vehicle indices of all vehicles to be simulated during this round of simulation iteration; The second linked list is a linked list composed of the travel time schedules of all vehicles to be simulated; The third linked list is a linked list organized from the path plans of all vehicles to be simulated.

2. The GPU-based microscopic traffic simulation system according to claim 1, characterized in that, The urban road network data includes static data for each lane in the urban road network; The city region of interest data includes: static data for each region of interest in the city; The travel timetable for each of the vehicles to be simulated includes: the departure time, departure point, and destination of each vehicle to be simulated; The static data for each lane includes: the ID of each lane, local coordinate system coordinates, the connecting intersection, the next lane, the speed limit, the traffic restriction, and the name; The static data for each region of interest includes: the ID of each region of interest, local coordinate system coordinates, local coordinate system coordinates of the connection point with the lane, type, and name.

3. The GPU-based microscopic traffic simulation system according to claim 2, characterized in that, The data loading unit includes: A data loading subunit is used to read the initial data from a pre-configured database or hard disk; The data format conversion subunit is used to represent the topological association relationship stored as ID in the initial data as a variable mapping relationship in the program, and then convert it into a data format suitable for the device to obtain the first data; A data forwarding subunit is used to send the first data to the device.

4. The GPU-based microscopic traffic simulation system according to claim 3, characterized in that, The data loading unit is also used to determine the urban road network topology based on the initial data; The path planning request and response forwarding unit includes: The route planning request forwarding subunit is used to parse the route planning request sent by the device to obtain the target origin and target destination; it is also used to request the route planning server to perform route planning between the target origin and the target destination via remote call. The path planning response forwarding subunit is used to parse the path planning response sent by the path planning server to obtain the target path plan; it is also used to mark the distance from the destination on the target path plan based on the urban road network topology, and send the marked target path plan to the device.

5. The GPU-based microscopic traffic simulation system according to claim 1, characterized in that, The process of simulating traffic flow for corresponding vehicles based on urban road network information, urban areas of interest information, and corresponding vehicle route planning includes: In each simulation iteration, based on the stored data in the storage unit, the driving behavior of each vehicle to be simulated in the urban road network is determined; wherein, the driving behavior includes: turning and going straight; Based on the driving behavior of each vehicle to be simulated in the urban road network, the speed and position changes of each vehicle to be simulated in the urban road network are simulated.

6. The GPU-based microscopic traffic simulation system according to claim 1, characterized in that, The step of sending a path planning response to the host based on the path planning request forwarded by the host includes: Determine the target origin and target destination in the path planning request forwarded by the host; The shortest path algorithm is used to calculate the shortest travel time between the target origin and the target destination; Road condition information is marked on the driving route, and the marked driving route is sent to the host as a route planning response.

7. The GPU-based microscopic traffic simulation system according to claim 1 or 6, characterized in that, The path planning server dynamically expands the number of local servers through distributed cluster technology. Each server is used to handle a portion of the path planning requests.

8. The GPU-based microscopic traffic simulation system according to claim 1, characterized in that, The traffic operation simulation unit is also used to perform third-party traffic operation simulation on vehicles to be simulated in the urban road network. Specifically, the third traffic operation simulation involves sending a route planning request containing the vehicle's origin and the changed destination to the host terminal when there is a need to change the destination, in order to obtain the corresponding route planning response, and modifying the third linked list accordingly.

Citation Information

Patent Citations

  • Multi-agent traffic simulation parallel computing method and device

    CN113515892A

  • Simulation device and simulation program

    JP2012118603A