Traffic flow online simulation method for traffic road

By building highway network data simulation scenarios and using BaseLSTM model for OD prediction, the problem that traditional traffic flow simulation methods are difficult to meet real-time and accuracy is solved, real-time online simulation and prediction of traffic flow are realized, and traffic management and planning are improved. level, reduces experimental costs and promotes traffic science research.

CN119152680APending Publication Date: 2024-12-17ZHEJIANG TRANSPORTATION GROUP TECHNICAL RESEARCH INSTITUTE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411262049.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

Traditional traffic flow simulation methods are difficult to meet the requirements of real-time and accuracy, cannot effectively respond to real-time changes in traffic conditions, lack timeliness, and it is difficult to provide timely decision-making basis for traffic managers.

Method used

By building a highway and road network data simulation scenario, real-time vehicle data is collected and processed, the BaseLSTM model is used to extract traffic flow characteristics for OD prediction, and real-time traffic flow is generated in the simulated road network, real-time simulation and prediction of traffic flow are realized.

Benefits of technology

Real-time update and accuracy of traffic flows are achieved, refined simulation decision support is provided, experimental costs are reduced, safety and efficiency of traffic management are improved, and traffic scientific research is promoted.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119152680A_ABST
    Figure CN119152680A_ABST
Patent Text Reader

Abstract

The invention relates to the field of traffic simulation in traffic engineering, in particular to a traffic flow online simulation method for a traffic road, which can simulate and predict traffic flow in real time and has the characteristics of high processing efficiency and accurate simulation. According to the technical scheme, the traffic flow online simulation method for the traffic road comprises the following steps that S1, a simulation scene is built according to road network data; s2, collecting and uploading data in real time; s3, traffic flow features are extracted for OD prediction; and S4, simulating a traffic road in real time according to a prediction result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of traffic simulation in traffic engineering, and in particular to an online traffic flow simulation method for traffic roads. Background Art

[0002] With the acceleration of urbanization and the rapid growth of the number of motor vehicles, traffic congestion is becoming increasingly serious, bringing great challenges to urban management and residents' lives. In order to solve the problem of traffic congestion and improve traffic efficiency, traffic simulation technology has been widely used in the field of traffic engineering as an effective tool.

[0003] Traffic simulation technology can provide strong support for traffic planning, management and control by constructing a virtual traffic environment and simulating actual traffic flow. Early traffic simulation technology mainly focused on offline simulation, that is, simulation analysis through historical data. Although this method can provide certain reference value, it is difficult to cope with real-time changing traffic conditions. It also lacks timeliness and is difficult to provide timely decision-making basis for traffic managers. With the continuous improvement of computer technology and data processing capabilities, real-time traffic simulation technology has gradually become a research hotspot.

[0004] With the complexity of traffic networks, traditional traffic flow simulation methods have been unable to meet the requirements of real-time and accuracy. Current traffic management and control systems require a technology that can simulate traffic flow in real time and predict and evaluate traffic conditions. To this end, the present invention proposes an online traffic flow simulation technology for traffic roads, which realizes real-time simulation and prediction of traffic flow through efficient data processing and simulation technology. Summary of the invention

[0005] The purpose of the present invention is to overcome the deficiencies in the above-mentioned background technology and to provide an online traffic flow simulation method for traffic roads, which should be able to simulate and predict traffic flow in real time and have the characteristics of efficient processing and accurate simulation.

[0006] The technical solution of the present invention is:

[0007] A traffic flow online simulation method for a traffic road comprises the following steps:

[0008] S1: Build simulation scenarios based on highway network data;

[0009] S2: real-time data collection and uploading;

[0010] S3: Extract traffic flow characteristics for OD prediction;

[0011] S4: Simulate traffic roads in real time based on the prediction results.

[0012] The step S1 includes: downloading regional road network vector data, importing simulation software to perform road network simulation, and setting up detection stations in the simulated road network.

[0013] The step S2 includes: the detector collects vehicle data in real time and sends a data transmission request; the web server temporarily stores and distributes vehicle data through a message queue; and the vehicle data is written into a redis database.

[0014] The step S3 comprises:

[0015] S3.1: Extract clean data

[0016] Read vehicle data from the redis database at a fixed step size and perform data cleaning;

[0017] S3.2: Extract vehicle traffic flow data

[0018] The vehicle data passing through the OD detection interval within the same fixed step length are summarized as vehicle traffic flow data;

[0019] S3.3: Extract OD flow data

[0020] All vehicle traffic flow data passing through the OD detection interval within the same fixed step length are summarized into one OD flow data;

