CN111856968B - Large-scale traffic simulation system and method based on parallel computing - Google Patents
Large-scale traffic simulation system and method based on parallel computing Download PDFInfo
- Publication number
- CN111856968B CN111856968B CN202010762553.6A CN202010762553A CN111856968B CN 111856968 B CN111856968 B CN 111856968B CN 202010762553 A CN202010762553 A CN 202010762553A CN 111856968 B CN111856968 B CN 111856968B
- Authority
- CN
- China
- Prior art keywords
- vehicle
- lane
- road
- point
- lane change
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B17/00—Systems involving the use of models or simulators of said systems
- G05B17/02—Systems involving the use of models or simulators of said systems electric
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Automation & Control Theory (AREA)
- Traffic Control Systems (AREA)
Abstract
The invention provides a large-scale traffic simulation system and method based on parallel computation, comprising the steps of appearing and disappearing of vehicles on a road; a road lane dividing method; a method for driving, following, selecting and changing a road on a road according to a lane; a large-scale vehicle parallel simulation method. The invention mainly aims at the defects that the existing vehicle simulation system has low performance and cannot adapt to the traffic simulation condition of the large-scale urban road network, combines the large-scale parallel calculation and the physical calculation, simulates the traffic behavior of the vehicle in the urban road network, and approximates the large-scale traffic trend of the urban road network by using a large number of traffic individual microscopic simulation behaviors.
Description
Technical Field
The invention belongs to the technical field of traffic control, and particularly relates to a large-scale traffic simulation system and method based on parallel computing.
Background
With the continuous development of society, people's life is more and more rich, and starts to move to cities continuously, and with the development of economy, self-driving travel has become the preferred mode of travel of more people, and this makes the city expand and flourish continuously, and simultaneously has also given the great challenge to the traffic of city, makes the traffic network become more and more complicated and huge, and although the continuous development and updating iteration of traffic industry and computer industry's technique appear the car networking, intelligent transportation system (ITS, intelligent Transport System), etc. some advanced concepts or advanced solutions and techniques are from computer angle or traffic industry traffic, make the city in order to deal with current traffic problem, the mode of traffic planning made is more and more advanced, more perfect. Although the technology is more perfect in traffic planning, along with the continuous migration of population to cities, the pressure of traffic is continuously increased, the existing technologies can not completely and truly reflect the congestion condition of vehicles on roads along with the continuous increase of vehicles, a large amount of traffic schemes of manpower and material resource cost are often input, and the control of the whole traffic or the incomplete control of partial traffic can only achieve the purpose of solving traffic problems, so that the current traffic schemes with short intervals can not play the role of traffic evacuation, or the new traffic jam problem can be caused in other places. The three-dimensional traffic simulation system is designed according to the actual urban road condition, so that traffic planning of the whole road is assisted by professionals in the traffic industry, and the traffic planning is avoided continuously and repeatedly.
Meanwhile, in the field of traffic simulation, the current single-thread traffic simulation is generally carried out on a CPU, and the information of the vehicle simulation is stored through a series of road objects, vehicle objects and a series of complex storage semantic structures, so that the operation efficiency of the system is greatly reduced, and the storage burden and redundancy are increased. Meanwhile, at the present stage, some more mature traffic simulation software such as VISSIM, sumo and the like are used by utilizing a road model existing in the existing software, then a road environment is built, the motion state of a vehicle on a road is approximately simulated through the built road environment and some manually set parameters, and the simulation type is generally one or more intersections, roads and the like. Although the technology adopted by the existing system such as SUMO and the like can reflect some traffic problems, the software can only simulate a plurality of intersections or roads due to performance, so that the condition of the whole road cannot be reflected, more accurate traffic planning scheme judgment cannot be assisted by traffic industry personnel, and meanwhile, the lane restriction technology adopted by the software restricts lanes by splicing the roads, so that the lane restriction is inflexible. Also, for example, traffic simulation of the entire Shanghai city is performed by using a large-scale cluster, but this is the cluster simulation adopted, which requires a lot of cost and time for calculation and rendering, thus resulting in inefficiency in traffic planning in the auxiliary traffic industry. In another example, GPU parallel computing is used for simulation, and although the efficiency of the traffic simulation system is improved to some extent, performance improvement is limited due to the bottlenecks of I/O input and output.
Disclosure of Invention
Aiming at the defects in the prior art, the large-scale traffic simulation system and method based on parallel calculation solve the problems that the performance of a vehicle simulation system is low, so that the vehicle simulation system cannot truly respond to the whole traffic condition and the lane limitation is inflexible in simulation.
In order to achieve the above purpose, the invention adopts the following technical scheme:
the scheme provides a large-scale traffic simulation system based on parallel computing, which comprises a vehicle flow statistics and computation module, a vehicle position and direction control module, a lane-dividing module, a vehicle lane-changing module, a vehicle route selection control module, a vehicle intersection driving module, a data storage module and a parallel computation module;
the vehicle flow statistics and calculation module is used for acquiring the vehicle flow data on all the current roads;
the vehicle position and direction control module is used for controlling the traveling direction of the vehicle;
the lane dividing module is used for acquiring a driving route point of the vehicle on a lane;
the vehicle lane changing module is used for calculating and obtaining a point required by lane changing, a lane changing ending point and a vehicle lane changing direction;
The vehicle route selection control module is used for determining the road on which the vehicle runs next time after the vehicle runs on the current road;
the vehicle intersection driving module is used for calculating the driving direction and the driving position of the vehicle at the intersection;
the data storage module is used for storing all driving data of each vehicle by utilizing the structural body;
the parallel computing module is used for splitting the large-scale traffic simulation system according to the modules, and parallelizing the split modules according to the respective functions.
The beneficial effects of the invention are as follows: the invention carries out friendly division on the modules, thoroughly delivers all functions, realizes the division of the 'plug pin' type modules, and supports a 'small system' computing module of multi-task parallelism, which is different from the parallel of general multi-thread tasks and has context switching, but directly distributes the tasks to each core of a CPU, and when the core is idle, the task is immediately executed; the invention utilizes a multitasking parallel mode, improves the efficiency of a general physical inquiry mode, adds the general physical inquiry mode into vehicle simulation, and changes the current situation that most of current traffic simulation software lacks physical characteristics or has the physical characteristics to cause the system efficiency to be slow; the invention adopts a vector migration method to change the defect that the road modeling is required to be changed due to the fact that general traffic simulation software limits the road for vehicles, thereby changing the road limiting way, and the data is continuously stored by utilizing a good data organization way facing the number, so that the CPU multi-level cache hit rate is improved, the reading and updating efficiency of the data is improved, and the performance of the system is improved.
Further, the vehicle position and direction control module comprises a vehicle starting position control unit, a vehicle movement position unit, a vehicle starting direction unit and a vehicle movement direction unit;
the vehicle starting position control unit is used for initializing the running road and the position of the vehicle;
the vehicle movement position unit is used for controlling the running of the vehicle on roads and intersections;
the vehicle starting direction unit is used for initializing the direction of the vehicle on a road or an intersection;
the vehicle movement direction unit is used for determining the movement direction of the vehicle on the road.
The beneficial effects of the above-mentioned further scheme are: the direction and the speed are separated, the control mode of the motion is simplified, the position and the direction are calculated more conveniently, and the method is suitable for large-scale parallel calculation.
Still further, the lane splitting module includes a vehicle lane selection unit and a vehicle offset distance calculation unit;
the vehicle lane selection unit is used for determining a lane in which the vehicle runs;
the vehicle offset distance calculation unit is used for obtaining an offset road point according to the distance of the vehicle offset original road point.
The beneficial effects of the above-mentioned further scheme are: the vehicle can control the lane of the vehicle by itself, so that the lane change is avoided, and the road model is required to be changed.
Still further, the vehicle lane change control module comprises a vehicle lane change point calculation unit, a vehicle lane change direction calculation unit and a vehicle lane change mode selection unit;
the vehicle lane change point calculating unit is used for calculating a lane offset distance according to the nearest lane and the lane change times and the lane change direction of the vehicle, and calculating a point required by lane change according to the lane offset distance, and specifically comprises the following steps:
a1, calculating a left vector and a right vector according to the latest lane and the lane change number by utilizing the rear position and the front position of a road section where a current vehicle is positioned, obtaining an initial section right vector according to the left vector and the right vector, adding and subtracting the product of the right vector and the width of the current lane and the current vehicle position, and obtaining the corresponding position of one lane beside the lane change direction of the vehicle to obtain a lane offset distance;
a2, calculating a corresponding position of a lane beside the lane changing direction of the vehicle according to the right vector of the initial section and the lane offset distance obtained in the step A1, and obtaining a point required by a first lane changing;
a3, acquiring the position of a later point of a road section where the vehicle is positioned backward, forming a vector with the last point of the road section where the vehicle is positioned, calculating to obtain a right vector of the final section, and adding and subtracting the product of the right vector and the width of the current lane and the position of the last point of the current final section to acquire the corresponding position of a lane beside the lane change direction to obtain the lane offset distance;
A4, calculating the corresponding position of a lane beside the lane change direction of the last point of the section where the current vehicle is positioned by using the right vector of the final section and the lane offset distance obtained in the step A3 to obtain a point required by a second lane change;
a5, acquiring the corresponding position of a lane beside the lane change direction of a point of which the rear point of the current road section of the vehicle moves backward by two units, and obtaining a point required by a third lane change;
the lane changing mode selecting unit is used for calculating and obtaining a lane changing ending point according to the point required by the lane changing lane;
the vehicle lane change direction calculation unit is used for calculating the lane change direction of the vehicle according to the lane change ending point.
The beneficial effects of the above-mentioned further scheme are: the lane change calculation method is simplified according to the lane change control module of the vehicle, and the calculation speed is improved.
Based on the system, the invention also provides a large-scale traffic simulation method based on parallel computation, which comprises the following steps:
s1, marking each road by using a road ID, and constructing a road network topological structure by using an intersection ID to mark each intersection;
s2, generating discrete road point data for all roads by using a curve algorithm according to the road network topological structure, and storing each road point data by using a road ID;
S3, acquiring the traffic flow data on all the current roads, distributing an initial vehicle of each road by utilizing the traffic flow data, forming an initial traveling direction of the vehicle by intercepting first data and second data in road point data of the distributed vehicles, and taking the position of the first data as the initial position of the vehicle;
s4, acquiring a road point ID section of a road where the current vehicle is located according to the initial position of the vehicle, enabling the vehicle to travel according to the initial traveling direction, judging whether the vehicle travels to the tail end of the road point ID section of the current road, if so, entering a step S5, otherwise, continuing to travel according to the initial traveling direction until the vehicle travels to the tail end of the road point ID section of the current road, and entering the step S5;
s5, acquiring a next road point ID section, and taking a vector formed by the tail end and the start of the next road point ID section as the travelling direction of the next road point ID section of the vehicle;
s6, judging whether the vehicle runs in a preset range at the end of a road in the direction of the current vehicle according to road point data in the next road point ID interval, if so, calculating the next road ID of the vehicle and entering a step S7, otherwise, acquiring the next road which can be reached by the lane where the current vehicle is located according to a network topological structure and entering the step S7;
S7, calculating to obtain the nearest lane and the variable number of passes of the vehicle reaching the next road currently according to the ID of the next road;
s8, calculating a lane offset distance according to the nearest lane, the lane changing times and the lane changing direction of the vehicle, and calculating a point required by lane changing according to the lane offset distance;
s9, calculating a lane change ending point according to the point required by the lane change;
s10, calculating according to the lane change ending point to obtain a lane change direction of the vehicle;
s11, enabling the vehicle to travel according to the lane changing direction of the vehicle until the vehicle reaches a lane changing ending point, judging whether the lane changing number is 0, if so, entering a step S12, otherwise, returning to the step S7;
s12, clearing vehicle road data, calculating to obtain intersection road point data required by the current vehicle by using the next road ID and a lane where the current vehicle is located, clearing the vehicle road data, loading the intersection road point data required by the current vehicle, judging whether the current vehicle runs in the starting direction, if so, entering a step S13, otherwise, returning to the step S3;
s13, processing data of all vehicles, storing the processed data by utilizing a structural body, and packaging the steps S3 to S12 into a parallel computing module;
S14, utilizing rays emitted by a vehicle head to detect a front vehicle, judging whether the front vehicle exists, if so, making corresponding speed adjustment according to the speed of the front vehicle, and entering a step S15, otherwise, entering the step S15;
s15, performing task small-system processing on the parallel computing module obtained in the step S13 and the step S14, performing batch processing on the data obtained in the step S13 and the parallel computing module, and submitting the data subjected to the task small-system processing.
The beneficial effects of the invention are as follows: the invention carries out friendly division on the modules, thoroughly delivers all functions, realizes the division of the 'plug pin' type modules, and supports a 'small system' computing module of multi-task parallelism, which is different from the parallel of general multi-thread tasks, has context switching, directly distributes tasks on each core of a CPU, and immediately executes the tasks when the cores are idle; the invention utilizes a multitasking parallel mode, improves the efficiency of a general physical inquiry mode, adds the general physical inquiry mode into vehicle simulation, and changes the current situation that most of current traffic simulation software lacks physical characteristics or has the physical characteristics to cause the system efficiency to be slow; the invention adopts a vector migration method to change the defect that the road modeling is required to be changed due to the fact that general traffic simulation software limits the vehicle through the road, thereby changing the road limiting way, and the data is continuously stored by using a good data organization way facing the number, so that the CPU multi-level cache hit rate is improved, the reading and updating efficiency of the data is improved, the performance of the system is improved, the data is continuously stored by using a continuous memory organization way facing the data, the CPU multi-level cache hit rate is greatly improved, the reading and updating efficiency of the data is improved, and the performance of the system is improved.
Further, the step S1 includes the steps of:
s101, taking a two-dimensional vector (ID, 0) or (ID, 1) as a unique indicator of an intersection, wherein 0 represents the starting position of a road and 1 represents the end of the road;
s102, taking the ID of the intersection as a unique identifier, and storing two-dimensional vectors connected with the intersection in a one-to-one correspondence manner;
s103, storing intersection ID and intersection waypoint data and road ID and road waypoint data in a one-to-many storage mode in a one-to-one correspondence manner;
and S104, storing the road IDs and the characteristics of each road one by one, storing four-dimensional vectors corresponding to five-dimensional vectors, and storing the number of intersection lanes corresponding to the five-dimensional vectors, so as to construct a road network topological structure, wherein the five-dimensional vectors are (the current road ID, the number of lanes, 0, the next road ID and the number of roads connected), and the four-dimensional vectors are (the next road ID, the number of lanes, 0 and the current road ID). .
The beneficial effects of the above-mentioned further scheme are: the method reasonably constructs a clearer and more convenient semantic road network, and is compatible with a good data organization mode and high-performance parallel computing for data.
Still further, the step S4 includes the steps of:
S401, calculating the next position of the vehicle according to the starting position of the vehicle by using the speed and the advancing direction of the vehicle, and acquiring intersection waypoint data of the vehicle according to the traffic flow data;
s402, taking (0, 1) as a road point ID section of a vehicle starting position and taking a vector formed by the position of '1' and the vehicle position as the movement direction of the vehicle according to the next position and the intersection road point data of the vehicle orientation, wherein 0 represents the starting position of a road and 1 represents the end of the road;
s403, forming a vector included angle between the last point of the road point ID section where the vehicle is located and the vehicle position in the advancing direction of the vehicle;
and S404, judging whether the vector included angle is a positive value, if so, the vehicle does not exceed the point where '1' is located, and entering a step S5, otherwise, the included angle is a negative value, updating the road point ID interval to be (1, 2), and enabling the vehicle to continue to travel in the initial direction until the vehicle reaches the end of the road point ID interval of the current road, and entering the step S5.
The beneficial effects of the above-mentioned further scheme are: the method and the device separate the relation between the vehicle direction calculation and the speed, so that the vehicle position and direction calculation is better suitable for large-scale parallel calculation.
Still further, the step S8 includes the steps of:
s801, calculating a left vector and a right vector according to the latest lane and the variable pass number and by utilizing the rear position and the front position of a road section where a current vehicle is positioned, obtaining an initial section right vector according to the left vector and the right vector, and adding and subtracting the product of the right vector and the width of the current lane and the current vehicle position to obtain the corresponding position of one lane beside the lane in the variable direction of the vehicle to obtain a lane offset distance;
s802, calculating a corresponding position of a lane beside a lane changing direction of a vehicle according to the initial section right vector and the lane offset distance obtained in the step S801, and obtaining a point required by a first lane changing;
s803, the position of a later point of the road section where the vehicle is located is obtained, the later point is moved backwards by one point, the later point and the last point of the road section where the vehicle is located are combined into a vector, a final section right vector is calculated, and the product of the right vector and the width of the current lane and the position of the last point of the current final section are utilized to carry out addition and subtraction to obtain the corresponding position of one lane beside the lane change direction, so that the lane offset distance is obtained;
S804, calculating the corresponding position of a lane beside the lane change direction of the last point of the section where the current vehicle is positioned by using the right vector of the final section and the lane offset distance obtained in the step 803 to obtain a point required by a second lane change;
s805, acquiring the corresponding position of a lane beside the lane change direction of a point of which the rear point of the current road section of the vehicle moves backward by two units, and obtaining the point required by the third lane change.
The beneficial effects of the above-mentioned further scheme are: the lane change calculation is simpler by using the offset method, and the method is more suitable for large-scale parallel calculation.
Still further, the step S9 includes the steps of:
s901, judging whether the distance between the current vehicle and the end of the current road section is larger than a preset threshold value, if so, entering a step S902, otherwise, entering a step S903;
s902, calculating a first lane change ending point according to the point required by the first lane change, the current vehicle direction and a preset threshold value;
the expression of the first lane change ending point is as follows:
D 1 =F*K*M
wherein D is 1 Representing a first lane change ending point, wherein F represents a point required by the first lane change, K represents the current vehicle direction, and M represents a preset threshold value;
S903, judging whether the distance between the next road section of the current vehicle is larger than a preset threshold value, if so, entering a step S904, otherwise, entering a step S905;
s904, calculating a second lane change ending point according to the point required by the second lane change, the next road section where the vehicle is located and a preset threshold value;
the expression of the second lane change ending point is as follows:
D 2 = G*H*M
wherein D is 2 Representing a second lane change ending point, G representing a point required for the second lane change, H representing a direction of a next road section in which the vehicle is located;
and S905, taking the point required by the third lane change as a third lane change ending point, and completing calculation of the lane change ending point.
The beneficial effects of the above-mentioned further scheme are: more convenient lane change ending point selection is determined.
Still further, the step S10 includes the steps of:
s1001, respectively taking vectors formed by a first lane change ending point, a second lane change ending point, a third lane change ending point and the current position of the vehicle as the travelling direction of the vehicle;
s1002, respectively taking a vector formed by a first lane change ending point, a second lane change ending point and a third lane change ending point and a point closest to the lane change ending point as a reference direction;
S1003, obtaining a lane change direction of the vehicle from the traveling direction of the vehicle and the reference direction.
The beneficial effects of the above-mentioned further scheme are: the way of judging the lane change direction is simplified.
Drawings
Fig. 1 is a schematic diagram of a system structure according to the present invention.
Fig. 2 is a schematic diagram of a vehicle position and direction control module according to the present embodiment.
Fig. 3 is a schematic view of a lane splitting module structure in the present embodiment.
Fig. 4 is a schematic structural diagram of a lane-change control module in the present embodiment.
Fig. 5 is a flow chart of the method of the present invention.
Fig. 6 is a schematic diagram of a road network in the present embodiment.
Fig. 7 is a schematic diagram of lane change of the vehicle in the present embodiment.
Fig. 8 is a schematic diagram of vehicle travel position and direction control in the present embodiment.
Fig. 9 is a lane offset diagram in the present embodiment.
Fig. 10 is a schematic view of a traffic simulation in the present embodiment.
Fig. 11 is a schematic view of lane splitting in the present embodiment.
Fig. 12 is a schematic diagram of the vehicle intersection driving in the present embodiment.
Fig. 13 is a schematic view of the vehicle routing behavior in the present embodiment,
Detailed Description
The following description of the embodiments of the present invention is provided to facilitate understanding of the present invention by those skilled in the art, but it should be understood that the present invention is not limited to the scope of the embodiments, and all the inventions which make use of the inventive concept are protected by the spirit and scope of the present invention as defined and defined in the appended claims to those skilled in the art.
Example 1
As shown in fig. 1, the large-scale traffic simulation system based on parallel computing comprises a vehicle flow statistics and computation module, a vehicle position and direction control module, a lane-dividing module, a vehicle lane-changing module, a vehicle route-selecting control module, a vehicle intersection driving module, a data storage module and a parallel computation module;
the vehicle flow statistics and calculation module is used for acquiring the current road residual flow;
in this embodiment, when the road-side vehicle travels to the current road, the total flow rate on the road for the period of time that has been calculated is reduced by the corresponding flow rate.
The vehicle position and direction control module is used for controlling the traveling direction of the vehicle;
in this embodiment, the result of subtracting the front and rear road points of the current position of the vehicle is taken as the advancing direction of the vehicle, and then the advancing direction of the vehicle and the speed of the vehicle are used to simulate the time spent for each frame to calculate the position of the next frame of the vehicle.
The lane dividing module is used for acquiring a driving route point of the vehicle on a lane;
in this embodiment, whether the road is bidirectional is first determined according to the road characteristics, if yes, whether the current road has an isolation belt is then checked, and if yes, the product of the road point position, the lane width and the absolute value of the lane of the vehicle is used to obtain the road point on which the current vehicle is traveling and then the width of half of the isolation belt is added. If the road point is not present, the road point where the vehicle runs can be obtained only by adding no width of the isolation belt in front. If the road is unidirectional, it is observed whether the number of road lanes is singular, the singular specifying the intermediate lane as the 0 th lane. If the number is double, the 0 th lane does not exist, and the driving route point of the vehicle on the road is obtained by directly multiplying the vehicle absolute value by the right vector of the vehicle advancing direction and the road width.
The vehicle lane changing module is used for calculating and obtaining a point required by lane changing, a lane changing ending point and a vehicle lane changing direction;
in this embodiment, using the method of calculating the branch road point offset, the following amounts are calculated:
(1) The vehicle's own position is at the side lane offset point position point P.
(2) The starting and ending positions of the road point section where the vehicle is currently located are at the position points A and B of the side lane.
(3) The starting and ending road points of the next road point section of the road point section where the vehicle is currently located are the position points C and D of the side lane.
(4) The start and end waypoints of the next waypoint section to the waypoint section where the vehicle is currently located, at the location of the side lane, points E and F.
And then judging the following situations according to the distance between the current vehicle position and the current waypoint section end position:
(1) The distance from the offset point P of the vehicle to the offset point B of the end position of the current interval is greater than the preset threshold distance H. Then the current vehicle forward direction is selected and the point I at a distance H from the vehicle offset point P is taken as the lane change ending point.
(2) The offset point P of the vehicle is at a distance from the offset point B of the end position of the current section that is less than a threshold distance H defined by us. Then a point I having a distance H from the offset point C of the start position in the next waypoint section in the vehicle forward direction is selected as the lane change reference point.
(3) The offset point P of the vehicle is at a distance from the offset point B of the end position of the current section that is less than a threshold distance H defined by us. And the whole distance between the next road point intervals is also smaller than H, then the point F is selected as the lane change ending point.
Finally, the vehicle runs towards the lane change ending point until the vehicle reaches the lane change ending point, the vehicle runs normally according to the road direction, so that lane change is completed once, and then the process is iterated by the process until the vehicle runs to the lane needing to be reached.
The vehicle route selection control module is used for determining the road on which the vehicle runs next time according to the fact that the vehicle runs on the current road;
in this embodiment, when the current road running is finished, the vehicle determines the road on which the vehicle runs next time. Firstly, removing the road which cannot be reached by the current road according to the traffic rule, then using a probability comparison method, generating a random probability by the vehicle, comparing the random probability with the probabilities of straight going, left turning, right turning and the like of the road, and selecting the corresponding road as the road for the next driving of the vehicle in the interval.
The vehicle intersection driving module is used for calculating the driving direction and the driving position of the vehicle at the intersection; the data storage module is used for storing all driving data of each vehicle by utilizing the structural body; the parallel computing module is used for splitting the large-scale traffic simulation system according to the modules, and parallelizing the split modules according to the respective functions.
As shown in fig. 2, the vehicle position and direction control module includes a vehicle start position control unit, a vehicle movement position unit, a vehicle start direction unit, and a vehicle movement direction unit; the vehicle starting position control unit is used for initializing the running road and the position of the vehicle; the vehicle movement position unit is used for controlling the running of the vehicle on roads and intersections; the vehicle starting direction unit is used for initializing the direction of the vehicle on a road or an intersection; the vehicle movement direction unit is used for determining the movement direction of the vehicle on the road.
As shown in fig. 3, the lane splitting module includes a vehicle lane selection unit and a vehicle offset distance calculation unit; the vehicle lane selection unit is used for determining a lane in which the vehicle runs; the vehicle offset distance calculation unit is used for obtaining an offset road point according to the distance of the vehicle offset original road point.
As shown in fig. 4, the vehicle lane change control module includes a vehicle lane change point calculating unit, a vehicle lane change direction calculating unit, and a vehicle lane change mode selecting unit; the vehicle lane change point calculating unit is used for calculating a lane offset distance according to the nearest lane and the lane change times and the lane change direction of the vehicle, and calculating a point required by lane change according to the lane offset distance, and specifically comprises the following steps:
A1, calculating a left vector and a right vector according to the latest lane and the lane change number by utilizing the rear position and the front position of a road section where a current vehicle is positioned, obtaining an initial section right vector according to the left vector and the right vector, adding and subtracting the product of the right vector and the width of the current lane and the current vehicle position, and obtaining the corresponding position of one lane beside the lane change direction of the vehicle to obtain a lane offset distance;
a2, calculating a corresponding position of a lane beside the lane changing direction of the vehicle according to the right vector of the initial section and the lane offset distance obtained in the step A1, and obtaining a point required by a first lane changing;
a3, acquiring the position of a later point of a road section where the vehicle is positioned backward, forming a vector with the last point of the road section where the vehicle is positioned, calculating to obtain a right vector of the final section, and adding and subtracting the product of the right vector and the width of the current lane and the position of the last point of the current final section to acquire the corresponding position of a lane beside the lane change direction to obtain the lane offset distance;
a4, calculating the corresponding position of a lane beside the lane change direction of the last point of the section where the current vehicle is positioned by using the right vector of the final section and the lane offset distance obtained in the step A3 to obtain a point required by a second lane change;
A5, acquiring the corresponding position of a lane beside the lane change direction of a point of which the rear point of the current road section of the vehicle moves backward by two units, and obtaining a point required by a third lane change;
the vehicle lane change direction calculation unit is used for calculating the lane change direction of the vehicle according to the lane change ending point; the lane changing mode selecting unit is used for calculating and obtaining a lane changing ending point according to the point required by the lane changing lane.
In this embodiment, a data-oriented (rather than object-oriented) design structure is adopted in the system, so that data and logic are separated and are concentrated in one place, and the continuous memory organization mode of the data is adopted to store vehicle data, so that the multi-level cache hit rate of the CPU is improved, and the system efficiency is improved. . The traditional parallel method generally allocates a large number of threads to compete for the limited cores of the CPU, and when the multithreading Cheng Fenshi competes for the cores of the CPU, the consumption of the context switching of the cores of the CPU exists; the system distributes one-to-one corresponding working threads for each core of the CPU, and avoids context switching of multitasking competition execution, thereby greatly improving the parallel efficiency.
In this embodiment, the entire system of the present application covers the entire flow from the emergence of the vehicle, to the travel of the vehicle, lane changing of the vehicle, routing, on-road flow control, and so on, until the vehicle has traveled to the end of the current simulation area and has been extinguished. The data center module is based on a data-oriented design thought, the logic and the data cores are thoroughly separated, the construction of the data center is directly related to the storage of the data, the unified updating and management of the data and the reading efficiency are one of the keys for improving the system performance, the high-performance parallel small systemization of the system is a main mode of high-performance parallel computing, and the method comprises the following steps: the system comprises a lane changing system, a road selecting system, a vehicle traveling control system, a vehicle direction control system, a vehicle lane dividing system and the like, wherein the lane changing system, the road selecting system, the vehicle traveling control system, the vehicle lane dividing system and the like are split, each system is changed into very tiny operating systems, parallel calculation is respectively carried out, and then the operating systems are sequentially and batched submitted to each parallel task, so that high-performance and rapid parallel calculation is realized, and the performance of the system is improved.
Example 2
As shown in fig. 5, a large-scale traffic simulation method based on parallel computing includes the following steps:
s1, marking each road by using a road ID, and constructing a road network topological structure by using each intersection by using an intersection ID, wherein the realization method is as follows:
s101, taking a two-dimensional vector (ID, 0) or (ID, 1) as a unique indicator of an intersection, wherein 0 represents the starting position of a road and 1 represents the end of the road;
s102, taking the ID of the intersection as a unique identifier, and storing two-dimensional vectors connected with the intersection in a one-to-one correspondence manner;
s103, storing intersection ID and intersection waypoint data and road ID and road waypoint data in a one-to-many storage mode in a one-to-one correspondence manner;
and S104, storing the road IDs and the characteristics of each road one by one, storing four-dimensional vectors corresponding to five-dimensional vectors, and storing the number of intersection lanes corresponding to the five-dimensional vectors, so as to construct a road network topological structure, wherein the five-dimensional vectors are (the current road ID, the number of lanes, 0, the next road ID and the number of roads connected), and the four-dimensional vectors are (the next road ID, the number of lanes, 0 and the current road ID).
In this embodiment, a road network topology is built by using unique identifiers of each road and each intersection to the roads and intersection number numbers ID, two-dimensional vectors (ID, 0) or (ID, 1) are used as unique identifiers for road connection intersections, wherein 0 represents the position which is the starting position of the road data, 1 represents the data tail of the road, then the two-dimensional vectors and the intersection IDs are stored in one-to-one correspondence, the storage structures are exchanged with each other, one-to-many storage structures are used for storage, then an array of the corresponding roads is stored in one-to-many correspondence by using the unique identification ID of each road, then some characteristics of each road such as lane number, road type and the like information are stored in one-to-one correspondence by using the corresponding characteristics of the road IDs, and four-dimensional vectors (next road ID, several lanes, 0, next road ID, connected several roads) are stored in one-to-one correspondence by using the five-dimensional vectors, and the lane number is stored in one-to-one correspondence and the container is stored in one-to-all correspondence.
In this embodiment, as shown in fig. 6, the road and the vehicle are too closely connected, which may cause the vehicle or the road to change greatly, and thus the calculation and storage costs are wasted. The method and the system utilize unique identification of the road to mark the road, thereby only utilizing data to automatically construct a road network, separating the connection of the road and vehicles to a certain extent, leading the vehicle to know which road needs to be reached through which intersection next to the end of the road, specifically, utilizing intersection IDs to identify each intersection, utilizing the road IDs to identify each road, and utilizing the 0 and 1 to identify whether the road is connected with the beginning or the end of a road point array of the intersection, thereby identifying the road, namely (RoadID, 0) identifying the end of the road at which the road point array begins, recording the intersection IDs connected at two ends of the road, then recording which road IDs are connected at the intersection, and identifying whether the road IDs are along the direction of the array or the direction of the opposite array.
S2, generating discrete road point data for all roads by using a curve algorithm according to the road network topology structure, and storing each road point data by using a road ID.
In this embodiment, the CatMullRom curve is utilized to further subdivide all road data, and all road points are stored in a multi hashmap data structure, where the data structure is a one-to-many hash table with one Key corresponding to multiple values; each Key represents a road ID, and a road ID corresponds to values of multiple waypoint data.
S3, acquiring the traffic flow data on all the current roads, distributing an initial vehicle of each road by utilizing the traffic flow data, forming an initial traveling direction of the vehicle by intercepting first data and second data in road point data of the distributed vehicles, and taking the position of the first data as the initial position of the vehicle;
in this embodiment, the flow values of all the roads are obtained for a period of time, and the corresponding directions are distinguished, that is, the directions from which one of the roads to which one of the roads the flow is known. And obtaining the road point data of the corresponding direction of the road by utilizing the flow data, then forming a vehicle initial traveling direction by intercepting the first data and the second data of the corresponding data and forming a vector, and then taking the first data position as the vehicle initial position.
S4, acquiring a road point ID section of a road where the current vehicle is located according to the starting position of the vehicle, enabling the vehicle to travel according to the starting traveling direction, judging whether the vehicle travels to the end of the road point ID section of the current road, if so, entering a step S5, otherwise, continuing to travel according to the starting traveling direction until the vehicle travels to the end of the road point ID section of the current road, and entering the step S5, wherein the implementation method is as follows:
S401, calculating the next position of the vehicle according to the starting position of the vehicle by using the speed and the advancing direction of the vehicle, and acquiring intersection waypoint data of the vehicle according to the traffic flow data;
s402, taking (0, 1) as a road point ID section of a vehicle starting position and taking a vector formed by the position of '1' and the vehicle position as the movement direction of the vehicle according to the next position and the intersection road point data of the vehicle orientation, wherein 0 represents the starting position of a road and 1 represents the end of the road;
s403, forming a vector included angle between the last point of the road point ID section where the vehicle is located and the vehicle position in the advancing direction of the vehicle;
s404, judging whether the vector included angle is a positive value, if so, the vehicle does not exceed the point where '1' is located, and entering a step S5, otherwise, the included angle is a negative value, updating the road point ID interval to be (1, 2), and enabling the vehicle to continue to travel in the initial direction until the vehicle reaches the end of the road point ID interval of the current road, and entering the step S5;
in this embodiment, it is determined that the vehicle is traveling within a range of 80 to 30 meters before the end of the road in which the current vehicle is traveling, if a random probability value is generated, the random probability value is compared with a corresponding steering road probability value range, and in that road range, that is, the road is used as the next road of the current vehicle point. If the road is smaller than 30, taking the next road which can be reached by the lane where the current vehicle is located as the next road of the current vehicle according to the topology.
S6, judging whether the vehicle runs within the range of 80-30 meters before the end of the road in the direction of the current vehicle according to the road point data in the next road point ID interval, if so, calculating the road ID of the next running vehicle, and entering a step S7, otherwise, acquiring the next road which can be reached by the lane of the current vehicle according to the network topology structure, and entering the step S7;
s7, calculating to obtain the nearest lane and the variable number of passes of the vehicle reaching the next road currently according to the ID of the next road;
in this embodiment, according to the obtained ID of the next road, several lanes of the current vehicle reaching the road are obtained from the lane division of the road junction and recorded, then the recorded several lanes are subtracted from the current lane one by one to obtain the lane closest to the current vehicle, and then the value is recorded as the variable number of passes.
S8, calculating a lane offset distance according to the nearest lane, the lane changing times and the lane changing direction of the vehicle, and calculating a point required by lane changing according to the lane offset distance, wherein the implementation method is as follows:
s801, calculating a left vector and a right vector according to the latest lane and the variable pass number and by utilizing the rear position and the front position of a road section where a current vehicle is positioned, obtaining an initial section right vector according to the left vector and the right vector, and adding and subtracting the product of the right vector and the width of the current lane and the current vehicle position to obtain the corresponding position of one lane beside the lane in the variable direction of the vehicle to obtain a lane offset distance;
S802, calculating a corresponding position of a lane beside a lane changing direction of a vehicle according to the initial section right vector and the lane offset distance obtained in the step S801, and obtaining a point required by a first lane changing;
s803, the position of a later point of the road section where the vehicle is located is obtained, the later point is moved backwards by one point, the later point and the last point of the road section where the vehicle is located are combined into a vector, a final section right vector is calculated, and the product of the right vector and the width of the current lane and the position of the last point of the current final section are utilized to carry out addition and subtraction to obtain the corresponding position of one lane beside the lane change direction, so that the lane offset distance is obtained;
s804, calculating the corresponding position of a lane beside the lane change direction of the last point of the section where the current vehicle is positioned by using the right vector of the final section and the lane offset distance obtained in the step 803 to obtain a point required by a second lane change;
s805, acquiring the corresponding position of a lane beside the lane change direction of a point of which the rear point of the current road section of the vehicle moves backward by two units, and obtaining the point required by the third lane change. In this embodiment, as shown in fig. 7, the required point for lane change is calculated: from mathematical space geometry it is known that if one direction is (x, y, z) and the vector modulo is 1, (z, 0, -x) (-z, 0, x) is the left and right vector of the vector, where (z, 0, -x) is the right vector. The system also uses the right vector of the vector as a reference. Subtracting the previous position from the next position of the section where the current vehicle is located to obtain a right vector of the vector by using the previous position as the vector, and adding and subtracting the product of the right vector and the width of the current lane and the current vehicle position to obtain the corresponding position of one lane beside the lane in the lane changing direction; acquiring the corresponding position of a lane beside the lane changing direction of the starting point of the section where the current vehicle is located; the method comprises the steps of obtaining the position of a point of a unit, which is moved backwards again by the later point of a current section of a vehicle, using the point and the last point of the current section to form a vector, obtaining a right vector of the vector, and using the product of the right vector and the width of a current lane and the position of the last point of the current last section to carry out addition and subtraction to obtain the corresponding position of a lane beside a lane changing direction; and acquiring the corresponding position of a lane beside the lane change direction of the point of the next point of the section where the vehicle is currently located, which is shifted back by one unit again.
S9, calculating a lane change ending point according to the point required by the lane change lane, wherein the implementation method is as follows:
s901, judging whether the distance between the current vehicle and the end of the current road section is larger than a preset threshold value, if so, entering a step S902, otherwise, entering a step S903;
s902, calculating a first lane change ending point according to the point required by the first lane change, the current vehicle direction and a preset threshold value;
the expression of the first lane change ending point is as follows:
D 1 =F*K*M
wherein D is 1 Representing a first lane change ending point, wherein F represents a point required by the first lane change, K represents the current vehicle direction, and M represents a preset threshold value;
s903, judging whether the distance between the next road section of the current vehicle is larger than a preset threshold value, if so, entering a step S904, otherwise, entering a step S905;
s904, calculating a second lane change ending point according to the point required by the second lane change, the next road section where the vehicle is located and a preset threshold value;
the expression of the second lane change ending point is as follows:
D 2 = G*H*M
wherein D is 2 Representing a second lane change ending point, G representing a point required for the second lane change, H representing a direction of a next road section in which the vehicle is located;
s905, taking a point required by a third lane change as a third lane change ending point, and completing calculation of the lane change ending point;
S10, calculating the lane change direction of the vehicle according to the lane change ending point, wherein the implementation method comprises the following steps:
s1001, respectively taking vectors formed by a first lane change ending point, a second lane change ending point, a third lane change ending point and the current position of the vehicle as the travelling direction of the vehicle;
s1002, respectively taking a vector formed by a first lane change ending point, a second lane change ending point and a third lane change ending point and a point closest to the lane change ending point as a reference direction;
s1003, obtaining a lane change direction of the vehicle from the traveling direction of the vehicle and the reference direction.
In this embodiment, as shown in fig. 8, the lane change direction of the vehicle is a vector formed by subtracting the lane change end target point and the current position, and is used as the traveling direction of the vehicle, a normalized vector formed by subtracting the lane change end target point and the starting point of the section where the lane change end target point is located is used as a reference, then the position of the vehicle and the vector formed by subtracting the lane change target point and the position of the vehicle are used as a reference, and by cross multiplication, the Y value of the cross multiplication result is used to determine whether the vehicle is on the left or the right of the reference vector, if the Y value is greater than 0, the vehicle is on the right of the reference vector, if the Y value is less than 0, the vehicle is on the left of the reference, and whether the vehicle needs to be on the right of the reference or the coordinates is required to be on the right of the reference is determined according to the actual lane change condition. Such as: if the lane change direction is right, the Y value of the cross product is larger than 0, the lane change is completed, the number of the lane change is reduced by 1 after the lane change is completed, and the mode is circulated until the number of the lane change is 0.
And S11, enabling the vehicle to travel according to the lane changing direction of the vehicle until the vehicle reaches a lane changing ending point, judging whether the lane changing number is 0, if so, entering a step S12, otherwise, returning to the step S7.
In this embodiment, the number of lanes of the current vehicle traveling road is initially utilized to randomly allocate vehicles on that road, and then, the road characteristic conditions, such as whether an emergency exists, whether a median exists in the road, and the like, are utilized to obtain the distance of the current vehicle deviating from the center of the road by utilizing the road width and the median emergency road width. After the system runs once, the next road ID obtained after the channel selection calculation, the current road ID and the lane with the channel change completed are used for inquiring what lane the current vehicle is on, and then the offset center point distance is calculated through the offset calculation in the initialization process.
In this embodiment, as shown in fig. 9, the lane splitting is very important for traffic simulation to be in conformity with real traffic, and as a basic function of traffic simulation, the lane splitting is often performed by using a model of a road itself or parameter setting of the road, and particularly, when the road is limited to a lane of a vehicle, the road model itself is often used to limit, so that when the lane limit is changed, re-modeling is required, and thus, the cost of manpower and material resources is wasted. The design method of the application utilizes the left and right vectors of the original road points to offset left and right from the original road points to realize the lane. The vehicle initially utilizes the road where the current vehicle is located to randomly allocate one lane of the vehicle as an initial lane according to the lane condition of the road, and then, according to the special condition of the road, the vehicle comprises the following steps: whether an emergency exists, whether a barrier tape exists, whether a single emergency lane exists or not, and the like, and calculating by utilizing the characteristics of road width, the lane where the current vehicle is located, the barrier tape and the like, for example: the number of the bidirectional lanes is the same and the road with the isolation belt is exemplified, the current vehicle takes the lane where the isolation belt is as the 0 th lane, then the number of the lanes of the road is larger and smaller towards the left and smaller towards the right when seen along the advancing direction of the vehicle, and the increment value is 1 each time, so the distance of the current vehicle deviated from the center of the road is obtained by the product of the value of the lane where the current vehicle is and the width of the lane. When the vehicle runs on a road, the absolute value of the numerical value of the lane where the vehicle is located is calculated by the method described in the above example, and the linear distance of the current lane point of the vehicle is required to be offset according to the original road point. For bidirectional running and lane running, due to the fact that the road and the direction are calculated separately, the vehicle only needs to multiply the right vector of the vector formed by the current vehicle running interval and the offset distance at the road starting position, then the right offset distance is added at the original road point, and the vehicle can run bidirectionally and according to the corresponding lane only by deflecting the corresponding distance rightwards each time for the vehicle to run rightwards because the vehicle approaches to the right.
S12, clearing vehicle road data, calculating to obtain intersection road point data required by the current vehicle by using the next road ID and a lane where the current vehicle is located, clearing the vehicle road data, loading the intersection road point data required by the current vehicle, judging whether the current vehicle runs in the starting direction, if so, entering a step S13, otherwise, returning to the step S3;
s13, processing data of all vehicles, storing the processed data by utilizing a structural body, and packaging the steps S3 to S12 into a parallel computing module;
s14, utilizing rays emitted by a vehicle head to detect a front vehicle, judging whether the front vehicle exists, if so, making corresponding speed adjustment according to the speed of the front vehicle, and entering a step S15, otherwise, entering the step S15;
s15, performing task small-system processing on all the steps, performing batch processing on the data obtained in the step S13 and the parallel computing module, submitting the data subjected to the task small-system processing, and completing parallel computing on the large-scale traffic simulation system.
In this embodiment, a vehicle following model is necessary for simulation of a road, so that a simplest following model is adopted to adapt to large-scale vehicle simulation, a corresponding following distance is utilized to carry out following, a ray is sent out from the head of a current vehicle in a system to detect the existence of the vehicle in front by using the ray, corresponding changes are made according to the speed of the vehicle in front, and as the following model adopts some physical characteristics, a physical engine generally consumes a large amount of performance, a common microscopic simulation system can cancel the design of the physical characteristics, but the phenomenon of overlapping of the vehicle can be caused, traffic congestion on the road cannot be truly reflected, and the traditional physical detection method is optimized by using a data storage technology of a continuous memory facing data and high-performance parallel calculation, so that the performance and efficiency of the system are greatly improved.
In this embodiment, the traffic simulation uses vehicles as the study objects to simulate the behaviors of lane splitting, vehicle crossing running, road selecting, lane selecting and lane changing, vehicle queuing and following models and the like on the road, and the complexity of the behaviors results in larger calculation and inquiry information, so that the performance consumption of a general method is large, the number of vehicles generated by the vehicle simulation is limited and cannot meet the urban area simulation, so that the system performance is greatly improved by using a good data organization technology facing data, and the traffic simulation local schematic diagram is shown in fig. 10.
In this embodiment, the vehicles have different driving directions on the same road, and the vehicles also move along different lanes in the same direction, so the vehicles need to be separated on the road, so the vehicles can drive on different lanes, meanwhile, due to the emergency road on the road and the traffic control or other reasons, the vehicles can not drive on the lanes, the common traffic simulation adopts a mode of splicing the roads, so the two roads are spliced, so the vehicles can not drive, but when the rules or the control changes, the roads need to be modeled, the system adopts a road point offset mode to realize the control of the vehicles on the lanes, so the waste of the cost of manpower and material resources is reduced, as shown in the lane separation schematic diagram of fig. 9.
In this embodiment, when the vehicle runs on the intersection, because the intersection of the road has an important function of connecting different roads, and the vehicle runs on the intersection along different directions and then runs on different roads and different lanes, there is also a different lane where the lanes connect different roads for the intersection, that is, the logical lanes on the intersection are connected by the different lanes of the different roads, for example: one or more lanes of one road are connected with different lanes or one lane of another road, and the like, and only the lanes are invisible and only exist logically, so that vehicles only need to travel along the logically-formed lanes at the intersection, and the vehicle intersection is schematically shown in fig. 11.
In this embodiment, the lane selection and the lane selection of the vehicle on the road are performed simultaneously, the vehicle selects the road on which the current vehicle will travel when the vehicle travels to the current road to end, and then the vehicle travels along the direction of the road at the intersection, so that the vehicle moves from the current road to the next road, and the lane selection of the vehicle is as shown in fig. 12.
In this embodiment, when the vehicle is near the end of the current road, since the vehicle selects which road is the next road, and the lanes of the intersection are connected with different lanes of the same road, and some lanes of the current road are not connected with the lanes capable of reaching the selected next road, the designated lane nearest to the lane where the current vehicle is located is required to be selected, so as to generate the lane selection behavior, the designated lane of the current road is selected, and meanwhile, the lane connection of the intersection is also required to generate the lane changing behavior, so that the vehicle reaches the designated lane, and the lane selection and the lane changing are as shown in fig. 13.
Claims (8)
1. The large-scale traffic simulation system based on parallel computing is characterized by comprising a vehicle flow statistics and computation module, a vehicle position and direction control module, a lane-dividing module, a vehicle lane-changing module, a vehicle route-selecting control module, a vehicle intersection driving module, a data storage module and a parallel computation module;
the vehicle flow statistics and calculation module is used for acquiring the vehicle flow data on all the current roads;
The vehicle position and direction control module is used for controlling the traveling direction of the vehicle;
the lane dividing module is used for acquiring a driving route point of the vehicle on a lane;
the vehicle lane changing module is used for calculating and obtaining a point required by lane changing, a lane changing ending point and a vehicle lane changing direction;
the vehicle lane change control module comprises a vehicle lane change point calculation unit, a vehicle lane change direction calculation unit and a vehicle lane change mode selection unit;
the vehicle lane change point calculating unit is used for calculating a lane offset distance according to the nearest lane and the lane change times and the lane change direction of the vehicle, and calculating a point required by lane change according to the lane offset distance, and specifically comprises the following steps:
a1, calculating a left vector and a right vector according to the latest lane and the lane change number by utilizing the rear position and the front position of a road section where a current vehicle is positioned, obtaining an initial section right vector according to the left vector and the right vector, adding and subtracting the product of the right vector and the width of the current lane and the current vehicle position, and obtaining the corresponding position of one lane beside the lane change direction of the vehicle to obtain a lane offset distance;
a2, calculating a corresponding position of a lane beside the lane changing direction of the vehicle according to the right vector of the initial section and the lane offset distance obtained in the step A1, and obtaining a point required by a first lane changing;
A3, acquiring the position of a later point of a road section where the vehicle is positioned backward, forming a vector with the last point of the road section where the vehicle is positioned, calculating to obtain a right vector of the final section, and adding and subtracting the product of the right vector and the width of the current lane and the position of the last point of the current final section to acquire the corresponding position of a lane beside the lane change direction to obtain the lane offset distance;
a4, calculating the corresponding position of a lane beside the lane change direction of the last point of the section where the current vehicle is positioned by using the right vector of the final section and the lane offset distance obtained in the step A3 to obtain a point required by a second lane change;
a5, acquiring the corresponding position of a lane beside the lane change direction of a point of which the rear point of the current road section of the vehicle moves backward by two units, and obtaining a point required by a third lane change;
the lane changing mode selecting unit is used for calculating and obtaining a lane changing ending point according to the point required by the lane changing lane;
the vehicle lane change direction calculation unit is used for calculating the lane change direction of the vehicle according to the lane change ending point;
the vehicle route selection control module is used for determining the road on which the vehicle runs next time after the vehicle runs on the current road;
The vehicle intersection driving module is used for calculating the driving direction and the driving position of the vehicle at the intersection;
the data storage module is used for storing all driving data of each vehicle by utilizing the structural body;
the parallel computing module is used for splitting the large-scale traffic simulation system according to the modules, and parallelizing the split modules according to the respective functions.
2. The parallel computing based mass transit simulation system of claim 1, wherein the vehicle position and direction control module comprises a vehicle starting position control unit, a vehicle movement position unit, a vehicle starting direction unit, and a vehicle movement direction unit;
the vehicle starting position control unit is used for initializing the running road and the position of the vehicle;
the vehicle movement position unit is used for controlling the running of the vehicle on roads and intersections;
the vehicle starting direction unit is used for initializing the direction of the vehicle on a road or an intersection;
the vehicle movement direction unit is used for determining the movement direction of the vehicle on the road.
3. The parallel computing-based mass transit simulation system of claim 1, wherein the lane splitting module comprises a vehicle lane selection unit and a vehicle offset distance calculation unit;
The vehicle lane selection unit is used for determining a lane in which the vehicle runs;
the vehicle offset distance calculation unit is used for obtaining an offset road point according to the distance of the vehicle offset original road point.
4. The large-scale traffic simulation method based on parallel computing is characterized by comprising the following steps of:
s1, marking each road by using a road ID, marking each intersection by using an intersection ID, and constructing a road network topological structure;
s2, generating discrete road point data for all roads by using a curve algorithm according to the road network topological structure, and storing each road point data by using a road ID;
s3, acquiring the traffic flow data on all the current roads, distributing an initial vehicle of each road by utilizing the traffic flow data, forming an initial traveling direction of the vehicle by intercepting first data and second data in road point data of the distributed vehicles, and taking the position of the first data as the initial position of the vehicle;
s4, acquiring a road point ID section of a road where the current vehicle is located according to the initial position of the vehicle, enabling the vehicle to travel according to the initial traveling direction, judging whether the vehicle travels to the tail end of the road point ID section of the current road, if so, entering a step S5, otherwise, continuing to travel according to the initial traveling direction until the vehicle travels to the tail end of the road point ID section of the current road, and entering the step S5;
S5, acquiring a next road point ID section, and taking a vector formed by the tail end and the start of the next road point ID section as the travelling direction of the next road point ID section of the vehicle;
s6, judging whether the vehicle runs in a preset range at the end of a road in the direction of the current vehicle according to road point data in the next road point ID interval, if so, calculating the next road ID of the vehicle and entering a step S7, otherwise, acquiring the next road which can be reached by the lane where the current vehicle is located according to a network topological structure and entering the step S7;
s7, calculating to obtain the nearest lane and the variable number of passes of the vehicle reaching the next road currently according to the ID of the next road;
s8, calculating a lane offset distance according to the nearest lane, the lane changing times and the lane changing direction of the vehicle, and calculating a point required by lane changing according to the lane offset distance;
s801, calculating a left vector and a right vector according to the latest lane and the variable pass number and by utilizing the rear position and the front position of a road section where a current vehicle is positioned, obtaining an initial section right vector according to the left vector and the right vector, and adding and subtracting the product of the right vector and the width of the current lane and the current vehicle position to obtain the corresponding position of one lane beside the lane in the variable direction of the vehicle to obtain a lane offset distance;
S802, calculating a corresponding position of a lane beside a lane changing direction of a vehicle according to the initial section right vector and the lane offset distance obtained in the step S801, and obtaining a point required by a first lane changing;
s803, the position of a later point of the road section where the vehicle is located is obtained, the later point is moved backwards by one point, the later point and the last point of the road section where the vehicle is located are combined into a vector, a final section right vector is calculated, and the product of the right vector and the width of the current lane and the position of the last point of the current final section are utilized to carry out addition and subtraction to obtain the corresponding position of one lane beside the lane change direction, so that the lane offset distance is obtained;
s804, calculating the corresponding position of a lane beside the lane change direction of the last point of the section where the current vehicle is positioned by using the right vector of the final section and the lane offset distance obtained in the step 803 to obtain a point required by a second lane change;
s805, acquiring the corresponding position of a lane beside the lane change direction of a point of which the back point of the current road section of the vehicle moves backward by two units, and obtaining a point required by a third lane change;
s9, calculating a lane change ending point according to the point required by the lane change;
S10, calculating according to the lane change ending point to obtain a lane change direction of the vehicle;
s11, enabling the vehicle to travel according to the lane changing direction of the vehicle until the vehicle reaches a lane changing ending point, judging whether the lane changing number is 0, if so, entering a step S12, otherwise, returning to the step S7;
s12, clearing vehicle road data, calculating to obtain intersection road point data required by the current vehicle by using the next road ID and a lane where the current vehicle is located, clearing the vehicle road data, loading the intersection road point data required by the current vehicle, judging whether the current vehicle runs in the starting direction, if so, entering a step S13, otherwise, returning to the step S3;
s13, processing data of all vehicles, storing the processed data by utilizing a structural body, and packaging the steps S3 to S12 into a parallel computing module;
s14, utilizing rays emitted by a vehicle head to detect a front vehicle, judging whether the front vehicle exists, if so, making corresponding speed adjustment according to the speed of the front vehicle, and entering a step S15, otherwise, entering the step S15;
and S15, performing task small-system processing on the parallel computing module obtained in the step S13 and the step S14, performing batch processing on the data obtained in the step S13 and the parallel computing module, submitting the data subjected to the task small-system processing, and completing the parallel computing of the large-scale traffic simulation system.
5. The parallel computing-based mass transit simulation method according to claim 4, wherein the step S1 comprises the steps of:
s101, taking a two-dimensional vector (ID, 0) or (ID, 1) as a unique indicator of an intersection, wherein 0 represents the starting position of a road and 1 represents the end of the road;
s102, taking the ID of the intersection as a unique identifier, and storing two-dimensional vectors connected with the intersection in a one-to-one correspondence manner;
s103, storing intersection ID and intersection waypoint data and road ID and road waypoint data in a one-to-many storage mode in a one-to-one correspondence manner;
and S104, storing the road IDs and the characteristics of each road one by one, storing four-dimensional vectors corresponding to five-dimensional vectors, and storing the number of intersection lanes corresponding to the five-dimensional vectors, so as to construct a road network topological structure, wherein the five-dimensional vectors are (the current road ID, the number of lanes, 0, the next road ID and the number of roads connected), and the four-dimensional vectors are (the next road ID, the number of lanes, 0 and the current road ID).
6. The parallel computing-based mass transit simulation method according to claim 4, wherein the step S4 comprises the steps of:
S401, calculating the next position of the vehicle according to the starting position of the vehicle by using the speed and the advancing direction of the vehicle, and acquiring intersection waypoint data of the vehicle according to the traffic flow data;
s402, taking (0, 1) as a road point ID section of a vehicle starting position and taking a vector formed by the position of '1' and the vehicle position as the movement direction of the vehicle according to the next position and the intersection road point data of the vehicle orientation, wherein 0 represents the starting position of a road and 1 represents the end of the road;
s403, forming a vector included angle between the last point of the road point ID section where the vehicle is located and the vehicle position in the advancing direction of the vehicle;
and S404, judging whether the vector included angle is a positive value, if so, the vehicle does not exceed the point where '1' is located, and entering a step S5, otherwise, the included angle is a negative value, updating the road point ID interval to be (1, 2), and enabling the vehicle to continue to travel in the initial direction until the vehicle reaches the end of the road point ID interval of the current road, and entering the step S5.
7. The parallel computing-based mass transit simulation method as set forth in claim 4, wherein the step S9 comprises the steps of:
S901, judging whether the distance between the current vehicle and the end of the current road section is larger than a preset threshold value, if so, entering a step S902, otherwise, entering a step S903;
s902, calculating a first lane change ending point according to the point required by the first lane change, the current vehicle direction and a preset threshold value;
the expression of the first lane change ending point is as follows:
D 1 =F*K*M
wherein D is 1 Represents the first lane change ending point, F represents the point required for the first lane change, K representsThe current vehicle direction, M, represents a preset threshold;
s903, judging whether the distance between the next road section of the current vehicle is larger than a preset threshold value, if so, entering a step S904, otherwise, entering a step S905;
s904, calculating a second lane change ending point according to the point required by the second lane change, the next road section where the vehicle is located and a preset threshold value;
the expression of the second lane change ending point is as follows:
D 2 = G*H*M
wherein D is 2 Representing a second lane change ending point, G representing a point required for the second lane change, H representing a direction of a next road section in which the vehicle is located;
and S905, taking the point required by the third lane change as a third lane change ending point, and completing calculation of the lane change ending point.
8. The parallel computing-based mass transit simulation method according to claim 4, wherein the step S10 comprises the steps of:
S1001, respectively taking vectors formed by a first lane change ending point, a second lane change ending point, a third lane change ending point and the current position of the vehicle as the travelling direction of the vehicle;
s1002, respectively taking a vector formed by a first lane change ending point, a second lane change ending point and a third lane change ending point and a point closest to the lane change ending point as a reference direction;
s1003, obtaining a lane change direction of the vehicle from the traveling direction of the vehicle and the reference direction.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010762553.6A CN111856968B (en) | 2020-07-31 | 2020-07-31 | Large-scale traffic simulation system and method based on parallel computing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010762553.6A CN111856968B (en) | 2020-07-31 | 2020-07-31 | Large-scale traffic simulation system and method based on parallel computing |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111856968A CN111856968A (en) | 2020-10-30 |
CN111856968B true CN111856968B (en) | 2023-07-21 |
Family
ID=72954061
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010762553.6A Active CN111856968B (en) | 2020-07-31 | 2020-07-31 | Large-scale traffic simulation system and method based on parallel computing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111856968B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112286206B (en) * | 2020-11-17 | 2024-01-23 | 苏州智加科技有限公司 | Automatic driving simulation method, system, equipment, readable storage medium and platform |
CN112650224A (en) * | 2020-12-11 | 2021-04-13 | 国汽(北京)智能网联汽车研究院有限公司 | Method, device, equipment and storage medium for automatic driving simulation |
CN113409573B (en) * | 2021-06-16 | 2022-07-05 | 福建师范大学 | Sumo urban traffic simulation and traffic flow control method based on matlab |
CN114582124B (en) * | 2022-03-02 | 2023-08-04 | 北京京东乾石科技有限公司 | Scene editing method, device, medium and electronic equipment |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101561836A (en) * | 2009-01-05 | 2009-10-21 | 天津大学 | Urban microscopic traffic flow simulation system based on cellular machine |
CN206833524U (en) * | 2017-06-20 | 2018-01-02 | 李柯林 | A kind of highway immediately pass through toll collection system |
CN108631359A (en) * | 2018-03-30 | 2018-10-09 | 新疆金风科技股份有限公司 | Wind power plant real-time simulation modeling and method |
CN109448499A (en) * | 2019-01-07 | 2019-03-08 | 北京智能佳科技有限公司 | Miniature multilevel traffic Simulation Experimental Platform |
DE102017218143A1 (en) * | 2017-10-11 | 2019-04-11 | Robert Bosch Gmbh | Method and device for driving a vehicle electronic planning module |
CN109765801A (en) * | 2019-01-04 | 2019-05-17 | 东南大学 | The implementation method of car networking desin speed adjustment based on VISSIM emulation |
CN110209068A (en) * | 2019-06-11 | 2019-09-06 | 滁州学院 | A kind of traffic lights timing designing and simulation method |
CN110220521A (en) * | 2019-05-24 | 2019-09-10 | 上海蔚来汽车有限公司 | A kind of generation method and device of high-precision map |
CN110780602A (en) * | 2019-09-09 | 2020-02-11 | 腾讯科技(深圳)有限公司 | Method, device and equipment for constructing simulated vehicle lane change track |
CN111016898A (en) * | 2019-11-14 | 2020-04-17 | 安徽卡思普智能科技有限公司 | Intelligent vehicle track lane change planning method |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP3902543B2 (en) * | 2002-12-17 | 2007-04-11 | 本田技研工業株式会社 | Road traffic simulation device |
CN106198049B (en) * | 2016-07-15 | 2019-03-12 | 百度在线网络技术(北京)有限公司 | Real vehicles are in ring test system and method |
US10948887B2 (en) * | 2016-11-10 | 2021-03-16 | Precisionlife Ltd | Control apparatus and method for processing data inputs in computing devices therefore |
-
2020
- 2020-07-31 CN CN202010762553.6A patent/CN111856968B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101561836A (en) * | 2009-01-05 | 2009-10-21 | 天津大学 | Urban microscopic traffic flow simulation system based on cellular machine |
CN206833524U (en) * | 2017-06-20 | 2018-01-02 | 李柯林 | A kind of highway immediately pass through toll collection system |
DE102017218143A1 (en) * | 2017-10-11 | 2019-04-11 | Robert Bosch Gmbh | Method and device for driving a vehicle electronic planning module |
CN108631359A (en) * | 2018-03-30 | 2018-10-09 | 新疆金风科技股份有限公司 | Wind power plant real-time simulation modeling and method |
CN109765801A (en) * | 2019-01-04 | 2019-05-17 | 东南大学 | The implementation method of car networking desin speed adjustment based on VISSIM emulation |
CN109448499A (en) * | 2019-01-07 | 2019-03-08 | 北京智能佳科技有限公司 | Miniature multilevel traffic Simulation Experimental Platform |
CN110220521A (en) * | 2019-05-24 | 2019-09-10 | 上海蔚来汽车有限公司 | A kind of generation method and device of high-precision map |
CN110209068A (en) * | 2019-06-11 | 2019-09-06 | 滁州学院 | A kind of traffic lights timing designing and simulation method |
CN110780602A (en) * | 2019-09-09 | 2020-02-11 | 腾讯科技(深圳)有限公司 | Method, device and equipment for constructing simulated vehicle lane change track |
CN111016898A (en) * | 2019-11-14 | 2020-04-17 | 安徽卡思普智能科技有限公司 | Intelligent vehicle track lane change planning method |
Non-Patent Citations (5)
Title |
---|
A machine learning approach for personalized autonomous lane change initiation and control;Charlott Vallon等;《2017 IEEE Intelligent Vehicles Symposium (IV)》;全文 * |
Co-simulation of energy management strategy for hybrid electric vehicle in AVL InMotion;Qi Zhang等;《2017 Chinese Automation Congress (CAC)》;全文 * |
城市交通多线路协调优化仿真模型研究;李晓东;曾凡智;陈广义;丁伟雄;;计算机应用研究(第08期);全文 * |
基于图模型的自动驾驶推理任务调度;王娟娟,等;《计算机研究与发展》;第54卷(第8期);全文 * |
大规模复杂网络社区并行发现算法;乔少杰,等;《计算机学报》;第40卷(第3期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN111856968A (en) | 2020-10-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111856968B (en) | Large-scale traffic simulation system and method based on parallel computing | |
Zhao et al. | Two-dimensional vehicular movement modelling at intersections based on optimal control | |
WO2021073389A1 (en) | Vehicle automatic control method and lane change intention prediction network training method | |
WO2022052406A1 (en) | Automatic driving training method, apparatus and device, and medium | |
CN109949604B (en) | Large parking lot scheduling navigation method and system | |
CN104952248B (en) | A kind of vehicle convergence Forecasting Methodology based on Euclidean space | |
CN107301289B (en) | Method for realizing traffic flow cellular automaton model based on intelligent game | |
CN101295326B (en) | Method for generating OD matrix based on GPS data, traffic simulation method thereof | |
CN113297721B (en) | Simulation method and device for signal intersection vehicle selective exit road | |
CN109115220B (en) | Method for parking lot system path planning | |
CN113312760B (en) | Network online motor vehicle right-turn track planning method and device based on traffic simulation | |
US20220366640A1 (en) | Spatial and temporal upsampling techniques for simulated sensor data | |
Hu et al. | Lane-level navigation based eco-approach | |
Park et al. | Deep Q-network-based traffic signal control models | |
CN112325898A (en) | Path planning method, device, equipment and storage medium | |
CN112309138A (en) | Traffic signal control method and device, electronic equipment and readable storage medium | |
CN115062202A (en) | Method, device, equipment and storage medium for predicting driving behavior intention and track | |
CN114428889A (en) | Trajectory path binding method, model training method, device, equipment and storage medium | |
CN113936475A (en) | Traffic control method and system for optimizing multi-road resources | |
WO2023174080A1 (en) | Path planning method and apparatus, and cloud platform | |
CN113788028B (en) | Vehicle control method, device and computer program product | |
CN115454082A (en) | Vehicle obstacle avoidance method and system, computer readable storage medium and electronic device | |
CN113392106A (en) | Multi-agent traffic simulation data storage and updating method | |
CN110457352A (en) | A kind of adjacent vehicle querying method based on microscopic traffic simulation vehicle data structure | |
CN111428910B (en) | Vehicle shortest time traffic path processing method based on delay Petri network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |