1. Introduction
An urban traffic signal control system is key to reducing traffic jams and accidents. With the rapid development of the scientific economy and an increase in population, the demand for motor vehicles is increasing in China. The traditional non-intelligent signal lamp is typically based on a fixed traffic signal control strategy, which makes it difficult to deal with the complex and changeable urban traffic state, leading to different degrees of traffic congestion and accidents, emissions of carbon dioxide, and huge economic losses [
1].
In recent years, several studies have been conducted both domestically and internationally on urban traffic signal control issues, such as the split-cycle offset optimizing technique (SCOOT) system in the UK [
2], real-time hierarchy optimized distribution effect system (RHODES) in the US [
3], vehicle information and communication system (VICS) in Japan [
4], and integrated traffic management system (ITMS) in China. To address the shortcomings of artificial experiences and sensor control, an increasing number of researchers have used artificial intelligence (AI) to improve urban transportation systems. Chin et al. [
5] used Q-learning algorithms to control traffic lights, allowing each intersection to collaborate independently, while Casas et al. [
6] used deep deterministic strategies for adaptive control of urban traffic signals. Kamal et al. [
7] proposed a model predictive control (MPC) based on urban road traffic signal control; the MPC adapts to different traffic conditions and adjusts the free parameters of traffic signals online to generate appropriate traffic signals. Domestic scholars have also conducted studies on signal control. Xia [
8] established an urban regional traffic signal control model to address the efficiency of traditional distributed adaptive traffic signal control coordination. He conducted traffic signal game interaction optimization control for local intersections and proposed a local information game interaction learning algorithm based on an intersection traffic signal control agent. Li et al. [
9]. proposed a memory density strategy in which the NS-BML model in signal control only considers instantaneous density and ignores historical density. Based on the short-term memory density strategy combined with the long-term memory density strategy, the impact on a Manhattan-style network was analyzed to improve the operational efficiency of the road signal control system. Shi et al. [
10] proposed a signal control strategy based on the operating characteristics of PFI traffic flow to address the congestion problem at urban traffic intersections and established corresponding optimization models, effectively improving the operational efficiency of intersections. Traditional adaptive signal control relies largely on the current traffic state and does not consider future traffic conditions, making it difficult to achieve an optimal global state. Researchers have applied methods such as neural networks [
11], particle swarm optimization algorithms [
12], and genetic algorithms [
13] to adaptive traffic signal control (ATSC) to improve global optimization capabilities. However, these algorithms also have problems, such as the slow convergence speed of genetic algorithms and the low accuracy of particle swarm optimization algorithms. The research and development in the field of signal control is relatively recent in China, and its application must be improved through the application of science, technology, and industry standards. Signal control research has a high research value [
14,
15].
Based on the above analysis, this study proposes an optimized model for predicting traffic flow at the signal port based on a temporal convolutional network and attention with digital twins (DT-TCN Attention), fused with digital twin technology. The following are the contributions of this study.
(1) Using a TCN to extract temporal features from traffic flow data: A TCN introduces extended convolution and residual structures based on a convolutional neural network (CNN), which can effectively remove cross-temporal nonlinear relationships in traffic flow data. The residual system accelerates the feedback and convergence of the original multilayer neural network.
(2) Introducing an attention mechanism that allocates more weight to the temporal features of important nodes helps capture the global and local connections, which can effectively improve the interpretability and prediction accuracy of the model.
(3) In addition to considering the volume of traffic flow data, the study also determines meteorological factors, holidays, and seasonal information, which can help fully explore changes in traffic flow, improve the accuracy of prediction, and optimize the effectiveness of signal control.
(4) Digital twin software and Python tools were used to simulate the running status of vehicles in heavy traffic. By simulating intersections in practical cases and studying the coordinated timing control of signal lights at different periods, a real-time dynamic optimization strategy for each intersection phase was proposed to alleviate the congestion problem at peak traffic intersections.
The rest of the article is organized as follows: The related work is presented in
Section 2 method of traffic Flow Prediction Strategy based on DT-TCN Attention. Following that,
Section 3 introduces the data processing. Afterward, as a case study, the target system setup and model training are illustrated in
Section 4. At the same time, based on the real-time dataset from traffic case studies, the evaluation results of the proposed model are discussed and presented in digital twin system. Discussion part is proposed in
Section 5. Finally, conclusions and future research directions are outlined in
Section 6.
2. Traffic Flow Prediction Strategy Based on DT-TCN Attention
2.1. TCN Attention Prediction Model Description
The traffic flow prediction model based on the TCN Attention, which is divided into three parts, is shown in
Figure 1.
Input layer: The input layer contains the data pre-processing process, first embedding the special weather data and holiday data in the data set, and then importing the traffic flow data, and is set according to the corresponding variable characteristics of the data set for the integration of meaningless data truncation or supplementing it to ensure the integrity of the data set input.
Backbone network: Its function extracts nonlinear features from input sequences with multiple features.
Output layer: Outputs the multidimensional feature sequence output by the backbone network. The feature is extracted based on the backbone layer, and the training set data are used to abstract the feature and output the corresponding traffic forecast results in the future.
2.2. Data Preprocessing
In the daily long-timescale prediction task, the time-sampling unit preprocesses historical traffic flow, meteorological factors, holidays, and other data as input to the model, and the prediction result is the traffic flow operation in the next stage. The meteorological factors included the average temperature, wind speed, and maximum and minimum temperatures in the next step. The data preprocessing primarily includes data normalization, de-normalization, and categorical variable vectorization based on embedding.
2.2.1. Data Normalization and Denormalization
Considering the significant differences between the original data and a large amount of data, data features with smaller values may need to be addressed. Therefore, the actual data in this study were normalized. This study adopts the normalization method of the linear function. The normalization formula is as follows:
where
is the normalized value obtained,
X is the initial data,
represents the minimum value in the data, and
is the maximum value in the data. Normalize the original data to within [0, 1] to achieve proportional scaling of the original data.
After obtaining the predicted results from the short-term traffic flow prediction model of the TCN-Attention, performing denormalization processing was necessary. The denormalization formula is as follows:
where
is the predicted value after inverse normalization,
predicts the output values for the model, and
and
are the maximum and minimum values in the original data, respectively.
2.2.2. Vectorization of the Categorical Variable Based on Embedding
In this study, the one-hot code converted the categorical variable into a numerical value. For example, the one-hot code V for rainy days can be expressed as V = [1, 0, 0, 0]. To avoid using one-hot code that may cause deviations in the model prediction accuracy, the embedding layer network structure processes the categorical variable. As shown in
Figure 2, high-dimensional sparse one-hot code V is converted into a low-dimensional dense embedding vector.
2.3. TCN Model Construction
The TCN model is an algorithm based on a convolutional structure (CNN) used to address time-series problems. It comprises a multilayer one-dimensional extended causal convolution and residual connected units. The input and output lengths are equal, and a residual connection mechanism is introduced to address the gradient vanishing problem.
The extended convolutional network structure selects the input of historical time
as the input
of the model
time, satisfies the input conditions of time-series prediction, and outputs
, which
are the expansion numbers, as shown in
Figure 3.
The extended convolution sampled the input data in different steps with varying sampling frequencies at different levels. The input layer often samples all initial data to extract richer and more accurate feature information.
The residual unit was formed by adding the output and input data of different layers of the networks and the outputs after the activation function. The residual unit connection mechanism can improve the feedback and convergence of the network and avoid the problems of gradient disappearance and explosion that exist in traditional neural networks.
Each residual element consists of two convolutional elements and a nonlinear mapping. First, the input data are subjected to one-dimensional extended causal convolution, and then the weight values are normalized to improve the calculation speed. The ReLU activation function is used to make the network nonlinear, and finally, dropout is performed on the output data, as shown in
Figure 4.
2.4. Establishment of the Attention Model
The attention mechanism layer adopts a scaling and clicking method, and its output is
Here, and represent key-value pairs (key, value), represents the objective function, and represents of the dimension. If it requires to be satisfied, the calculated value of attention will be obtained.
The structure of the attention mechanism network is shown in
Figure 5. The output value of the TCN output layer to the input of the attention mechanism layer was
. Different inputs had different features, and the features were significantly correlated with timing. The prediction results of each vector have different weights, and the attention mechanism performs a time-step action on values with higher weights in the prediction data. The weighted sum is used to obtain the attention value, and a dense output is obtained.
2.5. Digital Twin Signal Control System
A digital twin [
16] refers to a digital representation of real-world entities. It integrates multi-scale and multi-dimensional simulations based on sensor data updates, historical data accumulation, and physical entity models. This reflects the life cycle of a physical entity. The digital twin [
17] provides a new approach for analyzing and solving traffic signal timing problems by realistically restoring traffic operation scenarios in the digital space.
The data access layer in the digital twin software can be used to build static models of road intersections and obtain dynamic vehicle data using sensor devices. The traffic signal control system has a fixed timing control for traffic lights that cannot be flexibly adjusted based on the actual traffic congestion situation without importing optimization algorithms. Real-time traffic data were imported into the twin simulation model, connected to digital analysis through the built-in COM interface in the digital twin software, optimized the algorithm timing of the traffic signal control model under twin construction and provided feedback on the optimized timing scheme in the real scene. The data interaction model structure of the digital twin signal control system is illustrated in
Figure 6.
3. Data
The dataset in this study includes the effective traffic flow, meteorological factors, correlation dates, and nonhuman intervention factors from October 2022 to March 2023, as presented in
Table 1. The pre-processing of raw data includes normalization, de-normalization, and embedding categorical variable vectorization. Among them, for effective traffic flow processing, the number of vehicles passing through and the busy index are calculated in units of 24 h per day. The processing of meteorological factors includes precipitation, wind intensity, and the daily temperature difference index. Non-human intervention factors primarily include traffic control and major vehicle accidents.
3.1. Traffic Flow Time Series
The dataset was sourced from the intersection of Fenghuang Middle Avenue and Shangrao Avenue in Shangrao City, Jiangxi Province, China. The data statistical period was from 14 October 2022, to 4 March 2023, and the statistical period was a day.
The dynamic change curve of the dataset is shown in
Figure 7, where abnormal changes exist in the vehicle flow data during certain periods. The period from 20 November to 5 December was affected by pandemic policies, and the period from 21 January to 27 January was during the Spring Festival. The area is a population outflow area, and there are significant fluctuations in the trend of people returning home during the Spring Festival.
The daily traffic volume of this data set, which belongs to a traffic intersection with a large traffic volume, showed values above 5000 pcu over a long time. We note that the traffic flow fluctuates periodically, with about one large fluctuation every seven days, reaching a cyclical peak and a value of 6500–6800 pcu. Under the influence of the pandemic policy, the traffic flow had an obvious trough period. The figure was between 30 and 50 pcu for 14 days; traffic returned to normal after normal traffic policy resumed, and there were sharp spikes due to the holidays.
3.2. Impact Factors
A correlation exists between traffic flow data and morning and evening peak hours, holidays, and non-human-controllable factors. Therefore, based on embedding, this study transformed the relevant influencing factors of dynamic changes in traffic flow from text to low-dimensional vectors, defined as the time index, weather index, and non-human controllable index, as presented in
Table 2.
The time index types were divided into three categories: “workdays not adjacent to holidays”, “workdays adjacent to holidays”, and “holidays/weekends,” with weights of 0, 0.05, and 0.1, respectively. A non-human controllable index, such as traffic control and congestion alleviation, primarily manifests as a temporary sharp drop in traffic flow. The weight during this period was set to 0.1, and the weight for the non-interference period was set to 0. A specific weight-parameter diagram is shown in
Figure 8.
5. Discussion
As aforementioned, a neural network architecture integrating TCN Attention has the following advantages: parallelism, flexible receptive field size, stable gradients, low memory requirements during training, and variable-length input. This study used signal control optimization to effectively improve prediction accuracy. Further, digital twin technology is used for the simulation, effectively improving the driving efficiency. However, there are also obvious issues with this study.
1. The predicted results did not match the true values. In
Figure 11, the predicted values represented by the blue line are consistent with the true values represented by the yellow line in the overall trend; however, a significant difference occurred in the position of the trough around 40 days. Owing to the consideration of the impact of pandemic policies (sporadic events) in the dataset, there was a period of less than 50 vehicles/day traffic data from the end of November to the beginning of December. Training was conducted during this period; therefore, there could have been significant fluctuation; however, the actual situation did not reflect this.
2. Potential parameter changes in the dataset. The characteristics of different datasets may have additional requirements regarding the historical quantity required for model prediction. Therefore, specific parameters must be adjusted for other datasets when using models for continuous predictions. This dataset includes the impact of policies and holidays. If the data volume increases for more than one year, other factors, such as weather, may affect the parameters.
6. Conclusions
Owing to the increasing completeness of intelligent transportation systems, verifying traffic control strategies using digital twin simulation technologies has become important. To improve traffic efficiency at intersections, this study used digital twin software to predict traffic flow at road intersections and optimize the signal control simulation. The aim was to improve the effective green light time of each phase, overcome the limitations of target singularity, and provide a common simulation method for achieving traffic signal control.
This study integrated the TCN Attention neural network architecture to perform short-term traffic flow prediction on a time series in minutes and long-term prediction on a dataset in days. Considering multiple influencing factors such as related dates, holidays, and policies, the “Congestion Index” was proposed as an evaluation indicator. Experiments have shown that, based on traffic flow data at specific intersections, compared with traditional TCN, this method significantly improves accuracy and training efficiency, with MAPE = 0.239. By utilizing digital twin technology for real-time simulation and dynamically adjusting the signal control duration, it is evident that the delay time of the traffic flow is significantly decreased, yielding positive outcomes.
Additionally, the method proposed in this study requires improvements in certain aspects. In the case study analysis, this study only analyzed a single intersection and did not include any factors that affect pedestrian crossing time when considering factors that affect road traffic efficiency. With continuous improvements in computer technology, such as big data and cloud computing, the study of multiple factors, such as mixed traffic, can be added to future research. For each intersection phase, the model was established using the crossing times of pedestrians, electric vehicles, and cyclists as the objective function. Simultaneously, expanding the application scenario from simple single intersections to complex road network tests with multiple intersections and using the overall urban traffic scenario to reduce road congestion and traffic accidents is necessary.