Traffic flow simulation method and device
Patent Information
- Application Number
- CN202311711338.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-12
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2043-12-12
AI Technical Summary
[0002]自动驾驶算法的仿真测试需要在道路交通流场景下进行测试,而单一的自动驾驶仿真软件仅支持构建包括少数车辆的交通环境,无法构建包括大量车辆的交通流场景
[0006] This invention provides a traffic flow simulation method and apparatus. First, a microscopic traffic simulation road network is generated based on road information from an electronic map. Then, the original vehicle trajectory data corresponding to the road information is converted into vehicle trajectory data in the simulated road coordinate system corresponding to the microscopic traffic simulation road network. Based on the vehicle trajectory data, vehicle speed and lane location are determined. Subsequently, microscopic traffic simulation of the simulated vehicles is performed on the microscopic traffic simulation road network based on the vehicle trajectory data, vehicle speed, and lane location. Simultaneously, virtual vehicles are created, and autonomous driving simulation of the virtual vehicles is performed based on the real-time status information of the microscopic traffic simulation road network and the simulated vehicles. Using this technology, joint simulation of microscopic traffic simulation and autonomous driving simulation can be performed based on real trajectory data, thereby accurately recreating traffic flow scenarios formed by a large number of vehicles, thus meeting the testing requirements of autonomous driving algorithms in traffic flow scenarios.
Smart Images

