Traffic Simulation Data Push Method, Device, Medium and Product
The traffic simulation data push method optimizes data delivery by analyzing requests, reusing or creating tasks, and using data queues to enhance system efficiency and responsiveness in traffic simulation systems.
Patent Information
- Application Number
- CN202210006447.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-04
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2042-01-04
AI Technical Summary
In the prior art, traffic simulation data query is prone to problems such as high pressure, long response time, and poor system responsiveness.
By obtaining traffic simulation data requests, analyzing the target area, and querying whether there is a matching related data push task in the current execution task. If it exists, push the associated data. Otherwise, a new data push task will be created, and the parsed data will be pushed to the requesting end, and the blocking queue and data sending thread will be used to optimize data transmission.
Reduce the amount of data reacquisition, improve the efficiency of simulation data acquisition, reduce system resource overhead, improve system operation and response efficiency, and enhance database stability and system concurrency capabilities.
Smart Images

Figure CN114356975B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer technology, and particularly relates to a traffic simulation data pushing method, a traffic simulation data pushing device, a computer-readable medium, and a computer program product. Background Art
[0002] With the rapid development of technology, the functions of computers have become increasingly powerful, and the traffic conditions in reality can be reproduced by computers to achieve traffic simulation. Traffic simulation is an important part of the intelligent transportation system and an important application of computer technology in the field of traffic engineering. It can dynamically and realistically simulate various traffic phenomena such as traffic flow and traffic accidents, reproduce the spatio-temporal changes of traffic flow, deeply analyze the characteristics of vehicles, drivers and pedestrians, roads, and traffic, and effectively conduct research on traffic planning, traffic organization and management, traffic energy conservation, and rationalization of material transportation flow. At the same time, through virtual reality technology, traffic simulation can very intuitively show the running conditions of vehicles on the road network, and simulate on the computer economically and effectively and without risk whether the traffic at a certain location is congested, whether the road is unobstructed, and whether there are traffic accidents.
[0003] In the related art, when a large number of requests simultaneously query and obtain traffic simulation data, it is easy to cause problems such as high data query pressure and long data query response time, resulting in poor system responsiveness.
[0004] It should be noted that the information disclosed in the above background art section is only used to enhance the understanding of the background of this application, and thus may include information that does not constitute the prior art known to those of ordinary skill in the art. Summary of the Invention
[0005] The purpose of this application is to provide a traffic simulation data pushing method, device, medium, and product, which at least to a certain extent overcomes the technical problem of how to improve the query response efficiency of simulation data in the related art.
[0006] Other features and advantages of this application will become apparent through the following detailed description, or will be partially learned through the practice of this application.
[0007] According to one aspect of the embodiments of this application, a traffic simulation data pushing method is provided. The traffic simulation data pushing method includes:
[0008] Obtain a traffic simulation data request, and parse the traffic simulation data request to obtain parsed data, where the parsed data includes the target traffic simulation area requested by the traffic simulation data request;
[0009] In the currently executed data push task, query whether there is an associated data push task in which the traffic simulation area has a matching relationship with the target traffic simulation area;
[0010] If there is such an associated data push task in the currently executed data push task, push the traffic simulation data pushed by the associated data push task to the requester of the traffic simulation data request;
[0011] If there is no such associated data push task in the currently executed data push task, create a new data push task according to the parsed data, and push the traffic simulation data corresponding to the parsed data to the requester of the traffic simulation data request through the newly created data push task.
[0012] According to one aspect of the embodiments of the present application, there is provided a traffic simulation data push device, which includes:
[0013] A traffic simulation data request parsing module, configured to obtain a traffic simulation data request and parse the traffic simulation data request to obtain parsed data, where the parsed data includes the target traffic simulation area requested by the traffic simulation data request;
[0014] An associated data push task query module, configured to query whether there is an associated data push task in which the traffic simulation area has a matching relationship with the target traffic simulation area in the currently executed data push task;
[0015] A first data push module, configured to, if there is such an associated data push task in the currently executed data push task, push the traffic simulation data pushed by the associated data push task to the requester of the traffic simulation data request;
[0016] A second data push module, configured to, if there is no such associated data push task in the currently executed data push task, create a new data push task according to the parsed data, and push the traffic simulation data corresponding to the parsed data to the requester of the traffic simulation data request through the newly created data push task.
[0017] In some embodiments of the present application, based on the above technical solution, the second data push module includes:
[0018] A data acquisition unit, configured to create a new data acquisition thread, a blocking queue, and a data sending thread according to the parsed data, where the data acquisition thread is used to obtain the traffic simulation data corresponding to the parsed data from a preset database, the blocking queue is used to store and transfer the traffic simulation data, and the data sending thread is used to send the traffic simulation data to the requester of the traffic simulation data request;
[0019] A data transfer unit, configured to add the traffic simulation data to a blocking queue. When there is no traffic simulation data in the blocking queue, the blocking queue is blocked. When the blocking queue is full of traffic simulation data, the blocking queue is blocked;
[0020] A data push unit, configured to retrieve the traffic simulation data from the blocking queue and push the traffic simulation data to the requesting end of the traffic simulation data request through the data sending thread.
[0021] In some embodiments of the present application, based on the above technical solution, the parsed data further includes simulation parameters, and the simulation parameters include one or more of simulation parameters related to a map, simulation parameters related to motor vehicles, simulation parameters related to non-motor vehicles, and simulation parameters related to pedestrians; the data push unit includes:
[0022] A data preprocessing subunit, configured to retrieve the traffic simulation data from the blocking queue and preprocess the traffic simulation data according to the simulation parameters. The preprocessing includes one or more of simulation data adjustment processing related to a map, simulation data adjustment processing related to motor vehicles, simulation data adjustment processing related to non-motor vehicles, and simulation data adjustment processing related to pedestrians;
[0023] A data push subunit, configured to push the preprocessed traffic simulation data to the requesting end of the traffic simulation data request through the data sending thread.
[0024] In some embodiments of the present application, based on the above technical solution, the associated data push task includes an associated data acquisition thread, an associated blocking queue, and an associated data sending thread. The first data push module includes:
[0025] A simulation data acquisition unit, configured to acquire traffic simulation data from the preset database through the associated data acquisition thread;
[0026] A simulation data storage unit, configured to store the traffic simulation data through the associated blocking queue;
[0027] A simulation data preprocessing unit, configured to retrieve the traffic simulation data from the associated blocking queue and preprocess the traffic simulation data according to the simulation parameters;
[0028] A simulation data push unit, configured to create a new data sending thread and push the preprocessed traffic simulation data to the requesting end of the traffic simulation data request through the newly created data sending thread.
[0029] In some embodiments of the present application, based on the above technical solutions, the traffic simulation data pushing device further includes:
[0030] A simulation data generating unit, configured to generate traffic simulation data through a simulation data generator;
[0031] A Kafka queue storage unit, configured to store the traffic simulation data through a Kafka queue and forward the traffic simulation data to the preset database.
[0032] In some embodiments of the present application, based on the above technical solutions, the target traffic simulation area is a traffic simulation area including roads of a preset type, where the preset type of roads includes one or more of various technical standard levels of roads; the matching relationship is used to indicate that the traffic simulation area includes the preset type of roads indicated by the target traffic simulation area; the associated data push task query module includes:
[0033] An associated data push task first query unit, configured to query whether there is an associated data push task in the currently executed data push task whose traffic simulation area includes the preset road type.
[0034] In some embodiments of the present application, based on the above technical solutions, the target traffic simulation area is a traffic simulation area at a preset position on the map; the matching relationship is used to indicate that there is an overlapping area between two traffic simulation areas; the associated data push task query module further includes:
[0035] An associated data push task second query unit, configured to query whether there is an associated data push task in the currently executed data push task whose traffic simulation area has an overlapping area with the target traffic simulation area.
[0036] In some embodiments of the present application, based on the above technical solutions, the associated data push task second query unit includes:
[0037] An associated data push task first query subunit, configured to query whether there is an associated data push task in the currently executed data push task whose traffic simulation area is the same as the target traffic simulation area; and
[0038] An associated data push task second query subunit, configured to query whether there is an associated data push task in the currently executed data push task where the area ratio of the target overlapping area to the target traffic simulation area is greater than a preset area ratio but less than one, where the target overlapping area is the overlapping area between the traffic simulation area in the currently executed data push task and the target traffic simulation area.
[0039] In some embodiments of the present application, based on the above technical solutions, the first query subunit of the associated data push task includes:
[0040] A target task code determination subunit, configured to determine a target task code for the data push task for executing the traffic simulation data request according to the target traffic simulation area;
[0041] A task code query subunit, configured to query whether there is an associated data push task in the currently executed data push task whose task code is the same as the target task code.
[0042] In some embodiments of the present application, based on the above technical solutions, the simulation data push device further includes:
[0043] A data push task creation unit, configured to create a new data push task if there is an associated data push task in the currently executed data push task where the area ratio of the target overlapping area to the target traffic simulation area is greater than a preset area ratio but less than one, and push the traffic simulation data corresponding to the area outside the overlapping area in the target traffic simulation area to the request side of the traffic simulation data request through the newly created data push task.
[0044] In some embodiments of the present application, based on the above technical solutions, the traffic simulation data push device further includes:
[0045] A long-term connection establishment unit, configured to establish a long-term connection with the request side of the traffic simulation data request.
[0046] In some embodiments of the present application, based on the above technical solutions, the traffic simulation data push device further includes:
[0047] A registration association relationship establishment unit 1, configured to establish a registration association relationship between the request side of the traffic simulation data request and the associated data push task.
[0048] In some embodiments of the present application, based on the above technical solutions, the traffic simulation data push device further includes:
[0049] A registration association relationship establishment unit 2, configured to establish a registration association relationship between the request side of the traffic simulation data request and the newly created data push task.
[0050] In some embodiments of the present application, based on the above technical solutions, the traffic simulation data push device further includes:
[0051] A data close request acquisition unit, configured to acquire a data close request, where the data close request is used to request to stop acquiring traffic simulation data;
[0052] A request stop task determination unit is configured to determine a request end corresponding to the data closing request and a data push task corresponding to the traffic simulation data requested to stop obtaining;
[0053] A registration association release unit, configured to release the registration association between the requesting end and the data push task corresponding to the traffic simulation data requested to stop acquiring, and stop the data push task from pushing data to the requesting end;
[0054] A data push task closing unit, configured to close the data push task when there is a data push task that has no registration association relationship with any request end;
[0055] The long-term connection disconnection unit is configured to disconnect the long-term connection with the candidate request end after the candidate request end maintains a state of not having a registration association relationship with any data push task for a preset time period.
[0056] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the traffic simulation data push method in the above technical solution is implemented.
[0057] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the traffic simulation data push method in the above technical solution by executing the executable instructions.
[0058] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the traffic simulation data push method in the above technical solution.
[0059] In the technical solution provided by the embodiments of the present application, a traffic simulation data request is obtained, and the traffic simulation data request is parsed to obtain parsed data; in the currently executing data push task, it is queried whether there is an associated data push task in which the traffic simulation area has a matching relationship with the target traffic simulation area; if there is an associated data push task in the currently executing data push task, the traffic simulation data pushed by the associated data push task is pushed to the request side of the traffic simulation data request; if there is no associated data push task in the currently executing data push task, a data push task is newly created according to the parsed data, and the traffic simulation data corresponding to the parsed data is pushed to the request side of the traffic simulation data request through the newly created data push task; thereby, the amount of traffic simulation data that needs to be re-obtained can be reduced, the simulation data acquisition efficiency can be improved, and the number of currently executing tasks can be reduced through the reuse of tasks, reducing the system resource overhead, so as to improve the system operation efficiency and system response efficiency.
[0060] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. Brief Description of the Drawings
[0061] The drawings here are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.
[0062] Figure 1 Schematically shows an exemplary device architecture block diagram applying the technical solution of the present application.
[0063] Figure 2 Schematically shows a flowchart of the steps of the traffic simulation data push method in some embodiments of the present application.
[0064] Figure 3 Schematically shows a flowchart of the steps before obtaining the traffic simulation data request in an embodiment of the present application.
[0065] Figure 4 Schematically shows a flowchart of the process of sending and pushing simulation data in an embodiment of the present application.
[0066] Figure 5 Schematically shows a flowchart of the steps of querying whether there is an associated data push task in which the traffic simulation area has an overlapping area with the target traffic simulation area in a currently executing data push task in an embodiment of the present application.
[0067] Figure 6Schematically shows a flowchart of steps for querying whether there is an associated data push task with the same traffic simulation area as the target traffic simulation area in a data push task being currently executed in an embodiment of the present application.
[0068] Figure 7 Schematically shows a flowchart of steps for pushing the traffic simulation data pushed by the associated data push task to the request of the traffic simulation data request in an embodiment of the present application.
[0069] Figure 8 Schematically shows a flowchart of the simulation data sending and pushing process in another embodiment of the present application.
[0070] Figure 9 Schematically shows a flowchart of steps before obtaining the traffic simulation data request in an embodiment of the present application.
[0071] Figure 10 Schematically shows a flowchart of steps for taking out traffic simulation data from the blocking queue and pushing the traffic simulation data to the request end of the traffic simulation data request through a data sending thread in an embodiment of the present application.
[0072] Figure 11 Schematically shows a flowchart of steps that can also be included in an embodiment of the present application.
[0073] Figure 12 Schematically shows a structural block diagram of a traffic simulation data push device provided by an embodiment of the present application.
[0074] Figure 13 Schematically shows a computer system structural block diagram of an electronic device for implementing an embodiment of the present application. Detailed Embodiments
[0075] Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more complete and comprehensive, and will fully convey the concept of the example embodiments to those skilled in the art.
[0076] In addition, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present application. However, those skilled in the art will realize that the technical solutions of the present application can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. can be used. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the present application.
[0077] The block diagrams shown in the drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0078] The flowcharts shown in the drawings are merely illustrative and do not necessarily include all the content and operations / steps, nor do they necessarily have to be executed in the described order. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined, so the actual execution order may change according to the actual situation.
[0079] Before elaborating on the technical solutions such as the traffic simulation data pushing method and the traffic simulation data pushing device provided in the embodiments of the present application, a brief introduction to the cloud technology involved in some embodiments of the present application will be given first.
[0080] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.
[0081] Cloud computing is a computing model that distributes computing tasks across a resource pool composed of a large number of computing devices, enabling various application systems to obtain computing power, storage space, and information services as needed. The network that provides resources is called the "cloud". The resources in the "cloud" seem to the user to be infinitely expandable and can be obtained at any time, used on demand, expanded at any time, and paid according to usage.
[0082] As a basic capability provider of cloud computing, a cloud computing resource pool (referred to as a cloud platform, generally called an IaaS (Infrastructure as a Service) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to select and use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.
[0083] According to the logical function division, on the IaaS (Infrastructure as a Service) layer, the PaaS (Platform as a Service) layer can be deployed, and on top of the PaaS layer, the SaaS (Software as a Service) layer can be deployed. Or the SaaS can be directly deployed on the IaaS. PaaS is the platform for software operation, such as databases, web containers, etc. SaaS are various business software, such as web portals, SMS mass senders, etc. Generally speaking, SaaS and PaaS are the upper layers relative to IaaS.
[0084] Cloud storage is a new concept extended and developed from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as the storage system) refers to a storage system that combines a large number of different types of storage devices (storage devices are also called storage nodes) in the network through cluster applications, grid technologies, and distributed file systems, etc., and works together through application software or application interfaces to jointly provide data storage and business access functions to the outside world.
[0085] A database, in short, can be regarded as an electronic filing cabinet - a place to store electronic files. Users can perform operations such as adding, querying, updating, and deleting data in the files. A so-called "database" is a data set stored together in a certain way, shared by multiple users, with the smallest possible redundancy, and independent of application programs.
[0086] A database management system (English: Database Management System, abbreviated as DBMS) is a computer software system designed to manage databases. It generally has basic functions such as storage, interception, security protection, and backup. Database management systems can be classified according to the database models they support, such as relational, XML (Extensible Markup Language); or according to the types of computers they support, such as server clusters, mobile phones; or according to the query languages they use, such as SQL (Structured Query Language), XQuery; or according to the key performance metrics, such as maximum scale, highest running speed; or other classification methods. No matter which classification method is used, some DBMS can cross categories. For example, they can support multiple query languages at the same time.
[0087] The system involved in the embodiments of this application can be a distributed system formed by connecting a client and multiple nodes (any form of computing device in the access network, such as a server and a user terminal) through network communication.
[0088] The following will make a detailed description of the traffic simulation data pushing method and device provided by this application in combination with specific embodiments.
[0089] Figure 1 Schematically shown is an exemplary device architecture block diagram applying the technical solution of this application.
[0090] As Figure 1 shown, the device architecture 100 may include a terminal device 110, a network 120, and a server 130. The terminal device 110 may include various electronic devices such as a smart phone, a tablet computer, a laptop computer, and a desktop computer. The server 130 may be an independent physical server, or a server cluster or a distributed device composed of multiple physical servers, or a cloud server providing cloud computing services. The network 120 may be a communication medium of various connection types capable of providing a communication link between the terminal device 110 and the server 130. For example, it may be a wired communication link or a wireless communication link.
[0091] According to the implementation requirements, the device architecture in the embodiments of this application may have any number of terminal devices, networks, and servers. For example, the server 130 may be a server group composed of multiple server devices. In addition, the technical solution provided by the embodiments of this application may be applied to the terminal device 110, or may be applied to the server 130, or may be jointly implemented by the terminal device 110 and the server 130. This application makes no special limitation on this.
[0092] For example, the server 130 may execute the traffic simulation data pushing method provided by this application to obtain a traffic simulation data request, and parse the traffic simulation data request to obtain parsed data; in the currently executed data pushing task, query whether there is an associated data pushing task in which the traffic simulation area has a matching relationship with the target traffic simulation area; if there is an associated data pushing task in the currently executed data pushing task, push the traffic simulation data pushed by the associated data pushing task to the request end of the traffic simulation data request; if there is no associated data pushing task in the currently executed data pushing task, create a new data pushing task according to the parsed data, and push the traffic simulation data corresponding to the parsed data to the request end of the traffic simulation data request through the newly created data pushing task; thus, it is possible to reduce the amount of traffic simulation data that needs to be re-obtained, thereby reducing system overhead, reducing database access pressure, and improving data acquisition efficiency.
[0093] It can be understood that in the related art, Hbase + independent threads can be used to synchronously process data requests from different request ends. However, when the platform faces high-concurrency simulation data requests, problems such as poor stability on the data storage side, high maintenance costs, and high resource occupation by threads at the service level will occur, making the concurrency and performance of the simulation data acquisition service a bottleneck. In terms of actual experience, when a large number of users use it simultaneously, there will be inconsistent phenomena in the pictures of traffic simulation data.
[0094] In the implementation manner of the present application, when facing high-concurrency queries, since the amount of traffic simulation data that needs to be re-obtained can be reduced, the system resource overhead of the simulation platform can be reduced, the Qps (Queries-per-second) of the database and the access pressure can be reduced, and the acquisition efficiency of the simulation data at the request end can be improved. Therefore, the system operation performance of the simulation platform can be improved, the maximum accommodable concurrency can be increased, massive data throughput can be achieved, and the consistency of the picture results of the same simulation task data for multiple users can be improved.
[0095] The following will make a detailed description of the traffic simulation data pushing method provided by the present application in combination with specific implementation manners.
[0096] Figure 2 The step flowchart of the traffic simulation data pushing method of some implementation manners of the present application is schematically shown. The execution subject of the traffic simulation data pushing method can be a terminal device or a server, etc., and the present application does not limit this. In some implementation manners, through the collaborative implementation with cloud computing technology, the traffic simulation data pushing method of the present application can be implemented on a traffic simulation cloud platform. Or, the traffic simulation data pushing method of the present application can be executed by a simulation platform, a simulation system, etc. equipped with a server.
[0097] As Figure 2 shown, the traffic simulation data pushing method mainly may include the following steps S210 to step S240.
[0098] S210. Obtain a traffic simulation data request, and parse the traffic simulation data request to obtain parsed data, where the parsed data includes the target traffic simulation area requested by the traffic simulation data request.
[0099] Specifically, the traffic simulation data request may be a data request sent from the request end of the user web page to request corresponding traffic simulation data. Specifically, the traffic simulation data may be video frame data showing a map and vehicle flows. For example, the traffic simulation data may be video frame data played at a rate of one frame per 100 milliseconds and can be used to play a traffic simulation video animation.
[0100] The requesting end can be a WebSocket, a browser, an application software, etc. in a user terminal. This application does not limit this. For example, when a user opens a traffic simulation cloud platform through a browser, traffic simulation data obtained through the browser can be used to play the vehicle flow animation in the target traffic simulation area online in real time. The target traffic simulation area can be preset on the traffic simulation cloud platform and modified by the user customarily.
[0101] In some embodiments, the requesting end may include a display interface, and the display interface is used to display the traffic simulation data obtained by the requesting end. In a specific embodiment, the display interface is used to display the traffic simulation data obtained by the requesting end in real time.
[0102] Figure 3 Schematically shows the flowchart of steps before obtaining a traffic simulation data request in an embodiment of the present application. As Figure 3 shown, on the basis of the above embodiments, before the traffic simulation data request in step S210, the following steps S310 and step S320 may be further included.
[0103] S310. Generate traffic simulation data through a simulation data generator;
[0104] S320. Store the traffic simulation data through a Kafka queue and forward the traffic simulation data to a preset database.
[0105] Thus, by generating traffic simulation data through a simulation data generator, then storing the traffic simulation data through a Kafka queue, and forwarding the traffic simulation data to a preset database, it can enable the traffic simulation data to be generated and stored at a relatively stable speed, and avoid the mismatch between the generation speed of traffic simulation data and the data acquisition speed of requesting traffic simulation data.
[0106] It can be understood that in the related art, in the face of high-concurrency simulation data requests, the data query pressure is large, the data query response time is long, which is likely to impact the database and cause database query failure problems.
[0107] The embodiments of the present application can reduce the data volume of traffic simulation data that needs to be re-obtained, improve the simulation data acquisition efficiency, and reduce the total amount of currently executed tasks through the reuse of associated data push tasks, thereby reducing the data volume of obtaining traffic simulation data from the database. Therefore, it can improve the security and stability of the database, avoid the database from crashing due to excessive query volume, and can enhance the responsiveness and stability of the system.
[0108] In a specific embodiment, the preset database can be a database such as MongDb, redis, etc. This application does not limit this.
[0109] Figure 4Schematically shown is a flowchart of the simulation data sending and pushing process in an embodiment of the present application. As Figure 4 shown, traffic simulation data is generated by a simulation data generator, then stored in a Kafka queue, and the traffic simulation data is forwarded to a preset database. Then, a data push task retrieves the traffic simulation data from the database and pushes the traffic simulation data to the requesting end. The Kafka queue can include a Kafka message queue, which can undertake data generation, cache data for a preset duration, and is a high-throughput and highly scalable message queue, which can increase the maximum concurrency of the simulation platform and system stability. The preset duration can be 2 hours, 4 hours, 6 hours, 8 hours, 10 hours, etc.
[0110] S220. In the currently executed data push task, query whether there is an associated data push task in which the traffic simulation area has a matching relationship with the target traffic simulation area.
[0111] In some embodiments, on the basis of the above embodiments, the target traffic simulation area is a traffic simulation area including roads of a preset type, where the preset type of roads includes one or more of various technical standard levels of roads; the matching relationship is used to indicate that the traffic simulation area includes the preset type of roads indicated by the target traffic simulation area; in the currently executed data push task in step S220, querying whether there is an associated data push task in which the traffic simulation area has a matching relationship with the target traffic simulation area may further include the following steps:
[0112] In the currently executed data push task, query whether there is an associated data push task in which the traffic simulation area includes the preset road type.
[0113] Specifically, roads of various technical standard levels can include highways, national roads, provincial roads, county roads, township roads, bridge roads, interchange roads, urban roads, etc., and the present application does not limit this.
[0114] In some embodiments, on the basis of the above embodiments, the target traffic simulation area is a traffic simulation area at a preset position on the map; the matching relationship is used to indicate that there is an overlapping area between two traffic simulation areas; in the currently executed data push task in step S220, querying whether there is an associated data push task in which the traffic simulation area has a matching relationship with the target traffic simulation area may further include the following steps:
[0115] In the currently executed data push task, query whether there is an associated data push task in which the traffic simulation area has an overlapping area with the target traffic simulation area.
[0116] Figure 5Schematically shown is a flowchart of steps for querying whether there is an associated data push task in the currently executing data push task where the traffic simulation area overlaps with the target traffic simulation area in a certain embodiment of the present application. As Figure 5 shown, in some embodiments, based on the above embodiments, the step of "querying whether there is an associated data push task in the currently executing data push task where the traffic simulation area overlaps with the target traffic simulation area" may further include the following steps S510 and S520:
[0117] S510. Query whether there is an associated data push task in the currently executing data push task where the traffic simulation area is the same as the target traffic simulation area; and
[0118] S520. Query whether there is an associated data push task in the currently executing data push task where the area ratio of the target overlapping area to the target traffic simulation area is greater than the preset area ratio but less than one, where the target overlapping area is the overlapping area between the traffic simulation area in the currently executing data push task and the target traffic simulation area.
[0119] In some embodiments, based on the above embodiments, after the step of querying whether there is an associated data push task in the currently executing data push task where the area ratio of the target overlapping area to the target traffic simulation area is greater than the preset area ratio but less than one in step S520, the following steps may further be included:
[0120] If there is an associated data push task in the currently executing data push task where the area ratio of the target overlapping area to the target traffic simulation area is greater than the preset area ratio but less than one, a new data push task is created, and the traffic simulation data corresponding to the area outside the overlapping area in the target traffic simulation area is pushed to the requester of the traffic simulation data request through the newly created data push task.
[0121] Thus, it can be understood that the traffic simulation data corresponding to the overlapping area in the target traffic simulation area is pushed to the requester of the traffic simulation data request through the associated data push task, and the traffic simulation data corresponding to the area outside the overlapping area in the target traffic simulation area is pushed to the requester of the traffic simulation data request through the newly created data push task, so that only the traffic simulation data corresponding to the area outside the overlapping area in the target traffic simulation area needs to be queried through the newly created data push task, rather than querying the traffic simulation data of the entire target traffic simulation area, and the task of pushing the traffic simulation data of the entire target traffic simulation area to the requester can be completed. Therefore, the request of the requester can be realized while reducing the query volume of the database, and since the number of queries is reduced, the query time of some data is also omitted, and the acquisition efficiency of the simulation data can be improved.
[0122] Figure 6 Schematically shown is a flowchart of steps for querying whether there is an associated data push task with a traffic simulation area identical to a target traffic simulation area in a currently executing data push task in an embodiment of the present application. As Figure 6 shown, based on the above embodiment, in the currently executing data push task in step S510, querying whether there is an associated data push task with a traffic simulation area identical to the target traffic simulation area may further include the following steps S610 and S620.
[0123] S610. Determine a target task code for the data push task for executing a traffic simulation data request according to the target traffic simulation area;
[0124] S620. In the currently executing data push tasks, query whether there is an associated data push task with a task code identical to the target task code.
[0125] It can be understood that the task code of the data push task is determined by the traffic simulation area. Therefore, for an associated data push task with a task code identical to the target task code, its traffic simulation area is also identical to the target traffic simulation area. Thus, the associated data push task with a traffic simulation area identical to the target traffic simulation area is determined in an efficient manner, which is beneficial to improving the data acquisition speed for traffic simulation data requests.
[0126] S230. If there is an associated data push task in the currently executing data push task, push the traffic simulation data pushed by the associated data push task to the requester of the traffic simulation data request.
[0127] For example, as Figure 4 shown, Figure 4 the data push task shown can be an associated data push task. If there is an associated data push task in the currently executing data push task, push the traffic simulation data pushed by the associated data push task to the requester of the traffic simulation data request. Thus, the amount of data for obtaining traffic simulation data from the database can be reduced, thereby reducing the database access pressure and improving the system operation efficiency.
[0128] Figure 7 Schematically shown is a flowchart of steps for pushing the traffic simulation data pushed by an associated data push task to the requester of the traffic simulation data request in an embodiment of the present application. As Figure 7As shown, on the basis of the above embodiments, the associated data push task includes an associated data acquisition thread, an associated blocking queue, and an associated data sending thread. The step S230 of pushing the traffic simulation data pushed by the associated data push task to the request side of the traffic simulation data request may further include the following steps S710 to S740.
[0129] S710. Obtain traffic simulation data from a preset database through the associated data acquisition thread;
[0130] S720. Store the traffic simulation data through the associated blocking queue;
[0131] S730. Take out the traffic simulation data from the associated blocking queue and preprocess the traffic simulation data according to the simulation parameters;
[0132] S740. Create a new data sending thread and push the preprocessed traffic simulation data to the request side of the traffic simulation data request through the newly created data sending thread.
[0133] Specifically, the associated data acquisition thread is used to obtain the traffic simulation data corresponding to the parsed data from a preset database, the associated blocking queue is used to store and transfer the traffic simulation data, and the associated data sending thread is used to send the traffic simulation data to the request side of the traffic simulation data request.
[0134] The associated blocking queue is the blocking queue in the associated data push task, the associated data acquisition thread is the blocking queue in the associated data push task, and the associated data sending thread is the data sending thread in the associated data push task. Specifically, the blocking queue can be an asynchronous blocking queue.
[0135] Figure 8 Schematically shows a flowchart of the simulation data sending and pushing process in another embodiment of the present application. As Figure 8 shown, first obtain traffic simulation data from a preset database through the associated data acquisition thread, then store the traffic simulation data through the associated blocking queue, take out the traffic simulation data from the associated blocking queue, preprocess the traffic simulation data according to the simulation parameters, and then, create a new data sending thread and push the preprocessed traffic simulation data to the request side of the traffic simulation data request through the newly created data sending thread. Thus, personalized data push to different request sides can be realized without creating the entire data push task, and the amount of traffic simulation data obtained from the database can be reduced, thereby reducing the database access pressure and improving the system operation efficiency.
[0136] In addition, the associated blocking queue can serve as a transfer station for obtaining and pushing traffic simulation data, which can stabilize the data flow frequency of traffic simulation data and improve the smoothness of system operation. Specifically, it can preprocess traffic simulation data according to simulation parameters in a newly created data preprocessing thread, or in a centrally configured data preprocessing module according to simulation parameters.
[0137] S240. If there is no associated data push task in the currently executed data push task, a data push task is newly created according to the parsed data, and the traffic simulation data corresponding to the parsed data is pushed to the request side of the traffic simulation data request through the newly created data push task.
[0138] Figure 9 Schematically shows the flowchart of the steps before obtaining the traffic simulation data request in an embodiment of the present application. As Figure 9 shown, based on the above embodiment, the step of creating a data push task according to the parsed data in step S240 and pushing the traffic simulation data corresponding to the parsed data to the request side of the traffic simulation data request through the newly created data push task can further include the following steps S910 to S930.
[0139] S910. A data acquisition thread, a blocking queue, and a data sending thread are newly created according to the parsed data. The traffic simulation data corresponding to the parsed data is obtained from a preset database through the data acquisition thread. The blocking queue is used to store and transfer the traffic simulation data, and the data sending thread is used to send the traffic simulation data to the request side of the traffic simulation data request.
[0140] S920. The traffic simulation data is added to the blocking queue. When there is no traffic simulation data in the blocking queue, the blocking queue blocks. When the blocking queue is full of traffic simulation data, the blocking queue blocks.
[0141] S930. The traffic simulation data is taken out from the blocking queue, and the traffic simulation data is pushed to the request side of the traffic simulation data request through the data sending thread.
[0142] For example, as Figure 4 shown, Figure 4The data push task shown can be a newly created associated data push task. According to the parsed data, a data acquisition thread, a blocking queue, and a data sending thread are created. The data acquisition thread obtains traffic simulation data corresponding to the parsed data from a preset database. Among them, the traffic simulation data is added to the blocking queue, the traffic simulation data is taken out from the blocking queue, and the traffic simulation data is pushed to the request side of the traffic simulation data request through the data sending thread. Thus, the blocking queue can be used as a transfer station for obtaining and pushing traffic simulation data, which can stabilize the data flow frequency of traffic simulation data and improve the smoothness of system operation.
[0143] In a specific embodiment, the data sending frequency of the data sending thread can be set to a preset frequency, so that the data push frequency of each data push task is the preset frequency, realizing the control of the data flow frequency of traffic simulation data. The preset frequency can be 5 frames / s, 8 frames / s, 10 frames / s, etc.
[0144] In a specific embodiment, the data acquisition thread can obtain real-time traffic simulation data corresponding to the parsed data from the preset database, realizing the real-time push of traffic simulation data.
[0145] In a specific embodiment, when the blocking queue is full of traffic simulation data, it can mean that the storage data volume of the traffic simulation data in the blocking queue accounts for a preset proportion of the data capacity of the blocking queue. The preset proportion can be 85%, 90%, 95%, 100%, etc.
[0146] In some embodiments, on the basis of the above embodiments, on the simulation platform, the data acquisition threads in each data push task can be set in the data acquisition layer; the blocking queues in each data push task can be set in the transfer layer; the data sending threads in each data push task can be set in the data sending layer. Thus, through the clear division of the functional structures of each layer of the simulation platform, the code readability of the simulation platform and the scalability of subsequent development are improved.
[0147] Figure 10 Schematically shows the step flow chart of taking out traffic simulation data from the blocking queue and pushing the traffic simulation data to the request side of the traffic simulation data request in an embodiment of the present application. As Figure 10 shown, on the basis of the above embodiments, the parsed data further includes simulation parameters, and the simulation parameters include one or more of simulation parameters related to the map, simulation parameters related to motor vehicles, simulation parameters related to non-motor vehicles, and simulation parameters related to pedestrians. Taking out traffic simulation data from the blocking queue in step S930 and pushing the traffic simulation data to the request side of the traffic simulation data request through the data sending thread can further include the following steps S1010 to step S1020.
[0148] S1010. Take out traffic simulation data from the blocking queue, and preprocess the traffic simulation data according to simulation parameters. The preprocessing includes one or more of simulation data adjustment processing related to the map, simulation data adjustment processing related to motor vehicles, simulation data adjustment processing related to non-motor vehicles, and simulation data adjustment processing related to pedestrians;
[0149] S1020. Push the preprocessed traffic simulation data to the request side of the traffic simulation data request through the data sending thread.
[0150] Specifically, the simulation data adjustment processing related to the map can be to adjust the display accuracy of the map, adjust the map display type, etc. The map display accuracy can include the first-level accuracy with the store as the minimum display dimension, the second-level accuracy with the building as the minimum display dimension, and the third-level accuracy with the street as the minimum display dimension. The map display type can include the plane type, the three-dimensional type, the line type, the rendering type, etc. Thus, after adjusting the accuracy of the traffic simulation data first, discarding some data that does not need to be displayed, and then transmitting the traffic simulation data, the amount of data for transmitting traffic data can be reduced, and the acquisition efficiency of traffic simulation data can be improved.
[0151] In some embodiments, based on the above embodiments, after obtaining the traffic simulation data request in step S210, the following steps can be further included:
[0152] Establish a long-term connection with the request side of the traffic simulation data request.
[0153] Establishing a long-term connection with the request side of the traffic simulation data request, specifically, it can be that the server and the browser requesting the traffic simulation data only need to complete one handshake, and a persistent connection can be directly created between the two for two-way data transmission.
[0154] In some embodiments, based on the above embodiments, before pushing the traffic simulation data pushed by the associated data push task to the request side of the traffic simulation data request in step S230, the following steps can be further included:
[0155] Establish a registration association relationship between the request side of the traffic simulation data request and the associated data push task.
[0156] Specifically, establishing a registration association relationship between the request side of the traffic simulation data request and the associated data push task can be to establish a registration association relationship between the request side of the traffic simulation data request and the associated data push task on the task register. Thus, the registration association relationship between each request side and each data push task can be conveniently queried through the task register.
[0157] In some implementations, based on the above embodiments, before pushing the traffic simulation data corresponding to the parsed data to the requesting end of the traffic simulation data request through the newly created data push task in step S240, the following steps may be further included:
[0158] A registration association relationship is established between the request end of the traffic simulation data request and the newly created data push task.
[0159] Specifically, the registration association relationship between the request end of the traffic simulation data request and the newly created data push task can be established by establishing the registration association relationship between the request end of the traffic simulation data request and the associated data push task on the task register. Thus, the registration association relationship between each request end and each data push task can be conveniently queried through the task register.
[0160] Figure 11 The following schematically shows a flow chart of steps that may be included in a certain embodiment of the present application. Figure 11 As shown, based on the above embodiments, the traffic simulation data push method of certain embodiments of the present application may further include the following steps:
[0161] S1110. Get data close request, the data close request is used to request to stop obtaining traffic simulation data;
[0162] S1120. Determine the request end corresponding to the data closing request and the data push task corresponding to the traffic simulation data requested to stop obtaining;
[0163] S1130. Release the registration association between the requesting end and the data push task corresponding to the traffic simulation data requested to stop acquiring, and stop the data push task from pushing data to the requesting end;
[0164] S1140. When there is a data push task that has no registration association with any requesting end, close the data push task;
[0165] S1150. When the candidate request end remains in a state of not having a registration association relationship with any data push task for a preset period of time, disconnect the long-term connection with the candidate request end.
[0166] Accordingly, a data closing request is obtained, the request end corresponding to the data closing request and the data push task corresponding to the traffic simulation data whose acquisition is requested to stop are determined; the registration association relationship between the request end and the data push task corresponding to the traffic simulation data whose acquisition is requested to stop is released, and the data push to the request end by the data push task is stopped; it can enable the request end to stop the data push task corresponding to the traffic simulation data obtained through the data closing request, thereby releasing the platform system memory and reducing the database query pressure in a timely manner. When there is a data push task that has no registration association relationship with any request end, the data push task is closed; when the candidate request end maintains a state of having no registration association relationship with any data push task for a preset duration, the long-term connection with the candidate request end is disconnected; it can clean up the tasks that do not need to continue running currently in a timely manner, and disconnect the connection with the request end that does not need to push data, which can reduce the occupation rate of system resources and improve the system operation efficiency at the same time.
[0167] It should be noted that although the steps of the method in this application are described in a specific order in the drawings, this does not require or imply that these steps must be executed in this specific order, or that all the steps shown must be executed to achieve the desired result. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step for execution, and / or one step may be decomposed into multiple steps for execution, etc.
[0168] The device embodiments of the present application are introduced below, which can be used to execute the traffic simulation data push method in the above embodiments of the present application. Figure 12 Schematically shows the structural block diagram of the traffic simulation data push device provided by the embodiments of the present application. As Figure 12 shown, the traffic simulation data push device 1200 includes:
[0169] A traffic simulation data request parsing module 1210, configured to obtain a traffic simulation data request and parse the traffic simulation data request to obtain parsed data, where the parsed data includes the target traffic simulation area requested by the traffic simulation data request;
[0170] An associated data push task query module 1220, configured to query whether there is an associated data push task in the currently executing data push tasks whose traffic simulation area has a matching relationship with the target traffic simulation area;
[0171] A first data push module 1230, configured to, if there is an associated data push task in the currently executing data push tasks, push the traffic simulation data pushed by the associated data push task to the request end of the traffic simulation data request;
[0172] The second data push module 1240 is configured to, if there is no associated data push task in the currently executed data push task, create a data push task according to the parsed data, and push the traffic simulation data corresponding to the parsed data to the requester of the traffic simulation data request through the newly created data push task.
[0173] In some embodiments of the present application, based on the above embodiments, the second data push module includes:
[0174] A data acquisition unit, configured to create a data acquisition thread, a blocking queue, and a data sending thread according to the parsed data. The data acquisition thread is used to acquire the traffic simulation data corresponding to the parsed data from a preset database. The blocking queue is used to store and transfer the traffic simulation data. The data sending thread is used to send the traffic simulation data to the requester of the traffic simulation data request;
[0175] A data transfer unit, configured to add the traffic simulation data to the blocking queue. When there is no traffic simulation data in the blocking queue, the blocking queue is blocked. When the blocking queue is full of traffic simulation data, the blocking queue is blocked;
[0176] A data push unit, configured to take out the traffic simulation data from the blocking queue and push the traffic simulation data to the requester of the traffic simulation data request through the data sending thread.
[0177] In some embodiments of the present application, based on the above embodiments, the parsed data further includes simulation parameters, and the simulation parameters include one or more of simulation parameters related to the map, simulation parameters related to motor vehicles, simulation parameters related to non-motor vehicles, and simulation parameters related to pedestrians; the data push unit includes:
[0178] A data preprocessing subunit, configured to take out the traffic simulation data from the blocking queue and preprocess the traffic simulation data according to the simulation parameters. The preprocessing includes one or more of simulation data adjustment processing related to the map, simulation data adjustment processing related to motor vehicles, simulation data adjustment processing related to non-motor vehicles, and simulation data adjustment processing related to pedestrians;
[0179] A data push subunit, configured to push the preprocessed traffic simulation data to the requester of the traffic simulation data request through the data sending thread.
[0180] In some embodiments of the present application, based on the above embodiments, the associated data push task includes an associated data acquisition thread, an associated blocking queue, and an associated data sending thread. The first data push module includes:
[0181] A simulation data acquisition unit, configured to acquire traffic simulation data from a preset database through the associated data acquisition thread;
[0182] A simulation data storage unit, configured to store traffic simulation data through an associated blocking queue;
[0183] A simulation data preprocessing unit, configured to retrieve traffic simulation data from the associated blocking queue and preprocess the traffic simulation data according to simulation parameters;
[0184] A simulation data pushing unit, configured to create a new data sending thread and push the preprocessed traffic simulation data to the request side of the traffic simulation data request through the newly created data sending thread.
[0185] In some embodiments of the present application, based on the above embodiments, the traffic simulation data pushing device further includes:
[0186] A simulation data generating unit, configured to generate traffic simulation data through a simulation data generator;
[0187] A Kafka queue storage unit, configured to store traffic simulation data through a Kafka queue and forward the traffic simulation data to a preset database.
[0188] In some embodiments of the present application, based on the above embodiments, the target traffic simulation area is a traffic simulation area including roads of a preset type, where the preset type of roads includes one or more types of roads of each technical standard level; the matching relationship is used to indicate that the traffic simulation area includes the roads of the preset type indicated by the target traffic simulation area; the associated data push task query module includes:
[0189] An associated data push task first query unit, configured to query whether there is an associated data push task in the currently executed data push task where the traffic simulation area includes roads of a preset type.
[0190] In some embodiments of the present application, based on the above embodiments, the target traffic simulation area is a traffic simulation area at a preset position on the map; the matching relationship is used to indicate that there is an overlapping area between two traffic simulation areas; the associated data push task query module further includes:
[0191] An associated data push task second query unit, configured to query whether there is an associated data push task in the currently executed data push task where the traffic simulation area has an overlapping area with the target traffic simulation area.
[0192] In some embodiments of the present application, based on the above embodiments, the associated data push task second query unit includes:
[0193] The first query subunit of the associated data push task is configured to query whether there is an associated data push task in the currently executed data push task where the traffic simulation area is the same as the target traffic simulation area; and
[0194] The second query subunit of the associated data push task is configured to query whether there is an associated data push task in the currently executed data push task where the area ratio of the target overlapping area to the target traffic simulation area is greater than a preset area ratio but less than one, where the target overlapping area is the overlapping area between the traffic simulation area in the currently executed data push task and the target traffic simulation area.
[0195] In some embodiments of the present application, based on the above embodiments, the first query subunit of the associated data push task includes:
[0196] The target task code determination subunit is configured to determine a target task code for the data push task for executing the traffic simulation data request according to the target traffic simulation area;
[0197] The task code query subunit is configured to query whether there is an associated data push task in the currently executed data push task where the task code is the same as the target task code.
[0198] In some embodiments of the present application, based on the above embodiments, the simulation data push device further includes:
[0199] The data push task creation unit is configured to, if there is an associated data push task in the currently executed data push task where the area ratio of the target overlapping area to the target traffic simulation area is greater than a preset area ratio but less than one, create a new data push task, and push the traffic simulation data corresponding to the area outside the overlapping area in the target traffic simulation area to the request side of the traffic simulation data request through the newly created data push task.
[0200] In some embodiments of the present application, based on the above embodiments, the traffic simulation data push device further includes:
[0201] The long-term connection establishment unit is configured to establish a long-term connection with the request side of the traffic simulation data request.
[0202] In some embodiments of the present application, based on the above embodiments, the traffic simulation data push device further includes:
[0203] The first registration association relationship establishment unit is configured to establish a registration association relationship between the request side of the traffic simulation data request and the associated data push task.
[0204] In some embodiments of the present application, based on the above embodiments, the traffic simulation data push device further includes:
[0205] The second registration association relationship establishment unit is configured to establish a registration association relationship between the request end of the traffic simulation data request and the newly created data push task.
[0206] In some embodiments of the present application, based on the above embodiments, the traffic simulation data push device further includes:
[0207] A data closing request obtaining unit is configured to obtain a data closing request, where the data closing request is used to request to stop obtaining traffic simulation data;
[0208] A request stop task determination unit is configured to determine a request end corresponding to the data closing request and a data push task corresponding to the traffic simulation data requested to stop obtaining;
[0209] A registration association release unit is configured to release the registration association between the requesting end and the data push task corresponding to the traffic simulation data requested to stop acquiring, and stop the data push task from pushing data to the requesting end;
[0210] A data push task closing unit is configured to close the data push task when there is a data push task that has no registration association relationship with any request end;
[0211] The long-term connection disconnection unit is configured to disconnect the long-term connection with the candidate request end when the candidate request end remains in a state of not having a registration association relationship with any data push task for a preset period of time.
[0212] The specific details of the traffic simulation data push device provided in each embodiment of the present application have been described in detail in the corresponding method embodiments and will not be repeated here.
[0213] Figure 13 The structure block diagram of a computer system for implementing an electronic device according to an embodiment of the present application is schematically shown.
[0214] It should be noted that Figure 13 The computer system 1300 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0215] like Figure 13As shown, the computer system 1300 includes a central processing unit 1301 (CPU), which can perform various appropriate actions and processes according to a program stored in a read-only memory 1302 (ROM) or a program loaded from a storage section 1308 into a random access memory 1303 (RAM). In the random access memory 1303, various programs and data required for system operation are also stored. The central processing unit 1301, the read-only memory 1302, and the random access memory 1303 are connected to each other via a bus 1304. An input / output interface 1305 (Input / Output interface, i.e., I / O interface) is also connected to the bus 1304.
[0216] The following components are connected to the input / output interface 1305: an input section 1306 including a keyboard, a mouse, etc.; an output section 1307 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 1308 including a hard disk, etc.; and a communication section 1309 including a network interface card such as a local area network card, a modem, etc. The communication section 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to the input / output interface 1305 as needed. A removable medium 1311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1310 as needed so that a computer program read from it can be installed into the storage section 1308 as needed.
[0217] Specifically, according to an embodiment of the present application, the processes described in each method flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1309, and / or installed from the removable medium 1311. When the computer program is executed by the central processing unit 1301, various functions defined in the system of the present application are executed.
[0218] It should be noted that the computer-readable medium shown in the embodiments of the present application may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device. In the present application, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium, and the computer-readable medium may send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted by any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0219] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.
[0220] It should be noted that although several modules or units of a device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of the two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0221] Through the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software or by a combination of software and necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (such as a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
[0222] After considering the specification and practicing the invention disclosed herein, those skilled in the art will readily conceive of other embodiments of the present application. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include well-known knowledge or conventional technical means in the technical field not disclosed in the present application.
[0223] It should be understood that the present application is not limited to the exact structures already described and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.
Claims
1. A traffic simulation data push method, characterized in that, Including: Obtain a traffic simulation data request, and parse the traffic simulation data request to obtain parsed data, where the parsed data includes a target traffic simulation area and simulation parameters requested by the traffic simulation data request; In the currently executed data push task, query whether there is an associated data push task in which the traffic simulation area has a matching relationship with the target traffic simulation area; If there is the associated data push task in the currently executed data push task, push the traffic simulation data pushed by the associated data push task to the request end of the traffic simulation data request; If there is no such associated data push task in the currently executed data push task, create a new data push task according to the parsed data, and push the traffic simulation data corresponding to the parsed data to the request end of the traffic simulation data request through the newly created data push task; The associated data push task includes an associated data acquisition thread for obtaining traffic simulation data from a preset database, an associated blocking queue for storing and relaying the traffic simulation data, and an associated data sending thread. Pushing the traffic simulation data pushed by the associated data push task to the request end of the traffic simulation data request includes: Take out the traffic simulation data from the associated blocking queue, and preprocess the traffic simulation data according to the simulation parameters; Create a new data sending thread, and push the preprocessed traffic simulation data to the request end of the traffic simulation data request through the newly created data sending thread.
2. The traffic simulation data pushing method according to claim 1, wherein Creating a new data push task according to the parsed data, and pushing the traffic simulation data corresponding to the parsed data to the request end of the traffic simulation data request through the newly created data push task includes: Create a data acquisition thread, a blocking queue, and a data sending thread according to the parsed data. Use the data acquisition thread to obtain the traffic simulation data corresponding to the parsed data from a preset database. The blocking queue is used to store and relay the traffic simulation data, and the data sending thread is used to send the traffic simulation data to the request end of the traffic simulation data request; Add the traffic simulation data to the blocking queue. When there is no traffic simulation data in the blocking queue, the blocking queue is blocked. When the blocking queue is full of traffic simulation data, the blocking queue is blocked; Take out the traffic simulation data from the blocking queue, and push the traffic simulation data to the request end of the traffic simulation data request through the data sending thread.
3. The traffic simulation data pushing method according to claim 2, wherein The simulation parameters include one or more of simulation parameters related to the map, simulation parameters related to motor vehicles, simulation parameters related to non-motor vehicles, and simulation parameters related to pedestrians. Taking out the traffic simulation data from the blocking queue and pushing the traffic simulation data to the request end of the traffic simulation data request through the data sending thread includes: Take out the traffic simulation data from the blocking queue, and preprocess the traffic simulation data according to the simulation parameters. The preprocessing includes one or more of simulation data adjustment processing related to the map, simulation data adjustment processing related to motor vehicles, simulation data adjustment processing related to non-motor vehicles, and simulation data adjustment processing related to pedestrians; Push the preprocessed traffic simulation data to the request side of the traffic simulation data request through the data sending thread.
4. The traffic simulation data pushing method according to claim 1, wherein Before the traffic simulation data request is obtained, the method further includes: Generate traffic simulation data through a simulation data generator; Store the traffic simulation data through a Kafka queue and forward the traffic simulation data to the preset database.
5. The traffic simulation data pushing method according to claim 1, wherein The target traffic simulation area is a traffic simulation area including roads of a preset type, where the preset type of roads includes one or more of roads of various technical standard levels; the matching relationship is used to indicate that the traffic simulation area includes the roads of the preset type indicated by the target traffic simulation area; in the currently executed data push task, querying whether there is an associated data push task in which the traffic simulation area has a matching relationship with the target traffic simulation area includes: In the currently executed data push task, query whether there is an associated data push task in which the traffic simulation area includes the roads of the preset type.
6. The traffic simulation data pushing method according to claim 1, wherein The target traffic simulation area is a traffic simulation area at a preset position on the map; the matching relationship is used to indicate that there is an overlapping area between two traffic simulation areas; In the currently executed data push task, querying whether there is an associated data push task in which the traffic simulation area has a matching relationship with the target traffic simulation area includes: In the currently executed data push task, query whether there is an associated data push task in which the traffic simulation area has an overlapping area with the target traffic simulation area.
7. The traffic simulation data pushing method according to claim 6, wherein In the currently executed data push task, querying whether there is an associated data push task in which the traffic simulation area has an overlapping area with the target traffic simulation area includes: In the currently executed data push task, query whether there is an associated data push task in which the traffic simulation area is the same as the target traffic simulation area; and In the currently executed data push task, query whether there is an associated data push task in which the area ratio of the target overlapping area to the target traffic simulation area is greater than a preset area ratio but less than one, where the target overlapping area is the overlapping area between the traffic simulation area in the currently executed data push task and the target traffic simulation area.
8. The simulation data pushing method according to claim 7, wherein, In the currently executed data push task, querying whether there is an associated data push task in which the traffic simulation area is the same as the target traffic simulation area includes: Determine the target task code for the data push task for executing the traffic simulation data request according to the target traffic simulation area; In the currently executed data push task, query whether there is an associated data push task with a task code the same as the target task code.
9. The traffic simulation data pushing method according to claim 7, wherein, After querying whether there is an associated data push task in which the target overlapping area accounts for an area ratio of the target traffic simulation area that is greater than a preset area ratio but less than one in the currently executed data push task, the method further includes: If there is an associated data push task in the currently executed data push task in which the target overlapping area accounts for an area ratio of the target traffic simulation area that is greater than the preset area ratio but less than one, a new data push task is created, and the traffic simulation data corresponding to the area outside the overlapping area in the target traffic simulation area is pushed to the request end of the traffic simulation data request through the newly created data push task.
10. The traffic simulation data pushing method according to claim 1, wherein, After obtaining the traffic simulation data request, the method further includes: Establishing a long-term connection with the requesting end of the traffic simulation data request; Before pushing the traffic simulation data pushed by the associated data pushing task to the requesting end of the traffic simulation data request, the method further includes: Establishing a registration association relationship between the request end of the traffic simulation data request and the associated data push task; Before pushing the traffic simulation data corresponding to the parsed data to the requesting end of the traffic simulation data request through the newly created data pushing task, the method further includes: A registration association relationship is established between the requesting end of the traffic simulation data request and the newly created data push task.
11. The traffic simulation data pushing method according to claim 10, wherein The traffic simulation data pushing method further includes: Obtaining a data closing request, wherein the data closing request is used to request to stop obtaining traffic simulation data; Determine the request end corresponding to the data closing request and the data push task corresponding to the traffic simulation data requested to stop obtaining; Release the registration association between the requesting end and the data push task corresponding to the traffic simulation data requested to stop acquiring, and stop the data push task from pushing data to the requesting end; When there is a data push task that has no registration association relationship with any request end, close the data push task; When the candidate request end remains in a state of not having a registration association relationship with any data push task for a preset period of time, the long-term connection with the candidate request end is disconnected.
12. A traffic simulation data push device, characterized in that include: A traffic simulation data request parsing module is configured to obtain a traffic simulation data request and parse the traffic simulation data request to obtain parsed data, wherein the parsed data includes a target traffic simulation area and simulation parameters requested by the traffic simulation data request; The associated data push task query module is configured to query whether there is an associated data push task whose traffic simulation area has a matching relationship with the target traffic simulation area in the currently executed data push task; A first data pushing module is configured to push the traffic simulation data pushed by the associated data pushing task to the requesting end of the traffic simulation data request if the associated data pushing task exists in the currently executed data pushing task; The second data push module is configured to, if the associated data push task does not exist in the currently executed data push task, create a data push task according to the parsed data, and push the traffic simulation data corresponding to the parsed data to the request side of the traffic simulation data request through the newly created data push task; The associated data push task includes an associated data acquisition thread for acquiring traffic simulation data from a preset database, an associated blocking queue for storing and relaying the traffic simulation data, and an associated data sending thread. Pushing the traffic simulation data pushed by the associated data push task to the request side of the traffic simulation data request includes: Taking out the traffic simulation data from the associated blocking queue, and preprocessing the traffic simulation data according to the simulation parameters; Creating a new data sending thread, and pushing the preprocessed traffic simulation data to the request side of the traffic simulation data request through the newly created data sending thread.
13. A computer-readable medium, characterized in that, It stores a computer program, which when executed by a processor implements the traffic simulation data push method according to any one of claims 1 to 11.
14. An electronic device, characterized in that, Including: A processor; And A memory for storing executable instructions of the processor; Wherein, the processor is configured to execute the traffic simulation data push method according to any one of claims 1 to 11 by executing the executable instructions.
15. A computer program product, characterized in that, Including computer instructions, which when executed by a processor of a computer device, cause the computer device to implement the traffic simulation data push method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Road condition display method and apparatus
CN106599217A
Multi-source data integration method and system based on big data technology
CN113051332A