[0021] S3.4: OD prediction

[0022] The OD flow data and vehicle traffic flow data are input into the BaseLSTM model to obtain the prediction results, which are then converted into a CSV file.

[0023] The detector includes a toll station and a gantry; the vehicle data includes the detector, license plate, and time; the vehicle traffic flow data includes license plate, type, entry time, departure time, starting point, and end point; the OD flow data includes detection interval, time, sequence number, and vehicle flow.

[0024] The step S4 includes: inputting the CSV file into the simulation software, generating the traffic flow in the simulated road network, and realizing the online simulation of the traffic road.

[0025] The BaseLSTM model includes: OD traffic data as the input of the LSTM layer, the output of the LSTM layer as the input of the first fully connected layer, the output of the first fully connected layer and the vehicle traffic flow data as the input of the second fully connected layer, and the second fully connected layer outputs the prediction result.

[0026] The training process of the BaseLSTM model uses the optimizer and loss function provided by PyTorch, with a learning rate of 1e-4, 100 training rounds, a batch size of 64, a hidden layer size of 64, and a number of layers of 2.

[0027] The beneficial effects of the present invention are:

[0028] 1. Real-time and accuracy: Since traffic conditions often change significantly in a short period of time, rapid response and adjustment are required. Real-time is crucial for traffic management and planning. This method ensures the real-time update and accuracy of traffic flow data by transmitting detector data to the database in real time and extracting vehicle information at a fixed step size.

[0029] 2. Refined simulation: Refined simulation can help decision makers better understand traffic flow patterns, identify potential problems, and make more accurate decisions. This method can achieve more refined traffic flow simulation by extracting traffic flow features to train the model for OD| prediction;

[0030] 3. Decision support: This method can provide powerful decision support for traffic management and planning. By simulating traffic flow conditions in different scenarios, decision makers can evaluate the effects of different strategies and select the best solution, thereby optimizing traffic flow, reducing congestion, and improving road utilization.

[0031] 4. Adaptability: This method builds simulation scenarios based on highway network data, which has strong adaptability and flexibility. With the development of cities and changes in road networks, this method can easily update road network data and rebuild simulation scenarios to adapt to new traffic environments;

[0032] 5. Reduce experimental costs: Compared with traditional field traffic experiments, this method simulates traffic flow conditions through online simulation, which greatly reduces experimental costs and time costs; at the same time, since the simulation experiment can be carried out in a virtual environment, it will not interfere with and affect actual traffic.

[0033] 6. Improve safety and efficiency: This method uses online simulation technology to test and evaluate the effects of various traffic management strategies and traffic facilities without actually affecting traffic operations, which helps to improve the safety and efficiency of traffic management and reduce traffic accidents and congestion caused by improper strategies or unreasonable facility design;

[0034] 7. Promote traffic science research: This method provides a powerful tool for traffic science research, helping researchers to gain a deeper understanding of traffic flow patterns, vehicle driving behavior, and the complexity of traffic systems. This will help promote the development and innovation of traffic science. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 It is a flow chart of the present invention.

[0036] Figure 2 It is a schematic diagram of a simulation scene of the present invention.

[0037] Figure 3 It is a flow chart of uploading data of the present invention.

[0038] Figure 4 It is a schematic diagram of vehicle traffic flow data of the present invention.

[0039] Figure 5 It is a schematic diagram of OD flow data of the present invention.

[0040] Figure 6 It is a schematic diagram of the BaseLSTM model of the present invention.

[0041] Figure 7 It is a schematic diagram of the Flow traffic file of the present invention. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0043] like Figure 1 As shown, a traffic flow online simulation method for a traffic road includes the following steps:

[0044] S1: Build simulation scenarios based on highway network data

[0045] Input the road network data into the simulation software to generate a simulated road network, and set detectors in the simulated road network, including:

[0046] S1.1: Download regional road network vector data based on OpenStreetmap, and convert the regional road network vector data into the road network file (net.xml format) required for road network simulation through the road network format conversion program netconvert. Import the road network file into the SUMO simulation software for road network simulation.

[0047] S1.2: According to the latitude and longitude information of the detector, the detector is set in the simulated road network of the SUMO simulation software.

[0048] like Figure 2 As shown in FIG. 1 , the regional road network vector data is the road network vector data of 65 kilometers of Hang-An Expressway. The types of detectors include toll booths and gantry. Figure 2 Only the toll booths are shown, omitting the gantries.

[0049] S2: Real-time data collection and upload

[0050] The detector collects vehicle data in real time and uploads the vehicle data to the database, including:

