Converging road traffic flow simulation method and system based on digital twinning
By acquiring traffic flow data in the merging zone, analyzing speed differences and driver responses, calculating safe merging distances, generating lane-changing access probability factors, and controlling the lane-changing behavior of virtual vehicles, the problem of simulation result deviation caused by vehicle speed differences in traditional simulation models is solved, and more accurate traffic flow simulation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING XINYAJU TECHNOLOGY CO LTD
- Filing Date
- 2026-03-31
- Publication Date
- 2026-05-29
AI Technical Summary
Traditional traffic simulation models for merging areas fail to effectively describe the effective gap reduction effect caused by vehicle speed differences, resulting in significant discrepancies between simulation results and actual traffic flow patterns, which affects the accuracy of traffic control strategies.
By acquiring traffic flow data in the merging zone, analyzing speed differences, calculating safe merging distances, and combining driver reaction delays and vehicle safety distances, a lane-changing access probability factor is generated to control the lane-changing behavior of virtual vehicles in order to simulate real traffic flow patterns.
This improves the accuracy of the simulation system in reproducing real traffic flow patterns, avoids overly aggressive lane-changing behavior of virtual vehicles in the simulation, ensures that the simulation results match the actual road conditions, and reduces simulation deadlock.
Smart Images

Figure CN122116642A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of digital twin technology, specifically to a method and system for simulating traffic flow on merging roads based on digital twins. Background Technology
[0002] With the increasing density of urban expressways and highways, traffic pressure is growing. Merging areas between ramps and main roads, as key points in the road network, are prone to traffic congestion and accidents due to factors such as vehicle convergence, significant speed differences, and complex driving behaviors. To optimize traffic management strategies in merging areas, using digital twin technology to simulate traffic flow has become a mainstream approach in the industry.
[0003] Traditional merging zone traffic simulations typically rely on fixed geometric gap logic to determine whether a vehicle should merge. That is, as long as there is a gap in the target lane greater than the minimum safe distance, the virtual vehicle will merge. However, in real traffic flow, when the speed in the main lane is significantly higher than the speed on the ramp (i.e., a high speed difference exists), drivers, for safety reasons, often need to reserve a longitudinal buffer space longer than the theoretical geometric distance to eliminate the collision risk caused by the relative speed difference. This effective gap reduction effect caused by dynamic differences is not fully described by existing simulation models. As a result, even under high speed difference conditions, virtual vehicles in the simulation environment can easily find available gaps to merge, failing to realistically reproduce the complex traffic flow patterns such as ramp queuing and mainline congestion caused by merging difficulties. This leads to significant deviations in simulation results, misleading the assessment of congestion overflow risks and seriously affecting the guiding value of simulation for actual traffic control strategies. Summary of the Invention
[0004] To address the aforementioned technical issues, a method and system for simulating traffic flow on merging roads based on digital twins are provided to resolve existing problems.
[0005] The solution to the technical problem in this application is to provide a method and system for simulating traffic flow on merging roads based on digital twins, including the following steps: In a first aspect, embodiments of this application provide a method for simulating traffic flow on merging roads based on digital twins, the method comprising the following steps: Obtain traffic flow data of the merging area within a preset time window before the current moment, including traffic volume and average speed on the main lanes and ramps, and input the data into a pre-built merging area road simulation environment for traffic flow simulation; Analyze the difference in vehicle speed between the main lane and the ramp, calculate the buffer distance required to eliminate the speed difference, combine the distance traveled by the driver due to reaction delay, as well as the safe driving distance and vehicle length, to determine the safe merging distance at the current moment, so as to characterize the minimum space required for a vehicle to safely merge into the main lane. For the gap positions in front of the vehicle in the main lane, based on the traffic flow of the main lane and the distribution model that the randomness of the arrival of the traffic flow follows, a virtual headway is generated for each gap position, which is then converted into a headway for each gap position. The headway is compared with the safe merging distance, and the maximum merging capacity that meets the safe merging conditions is calculated. Combined with the traffic flow of the ramp, the lane-changing access probability factor at the current moment is obtained. In the simulation scenario, a random blocking decision strategy is implemented on the lane-changing requests of virtual vehicles on the ramp by using the lane-changing access probability factor to control the lane-changing behavior of virtual vehicles and simulate the real traffic flow pattern.
[0006] Preferably, the buffer distance is calculated as follows: the difference between the average driving speed of the main lane and the average driving speed of the ramp at the current moment is calculated, the maximum value between the difference and 0 is selected as the speed difference, and the buffer distance is calculated by combining the preset comfort acceleration and using the principle of vehicle dynamics.
[0007] Preferably, determining the safe merging distance at the current moment includes: Based on the average speed of the ramp at the current moment, the distance traveled by the vehicle on the ramp from the time the driver makes the merging decision to the time the operation is executed is calculated as the reaction travel distance; The average vehicle length on the main lane is calculated, and the sum of this length and the preset safe distance, reaction distance, and buffer distance is used as the safe merging distance at the current moment.
[0008] Preferably, the calculation process for the virtual headway at each gap position is as follows: Based on the traffic flow in the main lanes, calculate the total number of vehicles in the main lanes within a time window to infer the theoretical total number of gap locations in the main lanes; for each gap location, in the probability space... In the middle, a cumulative probability value is generated for it; Based on the inverse function of the preset probability distribution model, the cumulative probability value is inversely transformed to calculate the virtual headway at each gap position.
[0009] Preferably, the process of obtaining the cumulative probability value is as follows: using an equal-interval sampling method, the probability space is... Evenly cut There are several sub-intervals, among which... Given the total number of all gap locations, for each gap location, the midpoint of the corresponding sub-interval is taken as its cumulative probability value.
[0010] Preferably, the process for determining the maximum merging capacity is as follows: based on the traffic flow of the ramp, calculate the number of all vehicles on the ramp within the time window, and use this number as the total number of vehicles merging in. ;Build a 3D adjacency matrix , where the adjacency matrix In the matrix, rows represent merging vehicles, and columns represent gap positions; for any element in the matrix... If the first If the virtual headway at the corresponding gap position is greater than or equal to the safe merging distance, then... Assign a value of 1, otherwise assign a value of 0; for the adjacency matrix A, use the bipartite graph matching algorithm to solve for the maximum number of matches, which is the maximum inflow capacity.
[0011] Preferably, the lane-changing access probability factor is the ratio of the maximum merging capacity to the total number of vehicles merging.
[0012] Preferably, the random blocking determination strategy includes: during simulation runtime, reading the lane-change admission probability factor in real time at each simulation step and smoothing it; traversing the virtual vehicles located on the ramps in the simulation scenario, for virtual vehicles with lane-change requests on the ramps, if the virtual vehicle is in a cooldown period, rejecting its lane-change request; otherwise, randomly generating a lane-change probability factor for the virtual vehicle that conforms to the specified probability. A uniformly distributed random number is used, and the corresponding lane-changing control operation is executed based on the comparison between the random number and the smoothed lane-changing access probability factor.
[0013] Preferably, the execution of the corresponding lane-changing control operation includes: if the random number of the virtual vehicle is greater than the smoothed lane-changing admission probability factor, then its lane-changing request is rejected and it enters a cooling-off period of a preset duration; otherwise, it is allowed to perform the lane-changing operation.
[0014] Secondly, embodiments of this application also provide a merging road traffic flow simulation system based on digital twins, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps of any of the above-described merging road traffic flow simulation methods based on digital twins.
[0015] This application has at least the following beneficial effects: This application collects real traffic flow data and inputs it into the simulation environment, enabling the simulation model to operate based on actual traffic conditions and avoiding deviations between purely theoretical assumptions and reality. It calculates the buffer distance required to eliminate the speed difference, which is beneficial because it introduces a vehicle dynamics-based safety constraint mechanism, quantifying the nonlinear impact of the speed difference between the main lane and the ramp as a buffer distance, allowing the safety constraint to dynamically adapt to traffic conditions. It determines the safe merging distance at the current moment, which is beneficial because it comprehensively considers reaction delay, kinetic energy adjustment, static margin, and vehicle body correction, quantifying the minimum physical space required for a safe lane change under the current speed difference. This approach transforms abstract speed differences into concrete spatial constraints, providing an objective physical basis for determining the usability of gaps and avoiding the blindness of lane changing based solely on probability or rules. It generates virtual headway distances for each gap location, converting them into headway spacing. This approach discretizes macroscopic traffic flow data into microscopic gap spacing using a probability distribution model, restoring the randomness of gap distribution in traffic flow. Furthermore, it statistically analyzes the maximum merging capacity that meets safe merging conditions. This allows for the selection of truly usable gaps by comparing headway spacing with safe merging distances, and the calculation of the maximum capacity under the current safety constraints. The simulation ensures that lane-changing behavior does not exceed physical limits, avoiding "pattern crossing" or unrealistically high throughput. The current lane-changing access probability factor is obtained, which quantifies the road's capacity to accept merging vehicles under current traffic conditions by converting the ratio of maximum merging capacity to merging demand into a probability factor, providing macro-level command parameters for subsequent simulation control. A random blocking strategy is implemented for lane-changing requests from virtual vehicles on ramps to control their lane-changing behavior and simulate real traffic flow patterns. This strategy effectively suppresses excessive lane-changing behavior of virtual vehicles under high-speed differential conditions. The aggressive lane-changing behavior effectively eliminates the simulation deadlock phenomenon caused by the traditional geometric gap model. Under the constraints of macroscopic traffic flow parameters, virtual vehicles spontaneously exhibit queue lengths and speed reductions similar to those on real roads. In addition, the introduction of a cooling mechanism effectively solves the control failure problem caused by frequent vehicle retries in probabilistic control, ensuring that rejected vehicles cannot immediately retry. This realistically simulates the behavior of drivers waiting for suitable gaps in reality. Through this mechanism, the simulation can automatically generate queue congestion patterns that conform to the characteristics of real traffic flow, thereby improving the realism and accuracy of the simulation system in reproducing real traffic flow patterns. Attached Figure Description
[0016] The following section provides a more detailed description of the digital twin-based traffic flow simulation method for merging roads in this application, with reference to the accompanying drawings.
[0017] Figure 1A flowchart illustrating the steps of a digital twin-based method for simulating traffic flow on merging roads, as provided in this application embodiment; Figure 2 A flowchart illustrating the steps of the method for obtaining the secure inbound distance provided in this application embodiment. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description of the digital twin-based traffic flow simulation method and system for merging roads proposed in this application, in conjunction with the accompanying drawings and implementation examples, is provided. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.
[0020] Please see Figure 1 The diagram illustrates a flowchart of a method for simulating traffic flow on merging roads based on digital twins, according to an embodiment of this application. The method includes the following steps: Step 1: Obtain traffic flow data of the merging area within a preset time window before the current moment, including traffic volume and average speed on the main lanes and ramps, and input the data into a pre-built merging area road simulation environment for traffic flow simulation.
[0021] With the rapid growth of car ownership in China, congestion and traffic accidents frequently occur in key traffic convergence areas. Constructing a twin model of roads in convergence areas allows for the monitoring and analysis of traffic conditions in these areas, enabling the optimization of traffic control strategies and thus alleviating traffic pressure.
[0022] Based on the above analysis, by deploying roadside sensing devices, such as microwave radar, inductive loops or video detectors, upstream of the urban traffic confluence area, that is, by deploying roadside sensing devices upstream of the main lane and ramp of the confluence area, the average driving speed and traffic flow of vehicles on the main lane and the average driving speed and traffic flow of vehicles on the ramp within a preset time window before the current moment can be collected. The collected data is then input into a pre-built road simulation environment in the confluence area to drive the simulation platform to simulate traffic flow. In this embodiment, the average driving speed is calculated as follows: the average driving speed of all vehicles on the main lane within the time window is taken as the average driving speed of the main lane at the current moment; the average driving speed of all vehicles on the ramp within the time window is taken as the average driving speed of the ramp at the current moment. The traffic flow is calculated as follows: the number of all vehicles detected by the roadside sensing devices on the main lane within the time window is counted, and the units are converted to obtain the traffic flow of the main lane; correspondingly, the number of all vehicles detected by the roadside sensing devices on the ramp within the time window is counted, and the units are converted to obtain the traffic flow of the ramp. Next, a simulation environment of the merging area road is built using traffic simulation software to simulate the traffic flow. In this embodiment, VISSIM software is used to build the simulation environment. VISSIM software is a well-known technology and will not be described in detail here.
[0023] The average driving speed and traffic flow are calculated at a time interval of 5 seconds, and the time window is 60 seconds. As other implementation methods, implementers can set them according to the actual situation. The unit of traffic flow is vehicles per hour.
[0024] It should be noted that, to prevent errors such as a zero denominator in subsequent calculations due to the absence of vehicles at night or during traffic control periods, if the traffic flow in the main lane at the current moment is less than a preset value, the subsequent access probability factor is directly assigned a value of 1, indicating that all lane-changing requests are allowed by default. The preset value is 50veh / h, which can be set by the implementer according to the actual situation as another implementation method. Thus, the traffic flow and average speed of the main lane and ramps are obtained.
[0025] Step 2: Analyze the difference in vehicle speed between the main lane and the ramp, calculate the buffer distance required to eliminate the speed difference, and combine the distance traveled by the driver due to reaction delay, as well as the safe driving distance and vehicle length, to determine the safe merging distance at the current moment, so as to characterize the minimum space required for the vehicle to safely merge into the main lane.
[0026] Before vehicles on ramps enter the main lane, to ensure the safety of lane changes, the minimum space required to merge into the main lane must be calculated. Since there is usually a speed difference between the main lane and the ramp, vehicles not only need to occupy physical space during lane changes, but also need to reserve sufficient buffer distance to prevent rear-end collisions due to speed adjustments. Therefore, calculating the safe merging distance is crucial. The flowchart of the method for obtaining the safe merging distance provided in this embodiment is shown below. Figure 2 As shown, it specifically includes: Calculate the difference between the average speed of the main lane and the average speed of the ramp at the current moment, and select the maximum value between it and 0 as the speed difference; In this embodiment, the difference between the average speed of the main lane and the average speed of the ramp at the current moment is calculated, and the maximum value between the difference and 0 is selected as the speed difference.
[0027] It should be noted that if the average speed of the ramp is faster, and the speed difference is zero, the merging resistance is considered to be small. By filtering for the maximum value between the difference and zero, we ensure that we only focus on the situation where the speed in the main lane is faster than that on the ramp. This is the main reason for merging difficulties. The greater the speed difference, the more intense the relative motion between the traffic flow layers, and the greater the kinetic energy adjustment required for merging.
[0028] Based on the average speed of the ramp at the current moment, the distance traveled by the vehicle on the ramp from the time the driver makes the merging decision to the time the operation is executed is calculated as the reaction travel distance; In this embodiment, the preset reaction time is 1.5s. As other implementation methods, the implementer can set it according to the actual situation. The reaction travel distance is the product of the vehicle speed at each moment on the ramp and the preset reaction time. It should be noted that the faster the vehicle speed on the ramp, or the slower the driver's reaction, the greater the reaction travel distance.
[0029] Based on the speed difference and the preset comfort acceleration, the buffer distance required to eliminate the speed difference is calculated using the principles of vehicle dynamics. In this embodiment, the buffer distance The calculation formula is: ,in, Due to speed differences, The preset comfort acceleration is defined as follows: comfort acceleration refers to the acceleration index that affects passenger comfort in a vehicle. In this embodiment, the preset comfort acceleration value is 2. This ensures that the vehicle has sufficient dynamics to eliminate the speed difference during merging, while also ensuring the smoothness of the merging operation and the comfort of the occupants, in line with the expectations of normal driving behavior. Since the buffer distance is directly proportional to the speed difference, it means that as the speed difference increases, the buffer distance required for safe merging will increase non-linearly and sharply. This is the core physical reason for the difficulty of changing lanes under high speed differences.
[0030] The average vehicle length on the main lane is calculated, and the sum of this length and the preset safe distance, reaction distance, and buffer distance is used as the safe merging distance at the current moment. In this embodiment, the average vehicle length is 5 meters. This is introduced to convert the net distance into the distance between the front and rear of the vehicle, so that it can be compared with the gap length including the vehicle body generated in the subsequent steps. Secondly, the preset safe distance between vehicles is 5 meters, which is the minimum distance that must be maintained when the two vehicles are traveling at the same speed. As other implementation methods, the implementer can set it according to the actual situation.
[0031] It should be noted that the safe merging distance is a value that changes dynamically with the real-time speed difference. The larger the safe merging distance, the higher the current speed difference and the higher the risk. The merging operation must strictly select a sufficiently long gap before the lane change can be performed.
[0032] Thus, the safe merging distance at the current moment is obtained.
[0033] Step 3: For the gap positions in front of the vehicle in the main lane, based on the traffic flow of the main lane and the distribution model that the randomness of the traffic flow follows, generate the virtual headway for each gap position, convert it into the headway distance for each gap position, compare the headway distance with the safe merging distance, calculate the maximum merging capacity that meets the safe merging conditions, and combine it with the traffic flow of the ramp to obtain the lane change access probability factor at the current moment.
[0034] Furthermore, traffic flow only represents the number of vehicles passing through per unit time and cannot directly reflect the randomness of the headway in the microscopic distribution. That is, it cannot quantify the phenomenon that some gaps are very large and some gaps are very small. In order to restore this resource heterogeneity in the calculation, the statistical inverse transformation method is used to generate a series of discrete gap positions.
[0035] Based on the traffic flow in the main lanes, the total number of all vehicles in the main lanes within a statistical time window is calculated to infer the theoretical total number of gap positions in the main lanes. ; It should be noted that the product of the traffic flow in the main lane and the duration of the time window is rounded up to obtain the number of all vehicles in the main lane within the time window. When calculating the product of the traffic flow and the duration of the time window, the hourly traffic flow is converted to the flow per second before calculation. Each vehicle has a corresponding gap position in front of it, so the total number of gap positions is the total number of vehicles in the main lane.
[0036] Based on the traffic flow of the ramps, the total number of vehicles merging into the ramps within a time window is calculated. ; It should be noted that the product of the traffic flow on the ramp and the duration of the time window is rounded up to be the number of all vehicles on the ramp within the time window. If the total number of gap positions is 0 or the total number of vehicles merging is 0, it means that the traffic flow on the main lane is 0 at this time, or there are no vehicles on the ramp that need to merge. In this case, the subsequent access probability factor is directly assigned a value of 1, indicating that all lane change requests are allowed by default.
[0037] After determining the total number of gap locations, a specific spatial length needs to be assigned to each gap location. A statistical distribution model is used to simulate the headway. Considering that headway in traffic flow often follows a negative exponential distribution, the spatial length of each gap location is generated through the following iterative steps: Using an equal-interval sampling method, the probability space is divided into... Evenly cut There are several sub-intervals, among which... Given the total number of all gap locations, for each gap location, the midpoint of the corresponding sub-interval is taken as its cumulative probability value. In this embodiment, the calculation process of the cumulative probability value is as follows: construct a loop variable. Increasing from 1 to For the first For each gap location, calculate its corresponding cumulative probability value. The calculation formula is as follows: in, For the first The cumulative probability value of each gap location. This represents the total number of all gap locations; It should be noted that the function of this formula is to divide the probability space Uniform segmentation ensures that the generated samples cover the entire distribution range from the smallest to the largest gaps.
[0038] Based on the inverse function of the preset probability distribution model, the cumulative probability value is inversely transformed to calculate the virtual headway at each gap position. It should be noted that, based on classic assumptions in traffic engineering, the headway follows the parameter: The probability distribution model adopts a negative exponential distribution; in this embodiment, the probability distribution model adopts a negative exponential distribution, and its cumulative distribution function is: in, This refers to the average arrival rate of traffic flow, which is the traffic volume on the main lanes. It is an exponential function with the natural constant as its base. Indicates that the headway is less than or equal to The probability in seconds; Therefore, by performing an inverse transformation on the formula for the cumulative distribution function above, let... Then the headway , Indicates traffic flow, therefore, the first The formula for calculating the virtual headway at each gap position is: in, For the first Virtual headway at each gap position, For the first The cumulative probability value of each gap location. Traffic flow in the main lane This indicates the conversion of hourly traffic flow to per second.
[0039] It should be noted that when When smaller, Smaller indicates the short distances that are common in traffic flow. When it approaches 1, It is very large, representing the rare large spacing that occasionally appears in traffic flow.
[0040] Based on the average driving speed of the main lane at the current moment and the virtual headway, calculate the headway at each gap position; It should be noted that the headway is the product of the average driving speed and the virtual headway; the headway includes the length of the vehicle itself in the main lane, which is consistent with the definition of including the average vehicle length when calculating the safe merging distance, ensuring the fairness of subsequent comparisons.
[0041] Furthermore, due to the exclusivity of road resources, an available lane gap can only be occupied by one merging vehicle at a time. Therefore, we cannot simply sum the probabilities; we must calculate the maximum number of successful lane changes while satisfying the mutual exclusion constraint.
[0042] Build a 3D adjacency matrix , where the adjacency matrix In the matrix, rows represent merging vehicles, and columns represent gap positions; for any element in the matrix... If the first If the virtual headway at the corresponding gap position is greater than or equal to the safe merging distance, then... Assign a value of 1, otherwise assign a value of 0; For the adjacency matrix A, the bipartite graph matching algorithm is used to solve for the maximum number of matches, which is taken as the maximum inflow capacity; In this example, for a scenario where vehicles are homogeneous, i.e., assuming that all merging vehicles have similar performance and length, the number of columns in the adjacency matrix where the virtual headway of the corresponding gap position is greater than or equal to the safe merging distance is counted. The minimum value between this number and the total number of merging vehicles is selected as the maximum merging capacity. This value reflects the maximum number of lane changes that can be accommodated, which depends on the smaller of the total merging demand and the number of gaps that meet the safe merging conditions. This takes into account both resource constraints and demand constraints. For heterogeneous vehicle scenarios, such as large trucks and cars, different types of merging vehicles have different safe merging distances, requiring the calculation of the safe merging distance for each type: The length of each type of vehicle body is calculated, and the sum of this length and the preset safe distance, reaction distance, and buffer distance is used as the safe merging distance for each type at the current moment. Based on the type of each merging vehicle, obtain the safe merging distance for each merging vehicle; Build a 3D adjacency matrix ,in, Represents the total number of vehicles merging, adjacency matrix In the middle, rows represent incoming vehicles, and columns represent gap positions; For any element in the matrix If the first The virtual headway at the corresponding gap position in the column is greater than or equal to the first The safe merging distance for each merging vehicle, Assign a value of 1, otherwise assign a value of 0; Right now ,in, For the first The virtual headway corresponding to the gap position in the column. For the first The safe merging distance for each merging vehicle; For the adjacency matrix A, a bipartite graph matching algorithm is used to solve for the maximum number of matches, which is taken as the maximum inflow capacity. In this embodiment, the bipartite graph matching algorithm is solved by calling the Hungarian algorithm. The Hungarian algorithm is a well-known technique and will not be described in detail here. As other implementation methods, implementers can also use the Hopcroft-Karp algorithm to solve the problem. This embodiment does not impose any special restrictions on this.
[0043] It should be noted that if the virtual headway is greater than or equal to the safe merging distance, it means that the gap is long enough to accommodate merging vehicles and eliminate the current speed difference risk. Conversely, it means that although the gap physically exists, its length is insufficient to allow vehicles to merge safely.
[0044] Furthermore, based on the maximum merging capacity and the total number of vehicles merging, the lane-changing access probability factor is calculated as follows: The ratio of the maximum merging capacity to the total number of vehicles merging is used as the lane change access probability factor at the current moment. It should be noted that when the total number of vehicles merging is 0, the lane-changing access probability factor is set to 1 to ensure the validity of the mathematical calculation and logical coherence. Secondly, when the lane-changing access probability factor is 1, it indicates that the current lane gap resources are extremely abundant, and in the simulation, the lane-changing intention of vehicles should not be subject to any external restrictions. When the lane-changing access probability factor is less than 1, it indicates that a certain proportion exists. The merging demand, although subjectively intended to change lanes, is destined to fail due to encountering invalid gaps (i.e., gaps where the virtual headway is less than the safe merging distance) or resource preemption. During simulation, this factor must be utilized to preemptively block these inevitable lane-changing attempts; among them, This represents the lane-change access probability factor.
[0045] Thus, the lane change access probability factor at the current moment is obtained.
[0046] Step 4: In the simulation scenario, the lane-changing access probability factor is used to execute a random blocking judgment strategy on the lane-changing requests of virtual vehicles on the ramp, thereby controlling the lane-changing behavior of virtual vehicles to simulate the real traffic flow pattern.
[0047] By simulating the traffic conditions in the merging area, using the lane-changing access probability factor as a macro-level guide, and correcting the micro-level behavior of virtual vehicles in the simulation environment through a random blocking mechanism, the real traffic flow pattern can be reproduced.
[0048] During simulation, the lane change admission probability factor is read in real time at each simulation step and smoothed. In this embodiment, the simulation step size is 0.1s. As for other implementation methods, the implementer can set it according to the actual situation. Secondly, to prevent unnatural oscillations in the simulated vehicle behavior caused by sudden changes in control parameters, a smoothing operation needs to be performed on the lane-changing access probability factor. The smoothing process is as follows: in, This is the smoothed lane-change admission probability factor under the current simulation step size. This is the lane-change admission probability factor read at the current simulation step size. This is the smoothed lane-change admission probability factor under the previous simulation step size. The preset smoothing coefficient is 0.1. This ensures that when the measured data fluctuates drastically, the control force in the simulation system transitions smoothly, conforming to the gradual characteristics of traffic flow.
[0049] Secondly, in conventional simulations, if only simple random judgments are made, blocked vehicles will often retry immediately at the next simulation step, resulting in hundreds of consecutive attempts in a very short time, inevitably leading to success and rendering probability control ineffective. To solve this problem, a cooldown timing mechanism is introduced, specifically: Iterate through the virtual vehicles located on the ramps in the simulation scenario. For virtual vehicles with lane-change requests, if the virtual vehicle is in a cooldown period, reject its lane-change request; otherwise, randomly generate a lane-change option for the virtual vehicle that conforms to the specified rules. Given uniformly distributed random numbers, perform the following checks: If the random number is greater than the smoothed lane change admission probability factor, the lane change request is rejected and the user is put into a cooling-off period of a preset duration; otherwise, the user is allowed to perform the lane change operation. In this embodiment, the preset duration is 3 seconds. That is, after the virtual vehicle enters the cooling period, the virtual vehicle will be forcibly locked on the ramp within 3 seconds and will not be able to initiate a lane change request. As for other implementation methods, the implementer can set it according to the actual situation.
[0050] It should be noted that by introducing a cooling-off period, the frequency of vehicle-initiated requests is effectively controlled, ensuring... It can accurately reflect the throughput per unit time, rather than the instantaneous throughput, thus solving the deadlock problem.
[0051] Secondly, the lane-change access probability factor is a probability value between 0 and 1. However, macroscopically, it represents the proportion of vehicles allowed to pass under the current road conditions. For example, a lane-change access probability factor of 0.6 means that when a large number of vehicles attempt to change lanes, the available gap resources on the main lane can only meet the merging needs of 60% of the ramp vehicles. However, in microscopic simulation, it is impossible to predict at what specific moment each vehicle will encounter an available gap, nor is it possible to predetermine which 40% of vehicles are destined to fail to change lanes. Therefore, for each specific virtual vehicle, when it initiates a lane-change request, an independent random number is generated for it and compared with the smoothed lane-change access probability factor. This mechanism is equivalent to drawing lots independently for each vehicle and each attempt. Those who win the lottery are granted passage, while those who do not win the lottery wait temporarily. In this way, the macroscopic pass rate is accurately decomposed into the probability of each attempt at the microscopic level, which not only ensures computational efficiency but also makes the simulation results statistically match the macroscopic resource capacity. At the same time, the cooling mechanism avoids control failure caused by frequent vehicle retries.
[0052] When there is a significant speed difference between the main lane and the ramp, the safe merging distance will be larger, resulting in a reduction in the available gaps for a safe merging. The flow rate is significantly reduced. At this point, a large number of virtual vehicles will be triggered and blocked, entering a cooling-off period, because the random number is greater than or equal to the smoothed lane-changing access probability factor. These forced-to-cool-down virtual vehicles can only continue to move forward on the ramp or slow down and wait, causing the vehicle density on the ramp to increase rapidly, and the queue length to naturally increase. At the same time, because a large number of interfering vehicles are blocked on the ramp, the merging interference on the main lane is significantly reduced, thus maintaining a high traffic speed. This layered flow pattern of long ramp queues and high main lane speeds is a typical characteristic of high-speed difference merging zones. Through this closed-loop logic, this physical phenomenon was reproduced in the simulation platform, verifying the effectiveness of the solution.
[0053] Based on the same inventive concept as the above methods, this application also provides a merging road traffic flow simulation system based on digital twins, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps of any one of the above-described merging road traffic flow simulation methods based on digital twins.
[0054] It should be understood that, although Figure 1 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0055] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0056] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application. Therefore, any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of this application, without departing from the content of the technical solution of this application, shall fall within the protection scope of the technical solution of this application.
Claims
1. A method for simulating traffic flow on merging roads based on digital twins, characterized in that, The method includes the following steps: Obtain traffic flow data of the merging area within a preset time window before the current moment, including traffic volume and average speed on the main lanes and ramps, and input the data into a pre-built merging area road simulation environment for traffic flow simulation; Analyze the difference in vehicle speed between the main lane and the ramp, calculate the buffer distance required to eliminate the speed difference, combine the distance traveled by the driver due to reaction delay, as well as the safe driving distance and vehicle length, to determine the safe merging distance at the current moment, so as to characterize the minimum space required for a vehicle to safely merge into the main lane. For the gap positions in front of the vehicle in the main lane, based on the traffic flow of the main lane and the distribution model that the randomness of the arrival of the traffic flow follows, a virtual headway is generated for each gap position, which is then converted into a headway for each gap position. The headway is compared with the safe merging distance, and the maximum merging capacity that meets the safe merging conditions is calculated. Combined with the traffic flow of the ramp, the lane-changing access probability factor at the current moment is obtained. In the simulation scenario, a random blocking decision strategy is implemented on the lane-changing requests of virtual vehicles on the ramp by using the lane-changing access probability factor to control the lane-changing behavior of virtual vehicles and simulate the real traffic flow pattern.
2. The method for simulating traffic flow on merging roads based on digital twins as described in claim 1, characterized in that, The calculation process for the buffer distance is as follows: calculate the difference between the average driving speed of the main lane and the average driving speed of the ramp at the current moment, select the maximum value between the difference and 0 as the speed difference, and combine it with the preset comfort acceleration, using the principle of vehicle dynamics to calculate the buffer distance.
3. The method for simulating traffic flow on merging roads based on digital twins as described in claim 1, characterized in that, Determining the safe merging distance at the current moment includes: Based on the average speed of the ramp at the current moment, the distance traveled by the vehicle on the ramp from the time the driver makes the merging decision to the time the operation is executed is calculated as the reaction travel distance; The average vehicle length on the main lane is calculated, and the sum of this length and the preset safe distance, reaction distance, and buffer distance is used as the safe merging distance at the current moment.
4. The method for simulating traffic flow on merging roads based on digital twins as described in claim 1, characterized in that, The calculation process for the virtual headway at each gap position is as follows: Based on the traffic flow in the main lanes, calculate the total number of vehicles in the main lanes within a time window to infer the theoretical total number of gap locations in the main lanes; for each gap location, in the probability space... In the middle, a cumulative probability value is generated for it; Based on the inverse function of the preset probability distribution model, the cumulative probability value is inversely transformed to calculate the virtual headway at each gap position.
5. The method for simulating traffic flow on merging roads based on digital twins as described in claim 4, characterized in that, The process of obtaining the cumulative probability value is as follows: equal-interval sampling is used to divide the probability space... Evenly cut There are several sub-intervals, among which... Given the total number of all gap locations, for each gap location, the midpoint of the corresponding sub-interval is taken as its cumulative probability value.
6. The method for simulating traffic flow on merging roads based on digital twins as described in claim 5, characterized in that, The process for determining the maximum merging capacity is as follows: based on the traffic flow of the ramp, calculate the total number of vehicles on the ramp within the time window, which is then used as the total number of vehicles merging in. ;Build a dimensional adjacency matrix , where the adjacency matrix In the matrix, rows represent merging vehicles, and columns represent gap positions; for any element in the matrix... If the first If the virtual headway at the corresponding gap position is greater than or equal to the safe merging distance, then... Assign a value of 1, otherwise assign a value of 0; for the adjacency matrix A, use the bipartite graph matching algorithm to solve for the maximum number of matches, which is the maximum inflow capacity.
7. The method for simulating traffic flow on merging roads based on digital twins as described in claim 6, characterized in that, The lane-change access probability factor is the ratio of the maximum merging capacity to the total number of vehicles merging.
8. The method for simulating traffic flow on merging roads based on digital twins as described in claim 1, characterized in that, The random blocking determination strategy includes: during simulation runtime, reading the lane-change admission probability factor in real time at each simulation step and smoothing it; traversing the virtual vehicles located on the ramps in the simulation scenario, for virtual vehicles with lane-change requests on the ramps, if the virtual vehicle is in a cooldown period, its lane-change request is rejected; otherwise, a random lane-change probability factor is generated for the virtual vehicle that follows the specified rules. A uniformly distributed random number is used, and the corresponding lane-changing control operation is executed based on the comparison between the random number and the smoothed lane-changing access probability factor.
9. The method for simulating traffic flow on merging roads based on digital twins as described in claim 8, characterized in that, The execution of the corresponding lane-changing control operation includes: if the random number of the virtual vehicle is greater than the smoothed lane-changing admission probability factor, then its lane-changing request is rejected and it enters a cooling-off period of a preset duration; otherwise, it is allowed to perform the lane-changing operation.
10. A digital twin-based merging road traffic flow simulation system, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the merging road traffic flow simulation method based on any one of claims 1-9.