A method and system for transmitting vehicle data
By using a database with publish and subscribe functions in the vehicle data transmission system, the problem of redundant code and long adaptation time of the traditional CAN matrix when processing real-time vehicle data is solved, and high-speed transmission and code maintainability are improved, adapting to The needs of modern TBOX architecture.
Patent Information
- Application Number
- CN202410815218.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-06-24
AI Technical Summary
When processing a large amount of real-time vehicle data, the traditional CAN matrix faces problems such as increased complexity in redundant code writing, development and maintenance, and long adaptation time, which affects system stability and efficiency.
Use a database with publish and subscribe functions to replace the CAN matrix, achieve high-speed transmission through the database's high-speed reading and writing and data organization capabilities, reduce redundant code writing, and improve code maintainability and scalability.
It achieves high-speed transmission of vehicle data, reduces development burden, improves code maintainability and scalability, avoids data transmission delays or losses, and adapts to the needs of modern TBOX architecture.
Smart Images

Figure CN118382078B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a vehicle data transmission method and system. Background Art
[0002] Sensors or other electronic components on the vehicle generate data, such as vehicle status data and vehicle location data, etc. The data is transmitted to the TBOX through the vehicle communication system. The traditional vehicle communication system uses the CAN (Controller Area Network) matrix, which is a commonly used data transmission protocol for describing messages and signals in the network. However, the CAN matrix faces many challenges in processing large amounts of real-time vehicle data, especially in the modern TBOX architecture. Using the CAN matrix requires writing a lot of redundant code, and different vehicle models require re-adapting the CAN matrix, which not only increases the complexity of development and maintenance, but may also affect the stability and efficiency of the system. With the increase in vehicle models, this problem will be further exacerbated.
[0003] Figure 1 This is a schematic diagram of TBOX receiving vehicle data under the communication architecture of the traditional CAN matrix. After the sensor on vehicle 1 collects data (such as vehicle status data and vehicle location data), it transmits the data to the corresponding ECU1, ECU2 or ECU3. After receiving the data, the ECU adapts the internal CAN matrix, and then transmits the data to the gateway through the middleware (such as someip). After the gateway receives the data, it transmits it to TBOX. TBOX adapts the CAN matrix according to the matrix table of different models, thereby receiving the data collected by the vehicle. After replacing vehicle 1 with vehicle 2 or vehicle 3 of different models, the ECU and TBOX on vehicle 1 can no longer be used, and the CAN matrix needs to be adapted according to the matrix table of different models. Then the universal ECU and TBOX need to maintain the matrix adaptation code of many models. If the functions of the models overlap, it is necessary to write a lot of duplicate code to adapt the code according to the model. If the function interface of the previous vehicle is called, it is not conducive to the management of the architecture in terms of software architecture. Moreover, the CAN matrix takes a long time in the adaptation process, and it is impossible to transmit the vehicle data that needs to respond quickly in time.
[0004] In view of this, the present invention is proposed. Summary of the invention
[0005] The purpose of the present invention is to provide a vehicle data transmission method and system, which utilizes the publishing and subscription functions of the database to replace the CAN matrix with the database. It is no longer necessary to write a large amount of redundant code for each vehicle model to handle data transmission, which greatly reduces the burden of development work and improves the maintainability and scalability of the code.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] In a first aspect, the present invention provides a vehicle data transmission system, comprising: a publishing end, a first database and a subscription end; the database has a publishing and subscribing function;
[0008] The publishing end is used to obtain vehicle-related data and publish the data to a designated channel of the first database;
[0009] The first database is used to send data of the corresponding channel to the subscriber according to the channel pre-subscribed by the subscriber.
[0010] In a second aspect, the present invention provides a method for transmitting vehicle data, comprising:
[0011] The publishing end obtains vehicle-related data;
[0012] The publishing end publishes the data to a designated channel of the first database; the database has a publish-subscribe function;
[0013] The first database sends data of a corresponding channel to the subscriber according to the channel pre-subscribed by the subscriber.
[0014] Compared with the prior art, the present invention has the following beneficial effects:
[0015] By adopting a database with publish-subscribe functions for vehicle data transmission instead of the CAN matrix, there is no need for adaptation; by utilizing the database's high-speed reading and writing and data organization capabilities, high-speed transmission is achieved. There is no need to write a large amount of redundant code for each vehicle model to handle data transmission, which greatly reduces the burden of development work and improves the maintainability and scalability of the code. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 It is a schematic diagram of using CAN matrix to transmit vehicle data;
[0018] Figure 2 is a schematic diagram of the structure of a vehicle data transmission system provided by an embodiment of the present invention;
[0019] Figure 3This is a schematic diagram of data interaction between each service component and ECU in TBOX provided by an embodiment of the present invention;
[0020] Figure 4 is a schematic diagram of transmission of off-vehicle data provided by an embodiment of the present invention;
[0021] Figure 5 It is a schematic diagram of the interaction between APP and TBOX data provided by an embodiment of the present invention;
[0022] Figure 6 The present invention provides a flow chart of a vehicle data transmission method. DETAILED DESCRIPTION
[0023] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0024] As mentioned in the background technology, the prior art uses a CAN matrix to transmit vehicle data, which results in a large number of codes in the TBOX and ECU needing to be modified when changing the vehicle model; and the transmission mode of the CAN matrix takes a long time in the adaptation process, and key data cannot be transmitted in time. Therefore, the present invention uses a database with a publish-subscribe function to replace the CAN matrix, which constrains the input and output data types and does not require adaptation; the high-speed reading and writing and data organization capabilities of the database are utilized to achieve high-speed transmission, and it is no longer necessary to write a large amount of redundant code for each vehicle model to process data transmission, which greatly reduces the burden of development work and improves the maintainability and scalability of the code. The present invention is further described in detail below in conjunction with the embodiments.
[0025] Example 1
[0026] Figure 2 This is a schematic diagram of the structure of a vehicle data transmission system provided by this embodiment. This embodiment is applicable to the case where data generated in the vehicle or acquired outside the vehicle is transmitted to the vehicle's subscription end. When the subscription end is TBOX or ECU, after changing the vehicle model, TBOX or ECU can still be transplanted to the new vehicle model, without writing a large amount of redundant code, only the publishing and subscription channels need to be updated, and all vehicle models are adapted.
[0027] like Figure 2 As shown, the vehicle data transmission system includes a publishing end, a first database and a subscription end. The subscription end can be a subject such as TBOX, a vehicle domain controller, etc. that needs to subscribe to data from the first database.
[0028] The publishing end is used to obtain vehicle-related data and publish the data to a designated channel of the first database. For the convenience of description and distinction, the embodiment of the present invention refers to the end that publishes data to the first database as the publishing end. This embodiment does not limit what the publishing end is specifically, and it can be an electronic control unit ECU or a vehicle networking platform TSP. Any device / platform that can publish vehicle-related data to the first database is within the protection scope of this embodiment. There is no limit to the number of publishing ends, Figure 2 Three publishers are shown, namely publisher 1, publisher 2 and publisher 3, and the types of the publishers may be the same or different.
[0029] Vehicle-related data can be data collected by sensors, data input by users, data sent from roadside equipment or the cloud, etc. The data type can be vehicle status data or vehicle location data.
[0030] For the convenience of description and distinction, the database subscribed by the subscribers such as TBOX is referred to as the first database, and the database subscribed by the Internet of Vehicles platform in the following embodiments is referred to as the second database. Figure 2 Three first databases are shown.
[0031] Optionally, the publisher agrees on the data structure with the subscriber (such as TBOX) in advance to process the data to be published. The data structure here includes the type of data, the organization form of the data, the numerical format requirements, etc. For example, the data type includes vehicle status and vehicle location, and the organization form of the data includes compression form, encoding form, splicing form, etc. The value can be a floating point or integer. By agreeing on the data structure, the publisher can publish the data structure desired by the subscriber to the database, without the need to transmit irrelevant data, thereby improving communication efficiency; after the data organized into a data structure is transmitted to the subscriber, the processing amount of the subscriber can be reduced, thereby improving the data processing efficiency of the subscriber.
[0032] Optional, see Figure 2 After acquiring the vehicle-related data, the publisher constructs the data type and value into a key-value pair and publishes it to the designated channel of the first database. Therefore, this embodiment requires that the first database needs to store data in the form of key-value pairs. The key represents the type of data, including multiple fields; the value is the corresponding value, also including multiple fields. For example, the key is the window opening and the door opening, and the value is the opening value of 50% and 100%. This embodiment uses the organization form of key-value pairs to facilitate the subscriber to subscribe to data of the corresponding type.
[0033] The first database has a publish-subscribe function, including multiple data transmission channels, each of which stores and transmits different types of data. For example, channel 1 is a vehicle status data transmission channel, and channel 2 is a vehicle position data transmission channel (hereinafter referred to as channels).
[0034] This embodiment does not limit the type of database, and it may be a SQL Server database, a PostgreSQL database, or a Redis (REmote DIctionary Server) database, as long as it has a publish-subscribe function.
[0035] SQL Server Database You can use the Subscription Options page of the Publication Properties dialog box to view and set publication-level properties associated with a subscription. The properties are divided into the following categories: properties that apply to all publications; properties that apply to snapshot and transactional publications (including properties that allow updating subscriptions); and properties that apply to merge publications. Subscription types include push subscriptions and pull subscriptions.
[0036] PostgreSQL database is an open source relational database management system. PostgreSQL uses multi-version concurrency control (MVCC) to handle concurrent access, ensuring data consistency and reliability. PostgreSQL supports horizontal and vertical expansion, and can be easily expanded to large-scale data sets and high concurrent access. PostgreSQL strictly follows the SQL standard and supports most SQL standard features, such as foreign keys, triggers, views, etc. PostgreSQL supports advanced functions such as complex queries, custom functions, stored procedures, geographic information systems, etc. PostgreSQL provides powerful security features, including SSL support, access control, and data encryption.
[0037] Preferably, the first database and the second database in the following embodiments are both Redis databases. Redis is an open source, high-performance key-value database developed by Salvatore Sanfiippo in C language. It is often referred to as a data structure server because values can be strings, hashes, lists, sets, and sorted sets. The Redis database has the characteristics of data persistence, distribution, and multithreading, and can achieve efficient transmission and sharing of data. Redis supports data backup, i.e., data backup in master-slave mode, which effectively prevents data loss.
[0038] The Redis database provides a publish / subscribe function, which allows subscribers to subscribe to one or more channels. When these channels have messages published, the subscribed subscribers will receive the messages. The following are the basic steps to use the Redis publish / subscribe function: 1. Subscribe to a channel: The subscriber can use the SUBSCRIBE command to subscribe to one or more channels. 2. Publish a message: The publisher uses the PUBLISH command to send a message to the channel. 3. Receive a message: The subscriber will receive the message. Through the subscription function of Redis, the message publisher and the subscriber can be decoupled. The message publisher only needs to publish the message to the corresponding channel without knowing which subscribers there are. The subscriber only needs to subscribe to the corresponding channel. The advantage of this is that the decoupling between the two parties is achieved, so that the message publisher and the subscriber can change independently without affecting each other. The subscription function of Redis supports asynchronous communication, that is, the message publisher does not need to wait for the response of the subscriber to perform subsequent operations. This can make the entire message transmission process more efficient and improve the response speed of the system. The subscription function of Redis supports multiplexing, that is, multiple channels can be subscribed to at the same time in a subscriber, so that multiple different message transmissions can be realized through a subscriber. Doing so can reduce both the complexity of the system and the system overhead.
[0039] Optionally, there can be multiple first databases to store different types of data in a distributed manner, thereby expanding the storage space. The publisher needs to publish the key-value pair to the specified channel of the first database that matches the data type. Figure 2 , publishing end 1 publishes data of a certain data type to first database 1, publishing end 2 publishes data of a certain data type to first database 2, and publishing end 3 publishes data of a certain data type to first database 3.
[0040] Any subscriber with access rights to the first database can subscribe to data from the first database. This embodiment focuses on the process of the subscriber subscribing to data from the first database. TBOX needs to subscribe to the required channels from the first database in advance, that is, the channels where the required data types are published. Preferably, the subscriber (such as TBOX) includes multiple business components, such as a data reporting component, a Unified Diagnostic Service (UDS) component, a remote control component, a system management component and an X-Call component. Among them, X-Call is a collective name for E-Call (emergency rescue call system), B-Call (non-accident road rescue) and I-Call (information service) functions. Each business component requires different data types, and can subscribe to channels separately in the first data in advance, so as to achieve accurate data transmission.
[0041] Figure 3 It is a schematic diagram of data interaction between each business component and ECU in TBOX provided by an embodiment of the present invention. The names of the business components are data reporting, UDS, remote control, system management and XCALL. Each ECU publishes the acquired data to the corresponding Redis database, and each business component subscribes to a channel in the corresponding Redis database in advance according to demand, so that after the Redis database receives the data published by the ECU, it can send the required data to the business component. The ECU can also subscribe to the data published by other ECUs in the Redis database. After the business component or ECU processes the data, it can publish the new data to the channel of the specified Redis database again for other ECUs to subscribe. Figure 3 Three first databases are shown, namely Redis1, Redis2 and Redis3. A business component can subscribe to at least one Redis database, and an ECU can also subscribe to at least one Redis database. The Redis database serves as a bridge for data transfer between ECUs and between ECUs and business components.
[0042] After receiving the data on the corresponding channel, the first database sends the data on the corresponding channel to TBOX, specifically to the service component of TBOX, according to the channel pre-subscribed by TBOX. The service component of TBOX then processes the received data.
[0043] In the embodiment of the present invention, a database with a publish-subscribe function is used to transmit vehicle data instead of a CAN matrix, and no adaptation is required. The high-speed reading and writing and data organization capabilities of the database are utilized to achieve high-speed transmission, and there is no need to write a large amount of redundant code for each vehicle model to process data transmission, which greatly reduces the burden of development work and improves the maintainability and scalability of the code.
[0044] Redis database is a high-performance key-value storage system with features such as data persistence, distribution, and multi-threading. It can realize efficient data transmission and sharing, and effectively solve the problem of limited CAN matrix transmission efficiency, especially in the case of large data volume or high real-time requirements, and can avoid data transmission delays or losses.
[0045] Since the transmission method of the Redis database is flexible and can be flexibly adjusted according to actual needs, unlike the CAN matrix where the transmission method is fixed, it can better adapt to the needs of the modern TBOX architecture and improve the flexibility of data transmission.
[0046] Since all ECU data is transmitted through the Redis database, TBOX obtains data directly from the Redis database without distinguishing between vehicle models, and the data is more flexible, thereby simplifying the code structure and making the code easier to maintain and expand.
[0047] Example 2
[0048] The above embodiment describes the process of data from the publisher to the subscriber. This embodiment describes the process of the subscriber returning data to the publisher through the database.
[0049] The subscriber is used to generate new data after processing the subscribed data, and publish the new data and / or local data to the designated channel of the first database. The subscriber may change the data type or maintain the original data type during the data processing. After organizing the data into key-value pairs, the subscriber publishes the new data to the channel matching the key according to the data type (key) of the new data.
[0050] Furthermore, the first database is also used to return new data and / or local data of the corresponding channel to the publishing end according to the channel pre-subscribed by the publishing end. The publishing end here includes but is not limited to ECU and Internet of Vehicles platform. The publishing end also needs to subscribe to the channel in the first database in advance, so as to subscribe to the new data generated by the subscribing end.
[0051] Furthermore, it should be added that, in addition to new data, the subscriber (e.g., TBOX or ECU) can also publish direct local data (organized as key-value pairs) to the designated channel of the first database, and thus transmit it to the publisher, thus realizing one-way transmission from TBOX to ECU or IoV platform.
[0052] In combination with Embodiment 1 and Embodiment 2, both the subscriber and publisher can publish data and subscribe to data in the first database, thereby realizing two-way flow of data.
[0053] Example 3
[0054] Based on the above embodiments, this embodiment refines the publishing end into ECU and Internet of Vehicles platform, and describes in detail the solution provided by this embodiment from the two perspectives of in-vehicle data transmission and out-of-vehicle data transmission.
[0055] Continue to see Figure 2 The publishing end includes an electronic control unit ECU deployed on the vehicle, which is suitable for in-vehicle data transmission. The ECU is used to obtain data collected by sensors on the vehicle and publish the data to a specified channel of the first database; the first database is also used to send data of the corresponding channel to the ECU according to the channel pre-subscribed by the ECU.
[0056] Like TBOX, ECU can also subscribe to data from the first database, that is, it needs to subscribe to the required channels from the first database in advance, so that after the first database receives data from the corresponding channel, it sends the data of the corresponding channel to ECU according to the channel pre-subscribed by ECU. ECU then processes the received data. For example, vehicle status data is sent to ECU1 and continues to be published to the first database. Vehicle location data is sent to ECU2, and ECU2 subscribes to the first database for vehicle status data published by ECU1, and ECU2 then merges the vehicle status data with the vehicle location data for processing.
[0057] This embodiment realizes data sharing between ECUs through the publish-subscribe function of the database. The ECU also does not need to adapt the CAN matrix, and no longer needs to write a large amount of redundant code for each vehicle model to handle data transmission, which effectively solves the problem of limited CAN matrix transmission efficiency.
[0058] See also Figure 4 ,The vehicle data transmission system includes a vehicle networking platform (Telematics Service Provider, TSP), a second database, an off-vehicle communication subject, a first database and TBOX.
[0059] Among them, TSP provides a business model for connecting, managing and applying vehicle-related data. It usually includes installing sensors, communication equipment and software systems in the vehicle to monitor, collect and transmit vehicle data and Internet of Vehicles data in real time, and then use this data for various purposes such as vehicle tracking, remote diagnosis, vehicle safety, driving analysis, navigation and entertainment.
[0060] The off-vehicle communication subject is a communication subject that is interconnected with the vehicle TBOX, such as a mobile terminal, roadside equipment, TBOX of other vehicles, etc. The off-vehicle communication subject cannot directly access the first database, and a second database needs to be set up for the off-vehicle communication subject to publish and subscribe.
[0061] It should be noted that the first database and the second database may be deployed in different storage media respectively, or may be deployed in the same storage medium.
[0062] Optionally, the storage medium can be a computer-readable signal medium or a computer-readable storage medium. The medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of the medium (a non-exhaustive list) include: an electrical connection with 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 or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, device or device.
[0063] Different access permissions are set for the first database and the second database so that different communication subjects can publish and subscribe.
[0064] The off-vehicle communication subject publishes the vehicle-related data to the designated channel of the second database. Specifically, the off-vehicle communication subject constructs the data type and value into a key-value pair, and publishes the key-value pair to the corresponding channel of the second database according to the data type. The Internet of Vehicles platform needs to pre-subscribe to the required channels in the second database, and then the second database publishes the data of the corresponding channels to the Internet of Vehicles platform according to the channels pre-subscribed by the Internet of Vehicles platform. The Internet of Vehicles platform publishes the data to the designated channel of the first database, and then the first database sends the data of the corresponding channels to TBOX or ECU according to the channels pre-subscribed by TBOX or ECU.
[0065] Optionally, if TBOX or ECU wants to subscribe to data in the first database, the Internet of Vehicles platform as the publishing end is also used to process the data to be published according to the data structure agreed with the subscriber (TBOX or ECU). For details, please refer to the records of Example 1, which will not be repeated here.
[0066] The following is a detailed description of the communication process between the external vehicle communication subject and TBOX using a specific embodiment. The external vehicle communication subject is a mobile terminal, which is used to publish the data of scheduled charging to the designated channel of the second database; the second database is used to send the data of scheduled charging to the Internet of Vehicles platform according to the channel pre-subscribed by the Internet of Vehicles platform; the Internet of Vehicles platform is used to publish the data of scheduled charging to the designated channel of the first database; the first database is used to send the data of scheduled charging to the TBOX according to the channel pre-subscribed by TBOX; TBOX is used to charge according to the data of scheduled charging and publish the charging time to the designated channel of the first database; the first database is used to send the charging time to the Internet of Vehicles platform according to the channel pre-subscribed by the Internet of Vehicles platform; the Internet of Vehicles platform is used to publish the charging time to the designated channel of the second database; the second database is used to send the charging time to the mobile terminal according to the channel pre-subscribed by the mobile terminal.
[0067] See also Figure 5 , the first database is the mqtt_redis database, and the second database is the tsp_redis database. The external communication subject is specifically an application APP in the mobile phone.
[0068] The APP can execute control operations such as charging reservations for vehicles or charging reservations for electrical equipment through the vehicle battery, and generate specific data in response to the user's trigger operation, such as data for charging reservations to start charging at 2 pm. The APP organizes the charging reservation data into key-value pairs key1_value1 and publishes them to the specified channel of the tsp_redis database. The TSP platform pre-subscribes to the channel where key1_value1 is located. When the APP publishes to the tsp_redis database, it triggers the TSP platform to receive the charging reservation data.
[0069] Then, TSP processes the data to be published according to the data structure agreed with TBOX. Assume that the data structure published to the mqtt_redis database after processing is key2_value2.
[0070] TBOX subscribes to key2_value2 data. Similarly, when the TSP platform publishes data to the mqtt_redis database, TBOX will subscribe to key2_value2 data. TBOX sends the charging time to the vehicle and sends the charging time to the data reporting module. The data reporting module publishes it to the mqtt_redis database. The vehicle charges according to the charging time.
[0071] After TBOX publishes the data of scheduled charging to the vehicle, it needs to reply to the TSP platform to ensure that the APP can display the charging time (for example, charging for 2 minutes). TBOX publishes the charging time to the mqtt_redis database (publish is used for publishing data, and subscribe is used for subscribing data), and the data structure also uses key2_value2. After TSP subscribes to the key2_value2 data, it processes the data into key1_value1 according to the data structure agreed with the APP, and then publishes it to the tsp_redis database. The APP subscribes to the key1_value1 data of the tsp_redis database, and finally displays the charging time on the APP interface.
[0072] During the off-vehicle data transmission process, the above embodiment uses two databases as data transfer stations. In fact, at least one database can be set between any two different types of communication subjects. For example, the ECU publishes the vehicle status data of the sensor to the third database, the domain controller subscribes to the required vehicle status data from the third database, processes the vehicle status data to obtain identification data, and publishes the identification data to the first database. TBOX subscribes to the identification data from the first database. Then, the identification data is aggregated and published back to the first database. The TSP platform subscribes to the aggregated data from the first database and then publishes it to the second database. The mobile phone APP subscribes to the aggregated data from the second database.
[0073] The capacity and number of databases that need to be set can be determined between the communication subjects according to the amount of data to be transmitted. According to the response speed requirements of the data, the database type corresponding to the read and write rate is set. Before actually publishing and subscribing to data, it is necessary to select a database with a corresponding read and write rate for channel agreement based on the data's requirements for response speed. For example, if the alarm data requires the fastest response, the TBOX and ECU must pre-agree on the publishing and subscription channels in the database with the fastest read and write rate.
[0074] In the embodiment of the present invention, the TBOX software architecture uses the Redis database to transmit vehicle data, which effectively increases the data transmission efficiency. TBOX no longer adapts the CAN matrix according to the vehicle model, but directly reads data from the database, which can inherit the previous code and is easy to maintain in terms of software architecture. The Redis data transmission method is very flexible and can be flexibly adjusted according to actual needs. This architecture can be used for data communication inside and outside the vehicle, and supports two-way data transmission.
[0075] Example 4
[0076] Figure 6It is a flowchart of a vehicle data transmission method provided in an embodiment of the present invention, which is executed by the vehicle data transmission system provided in the aforementioned embodiment and is suitable for transmitting data generated in the vehicle or obtained outside the vehicle to the vehicle subscription end.
[0077] Specifically, the vehicle data transmission method provided in this embodiment includes:
[0078] S110, the publishing end obtains vehicle-related data.
[0079] S120, the publishing end publishes the data to a designated channel of the first database; the database has a publish-subscribe function.
[0080] S130. The first database sends data of the corresponding channel to the subscriber according to the channel pre-subscribed by the subscriber.
[0081] Optionally, after S130, the subscriber generates new data after processing the subscribed data, and publishes the new data and / or local data to a designated channel of the first database; the first database returns the new data and / or local data of the corresponding channel to the publisher according to the channel pre-subscribed by the publisher.
[0082] Optionally, the publishing end includes an ECU deployed on the vehicle, and the publishing end obtains vehicle-related data, and publishing the data to a designated channel of the first database includes: the ECU obtains data collected by a sensor on the vehicle, and publishes the data to a designated channel of the first database. After publishing the data to the designated channel of the first database, the first database also includes: according to the channel pre-subscribed by the ECU, the first database sends the data of the corresponding channel to the ECU.
[0083] Optionally, the publishing end includes a vehicle networking platform, and the publishing end obtains the vehicle-related data including the vehicle networking platform subscribing to the vehicle-related data from the second database. Before the vehicle networking platform subscribes to the vehicle-related data from the second database, it also includes: the external communication subject publishes the vehicle-related data to a designated channel of the second database; the second database publishes the data of the corresponding channel to the vehicle networking platform according to the channel pre-subscribed by the vehicle networking platform.
[0084] Optionally, the external communication subject is a mobile terminal, and the publishing end obtains vehicle-related data including: the mobile terminal publishes the charging reservation data to the designated channel of the second database; the second database sends the charging reservation data to the Internet of Vehicles platform according to the channel pre-subscribed by the Internet of Vehicles platform; the Internet of Vehicles platform publishes the charging reservation data to the designated channel of the first database; the first database sends the charging reservation data to the TBOX according to the channel pre-subscribed by TBOX; further, the vehicle data transmission method also includes: TBOX charges according to the charging reservation data, and publishes the charging time to the designated channel of the first database; the first database sends the charging time to the Internet of Vehicles platform according to the channel pre-subscribed by the Internet of Vehicles platform; the Internet of Vehicles platform publishes the charging time to the designated channel of the second database; the second database sends the charging time to the mobile terminal according to the channel pre-subscribed by the mobile terminal.
[0085] Optionally, before publishing the data to a designated channel of the first database, the publishing end is further used to process the data to be published according to a data structure agreed upon with the subscriber end; the subscriber end includes TBOX and ECU.
[0086] Optionally, the subscriber terminal includes a plurality of service components. Each service component subscribes to a channel in the first data before sending data of a corresponding channel to the subscriber terminal according to the channel pre-subscribed by the subscriber terminal.
[0087] Optionally, the first database or the second database is a Redis database.
[0088] Optionally, after acquiring the vehicle-related data, the publishing end further includes constructing the type and value of the data into a key-value pair and publishing it to a designated channel of the first database.
[0089] Compared with the existing technology, the beneficial effects of this technical solution are as follows:
[0090] 1. Reduce redundant code: By using the Redis database for vehicle data transmission, there is no need to write a large amount of redundant code for each model to handle data transmission, which greatly reduces the burden of development work and improves the maintainability and scalability of the code.
[0091] 2. Improve data transmission efficiency: Redis database is a high-performance key-value storage system with features such as data persistence, distribution, and multi-threading. It can realize efficient data transmission and sharing, and effectively solve the problem of limited CAN matrix transmission efficiency, especially in the case of large data volume or high real-time requirements, and can avoid data transmission delays or losses.
[0092] 3. Enhanced data transmission flexibility: Since the transmission method of the Redis database is flexible, it can be flexibly adjusted according to actual needs. Unlike the CAN matrix, the transmission method is no longer fixed. Therefore, it can better adapt to the needs of the modern TBOX architecture and improve the flexibility of data transmission.
[0093] 4. Simplified code structure: Since all ECU data is transmitted through the Redis database, TBOX obtains data directly from the Redis database without distinguishing between vehicle models. The data is also more flexible, which simplifies the code structure and makes the code easier to maintain and expand.
[0094] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0095] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A vehicle data transmission system, characterized in that: include: A publishing end, a first database, a second database, an external vehicle communication subject and a subscription end; The database has a publish-subscribe function; the publishing end includes a vehicle networking platform; The publishing end is used to obtain vehicle-related data and publish the data to a designated channel of the first database; The first database is used to send data of the corresponding channel to the subscriber according to the channel pre-subscribed by the subscriber; The off-vehicle communication subject is used to publish vehicle-related data to a designated channel of the second database; The second database is used to send data of the corresponding channel to the Internet of Vehicles platform according to the channel pre-subscribed by the Internet of Vehicles platform; or send data of the corresponding channel to the external communication subject according to the channel pre-subscribed by the external communication subject; The first database is also used to return new data and / or local data of the corresponding channel to the publishing end according to the channel pre-subscribed by the publishing end.
2. The system according to claim 1, characterized in that The subscriber is used to generate new data after processing the subscribed data, and publish the new data and / or local data to a designated channel of the first database.
3. The system according to claim 1, characterized in that The publishing end includes an electronic control unit ECU deployed on the vehicle; The ECU is used to obtain data collected by sensors on the vehicle and publish the data to a designated channel of the first database; The first database is further used to send data of a corresponding channel to the ECU according to the channel pre-subscribed by the ECU.
4. The system according to claim 1, characterized in that The external vehicle communication subject is a mobile terminal. The mobile terminal is used to publish the charging reservation data to a designated channel of the second database; The second database is used to send the scheduled charging data to the Internet of Vehicles platform according to the channel pre-subscribed by the Internet of Vehicles platform; The Internet of Vehicles platform is used to publish the scheduled charging data to a designated channel of the first database; The first database is used to send the scheduled charging data to the TBOX according to the channels pre-subscribed by the TBOX; The TBOX is used to charge according to the reserved charging data and publish the charging time to a designated channel of the first database; The first database is used to send the charging time to the Internet of Vehicles platform according to the channel pre-subscribed by the Internet of Vehicles platform; The Internet of Vehicles platform is used to publish the charging time to a designated channel of the second database; The second database is used to send the charging time to the mobile terminal according to the channel pre-subscribed by the mobile terminal.
5. The system according to claim 1, characterized in that Before publishing the data, the publishing end is also used to process the data to be published according to the data structure agreed with the subscriber end; The subscription end includes TBOX and ECU.
6. The system according to claim 1, characterized in that The subscription end includes multiple business components; Each business component is used to subscribe to a channel in the first data in advance.
7. The system according to any one of claims 1 to 6, characterized in that: The first database or the second database is a Redis database.
8. The system according to any one of claims 1 to 6, characterized in that: After acquiring the vehicle-related data, the publishing end is used to construct the type and value of the data into a key-value pair and publish it to a designated channel of the first database.
9. A method for transmitting vehicle data, characterized in that: include: The publishing end obtains vehicle-related data; The publishing end includes a vehicle networking platform; The publishing end publishes the data to a designated channel of the first database; The database has a publish-subscribe function; The first database sends data of the corresponding channel to the subscriber according to the channel pre-subscribed by the subscriber; The publishing end obtains the vehicle-related data, including: the Internet of Vehicles platform subscribes to the vehicle-related data from the second database; Before the Internet of Vehicles platform subscribes to the vehicle-related data from the second database, the method further includes: the external communication subject publishes the vehicle-related data to a designated channel of the second database; the second database sends the data of the corresponding channel to the Internet of Vehicles platform according to the channel pre-subscribed by the Internet of Vehicles platform; After the first database sends the data of the corresponding channel to the subscriber according to the channel pre-subscribed by the subscriber, it also includes: the first database returns the new data and / or local data of the corresponding channel to the publisher according to the channel pre-subscribed by the publisher.
10. The method according to claim 9, characterized in that After the first database sends data of the corresponding channel to the subscriber according to the channel pre-subscribed by the subscriber, the method further includes: The subscriber generates new data after processing the subscribed data, and publishes the new data and / or local data to a designated channel of the first database.
11. The method according to claim 9, characterized in that The publishing end includes an ECU deployed on a vehicle; The publishing end obtains vehicle-related data and publishes the data to a designated channel of the first database, including: The ECU obtains data collected by sensors on the vehicle and publishes the data to a designated channel of the first database; after publishing the data to the designated channel of the first database, it also includes: the first database sends the data of the corresponding channel to the ECU according to the channel pre-subscribed by the ECU.
12. The method according to claim 9, characterized in that Before publishing the data to the designated channel of the first database, the publishing end is further used to: Process the data to be published according to the data structure agreed upon with the subscriber; The subscription end includes TBOX and ECU.