[0051] S2.1: The detector collects vehicle data in real time and sends a data transmission request to the web server;

[0052] S2.2: The web server processes data transmission requests, stores and distributes vehicle data through message queues, and achieves traffic peak shifting between the upstream transmission end (detector) and the downstream data processing end (BaseLSTM model);

[0053] S2.3: Write vehicle data into redis database: Use the flink program to push the vehicle data in the message queue to the redis database in multiple threads, push the pre-processed information according to the support input of the downstream data processing end, and cache the vehicle data in real time for use by the downstream data processing end.

[0054] The vehicle data is the cross-sectional traffic flow of the detector, including the detector, license plate, and time;

[0055] S3: Extract traffic flow features for OD prediction

[0056] Extract traffic flow features based on vehicle data, input into the BaseLSTM model for OD prediction, and obtain OD prediction results;

[0057] Traffic flow characteristics include vehicle traffic flow data and OD flow data;

[0058] S3.1: Extract clean data

[0059] Read vehicle data from the redis database with a fixed step size, and access the vehicle passing information collected by the detector in real time online.

[0060] Clean vehicle data and process missing values, outliers, and duplicate values.

[0061] The fixed step length is set to 15 minutes. It can also be 5 minutes, 10 minutes, 20 minutes, etc.

[0062] S3.2: Extract vehicle traffic flow data

[0063] Set the OD detection interval that needs to be predicted.

[0064] The vehicle data passing through the OD detection interval within the same fixed step length are summarized as vehicle traffic flow data;

[0065] like Figure 4As shown, the vehicle traffic flow data includes the license plate VehiclePlate, type MediaType, entry time TransTime, point n_en_station (station number of the starting point detector), departure time n_en_Time, starting point O, and end point D. The vehicle traffic flow data is the vehicles that enter from the starting point of the OD detection interval and leave from the end point of the OD detection interval within a fixed step size.

[0066] In the same fixed step, a vehicle has only one piece of vehicle traffic flow data. And the vehicle traffic flow data can be divided into four categories: toll station entry - toll station exit, toll station entry - other road section exit, other road section entry - toll station exit, other road section entry - toll station exit.

[0067] like Figure 4 As shown, the OD detection interval is Lin'an_Yuhang, that is, the vehicle enters from the Lin'an toll station and exits from the Yuhang toll station. Multiple OD detection intervals can be set in the road network as needed.

[0068] S3.3: extract OD flow data;

[0069] All vehicle traffic flow data passing through the OD detection interval within the same fixed step length are summarized into one OD flow data.

[0070] OD traffic data includes OD detection interval, time date, sequence number, and vehicle flow ts_15.

[0071] like Figure 5 As shown, since the OD detection interval is set to Lin'an to Yuhang, there are 5 fixed-step OD flow data, which are arranged in ascending order from 0 to 4.

[0072] S3.4: OD prediction

[0073] The vehicle traffic flow data and OD flow data are input into the BaseLSTM model, and the prediction result is output, that is, the predicted OD flow data (next fixed step) for the OD detection interval. The predicted OD flow data is generated into a readable CSV file.

[0074] The BaseLSTM model is built using the deep learning framework PyTorch. The BaseLSTM model combines a long short-term memory network (LSTM) and a fully connected layer to process time series data and some additional external features, and finally outputs a prediction result (prediction of OD traffic data).

[0075] The BaseLSTM model includes an LSTM layer, a first fully connected layer, and a second fully connected layer. The time series data (OD traffic data) is used as the input of the LSTM layer, the output of the LSTM layer is used as the input of the first fully connected layer Self.linear1, the output of the first fully connected layer and the external features (vehicle traffic flow data Ext) are used as the input of the second fully connected layer Self.linear2, and the second fully connected layer outputs the prediction result output.

[0076] The training process of the BaseLSTM model is as follows:

[0077] The training process uses the optimizer and loss function provided by PyTorch, with a learning rate of 1e-4, 100 epochs, a batch size of 64, a hidden size of 64, and 2 layers.

[0078] Collect historical vehicle data, divide it into time slices of 15 minutes, sort it in chronological order, and divide it into training set and test set, where the training set is the first 60 time slices of a day, and the rest are test sets. After processing the data, the historical time series data (OD flow data) and historical external features (vehicle traffic flow data) required for the training model are obtained.

[0079] Through cross-validation, we adjust the model's hyperparameters, such as learning rate, hidden layer size of LSTM layer, number of layers, etc., to improve model performance. We evaluate the model's performance through model evaluation indicators, such as accuracy, recall, F1 score, etc., and further adjust the model structure or hyperparameters based on the evaluation results to achieve better prediction results.

[0080] S4: Real-time simulation of traffic roads based on prediction results

[0081] Secondary development of simulation software, input the prediction results into the simulation software, and obtain the predicted simulated traffic flow in the simulated road network. The specific steps are as follows:

[0082] Convert the CSV file (OD traffic data) into a format that can be recognized and processed by the simulation software: Reorganize the data according to the XML schema of the SUMO simulation software and convert the CSV file into a Flow file in XML format that can be recognized by SUMO.

[0083] like Figure 7 As shown, the flow file represents a traffic volume from O to D, where begin indicates the time point when the predicted traffic flow starts, number indicates the predicted traffic volume, fromTaz1 and toTaz indicate the starting point and end point of the traffic flow respectively.

[0084] The secondary development simulation software is as follows: In the SUMO simulation software, Traci (Traffic Control Interface) is used as the control interface to achieve dynamic control of the simulation process; the SUMO simulation software is set to update the traffic flow according to the new prediction results every 900 simulation steps (15 minutes). Use Traci to control the simulation step and perform an update operation every 900 steps. When the update point is reached, the simulation state is saved to the specified file to save the current simulation state. After that, use Traci to reload the network and vehicle status to ensure that the simulation continues from the correct time point.

[0085] Input the Flow traffic file into the SUMO simulation software, generate traffic flow in the simulated road network (the predicted traffic flow of the OD detection interval of Lin'an_Yuhang at the next fixed step length), and realize the online simulation of traffic roads.

[0086] In summary, the online traffic flow simulation method for traffic roads provided by the present invention realizes accurate prediction of traffic flow through real-time collection and processing of data from gantries, toll stations, etc., combined with advanced machine learning algorithms such as long short-term memory networks, and finally realizes real-time online simulation. The present invention has significant beneficial effects and is of great significance for improving traffic management and planning levels, optimizing traffic flow, and improving road utilization.

[0087] The preferred embodiments of the present invention are shown in the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described in this specification. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.

Claims

1. A traffic flow online simulation method for a traffic road, comprising the following steps: S1: Build simulation scenarios based on highway network data; S2: collect and upload data in real time; S3: Extract traffic flow features for OD prediction; S4: Simulate traffic roads in real time based on the prediction results.

2. The method for online simulation of traffic flow for traffic roads according to claim 1, characterized in that: The step S1 includes: downloading regional road network vector data, importing simulation software to perform road network simulation, and setting up detection stations in the simulated road network.

3. The method for online simulation of traffic flow for traffic roads according to claim 2, characterized in that: The step S2 includes: the detector collects vehicle data in real time and sends a data transmission request; the web server temporarily stores and distributes vehicle data through a message queue; and the vehicle data is written into a redis database.

4. The method for online simulation of traffic flow for traffic roads according to claim 3 is characterized in that: The step S3 comprises: S3.1: Extract clean data Read vehicle data from the redis database at a fixed step size and perform data cleaning; S3.2: Extract vehicle traffic flow data The vehicle data passing through the OD detection interval within the same fixed step length are summarized as vehicle traffic flow data; S3.3: Extract OD flow data All vehicle traffic flow data passing through the OD detection interval within the same fixed step length are summarized into one OD flow data; S3.4: OD prediction The OD flow data and vehicle traffic flow data are input into the BaseLSTM model to obtain the prediction results, which are then converted into a CSV file.

5. The method for online simulation of traffic flow for traffic roads according to claim 4, characterized in that: The detector includes a toll station and a gantry; the vehicle data includes the detector, license plate, and time; the vehicle traffic flow data includes license plate, type, entry time, departure time, starting point, and end point; the OD flow data includes detection interval, time, sequence number, and vehicle flow.

6. The method for online simulation of traffic flow for traffic roads according to claim 5, characterized in that: The step S4 includes: inputting the CSV file into the simulation software, generating the traffic flow in the simulated road network, and realizing the online simulation of the traffic road.

7. The method for online simulation of traffic flow for traffic roads according to claim 6, characterized in that: The BaseLSTM model includes: OD traffic data as the input of the LSTM layer, the output of the LSTM layer as the input of the first fully connected layer, the output of the first fully connected layer and the vehicle traffic flow data as the input of the second fully connected layer, and the second fully connected layer outputs the prediction result.

8. The method for online simulation of traffic flow for traffic roads according to claim 7, characterized in that: The training process of the BaseLSTM model uses the optimizer and loss function provided by PyTorch, with a learning rate of 1e-4, 100 training rounds, a batch size of 64, a hidden layer size of 64, and a number of layers of 2.