Figure CN117765729B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic simulation technology, and in particular to a traffic flow simulation method and apparatus. Background Technology
[0002] Simulation testing of autonomous driving algorithms requires testing in road traffic flow scenarios. However, single autonomous driving simulation software can only support the construction of traffic environments with a small number of vehicles, and cannot construct traffic flow scenarios with a large number of vehicles. Microscopic traffic simulation is a technique that uses computer simulation technology to reproduce the motion state of real vehicles in a virtual world. In existing microscopic traffic simulation methods, vehicle speed and lane-changing behavior are generally simulated through car-following models and lane-changing models. Even when using real vehicle trajectory data to calibrate the model parameters, the simulation results still have a large error compared to the actual vehicle operation results, making it difficult to meet the testing requirements of autonomous driving algorithms in traffic flow scenarios. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to provide a traffic flow simulation method and apparatus to alleviate the above-mentioned problems existing in the related art.
[0004] In a first aspect, embodiments of the present invention provide a traffic flow simulation method, the method comprising: acquiring road information from an electronic map and generating a microscopic traffic simulation road network based on the road information; acquiring original vehicle trajectory data corresponding to the road information and converting the original vehicle trajectory data into vehicle trajectory data in the simulation road coordinate system corresponding to the microscopic traffic simulation road network, and then determining vehicle speed and the lane in which the vehicle is located based on the vehicle trajectory data; wherein, the vehicle trajectory data includes vehicle identification, vehicle position, and vehicle time; performing microscopic traffic simulation of the simulated vehicle on the microscopic traffic simulation road network based on the vehicle trajectory data, the vehicle speed, and the lane in which the vehicle is located; creating a virtual vehicle corresponding to the simulated vehicle, and performing autonomous driving simulation of the virtual vehicle based on the microscopic traffic simulation road network and the real-time status information of the simulated vehicle during the microscopic traffic simulation process.
[0005] Secondly, embodiments of the present invention also provide a traffic flow simulation device, the device comprising: a generation module, configured to acquire road information from an electronic map and generate a microscopic traffic simulation road network based on the road information; a determination module, configured to acquire original vehicle trajectory data corresponding to the road information, convert the original vehicle trajectory data into vehicle trajectory data in the simulation road coordinate system corresponding to the microscopic traffic simulation road network, and then determine the vehicle speed and the lane where the vehicle is located based on the vehicle trajectory data; wherein, the vehicle trajectory data includes vehicle identification, vehicle position, and vehicle time; a first simulation module, configured to perform microscopic traffic simulation of the simulated vehicle on the microscopic traffic simulation road network based on the vehicle trajectory data, the vehicle speed, and the lane where the vehicle is located; and a second simulation module, configured to create a virtual vehicle corresponding to the simulated vehicle, and perform autonomous driving simulation of the virtual vehicle based on the microscopic traffic simulation road network and the real-time status information of the simulated vehicle during the microscopic traffic simulation process.
[0006] This invention provides a traffic flow simulation method and apparatus. First, a microscopic traffic simulation road network is generated based on road information from an electronic map. Then, the original vehicle trajectory data corresponding to the road information is converted into vehicle trajectory data in the simulated road coordinate system corresponding to the microscopic traffic simulation road network. Based on the vehicle trajectory data, vehicle speed and lane location are determined. Subsequently, microscopic traffic simulation of the simulated vehicles is performed on the microscopic traffic simulation road network based on the vehicle trajectory data, vehicle speed, and lane location. Simultaneously, virtual vehicles are created, and autonomous driving simulation of the virtual vehicles is performed based on the real-time status information of the microscopic traffic simulation road network and the simulated vehicles. Using this technology, joint simulation of microscopic traffic simulation and autonomous driving simulation can be performed based on real trajectory data, thereby accurately recreating traffic flow scenarios formed by a large number of vehicles, thus meeting the testing requirements of autonomous driving algorithms in traffic flow scenarios.
[0007] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0008] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0009] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0010] Figure 1 This is a flowchart illustrating a traffic flow simulation method according to an embodiment of the present invention;
[0011] Figure 2 This is an example diagram of trajectory data in an embodiment of the present invention;
[0012] Figure 3 This is a partial example diagram of the trajectory data processing results in an embodiment of the present invention;
[0013] Figure 4 This is a flowchart illustrating the vehicle lane-changing behavior recognition process in an embodiment of the present invention.
[0014] Figure 5 This is a flowchart illustrating the loading and control of a simulated vehicle in an embodiment of the present invention.
[0015] Figure 6 This is an example diagram of co-simulation in an embodiment of the present invention;
[0016] Figure 7 This is a schematic diagram of the structure of a traffic flow simulation device according to an embodiment of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] Currently, single autonomous driving simulation software can only support the construction of traffic environments with a small number of vehicles, and cannot construct traffic flow scenarios with a large number of vehicles. Microscopic traffic simulation is a technique that uses computer simulation technology to reproduce the motion state of real vehicles in a virtual world. In existing microscopic traffic simulation methods, vehicle speed and lane-changing behavior are generally simulated through car-following models and lane-changing models. Even when using real vehicle trajectory data to calibrate the model parameters, the simulation results still have a large error compared to the actual vehicle operation results, making it difficult to meet the testing requirements of autonomous driving algorithms in traffic flow scenarios.
[0019] Based on this, the present invention provides a traffic flow simulation method and apparatus that can alleviate the above-mentioned problems existing in related technologies.
[0020] To facilitate understanding of this embodiment, a traffic flow simulation method disclosed in this invention will first be described in detail, see [link to relevant documentation]. Figure 1 The diagram shows a flow simulation method for traffic flow, which may include the following steps:
[0021] Step S102: Obtain road information from the electronic map and generate a microscopic traffic simulation road network based on the road information.
[0022] The aforementioned electronic maps can be in formats such as OSM and SHP, and there are no restrictions on this.
[0023] Step S104: Obtain the original vehicle trajectory data corresponding to the road information, and convert the original vehicle trajectory data into vehicle trajectory data in the simulation road coordinate system corresponding to the micro traffic simulation road network. Then, determine the vehicle speed and the lane where the vehicle is located based on the vehicle trajectory data.
[0024] The aforementioned vehicle trajectory data may include vehicle identifiers (such as vehicle ID), vehicle positions (such as vehicle coordinates), and vehicle time (such as the current frame number), without limitation. For example, vehicle trajectory data may include fields such as unique vehicle identifier, current frame number, vehicle horizontal coordinate position, and vehicle vertical coordinate position. The data source for vehicle trajectory data is not limited to vehicle trajectories extracted using machine vision algorithms or vehicle trajectories extracted through radar scanning.
[0025] In step S104 above, the conversion between the vehicle trajectory coordinate system corresponding to the original vehicle trajectory data and the simulation road coordinate system corresponding to the microscopic traffic simulation road network can be achieved by designing a coordinate transformation algorithm.
[0026] The design methods for the above coordinate transformation algorithm can include:
[0027] (1) Select multiple coordinate points in the vehicle trajectory coordinate system and the simulated road coordinate system as known points by sampling known points.
[0028] (2) Based on the corresponding coordinate points in the selected vehicle trajectory coordinate system and the simulated road coordinate system, the following transformation equations between the vehicle trajectory coordinate system and the simulated road coordinate system are constructed using the scaling parameter, horizontal translation parameter, vertical translation parameter, and rotation parameter as the parameters to be solved:
[0029]
[0030] In the formula, (X′,Y′) represents the coordinate position of the point in the vehicle trajectory coordinate system, (X,Y) represents the coordinate position of the point in the simulated road coordinate system, k represents the scaling parameter in the coordinate transformation algorithm, ΔX and ΔY represent the horizontal translation parameter and the vertical translation parameter in the coordinate transformation algorithm, respectively, and θ represents the rotation parameter in the coordinate transformation algorithm.
[0031] (3) Substitute multiple known corresponding coordinate points into the above transformation equation and use the least squares method to solve for the parameters of the coordinate system transformation algorithm (i.e., scaling parameters, horizontal translation parameters, vertical translation parameters and rotation parameters).
[0032] When a vehicle's trajectory is partially missing, it can be completed using a preset trajectory completion algorithm. Specifically, for a missing trajectory of a particular vehicle, the missing trajectory can be completed using the following formula:
[0033]
[0034]
[0035] In the formula, (x t ,y t (x) represents the vehicle coordinates at time t that need to be calculated in the missing trajectory. begin ,y beign (x) represents the vehicle position at the moment preceding the starting point of the missing trajectory. end ,y end ) represents the vehicle position one moment after the endpoint of the missing trajectory, t begin t represents the time value preceding the starting point of the missing trajectory. end This represents the time value one moment after the endpoint of the missing trajectory.
[0036] Step S106: Perform micro-traffic simulation of the simulated vehicles on the micro-traffic simulation road network based on vehicle trajectory data, vehicle speed, and the lane in which the vehicle is located.
[0037] Step S108: Create a virtual vehicle corresponding to the simulated vehicle, and perform autonomous driving simulation of the virtual vehicle based on the micro-traffic simulation road network and the real-time status information of the simulated vehicle during the micro-traffic simulation process.
[0038] The aforementioned autonomous driving simulation can be performed together with the aforementioned micro-traffic simulation to achieve joint simulation of micro-traffic simulation and autonomous driving simulation, and then the traffic flow scenario containing a large number of vehicles can be reconstructed through the results of joint simulation.
[0039] This invention provides a traffic flow simulation method. First, a microscopic traffic simulation road network is generated based on road information from an electronic map. Then, the original vehicle trajectory data corresponding to the road information is converted into vehicle trajectory data in the simulated road coordinate system corresponding to the microscopic traffic simulation road network. Based on the vehicle trajectory data, vehicle speed and lane location are determined. Subsequently, microscopic traffic simulation of the simulated vehicles is performed on the microscopic traffic simulation road network based on the vehicle trajectory data, vehicle speed, and lane location. Simultaneously, virtual vehicles are created, and autonomous driving simulation of the virtual vehicles is performed based on the real-time status information of the microscopic traffic simulation road network and the simulated vehicles. Using this technology, joint simulation of microscopic traffic simulation and autonomous driving simulation can be performed based on real trajectory data, thereby accurately recreating traffic flow scenarios formed by a large number of vehicles, thus meeting the testing requirements of autonomous driving algorithms in traffic flow scenarios.
[0040] As one possible implementation, the centerline of each lane in the above-mentioned microscopic traffic simulation road network can be formed by connecting multiple lane control points; based on this, the step S104 above, which determines the vehicle speed and the lane the vehicle is in based on vehicle trajectory data, may include:
[0041] Step 1: Determine the vehicle speed at each moment based on the vehicle position at each moment and the previous moment in the vehicle trajectory data.
[0042] For example, for a given moment, the vehicle speed at that moment can be calculated using the following formula, based on the vehicle's position at that moment and its position at the previous moment:
[0043]
[0044] In the formula, V t Let x represent the vehicle speed at time t, (x) t ,y t (x) represents the vehicle's position at time t. t-1 ,y t-1 () represents the vehicle position at time t-1, T t T represents the time value at time t; t-1 This represents the time value at time t-1.
[0045] Step 2: Based on the location of each lane control point and the vehicle position at each time in the vehicle trajectory data, determine the lane corresponding to the vehicle position at each time.
[0046] For example, in the above-mentioned microscopic traffic simulation road network, each lane has its own corresponding driving direction, which can usually be represented by the direction from the start of the lane to the end of the lane; based on this, step 2 above (i.e., determining the lane corresponding to the vehicle position at each moment based on the location of each lane control point and the vehicle position at each moment in the vehicle trajectory data) may include:
[0047] Step A: Calculate the first distance between the location of each lane control point and the vehicle position at each time, and determine the lane control point with the smallest first distance to the vehicle position at each time as the corresponding nearest lane control point.
[0048] For example, for a certain vehicle, the vehicle's position (x) at time t is obtained. t ,y t ), where x t y represents the horizontal position of the vehicle at time t. t This represents the vertical position of the vehicle at time t. After realizing the coordinate system of the vehicle position and the road in the microscopic traffic simulation road network through the above coordinate transformation algorithm, the distance between the vehicle position at time t and each control point can be calculated, and the control point with the smallest distance from the vehicle position can be selected as the nearest lane control point for the vehicle position. By analogy, the nearest lane control point corresponding to the vehicle position at each time can be obtained.
[0049] Step B: Based on the driving direction of the lane where the nearest lane control point is located at each time point, determine the second distance between the vehicle position at each time point and the center line of the lane where the nearest lane control point is located.
[0050] Continuing the previous example, after determining the nearest lane control point corresponding to the vehicle's position at time t, the upstream and downstream relationship between the vehicle's position and its corresponding nearest lane control point can be determined based on the driving direction of the lane containing the nearest lane control point. Then, the second distance corresponding to the vehicle's position can be calculated based on this upstream and downstream relationship. The operation for determining this upstream and downstream relationship can be as follows: construct vector a using the start and end points of the lane containing the nearest lane control point, construct vector b using the vehicle's position and its corresponding nearest lane control point, and calculate the cosine of the angle θ between vector a and vector b. Let |a| be the magnitude of vector a and |b| be the magnitude of vector b. If cosθ is negative (meaning θ is greater than 90°), the vehicle is downstream of its nearest lane control point. If cosθ is positive (meaning θ is less than 90°), the vehicle is upstream of its nearest lane control point. If the vehicle is downstream of its nearest lane control point, the distance between the vehicle and the line segment connecting the nearest lane control point and its downstream control point can be calculated using the point-to-line distance formula, serving as the second distance for the vehicle. If the vehicle is upstream of its nearest lane control point, the distance between the vehicle and the line segment connecting the nearest lane control point and its upstream control point can be calculated using the point-to-line distance formula, serving as the second distance for the vehicle.
[0051] Step C: Based on the width of each lane and the second distance corresponding to the vehicle position at each time, determine the lane where the vehicle is located at each time.
[0052] Continuing from the previous example, a distance threshold δ (usually slightly less than half the lane width) can be set based on the width of each lane. After determining the second distance corresponding to the vehicle's position at time t, if the second distance is less than δ, the lane containing the nearest lane control point corresponding to the vehicle's position is determined as the lane where the vehicle is located. If the second distance is not less than δ, the distance between the vehicle's position and the center lines of the other lanes is calculated. If the distance between the center line of any of the other lanes and the vehicle's position is less than δ, that lane is determined as the lane where the vehicle is located. If the distance between the center line of any of the other lanes and the vehicle's position is less than δ, the lane with the smallest distance between the center line of any of the other lanes and the vehicle's position is determined as the lane where the vehicle is located.
[0053] As one possible implementation, the traffic flow simulation method described above may further include: for each time moment, generating a corresponding first vector based on the vehicle position at that time moment and the previous time moment, generating a corresponding second vector based on the nearest lane control point corresponding to the vehicle position at that time moment and the lane control point adjacent to it along the driving direction of the lane where the corresponding vehicle is located; and determining the vehicle lane-changing time based on the angle between the first vector and the second vector corresponding to each time moment.
[0054] Continuing the previous example, an angle threshold can be set. After determining the vehicle's position at time t and the corresponding lane, vector c can be constructed using this vehicle position and its position at time t-1. Vector d can then be constructed using the nearest lane control point and the second nearest lane control point (i.e., the lane control point adjacent to the nearest lane control point along the driving direction of the corresponding lane) corresponding to this vehicle position. Finally, the angle between vector c and vector d can be calculated. |c| is the magnitude of vector c, and |d| is the magnitude of vector d. If θ′ is less than this angle threshold, it can be determined that the vehicle started changing lanes at time t (time t is the time the vehicle changed lanes). If θ′ is not less than this angle threshold, it can be determined that the vehicle did not change lanes at time t. Similarly, this calculation method can be used to determine the lane-changing times of all vehicles in the vehicle trajectory data.
[0055] As one possible implementation, step S106 (i.e., performing micro-traffic simulation of the vehicle based on vehicle trajectory data, vehicle speed, and the lane the vehicle is in) may include:
[0056] Step a: Set the simulation step size of the micro-traffic simulation based on the interval between each time point in the vehicle trajectory data, and set the vehicle type of the micro-traffic simulation based on the pre-stored physical parameters of different vehicle types.
[0057] The microscopic traffic simulation software supports setting simulation step sizes at the millisecond level, as well as simulation step sizes with time intervals of 1 second or longer. Since a simulation step size that is too small will consume excessive computational resources, while a simulation step size that is too large will result in inaccurate simulation results, the simulation step size can be set to a positive integer multiple of the trajectory data time interval according to the following formula:
[0058]
[0059] In the formula, T sim_gap For the set simulation step size, The time interval for trajectory data is n, where n is a positive integer.
[0060] The microscopic traffic simulation software supports simulation of various vehicle types. When defining vehicle types, they can be categorized into private cars, buses, trucks, and other types. For different vehicle types, various physical parameters such as maximum vehicle speed, vehicle length, acceleration, and vehicle width can be designed. These physical parameters can be pre-stored in a designated storage space, allowing the microscopic traffic simulation software to directly retrieve these parameters when setting vehicle types.
[0061] Step b: Based on the simulation step size and vehicle type, load and control the simulated vehicles in the microscopic traffic simulation road network.
[0062] For example, the loading content of the simulated vehicle may include the simulated vehicle identifier, vehicle type, vehicle path, vehicle departure lane, vehicle departure speed, vehicle departure position, vehicle departure time, etc., without limitation; based on this, the loading steps of the simulated vehicle may include:
[0063] Step b1: Assign a corresponding simulation vehicle identifier to each simulation vehicle and establish a matching relationship between simulation vehicle identifiers and vehicle identifiers.
[0064] For example, natural numbers can be used to sequentially number different simulated vehicles, so that the number of each simulated vehicle can be used as the corresponding simulated vehicle ID (i.e., simulated vehicle identifier), and a matching table between the simulated vehicle ID and the vehicle ID in the trajectory data can be established.
[0065] Step b2: Determine the vehicle type of each simulated vehicle based on the physical parameters of each simulated vehicle.
[0066] If the specified storage space contains pre-stored physical parameters for different vehicle types, the vehicle type can be set directly according to the physical parameters of different vehicle types in the specified storage space.
[0067] Step b3: Based on the starting position of the lane where the vehicle is located and the ending position of the micro-traffic simulation road network, the shortest path method is used to determine the vehicle path of each simulated vehicle in the micro-traffic simulation road network.
[0068] For a given simulated vehicle, after determining the lane it occupies, the starting point of that lane can be selected as the starting point of the vehicle's path, and the ending point of the microscopic traffic simulation network can be selected as the ending point. The shortest path from the starting point to the ending point is then calculated using a shortest path algorithm. For example, the getFastestPath interface in the built-in sumolib class of SUMO (Simulation of Urban Mobility) can be directly called to calculate the vehicle path.
[0069] Step b4: Determine the departure lane of each simulated vehicle in the microscopic traffic simulation road network based on the lane where the vehicle is located.
[0070] After determining the lane corresponding to the vehicle position of a simulated vehicle at each time, the lane corresponding to the vehicle position of the simulated vehicle at its initial time can be directly used as the starting lane of the simulated vehicle.
[0071] Step b5: Determine the departure speed of each simulated vehicle in the microscopic traffic simulation network based on the vehicle speed.
[0072] Once the speed of a simulated vehicle at each moment is determined, the speed of the simulated vehicle at its initial moment can be directly used as the starting speed of the simulated vehicle.
[0073] Step b6: Within each simulation step, determine the road where each simulated vehicle is located at its initial position based on the simulated vehicle identifier. Based on the start and end points of each simulated vehicle's departure lane, all control points, and the initial position of each simulated vehicle, determine the departure position of each simulated vehicle in the micro-traffic simulation road network.
[0074] The aforementioned initial vehicle position can be the position of the corresponding simulated vehicle at its initial moment.
[0075] Step b6 above can be performed as follows:
[0076] Step b61: Arrange the starting point, ending point and all control points of the vehicle departure lane of each simulated vehicle into a corresponding point sequence according to the forward order of the driving direction. Generate a corresponding third vector based on the starting point and ending point of the vehicle departure lane of each simulated vehicle, and generate multiple corresponding fourth vectors based on the point sequence and initial vehicle position of each simulated vehicle. The number of fourth vectors corresponding to each simulated vehicle is consistent with the number of points contained in the corresponding point sequence.
[0077] Step b62: For each simulated vehicle, based on the angle between the third vector corresponding to the simulated vehicle and each of the fourth vectors corresponding to the simulated vehicle, determine the first control point that is closest to the initial vehicle position of the simulated vehicle from the point sequence corresponding to the simulated vehicle.
[0078] Step b63: Based on all points in the point sequence corresponding to each simulated vehicle that are located before the corresponding first control point, the third distance of each simulated vehicle is calculated using the following formula:
[0079]
[0080] Where S1 is the third distance, the k-th point in the point sequence is the first control point, and dis(p i-1 ,p i Let p be the (i-1)th point in the point sequence. i-1 With the i-th point p i The distance between them.
[0081] Step b64: Calculate the fourth distance between the initial vehicle position of each simulated vehicle and the corresponding first control point, and the fifth distance between the initial vehicle position of each simulated vehicle and the centerline of the lane where the corresponding first control point is located.
[0082] Step b65: Based on the fourth and fifth distances corresponding to each simulated vehicle, the sixth distance between the starting position of each simulated vehicle and the starting point of the corresponding vehicle's starting lane is calculated using the following formula:
[0083]
[0084] Among them, P depart d1 is the sixth distance, d2 is the fourth distance, and d3 is the fifth distance.
[0085] Step b66: Determine the starting position of each simulated vehicle based on the sixth distance corresponding to each simulated vehicle and the starting point of the corresponding vehicle departure lane.
[0086] Taking a simulated vehicle as an example, the simulated vehicle identifier can be found within each simulation step to determine the time when the simulated vehicle first appears (i.e., the initial time of the simulated vehicle), and then the vehicle position at that initial time (i.e., the initial vehicle position) can be determined. The road corresponding to the initial vehicle position is then identified as the vehicle's departure lane. After determining the initial vehicle position and departure lane, steps b61 to b66 can be performed as follows:
[0087] Step 1: Construct a set P that sequentially contains the start point, control point, and end point of the vehicle departure lane, and construct a vector a using the start point and end point of the vehicle departure lane.
[0088] Where, P = {p1, p2, ..., p n}, and the points contained in P are arranged in ascending order according to the direction of travel.
[0089] Step 2: Construct vector b by sequentially taking elements from set P and the initial position of the vehicle. i , where i represents the i-th element in set P.
[0090] Step 3: Calculate a and b i Angle θ between i cosine value Based on all the calculated cosine values, the control point closest to the initial vehicle position is determined from set P.
[0091] If a and the (k+1)th vector b k+1 The cosine of the angle between them is less than 0, and it is related to the k-th vector b. k If the angle between vectors a and b is greater than 0, then the kth element in the set is the upstream control point closest to the initial vehicle position; if a and the (k+1)th vector b k+1 The cosine of the angle between them is greater than 0, and it is related to the k-th vector b. k If the included angle is less than 0, then the kth element in the set is the downstream control point closest to the initial vehicle position.
[0092] Step 4: Calculate the distance between each pair of adjacent points of the first k-1 elements of set P using the distance formula between two points, and sum the results to obtain distance S1. The formula for calculating S1 is shown below:
[0093]
[0094]
[0095] In the formula, and p i and p i-1x-coordinate and p i and p i-1 The ordinate.
[0096] Step 5: Calculate the distance d1 between the kth element in set P and the initial position of the vehicle using the distance formula between two points, and calculate the distance d2 between the initial position of the vehicle and the line segment connecting the kth and (k+1)th elements in set P using the distance formula from a point to a line.
[0097] Step 6: Calculate the distance between the vehicle's initial position and the k-th element in set P along the vehicle's starting lane direction. And calculate the distance P between the starting point of the vehicle's departure lane and the vehicle's departure position. depart =S1+S2, and thus the distance P from the starting point of the vehicle's departure lane along the direction of travel of the vehicle's departure lane can be defined. depart The location is used as the vehicle's starting position.
[0098] Based on the above-mentioned vehicle loading steps, the vehicle control steps may include: setting the vehicle's simulation control parameters based on the loaded content, and performing simulation control of the vehicle in the microscopic traffic simulation network according to the simulation step size and simulation control parameters.
[0099] For example, after loading the simulated vehicles (i.e., knowing the loaded content of the simulated vehicles), during the simulation run, at each simulation step, the lane information of each simulated vehicle that has appeared in the current trajectory data can be queried. The simulated vehicle ID and the calculated vehicle speed are used as interface input parameters to set the vehicle speed of the simulated vehicles using SUMO's `traci.vehicle.setSpeed` interface. The lane information of the same simulated vehicle in subsequent simulation steps is queried. If the vehicle's lane changes, the simulated vehicle ID and the lane number after the lane change are used as interface input parameters to set the lane-changing behavior of the simulated vehicle using the `traci.vehicle.changelane` interface.
[0100] As one possible implementation, the aforementioned real-time status information may include the real-time position and speed of the simulated vehicle in the microscopic traffic simulation road network. Based on this, step S108 (i.e., creating a virtual vehicle corresponding to the simulated vehicle and performing autonomous driving simulation of the virtual vehicle based on the microscopic traffic simulation road network and the real-time status information of the simulated vehicle during the microscopic traffic simulation) may include: converting the microscopic traffic simulation road network into a simulation road network that supports autonomous driving simulation, and creating a corresponding virtual vehicle for each simulated vehicle based on the geometric and physical parameters of each simulated vehicle; and using a preset autonomous driving algorithm to control the virtual vehicle to drive autonomously in the simulation road network based on the real-time position and speed of each simulated vehicle.
[0101] Autonomous driving simulation software typically requires high-precision maps (such as XODR format road files) for simulation testing. Therefore, the simulated road network used by the micro-traffic simulation software (i.e., the aforementioned micro-traffic simulation road network) needs to be converted into a simulated road network file that can be read by the autonomous driving simulation software. In the autonomous driving simulation software, one or more types of vehicle models are selected as the appearance of the virtual vehicles. Based on the appearance of the virtual vehicles and the geometric and physical parameters (such as maximum vehicle speed, acceleration, etc.) of different vehicle types, virtual vehicle objects of each simulation vehicle are instantiated in the autonomous driving simulation software. The autonomous driving simulation software obtains information such as vehicle position and vehicle speed from the micro-traffic simulation software through information interaction with it, and performs autonomous driving simulation of the virtual vehicle objects according to the vehicle position and vehicle speed information using the autonomous driving algorithm.
[0102] To facilitate understanding, the operation of the traffic flow simulation method described above is illustrated below using a specific application example. In the specific application, the autonomous driving simulation software CARLA and the microscopic traffic simulation software SUMO are used as simulation tools. The traffic flow simulation method described above can be performed as follows:
[0103] Step S1: Constructing the basic simulation environment.
[0104] The roads to be simulated are extracted from the OSM (OpenStreetMap) electronic map. The SUMO netconvert plugin is used to generate a SUMO simulation road network (i.e., a microscopic traffic simulation road network). A coordinate transformation algorithm is designed to convert the coordinate system corresponding to the original vehicle trajectory data to the coordinate system corresponding to the simulated road in the SUMO simulation road network. In the designed coordinate transformation algorithm, known points are required for calibration. When selecting known points, relevant specifications such as the "Highway Engineering Technical Standards" can be used. For example, this standard specifies that the solid line length of a highway is 900 cm, the dashed line length is 600 cm, the lane width is 375 cm, and the lane line width is 15 cm. A highway coordinate system can be established using this information, and specific coordinate points can be selected as known points according to certain rules (such as uniform coverage).
[0105] Step S2: Trajectory data processing.
[0106] The data source for the trajectory data can be vehicle trajectory data extracted through machine vision, and should include information such as start time, end time, vehicle type, vehicle x-coordinate position, vehicle y-coordinate position, and direction. The trajectory data should be as follows: Figure 2 As shown.
[0107] By designing algorithms for trajectory data completion, vehicle speed recognition, vehicle lane identification, and lane-changing behavior recognition, the system calculates vehicle speed, lane location, and lane-changing behavior. After calculation, the results can be stored in data formats such as JSON. The stored data should include vehicle ID, vehicle type, and information such as vehicle speed and lane location at each time point. (Partial data storage is shown below.) Figure 3 As shown. Figure 3 The data shows that the vehicle speed of "car1" at times "243", "248", and "253" is 31.2 km / h, 30.5 km / h, and 29.4 km / h, respectively. Figure 4 It also shows that the lane number of vehicle "car1" at times "243", "248" and "253" is "2".
[0108] See Figure 4 As shown, the specific steps of the vehicle lane-changing behavior recognition algorithm in step S2 above are as follows:
[0109] Step S21: Obtain the vehicle position (x) of a certain vehicle at time t. t ,y t ).
[0110] Step S22: Obtain the distance (x) t ,y t The nearest lane control point is (x) t,y t The nearest lane control point.
[0111] In the SUMO road network file, coordinate information is stored at each lane's line shape change point. After the coordinate system of vehicle position and road coordinates is unified through the coordinate transformation algorithm described in step S1, (x... t ,y t The distance between each control point and the distance (x) is selected. t ,y t The nearest lane control point is (x) t ,y t The nearest lane control point.
[0112] Step S23: Calculate (x) t ,y t The distance between the lane centerline and the lane centerline where the nearest lane control point is located.
[0113] Step S24: Calculate the lane the vehicle is in and determine the lane change time.
[0114] The parameter δ can be set. When selecting the lane where the nearest lane control point is located for calculation, if the distance calculated by S23 is less than δ, the vehicle is considered to be driving normally in that lane, and that lane is selected as the vehicle's lane, and the lane number of the vehicle's lane is output. If the distance calculated by S23 is greater than δ, the vehicle is considered not to be in that lane, and the remaining lanes are traversed to determine if there are any other lanes whose center line is less than δ in distance from the vehicle's position. If there is a lane whose center line is less than δ in distance from the vehicle's position, the lane whose center line is less than δ in distance from the vehicle's position is selected as the vehicle's lane, and the lane number of the vehicle's lane is output. If the distance between the center line of all lanes and the vehicle's position is not less than δ, the lane whose center line is closest to the vehicle's position is selected as the vehicle's lane, and the lane number of the vehicle's lane is output.
[0115] Step S25: Vehicle lane change timing recognition.
[0116] After determining the lane of the vehicle at the current moment, a vector c is constructed using the current vehicle position and the vehicle position at the previous moment. A vector d is constructed using the nearest lane control point and the second nearest lane control point corresponding to the current vehicle position. Then, the angle between vector c and vector d is calculated. Determine whether the vehicle has started changing lanes at the current moment. If the vehicle has started changing lanes at the current moment, then the current moment is determined as the lane-changing moment.
[0117] Step S3: Simulated Vehicle Loading and Control. An algorithm for loading and controlling simulated vehicles is designed for microscopic traffic simulation software, enabling the loading and control of simulated vehicles in SUMO.
[0118] See Figure 5 As shown, the specific steps of the simulated vehicle loading and control algorithm in step S3 above are as follows:
[0119] Step S31: Set the simulation step size.
[0120] For example, set the simulation step size to 0.5 seconds.
[0121] Step S32: Set the vehicle type.
[0122] When setting the initial vehicle type, you can define various vehicle types such as private cars, buses, and trucks, and design physical parameters such as maximum vehicle speed, vehicle length, acceleration, and vehicle width for each vehicle type. The vehicle types set are shown in Table 1 below.
[0123] Table 1. Example of Vehicle Type Definitions
[0124]
[0125] In Table 1, vType_id represents the vehicle model identifier, vClass represents the vehicle category, Length represents the vehicle length, maxSpeed represents the maximum vehicle speed, and accel represents the acceleration.
[0126] Step S33: Vehicle loading.
[0127] A microscopic traffic simulation vehicle loading algorithm can be designed to load simulated vehicles. The specific operation method is as follows: at each simulation step, query all vehicle IDs at the current time. If the vehicle appears for the first time in the simulation step, use the SUMO's traci.vehicle.add() function to load the simulated vehicle and add it to the specified position in the simulated road network. When calling this function, the simulated vehicle ID, vehicle type, vehicle path, vehicle departure time, vehicle departure position, vehicle departure lane, and vehicle departure speed need to be set.
[0128] Vehicle ID setting method: Natural numbers can be used for sequential numbering, and a matching table between simulated vehicle IDs and vehicle IDs in trajectory data can be established.
[0129] Vehicle type setting method: If the data source contains vehicle type classification results, the vehicle type can be set in advance in the SUMO vehicle flow file (*.rou.xml) according to the physical parameters of different vehicle types based on the vehicle type classification results.
[0130] Vehicle path setting method: For vehicle path setting, the starting point of the simulation road where the vehicle is currently located can be selected as the starting point of the vehicle path, and the ending point of the simulation road network can be selected as the ending point of the vehicle path. The shortest path algorithm is used to calculate the vehicle path by directly calling the getFastestPath interface in the built-in sumolib class of SUMO.
[0131] The vehicle's departure lane can be calculated using the lane identification algorithm in step S2, and the vehicle's departure speed can be calculated using the vehicle speed identification algorithm in step S2.
[0132] The vehicle's departure position is actually the position where the vehicle is first detected. The algorithm logic for the vehicle departure position detection algorithm is as follows:
[0133] 1) Vehicle departure lane recognition.
[0134] The road ID of the lane in which the vehicle first appears (i.e., the initial vehicle position) can be found. The specific operation method is as follows: traverse the lane control point position data of all lanes, use the nearest neighbor matching algorithm to calculate the distance between the initial vehicle position and each lane control point, select the lane containing the lane control point closest to the initial vehicle position (i.e., the nearest lane control point) as the vehicle's departure lane, and output the road ID of the vehicle's departure lane.
[0135] 2) Calculation of vehicle departure position.
[0136] The distance between the vehicle's starting position and the starting point of its lane can be calculated by relating the initial vehicle position to the starting point of the vehicle's departure lane, all lane control points, and the ending point. The specific steps can be performed according to the procedures outlined in Steps 1 through 6 above, and will not be repeated here.
[0137] Step S34: Vehicle control.
[0138] During simulation, for each vehicle that has appeared within a simulation step, the system queries the lane information of that vehicle in the current trajectory data and sets the vehicle speed using SUMO's `traci.vehicle.setSpeed` interface. It then queries the lane information of that vehicle for several subsequent simulation steps. If a vehicle changes lanes (i.e., the vehicle begins changing lanes), the system uses the `traci.vehicle.changelane` interface to set the lane-changing behavior.
[0139] During vehicle loading and control in step S3, the simulated vehicle data can be compared with the trajectory data to verify the simulation effect. For example, 10 minutes of trajectory data can be restored to SUMO for micro-traffic simulation, and the number of vehicles, the vehicle type corresponding to each vehicle, the number of lane changes corresponding to each vehicle, and the departure time corresponding to each vehicle can be compared with the simulated vehicle data. If the number of vehicles, the vehicle type corresponding to each vehicle, and the number of lane changes corresponding to each vehicle are completely consistent, and the deviation of the departure time corresponding to each vehicle is less than 0.5 seconds (i.e., one simulation step), it indicates that the simulation effect is good.
[0140] Step S4: Joint simulation with autonomous driving simulation software.
[0141] The specific steps of the co-simulation in step S4 above are as follows:
[0142] Step S41: Simulated road network format conversion.
[0143] The SUMO simulated road network can be converted to xodr format using the SUMO netconvert plugin.
[0144] Step S42: Vehicle mapping relationship setting.
[0145] Virtual vehicles can be created in CARLA through instantiation, establishing a vehicle mapping relationship between the virtual vehicle and vehicles in the SUMO simulated road network. A CARLA bridge is used to convert information between the two simulation software programs, and the vehicle mapping relationship is used to synchronize the real-time status information of the virtual vehicle and the vehicles in the SUMO simulated road network. This allows CARLA's autonomous driving algorithm to create autonomous vehicles (i.e., to perform autonomous driving simulation of virtual vehicles). For example, any vehicle in the SUMO simulated road network can be arbitrarily selected and replaced with an autonomous vehicle loaded with the autonomous driving algorithm, thus enabling the testing of autonomous vehicles in traffic flow scenarios. Figure 6 The effects of co-simulation are shown, in which, Figure 6 The left side of the image shows the autonomous driving simulation effect of CARLA. Figure 6 The right side of the image shows the microscopic traffic simulation effect of SUMO.
[0146] By employing the aforementioned traffic flow simulation method, and provided that the trajectory data is accurate, a joint simulation of microscopic traffic simulation and autonomous driving simulation can be performed based on the trajectory data to accurately recreate traffic flow scenarios formed by a large number of vehicles, thereby meeting the testing requirements of autonomous driving algorithms in traffic flow scenarios.
[0147] Based on the above traffic flow simulation method, this invention also provides a traffic flow simulation device, see [link to relevant documentation]. Figure 7 As shown, the device may include the following modules:
[0148] The generation module 702 is used to acquire road information from the electronic map and generate a microscopic traffic simulation road network based on the road information.
[0149] The determination module 704 is used to acquire the original vehicle trajectory data corresponding to the road information, and convert the original vehicle trajectory data into vehicle trajectory data in the simulation road coordinate system corresponding to the microscopic traffic simulation road network. Then, the vehicle speed and the lane where the vehicle is located are determined based on the vehicle trajectory data. The vehicle trajectory data includes vehicle identification, vehicle position and vehicle time.
[0150] The first simulation module 706 is used to perform micro-traffic simulation of the simulated vehicle on the micro-traffic simulation road network based on the vehicle trajectory data, the vehicle speed, and the lane in which the vehicle is located.
[0151] The second simulation module 708 is used to create a virtual vehicle corresponding to the simulated vehicle, and to perform autonomous driving simulation of the virtual vehicle based on the micro-traffic simulation road network and the real-time status information of the simulated vehicle during the micro-traffic simulation process.
[0152] The traffic flow simulation device provided in this embodiment of the invention can perform joint simulation of micro-traffic simulation and autonomous driving simulation based on real trajectory data, thereby accurately reproducing the traffic flow scene formed by a large number of vehicles, thus meeting the testing requirements of autonomous driving algorithms in traffic flow scenarios.
[0153] In the above-mentioned microscopic traffic simulation road network, the centerline of each lane can be formed by connecting multiple lane control points; based on this, the above-mentioned determining module 704 can also be used to: determine the vehicle speed corresponding to each moment based on the vehicle position at each moment and the vehicle position at the previous moment in the vehicle trajectory data; and determine the lane where the vehicle is located at each moment based on the location of each lane control point and the vehicle position at each moment in the vehicle trajectory data.
[0154] In the aforementioned microscopic traffic simulation road network, each lane has its own corresponding driving direction. Based on this, the aforementioned determining module 704 can also be used to: calculate the first distance between the location of each lane control point and the vehicle position at each time, and determine the lane control point with the smallest first distance to the vehicle position at each time as the corresponding nearest lane control point; determine the second distance between the vehicle position at each time and the centerline of the lane where the nearest lane control point is located, based on the driving direction of the lane where the vehicle position is located at each time; and determine the lane where the vehicle is located, based on the width of each lane and the second distance corresponding to the vehicle position at each time.
[0155] The aforementioned determining module 704 can also be used to: for each time moment, generate a corresponding first vector based on the vehicle position at that time moment and the previous time moment, generate a corresponding second vector based on the nearest lane control point corresponding to the vehicle position at that time moment and the lane control point adjacent to it along the driving direction of the lane where the corresponding vehicle is located; and determine the vehicle lane-changing time based on the angle between the first vector and the second vector corresponding to each time moment.
[0156] The first simulation module 706 described above can also be used to: set the simulation step size of the micro-traffic simulation based on the interval between each time point in the vehicle trajectory data, and set the vehicle type of the micro-traffic simulation based on the physical parameters of different vehicle types stored in advance; and load and control the simulated vehicles of the micro-traffic simulation road network based on the simulation step size and the vehicle type.
[0157] The loaded content of the simulated vehicles may include simulated vehicle identifier, vehicle type, vehicle path, vehicle departure lane, vehicle departure speed, and vehicle departure position. Based on this, the first simulation module 706 can also be used to: assign a corresponding simulated vehicle identifier to each simulated vehicle and establish a matching relationship between the simulated vehicle identifier and the vehicle identifier; determine the vehicle type of each simulated vehicle based on the physical parameters of each simulated vehicle; determine the vehicle path of each simulated vehicle in the micro-traffic simulation network using the shortest path method based on the starting position of the lane where the vehicle is located and the ending position of the micro-traffic simulation network; determine the vehicle departure lane of each simulated vehicle in the micro-traffic simulation network based on the lane where the vehicle is located; determine the vehicle departure speed of each simulated vehicle in the micro-traffic simulation network based on the vehicle speed; determine the road where each simulated vehicle is located at its initial position according to the simulated vehicle identifier within each simulation step, and determine the vehicle departure position of each simulated vehicle in the micro-traffic simulation network based on the starting point, ending point, and all control points of the vehicle departure lane of each simulated vehicle and the initial vehicle position of each simulated vehicle; wherein, the initial vehicle position is the vehicle position of the corresponding simulated vehicle at its initial moment.
[0158] The aforementioned first simulation module 706 can also be used to: assemble the start point, end point, and all control points of each simulated vehicle's departure lane into a corresponding point sequence according to the forward order of the driving direction; generate a corresponding third vector based on the start point and end point of each simulated vehicle's departure lane; and generate multiple corresponding fourth vectors based on each simulated vehicle's point sequence and initial vehicle position; wherein the number of fourth vectors corresponding to each simulated vehicle is consistent with the number of points contained in the corresponding point sequence; for each simulated vehicle, based on the angle between the third vector corresponding to the simulated vehicle and each of the fourth vectors corresponding to the simulated vehicle, determine the first control point closest to the initial vehicle position from the point sequence corresponding to the simulated vehicle; and calculate the third distance of each simulated vehicle using the following formula based on all points in the point sequence corresponding to each simulated vehicle that are located before the corresponding first control point: Where S1 is the third distance, the k-th point in the point sequence is the first control point, and dis(p i-1 ,p i Let p be the (i-1)th point in the point sequence. i-1 With the i-th point p i The distance between them is calculated; the fourth distance between the initial vehicle position of each simulated vehicle and the corresponding first control point, and the fifth distance between the initial vehicle position of each simulated vehicle and the centerline of the lane where the corresponding first control point is located are calculated respectively; based on the fourth and fifth distances corresponding to each simulated vehicle, the sixth distance between the starting position of each simulated vehicle and the starting point of the corresponding starting lane is calculated using the following formula: Among them, P depart d1 is the sixth distance, d2 is the fourth distance, and d3 is the fifth distance. The starting position of each simulated vehicle is determined based on the sixth distance corresponding to each simulated vehicle and the starting point of the corresponding vehicle's starting lane.
[0159] The first simulation module 706 described above can also be used to: set the simulation control parameters of the simulation vehicle based on the loaded content of the simulation vehicle, and perform simulation control of the simulation vehicle in the microscopic traffic simulation network according to the simulation step size and the simulation control parameters.
[0160] The aforementioned real-time status information may include the real-time position and speed of the simulated vehicle in the microscopic traffic simulation network. Based on this, the second simulation module 708 may also be used to: convert the microscopic traffic simulation network into a simulation network that supports autonomous driving simulation, and create a corresponding virtual vehicle for each simulated vehicle based on the geometric and physical parameters of each simulated vehicle; and control the virtual vehicle to drive autonomously in the simulation network using a preset autonomous driving algorithm based on the real-time position and speed of each simulated vehicle.
[0161] The traffic flow simulation device provided in the embodiments of the invention has the same implementation principle and technical effect as the aforementioned traffic flow simulation method embodiments. For the sake of brevity, any parts not mentioned in the device embodiments can be referred to the corresponding content in the aforementioned method embodiments.
[0162] Unless otherwise specifically stated, the relative steps, numerical expressions, and values of the components and steps described in these embodiments do not limit the scope of the invention.
[0163] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0164] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0165] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A traffic flow simulation method characterized by, The method includes: Obtain road information from an electronic map and generate a microscopic traffic simulation road network based on the road information; wherein, the centerline of each lane in the microscopic traffic simulation road network is formed by connecting multiple lane control points, and each lane in the microscopic traffic simulation road network has its own corresponding driving direction; Obtain the original vehicle trajectory data corresponding to the road information, and convert the original vehicle trajectory data into vehicle trajectory data in the simulated road coordinate system corresponding to the microscopic traffic simulation road network; wherein, the vehicle trajectory data in the simulated road coordinate system includes vehicle identification, vehicle position and vehicle time; Based on the vehicle trajectory data in the simulated road coordinate system at each time point and the vehicle position at the previous time point, the vehicle speed at each time point is determined. Calculate the first distance between the location of each lane control point and the vehicle position at each time, and determine the lane control point with the smallest first distance to the vehicle position at each time as the corresponding nearest lane control point. Based on the driving direction of the lane where the nearest lane control point is located at each time, determine the second distance between the vehicle position at each time and the center line of the lane where the nearest lane control point is located. Based on the width of each lane and the second distance corresponding to the vehicle position at each time, the lane of the vehicle corresponding to the vehicle position at each time is determined. For each time moment, a first vector is generated based on the vehicle position at that time moment and the previous time moment, and a second vector is generated based on the nearest lane control point corresponding to the vehicle position at that time moment and the lane control point adjacent to it along the driving direction of the lane where the corresponding vehicle is located. The lane-changing time of the vehicle is determined based on the angle between the first vector and the second vector at each time point. Based on the vehicle trajectory data in the simulated road coordinate system, as well as the vehicle speed and the lane in which the vehicle is located, a micro-traffic simulation of the simulated vehicle is performed on the micro-traffic simulation road network. A virtual vehicle corresponding to the simulated vehicle is created, and autonomous driving simulation of the virtual vehicle is performed based on the microscopic traffic simulation road network and the real-time status information of the simulated vehicle during the microscopic traffic simulation process.
2. The method according to claim 1, characterized in that, Based on the vehicle trajectory data in the simulated road coordinate system, as well as the vehicle speed and the lane the vehicle is in, a micro-traffic simulation of the simulated vehicle is performed on the micro-traffic simulation road network, including: The simulation step size of the micro-traffic simulation is set based on the interval between each time point in the vehicle trajectory data under the simulated road coordinate system, and the vehicle type of the micro-traffic simulation is set based on the pre-stored physical parameters of different vehicle types. Based on the simulation step size and the vehicle type, the loading and control of simulated vehicles are performed on the microscopic traffic simulation road network.
3. The method according to claim 2, characterized in that, The loaded content of the simulated vehicle includes the simulated vehicle identifier, vehicle type, vehicle path, vehicle departure lane, vehicle departure speed, and vehicle departure position; the loading of the simulated vehicle includes: Assign a corresponding simulated vehicle identifier to each simulated vehicle, and establish a matching relationship between the simulated vehicle identifier and the vehicle identifier; The vehicle type of each simulated vehicle is determined based on its physical parameters. Based on the starting position of the lane where the vehicle is located and the ending position of the micro-traffic simulation road network, the shortest path method is used to determine the vehicle path of each simulated vehicle in the micro-traffic simulation road network. The starting lane of each simulated vehicle in the microscopic traffic simulation road network is determined based on the lane where the vehicle is located. The starting speed of each simulated vehicle in the microscopic traffic simulation network is determined based on the vehicle speed. Within each simulation step, the road where each simulated vehicle is located is determined according to the simulated vehicle identifier at its initial time. Based on the start point, end point, and all control points of each simulated vehicle's departure lane and the initial vehicle position of each simulated vehicle, the departure position of each simulated vehicle in the microscopic traffic simulation road network is determined; wherein, the initial vehicle position is the vehicle position of the corresponding simulated vehicle at its initial time.
4. The method according to claim 3, characterized in that, Based on the start and end points of the departure lanes of each simulated vehicle, all control points, and the initial vehicle positions of each simulated vehicle, the departure positions of each simulated vehicle in the microscopic traffic simulation network are determined, including: In the forward order of driving direction, the starting point, ending point and all control points of the vehicle departure lane of each simulated vehicle are arranged into a corresponding point sequence. A corresponding third vector is generated based on the starting point and ending point of the vehicle departure lane of each simulated vehicle, and multiple corresponding fourth vectors are generated based on the point sequence and initial vehicle position of each simulated vehicle. The number of fourth vectors corresponding to each simulated vehicle is consistent with the number of points contained in the corresponding point sequence. For each simulated vehicle, based on the angle between the third vector corresponding to the simulated vehicle and each of the fourth vectors corresponding to the simulated vehicle, the first control point that is closest to the initial vehicle position of the simulated vehicle is determined from the point sequence corresponding to the simulated vehicle. Based on all points in the point sequence corresponding to each simulated vehicle that are located before the corresponding first control point, the third distance of each simulated vehicle is calculated using the following formula: in, The third distance, the first in the point sequence These points are the first control points. For the point sequence, the first -1 point With the Points The distance between them; Calculate the fourth distance between the initial vehicle position of each simulated vehicle and the corresponding first control point, and the fifth distance between the initial vehicle position of each simulated vehicle and the center line of the lane where the corresponding first control point is located. Based on the fourth and fifth distances corresponding to each simulated vehicle, the sixth distance between the starting position of each simulated vehicle and the starting point of the corresponding starting lane is calculated using the following formula: in, The sixth distance, The fourth distance, This is the fifth distance; The starting position of each simulated vehicle is determined based on the sixth distance corresponding to each vehicle and the starting point of the corresponding vehicle departure lane.
5. The method according to claim 2, characterized in that, The control of the simulated vehicle includes: Based on the loaded content of the simulated vehicle, the simulation control parameters of the simulated vehicle are set, and the simulation control of the simulated vehicle in the microscopic traffic simulation road network is performed according to the simulation step size and the simulation control parameters.
6. The method according to claim 1, characterized in that, The real-time status information includes the real-time position and speed of the simulated vehicle in the microscopic traffic simulation network; creating a virtual vehicle corresponding to the simulated vehicle, and performing autonomous driving simulation of the virtual vehicle based on the microscopic traffic simulation network and the real-time status information of the simulated vehicle during the microscopic traffic simulation, including: The microscopic traffic simulation road network is converted into a simulation road network that supports autonomous driving simulation, and a corresponding virtual vehicle is created for each simulation vehicle based on the geometric and physical parameters of each simulation vehicle. Based on the real-time location and speed of each simulated vehicle, a preset autonomous driving algorithm is used to control the virtual vehicle to drive autonomously in the simulated road network.
7. A traffic flow simulation device, characterized in that, The device includes: The generation module is used to acquire road information from an electronic map and generate a microscopic traffic simulation road network based on the road information; wherein, the centerline of each lane in the microscopic traffic simulation road network is formed by connecting multiple lane control points, and each lane in the microscopic traffic simulation road network has its own corresponding driving direction. The determination module is configured to: acquire the original vehicle trajectory data corresponding to the road information, and convert the original vehicle trajectory data into vehicle trajectory data in the simulated road coordinate system corresponding to the microscopic traffic simulation road network; wherein, the vehicle trajectory data in the simulated road coordinate system includes vehicle identification, vehicle position, and vehicle time; determine the vehicle speed corresponding to each time based on the vehicle position at each time and the previous time in the vehicle trajectory data in the simulated road coordinate system; calculate the first distance between the location of each lane control point and the vehicle position at each time, and determine the lane control point with the smallest first distance to the vehicle position at each time as the corresponding nearest lane control point. Based on the driving direction of the lane where the nearest lane control point is located at each time point, a second distance is determined between the vehicle position at each time point and the centerline of the lane where the nearest lane control point is located. Based on the width of each lane and the second distance corresponding to the vehicle position at each time point, the lane where the vehicle is located at each time point is determined. For each time point, a corresponding first vector is generated based on the vehicle position at that time point and the previous time point, and a corresponding second vector is generated based on the nearest lane control point corresponding to the vehicle position at that time point and the lane control point adjacent to it along the driving direction of the lane where the vehicle is located. Based on the angle between the first vector and the second vector corresponding to each time point, the lane-changing time of the vehicle is determined. The first simulation module is used to perform micro-traffic simulation of the simulated vehicles on the micro-traffic simulation road network based on the vehicle trajectory data in the simulated road coordinate system, the vehicle speed, and the lane in which the vehicle is located. The second simulation module is used to create a virtual vehicle corresponding to the simulated vehicle, and to perform autonomous driving simulation of the virtual vehicle based on the microscopic traffic simulation road network and the real-time status information of the simulated vehicle during the microscopic traffic simulation process.
Citation Information
Patent Citations
Calibration method and device for microscopic traffic simulation system in urban expressway interweaving area
CN113094875A
Simulation scene generation method and device, storage medium and computer equipment
CN114581623A