A service state notification method and device, computer device and storage medium
By establishing connections with the MCU and MPU processes through the DDS gateway, continuously detecting changes in MCU status, and updating entity IDs and service identification information, the problems of MCU memory shortage and invalid message occupation are solved, and the accuracy of service status and efficient use of network bandwidth are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING CHANGAN TECH CO LTD
- Filing Date
- 2023-08-10
- Publication Date
- 2026-05-08
AI Technical Summary
In automotive communication, MCU memory resources are scarce and invalid message data increases the data processing pressure. DDS communication is under great pressure and there is no effective handling when communication entities are abnormal, resulting in network bandwidth consumption.
The DDS gateway establishes a connection with the MCU and MPU processes, continuously monitors MCU status changes, updates entity IDs and service identification information, and promptly marks service online status to avoid sending invalid messages.
This reduces MCU memory usage, lowers data processing pressure, avoids unnecessary data usage of network bandwidth, and ensures the accuracy of service status.
Smart Images

Figure CN117041327B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automotive Ethernet communication technology, and more specifically to a service status notification method, apparatus, computer device, and storage medium. Background Technology
[0002] With the increasing volume of automotive communication data and the continuous development of vehicle networking technology, Ethernet technology is gradually gaining a larger share in automotive communication methods, making the overall vehicle network structure more complex compared to traditional CAN and LIN communication networks. Meanwhile, many automakers are adopting a distributed architecture—SOA (Service-Oriented Architecture)—to refine the applications of each ECU (Electronic Control Unit) into various services, thereby reducing the complexity of communication between ECUs. DDS (Data Distribution Service), as a middleware protocol, defines different types of data sending and receiving entities (such as participants, publishers, subscribers, and topics for data transmission) to construct a data publish / subscribe model, thus meeting the communication needs between ECUs. Due to its high reliability and strong real-time performance, it is gradually being promoted in vehicle network communication.
[0003] For an automotive ECU, it can be either an MCU (Microcontroller Unit) or an MPU (Microprocessor Unit). Since each creation of a DDS data transceiver entity requires memory resources from the ECU, while the MPU has relatively abundant memory resources, the DDS protocol stack communication between MPUs can adopt the traditional DDS communication rules. However, the memory resources on the MCU are relatively scarce and do not support the creation of a large number of data transceiver entities on the MCU. Furthermore, during the DDS service discovery phase, the ECU will also create remote entities of the peer entity on its own end, which will also consume its own memory. Thus, the traditional DDS communication method will not only result in too many entities existing on the MCU, occupying a large amount of MCU memory, but will also cause the MCU to receive a large amount of invalid message data, increasing the data processing pressure on the MCU and limiting the operation effect of DDS in the vehicle.
[0004] To address the aforementioned issues, Chinese patent CN115913809A discloses a data distribution communication method, system, computer device, and storage medium. This patent is based on the SOA architecture used in automobiles and merges the communication data types of automobiles according to the characteristics of the services, combining multiple services into one topic to reduce the number of topics. This allows services to be divided into three main categories: requests, responses, and notifications, resulting in three topics. For other data that is not suitable for SOA services, topics can be divided according to other standards or separately. This reduces the number of data sending and receiving entities, thereby reducing the memory usage of the MCU.
[0005] Based on the solution disclosed in Chinese Patent CN115913809A, Chinese Patent CN116248775A further discloses an interaction method, device, electronic device, and storage medium for a DDS gateway, which can further solve the problem of high communication pressure in DDS. This patent deploys a data transceiver entity responsible for providing services within each MCU, a DDS gateway process within each MPU, and several MPU processes within each MPU. Each MPU process includes a data transceiver entity for performing services. The DDS gateway intervenes between the MCU and the MPU, enabling communication between each MCU and any MPU process within an MPU. The DDS gateway maintains the entity IDs of the entities in each MCU and the service identifiers of the services contained within each entity. The DDS gateway forwards the service identifiers to each MPU process. Once the data communication phase begins, the MPU process, acting as the client, sends a service request message to a data transceiver entity that provides services to a specific MCU. This message carries the service identifier requested by the MPU process. When the message passes through the DDS gateway, the gateway looks up the service identifier. If the service identifier exists in the DDS gateway's database, it searches for the entity ID to which the service identifier belongs. Only based on the entity ID can the message reach the MCU's data transceiver entity. Similarly, when the MCU entity sends a response message, it carries the destination entity ID. Only if the destination entity ID exists in the gateway's GUID list can the response message reach the corresponding entity of the MPU process through the gateway. The DDS gateway uses GUIDs and service identifier values to filter request and response messages, significantly reducing the amount of unnecessary data received by the MCU and further reducing DDS communication load.
[0006] However, the above solution still has a serious problem: it does not handle abnormal situations when the DDS encounters communication entities. In other words, for example, when the MCU or other components malfunction and cannot respond to the MPU process, the MPU does not know which services are offline and continues to send service request messages to the MCU through the gateway. This invalid data will consume network bandwidth and have an adverse effect on the vehicle network communication. Summary of the Invention
[0007] In view of this, embodiments of the present invention provide a service status notification method, apparatus, computer device, and storage medium to solve the problem that when communication is abnormal, the MPU continues to send service request messages to the MCU through the DDS gateway, thereby consuming network bandwidth.
[0008] In a first aspect, embodiments of the present invention provide a service status notification method, applied to an MPU, comprising: starting a DDS gateway and each MPU process; performing DDS service discovery through the DDS gateway and an MCU group, so as to establish a communication connection between the DDS gateway and the MCUs in the MCU group, wherein the MCU group includes one or more MCUs, and the MCUs establish a communication connection with each other through DDS service discovery; receiving and storing entity ID information and service identification information sent by the MCUs in the MCU group through the DDS gateway; performing DDS service discovery through the DDS gateway and each MPU process, so as to establish a communication connection between the DDS gateway and each MPU process; forwarding the service identification information to each MPU process through the DDS gateway, so that each MPU process marks the corresponding service as online based on the service identifier contained in the service identification information, wherein the service marked as online is used to characterize the service that the MPU process can send request messages; when the DDS gateway detects a status change in any MCU in the MCU group, updating the stored entity ID information and service identification information, and resending the updated new service identification information to each MPU process, so that each MPU process remarks the online status of each service based on the new service identification information.
[0009] Based on the above technical means, the solution provided by the embodiments of the present invention continuously detects whether any MCU in the MCU group has a state change after the DDS gateway establishes a connection with each MCU and each MPU process. Once any MCU in the MCU group has a state change, the stored entity ID information and service identifier information are updated, and the updated new service identifier information is resent to each MPU process. This allows each MPU process to re-mark the online status of each service according to the new service identifier information, so that each MPU process can know in a timely manner which services are available and which services are unavailable. This avoids the MPU process continuously sending request messages to the DDS gateway and avoids the problem of network bandwidth being occupied by invalid data.
[0010] In one optional implementation, when a state change is detected in any MCU in the MCU group through the DDS gateway, the stored entity ID information and service identifier information are updated, including: when a newly powered-on first MCU appears in the MCU group, DDS service discovery is performed between the DDS gateway and the first MCU; the first entity ID and first service identifier sent by the first MCU are received through the DDS gateway, and the first entity ID and first service identifier are added to the entity ID information and service identifier information.
[0011] According to the above technical means, if a first MCU fails to power on, resulting in a late connection establishment with the DDS gateway, this embodiment promptly adds it to the entity ID information and service identification information. This operation indicates that the entity ID information and service identification information have been updated. As a result, the DDS gateway resends the updated service identification information to each MPU process, so that each MPU process can re-mark the online status of each service according to the new service identification information, further ensuring the accuracy of the service status maintained in the MPU process.
[0012] In one optional implementation, when a state change is detected in any MCU in the MCU group via the DDS gateway, the stored entity ID information and service identifier information are updated, including: receiving a service request message sent by the target MPU process via the DDS gateway and forwarding the service request message to the corresponding second MCU; if no response message in response to the service request message is received from the second MCU via the DDS gateway after a preset inactive time, the second MCU is determined to be offline; the second entity ID and second service identifier belonging to the second MCU are deleted from the stored entity ID information and service identifier information via the DDS gateway to update the entity ID information and service identifier information.
[0013] According to the above technical means, when a second MCU goes offline, and a target MPU process happens to send a service request message to the second MCU, this embodiment uses the DDS gateway to count the duration after forwarding the service request message. If the duration reaches the preset inactive time and no response message from the second MCU is received in response to the service request message, it is determined that the DDS gateway has detected that the second MCU has gone offline. Therefore, the DDS gateway deletes the second entity ID and second service identifier belonging to the second MCU from the stored entity ID information and service identifier information to update the entity ID information and service identifier information. Then, the DDS gateway sends the new service identifier information to each MPU process to ensure the accuracy of the service status in the MPU process and avoid the subsequent MPU process sending invalid messages and consuming bandwidth.
[0014] In an optional implementation, if the second MCU successfully restarts within the inactivation time, the method further includes: treating the restarted second MCU as a newly online MCU, and performing DDS service discovery with the second MCU through a DDS gateway; receiving a third entity ID and a third service identifier sent by the second MCU through the DDS gateway, wherein the third entity ID is different from the second entity ID, and the third service identifier is the same as the second service identifier; adding the third entity ID and the third service identifier to the entity ID information and service identifier information respectively through the DDS gateway; when the third service identifier and the second service identifier are detected to be the same through the DDS gateway, after performing the step of deleting the second entity ID and the second service identifier belonging to the second MCU from the saved entity ID information and service identifier information through the DDS gateway to update the entity ID information and service identifier information, abandoning the step of resending the updated new service identifier information to each MPU process.
[0015] According to the aforementioned technical means, when the second MCU goes offline while the DDS gateway is forwarding service request packets, it begins to count the inactive time. If the second MCU restarts quickly, it acts as a new MCU and re-discovers services with the DDS gateway, re-entering the third entity ID and third service identifier into the DDS gateway. Since it's a new MCU establishing a connection with the DDS gateway, its third entity ID changes. However, because the services provided by the MCU remain the same, the third service identifier remains unchanged, identical to the old second service identifier. This does not affect subsequent request operations of each MPU process, thus causing the DDS gateway to abandon resending the new service identifier information, further reducing bandwidth waste. Furthermore, after the inactive time has elapsed, the DDS gateway deletes the old second entity ID and second service identifier from the gateway, releasing the MPU's memory resources. Simultaneously, this method avoids blocking and stuttering caused by calling the services of the restarted MCU.
[0016] In an optional implementation, the method further includes: when the DDS gateway goes offline, after sending a service request message through the target MPU process, controlling the target MPU process to detect whether a preset inactive time has elapsed; if the target MPU detects that no response message has been received after the inactive time has elapsed, controlling the target MPU process to mark the service corresponding to the service request message as offline; when the DDS gateway restarts, re-discovering DDS services with the MCU group and each MPU process through the DDS gateway; re-receiving and saving the second entity ID information and second service identifier information sent by the MCUs in the MCU group through the DDS gateway; forwarding the second service identifier information to each MPU process through the DDS gateway, so that each MPU process re-marks the online status of each service according to the service identifier contained in the second service identifier information; and deleting the entity ID information and service identifier information saved before the DDS gateway restarts.
[0017] Based on the aforementioned technical means, if the DDS gateway is offline, this embodiment also controls each MPU process to perform offline processing on the service request message if it sends a service request message but does not receive a response message after the inactive period, thus avoiding duplicate message transmission. Furthermore, when the DDS gateway re-enters the network, it re-establishes a connection with the MCU and MPU processes, thereby receiving the second entity ID information and second service identifier information sent by the MCU, and re-announcing the second entity ID information and second service identifier information to each MPU process to keep its internal service status up-to-date. Finally, the entity ID information and service identifier information saved before the DDS gateway restart are deleted from the MPU's internal memory, reclaiming memory resources and reducing memory usage.
[0018] In an optional implementation, the method further includes: when the first MPU process goes offline and restarts, re-discovering DDS services with the first MPU process through the DDS gateway; and resending service identification information to each MPU process through the DDS gateway.
[0019] Based on the above technical means, when an MPU process goes offline and restarts, the DDS gateway will also resend the service identification information to each MPU process to further ensure the accuracy of the service status within each MPU process.
[0020] In an optional implementation, the method further includes: when a newly online second MPU process appears in the MPU, performing DDS service discovery through the DDS gateway and the second MPU process; and resending the service identification information to each MPU process through the DDS gateway.
[0021] Based on the above technical means, when a new MPU process comes online, the DDS gateway will also resend the service identification information to each MPU process to further ensure the accuracy of the service status within each MPU process.
[0022] Secondly, embodiments of the present invention provide a service status notification device, applied to an MPU, comprising: a power-on startup module for starting a DDS gateway and each MPU process; a first connection establishment module for performing DDS service discovery through the DDS gateway and an MCU group, thereby enabling the DDS gateway and the MCUs in the MCU group to establish a communication connection, wherein the MCU group includes one or more MCUs, and the MCUs establish a communication connection through DDS service discovery; an identifier receiving module for receiving and storing entity ID information and service identifier information sent by the MCUs in the MCU group through the DDS gateway; and a second connection establishment module for performing DDS service discovery through the DDS gateway and each MPU process, thereby enabling the DDS gateway and the MCUs in the MCU group to establish a communication connection. The DDS gateway establishes a communication connection with each MPU process; the identifier forwarding module is used to forward service identifier information to each MPU process through the DDS gateway, so that each MPU process marks the corresponding service as online based on the service identifier contained in the service identifier information. The service marked as online is used to indicate the service that the MPU process can send request messages; the identifier update module is used to update the stored entity ID information and service identifier information when the DDS gateway detects a state change of any MCU in the MCU group, and resend the updated new service identifier information to each MPU process, so that each MPU process remarks the online status of each service based on the new service identifier information.
[0023] Thirdly, embodiments of the present invention provide a computer device, including: a memory and an MPU, the memory and the MPU being communicatively connected to each other, the memory storing computer instructions, and the MPU executing the computer instructions to perform the method described in the first aspect or any corresponding embodiment thereof.
[0024] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer instructions for causing a computer to perform the method described in the first aspect or any corresponding embodiment thereof.
[0025] The beneficial effects of this invention are:
[0026] (1) The solution provided in this embodiment of the invention continuously detects whether any MCU in the MCU group has a state change after the DDS gateway establishes a connection with each MCU and each MPU process. Once any MCU in the MCU group has a state change, the stored entity ID information and service identifier information are updated, and the updated new service identifier information is resent to each MPU process so that each MPU process can re-mark the online status of each service according to the new service identifier information. This allows each MPU process to know in a timely manner which services are available and which services are unavailable, avoiding the continuous sending of request messages to the DDS gateway by the MPU process and avoiding the problem of network bandwidth being occupied by invalid data.
[0027] (2) In this embodiment of the invention, if a first MCU fails to power on and causes it to establish a connection with the DDS gateway late, this embodiment will promptly add it to the entity ID information and service identification information. This operation indicates that the entity ID information and service identification information have been updated. As a result, the DDS gateway will resend the updated service identification information to each MPU process so that each MPU process can re-mark the online status of each service according to the new service identification information, thereby further ensuring the accuracy of the service status maintained in the MPU process.
[0028] (3) In this embodiment of the invention, when a second MCU goes offline, and a target MPU process happens to send a service request message to the second MCU, this embodiment uses the DDS gateway to count the duration after forwarding the service request message. If the duration reaches the preset inactive time and no response message from the second MCU is received in response to the service request message, it is determined that the DDS gateway has detected that the second MCU has gone offline. Therefore, the DDS gateway deletes the second entity ID and the second service identifier belonging to the second MCU from the stored entity ID information and service identifier information to update the entity ID information and service identifier information. Then, the DDS gateway sends the new service identifier information to each MPU process to ensure the accuracy of the service status in the MPU process and avoid the subsequent MPU process from sending invalid messages and occupying bandwidth.
[0029] (4) In this embodiment of the invention, when the second MCU goes offline while the DDS gateway is forwarding the service request message, it will start counting the inactive time. If the second MCU restarts quickly, since the inactive time has not yet expired, the DDS gateway has not yet determined that the second MCU is offline. The DDS gateway is still unaware of why the second MCU has not responded to the message and is in a waiting phase. Therefore, the saved second entity ID and second service identifier of the second MCU cannot be deleted. At this time, the second MCU, as a new MCU, re-discovers services with the DDS gateway and re-enters the third entity ID and third service identifier in the DDS gateway. Since it is a new MCU establishing a connection with the DDS gateway, its third entity ID will change. However, since the services provided by the MCU remain unchanged, the third service identifier will not change and will remain the same as the old second service identifier. This does not affect the subsequent request operations of each MPU process. Therefore, the DDS gateway abandons resending the new service identifier information, further reducing bandwidth waste. In addition, after the inactive time has expired, the DDS gateway deletes the old second entity ID and second service identifier from the gateway, releasing the memory resources of the MPU.
[0030] (5) Based on the above technical means, if the DDS gateway is offline, this embodiment also controls each MPU process to perform offline processing on the service request message if it sends a service request message but does not receive a response message after the inactive time, thus avoiding duplicate transmission of the message. Furthermore, when the DDS gateway comes back online, it will re-establish a connection with the MCU and MPU processes, thereby receiving the second entity ID information and second service identifier information sent by the MCU, and re-announcing the second entity ID information and second service identifier information to each MPU process to keep its internal service status up-to-date. Finally, the entity ID information and service identifier information saved before the DDS gateway restart are deleted from the MPU, reclaiming memory resources and reducing memory usage. Attached Figure Description
[0031] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0032] Figure 1 This is a first flowchart illustrating a service status notification method according to some embodiments of the present invention;
[0033] Figure 2 This is a second flowchart illustrating a service status notification method according to some embodiments of the present invention;
[0034] Figure 3 This is a third flowchart illustrating a service status notification method according to some embodiments of the present invention;
[0035] Figure 4 This is a fourth flowchart illustrating a service status notification method according to some embodiments of the present invention;
[0036] Figure 5 This is a fifth flowchart illustrating a service status notification method according to some embodiments of the present invention.
[0037] Figure 6 This is a sixth flowchart illustrating a service status notification method according to some embodiments of the present invention;
[0038] Figure 7 This is the seventh flowchart of a service status notification method according to some embodiments of the present invention;
[0039] Figure 8 This is a schematic diagram of the structure of a service status notification device according to some embodiments of the present invention;
[0040] Figure 9 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation
[0041] The embodiments of the present invention will be described below with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention and not for limiting the scope of protection of the present invention.
[0042] (It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components. In actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.)
[0043] According to an embodiment of the present invention, a service status notification method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0044] This embodiment provides a service status notification method, applied to MPU. Figure 1 This is a flowchart of a service status notification method according to an embodiment of the present invention, the process including the following steps:
[0045] Step S101: Start the DDS gateway and each MPU process.
[0046] Specifically, the MPU is a hardware device, and the DDS gateway is a software process within the MPU, used to filter request and response messages. Each MPU deploys one DDS gateway. Additionally, one or more MPU processes are deployed within the MPU, each an application process that performs a specific function. Each MPU process needs to obtain corresponding service data from its MCU to perform its function. For details on the communication relationship between the DDS gateway, MPU processes, and the MCU, please refer to the relevant technical descriptions; they will not be elaborated upon here. Since the DDS gateway and each MPU process are deployed within the MPU, the DDS gateway and each MPU process must be started first upon MPU power-on initialization.
[0047] Step S102: DDS service discovery is performed through the DDS gateway and the MCU group to establish a communication connection between the DDS gateway and the MCUs in the MCU group. The MCU group includes one or more MCUs, and the communication connection between the MCUs is completed through DDS service discovery.
[0048] Specifically, under normal circumstances, the MCU's power-on initialization completion time is much shorter than the MPU's initialization completion time. Since the MCU powers on faster than the MPU, after the MCU powers on, MCUs belonging to the same communication domain will first perform DDS service discovery to establish communication connections between them. This occurs earlier than the step of the MCU discovering services with the DDS gateway. In this embodiment, all MCUs in the same communication domain are referred to as an MCU group. MCUs within the same communication domain can directly exchange data, but MCUs and MPUs cannot directly exchange data; they need to use a DDS gateway to forward data for communication. The specific principles of DDS service discovery and the concept of a communication domain are existing technologies and can be found in relevant technical documents, so they will not be elaborated here. After the DDS gateway starts, it then performs DDS service discovery with each MCU in the MCU group to establish communication connections.
[0049] Step S103: Receive and save the entity ID information and service identifier information sent by the MCUs in the MCU group through the DDS gateway.
[0050] Specifically, during the DDS service discovery process between the DDS gateway and each MCU, the MCU sends its own entity IDs and service identifiers to the DDS gateway, instructing the DDS gateway to create a corresponding list to maintain this information. In this embodiment, the maintained list is referred to as entity ID information and service identifier information. The entity ID information includes all entity IDs provided by the MCU, such as the topic ID, and the service identifier information includes the service identifiers of all entities.
[0051] Step S104: DDS service discovery is performed through the DDS gateway and each MPU process to establish a communication connection between the DDS gateway and each MPU process.
[0052] Specifically, when the DDS gateway and MPU processes are in the startup state, the DDS gateway and each MPU process will also perform DDS service discovery, thereby establishing a communication connection between the DDS gateway and each MPU process.
[0053] Step S105: The service identification information is forwarded to each MPU process through the DDS gateway, so that each MPU process marks the corresponding service as online based on the service identifier contained in the service identification information. The service marked as online is used to represent the service that the MPU process can send request messages.
[0054] Specifically, the MPU process internally maintains many services, i.e., which services the MPU process needs to call. Based on this, this embodiment of the invention enables the DDS gateway to not only store service identification information itself but also forward this information to each MPU process. After receiving the service identification information, this embodiment defines two states for each service: online and ideal. The MPU process marks the corresponding service as online based on the existing service identifiers. For services that do not receive a service identifier, the MPU process marks the corresponding service as offline. Therefore, the MPU process only sends service request messages to services marked as online, ensuring that the message reaches the online MCU providing the service. For offline services, the MPU process does not send service request messages, and thus the message will not reach the corresponding offline MCU.
[0055] Step S106: When a state change is detected in any MCU in the MCU group through the DDS gateway, the saved entity ID information and service identifier information are updated, and the updated new service identifier information is resent to each MPU process so that each MPU process can re-mark the online status of each service according to the new service identifier information.
[0056] Specifically, based on the logic provided in step S105, this embodiment of the invention detects the status of the MCU group through the DDS gateway. When any MCU changes status, the saved entity ID information and service identifier information are updated, and the updated service identifier information is resent to each MPU process. This allows each MPU process to re-mark the online status of each service according to the new service identifier information, enabling each MPU process to know in a timely manner which services are available and which are unavailable. For unavailable services, messages are no longer repeatedly sent, avoiding the continuous sending of request messages to the DDS gateway by the MPU process and preventing the problem of network bandwidth being occupied by invalid data.
[0057] In some optional embodiments, the service status notification method provided by this invention further includes:
[0058] Step a1: When a new second MPU process comes online in the MPU, DDS service discovery is performed through the DDS gateway and the second MPU process;
[0059] Step a2: Resend the service identification information to each MPU process through the DDS gateway.
[0060] Specifically, in this embodiment, due to certain power-on anomalies, some MPU processes may start earlier than others. To address this issue, if a new second MPU process comes online, the DDS gateway will resend the service identification information to each MPU process to further ensure the accuracy of the service status within each MPU process. For example... Figure 2 As shown, assuming the MCU group includes three MCUs, namely MCU1, MCU2, and MCU3, after the three MCUs power on and start up, they perform service discovery with each other; then the MPU power-on initialization completes and starts the DDS gateway, MPU process 1, and MPU process 2; each MCU establishes a connection with the DDS gateway and the online MPU processes; the DDS gateway announces the MCU's service identification information to the MPU processes that have already established a connection; then, MPU process 3 comes online, and the DDS gateway and the subsequently started MPU process 3 establish a connection again; the DDS gateway resends the service identification information to each MPU process.
[0061] In some alternative implementations, step S106 includes:
[0062] Step b1: When a newly powered-on first MCU appears in the MCU group, DDS service discovery is performed between the DDS gateway and the first MCU.
[0063] Step b2: Receive the first entity ID and first service identifier sent by the first MCU through the DDS gateway, and add the first entity ID and first service identifier to the entity ID information and service identifier information.
[0064] Specifically, in practical applications, some MCUs may power on later due to abnormal power-on. For example, if a first MCU's power-on is abnormal, its connection with the DDS gateway may be established later. In this embodiment, after power-on, the first MCU promptly performs DDS service discovery through the DDS gateway to establish a connection. The first entity ID and first service identifier sent by the first MCU are promptly added to the entity ID and service identifier information. This operation indicates that the entity ID and service identifier information have been updated. The updated service identifier information is then resent to each MPU process through the DDS gateway, allowing each MPU process to re-mark the online status of each service based on the new service identifier information. This further ensures the accuracy of the service status maintained by the MPU process and prevents the MPU process from delaying its service acquisition request due to not knowing the upper limit of some MCUs.
[0065] For example Figure 3 As shown, assuming MCU3 powers on abnormally, while MCU1 and MCU2 power on normally and perform service discovery; after the MPU power-on initialization, the DDS gateway and each MPU process are started; then, the MCU, DDS gateway, and each MPU process (uppermost MPU process 1 and MPU process 2) establish connections; then, the MPU processes with established connections by the DDS gateway announce the MCU's service identification information; then, the DDS gateway establishes a connection with the later-started MPU process 3 and synchronizes the MCU's service identification information to MPU process 3; then, MCU3 powers on normally, and the later-started MCU3 joins the network, establishing connections with MCU1, MCU2, and the DDS gateway, thereby updating the entity ID information and service identification information stored internally by the DDS gateway; then, the DDS gateway sends the updated new service identification information to each MPU process.
[0066] In some alternative implementations, step S106 includes:
[0067] Step c1: Receive the service request message sent by the target MPU process through the DDS gateway, and forward the service request message to the corresponding second MCU.
[0068] Step c2: If no response message in the service request message from the second MCU is received through the DDS gateway after the preset inactivation time, the second MCU is determined to be offline.
[0069] Step c3: Delete the second entity ID and second service identifier belonging to the second MCU from the saved entity ID information and service identifier information through the DDS gateway, in order to update the entity ID information and service identifier information.
[0070] Specifically, in this embodiment, a preset inactive time is used to determine whether each MCU is offline. The inactive time refers to the length of time during which there is no data interaction between the MCU and the MPU process. If this time exceeds, the MCU is considered inactive. In related technologies, when a second MCU goes offline, the DDS gateway is unaware of the second MCU's offline status. Therefore, in this case, if a target MPU process sends a service request message to the second MCU, the DDS gateway will still forward the message to the second MCU. To avoid this situation from repeatedly occurring and wasting bandwidth, this embodiment sets the DDS gateway to start counting the waiting time after forwarding the service request message. If no feedback message is received from the second MCU after the preset inactive time, i.e., the waiting time equals the inactive time, the DDS notifies each MPU process of a response timeout and performs response timeout processing.
[0071] Upon timeout, the DDS gateway determines that the second MCU is offline and automatically deletes the second entity ID and second service identifier of the second MCU from the saved entity ID and service identifier information. This updates the entity ID and service identifier information and triggers the resending of the new service identifier information to each MPU process. This ensures that the service status maintained in each MPU process is up-to-date, preventing the MPU from sending service request messages for offline services and avoiding bandwidth waste.
[0072] For example Figure 4 As shown, after the three MCUs power on and start, they perform service discovery with each other; after the MPU power-on initialization is completed, the DDS gateway, MPU process 1, and MPU process 2 are started; the DDS gateway, each MCU, MPU process 1, and MPU process 2 respectively perform DDS service discovery and establish communication connections; the DDS gateway announces the MCU's service identification information to the MPU processes that have established connections; the DDS gateway establishes a communication connection with the subsequently started MPU process 3; the DDS gateway resynchronizes the MCU's service identification information to each MPU process; at this time, MCU 3 crashes and goes offline, and the DDS gateway cannot... An MCU crash is detected, but MPU process 1 is still calling the service of MCU3. At this time, the DDS gateway is unaware that MCU3 is offline, so the DDS gateway will still forward the service request message to MCU3, but will not receive a response from MCU3. After the inactive timeout period, MPU process 1 will still generate a service call timeout, and the DDS gateway will handle the timeout response. During the timeout handling, the DDS gateway determines that MCU3 is offline, the service identifier information maintained in the DDS gateway will change, the service identifier of MCU3 will be deleted, and then the DDS gateway will send the changed service identifier information to each MPU process.
[0073] It is important to note that in one embodiment, after all MCUs crash or power down, the DDS gateway will reclaim all MCU-related information, thus lacking MCU-related service identifier information. The DDS gateway needs to inform each MPU process of this status. Additionally, when all MCUs are not powered on or not connected, the gateway does not maintain MCU service identifier information internally; in this case, the gateway also needs to inform each MPU process of this status. In short, whenever the MCU status changes, the DDS gateway will re-inform each MPU process of the latest service identifier information.
[0074] In some optional implementations, if the second MCU successfully restarts within the deactivation time, the service status notification method provided in this embodiment of the invention further includes:
[0075] Step d1: The restarted second MCU is treated as the newly online MCU, and DDS service discovery is performed between the second MCU and the DDS gateway.
[0076] Step d2: Receive the third entity ID and third service identifier sent by the second MCU through the DDS gateway. The third entity ID is different from the second entity ID, and the third service identifier is the same as the second service identifier.
[0077] Step d3: Add the third entity ID and the third service identifier to the entity ID information and service identifier information respectively through the DDS gateway.
[0078] Step d4: When the DDS gateway detects that the third service identifier and the second service identifier are the same, after executing the step of deleting the second entity ID and the second service identifier belonging to the second MCU from the saved entity ID information and service identifier information through the DDS gateway to update the entity ID information and service identifier information, the step of resending the updated new service identifier information to each MPU process is abandoned.
[0079] Specifically, when a module of the MCU malfunctions, the MCU typically restarts. Therefore, the offline second MCU may come back online within a short period, meaning it's highly likely to re-enter during the inactive time determination process. While this embodiment of the invention uses the inactive time to determine whether the second MCU is offline, and can restart the second MCU by resetting the inactive time and retaining the original information, this complicates the inactive time determination process (e.g., it requires monitoring other signals to decide whether to reset the inactive time, potentially causing conflicts in the determination logic). Furthermore, the MPU process cannot call MCU services during the MCU restart, which may cause blocking and lag.
[0080] To maintain the stability of the inactive timeout determination process and avoid congestion, this embodiment of the invention treats the second MCU as a new MCU for DDS service discovery after restarting, thereby saving the newly sent third entity ID and third service identifier from the second MCU. When the second MCU joins the network as a new node, the entity ID changes; that is, the new third entity ID is different from the old second entity ID. However, because the services provided by the second MCU remain unchanged, the third service identifier and the second service identifier are still the same. Therefore, before the inactive timeout is reached, the DDS gateway maintains two sets of information for the second MCU, including the old second entity ID and second service identifier, as well as the new third entity ID and third service identifier. In this way, the DDS gateway still executes the inactive timeout determination process. Only after the inactive timeout has elapsed will the old second entity ID and second service identifier be deleted by the DDS gateway, releasing the MPU's memory resources.
[0081] Since the third service identifier remains the same as the old second service identifier, it does not affect the service request operations of each MPU process after the MCU restarts successfully. Therefore, excessive decision-making logic will not cause the MPU process to call the MCU restart service, resulting in blocking or lag. In addition, when the second and third service identifiers are detected by the DDS gateway, this embodiment also refrains from resending the new service identifier information to each MPU process, reducing meaningless operations and further reducing bandwidth waste.
[0082] It should be noted that if none of the MPU processes request services from the second MCU during the process of the second MCU going offline and restarting successfully, the DDS gateway and the individual MPU processes will not be aware that the second MCU is offline.
[0083] It is important to note that if the second MCU restarts successfully while it is still within the inactive period and the old information has not been deleted, the DDS gateway will maintain the entity ID and service identifier information of the second MCU. If any MPU process initiates a service request to the second MCU at this time, the DDS gateway will unicast two requests. However, the MCU will filter based on the entity ID and only reply with a response based on the new third entity ID. After that, the DDS gateway will forward normally to avoid blocking issues.
[0084] For example Figure 5As shown, after MCU3 goes offline, MPU process 2 in the MPU is simultaneously calling MCU3's services. The DDS gateway is unaware that MCU3 is offline, so it continues to forward MPU process 2's service requests to MCU3, but receives no response from MCU3. MPU process 2 experiences a service call timeout. After the inactive period, the DDS gateway handles the response timeout. MCU3 successfully restarts before the inactive period and establishes a communication connection with MCU1, MCU2, and the DDS gateway. At this time, the DDS gateway treats MCU3 as a newly added node in the network and receives the service identifier from MCU3. The gateway finds that this service identifier is duplicated with the already maintained service identifier, so it assumes the maintained service identifier has not changed and therefore does not notify any MPU processes. After the inactive period, the DDS gateway detects that the old MCU3 is inactive, deletes the old service identifier and entity ID, and reclaims memory resources. Since the updated service identifier has not changed, it does not notify any MPU processes.
[0085] In one optional implementation, the service status notification method provided by this embodiment of the invention further includes:
[0086] Step e1: When the DDS gateway goes offline, after sending a service request message through the target MPU process, the target MPU process is controlled to check whether the preset inactive time has elapsed.
[0087] Step e2: If the target MPU detects that no response message has been received after the inactivity period, the control target MPU process marks the service corresponding to the service request message as offline.
[0088] Step e3: When the DDS gateway restarts, DDS service discovery is performed again through the DDS gateway with the MCU group and each MPU process.
[0089] Step e4: Re-receive and save the second entity ID information and second service identifier information sent by the MCUs in the MCU group through the DDS gateway.
[0090] Step e5: The second service identification information is forwarded to each MPU process through the DDS gateway, so that each MPU process can re-mark the online status of each service according to the service identifier contained in the second service identification information.
[0091] Step e6: Delete the entity ID information and service identifier information saved before the DDS gateway restarts.
[0092] Specifically, in the case of an offline DDS gateway, this embodiment of the invention further controls the execution steps of each MPU process: if a service request message is sent but no response message is received after the inactive timeout, the service request message is processed offline. This avoids duplicate message transmission. Furthermore, when the DDS gateway comes back online, it re-establishes a connection with the MCU and MPU processes, thereby receiving the second entity ID information and second service identifier information sent by each MCU, and re-announcing the second entity ID information and second service identifier information to each MPU process. This ensures that the service status within each MPU process is up-to-date, improves the accuracy of the service status, and avoids the transmission of invalid data. Finally, when the MPU detects a new DDS gateway process coming online, it internally deletes the old entity ID information and service identifier information maintained before the DDS gateway restart, thereby reclaiming memory resources and reducing memory usage.
[0093] For example Figure 6 As shown, after the DDS gateway goes offline, each MPU process still maintains the online status of MCU-related services. If both the MCU and MPU processes send messages to the gateway at this time, these messages will be discarded and the application will handle timeouts. The DDS gateway restarts and establishes communication connections with each MCU and each MPU process. The DDS gateway re-announces the service status of the MCU to the MPU processes. After receiving the reconnection information, the MPU process recognizes that the gateway was previously inactive, so it deletes the old entity ID information and service identification information, reclaims its resources, and each MPU process maintains the latest entity ID information and service identification information.
[0094] In some optional embodiments, the service status notification method provided by this invention further includes:
[0095] Step f1: When the first MPU process goes offline and restarts, DDS service discovery is re-performed with the first MPU process through the DDS gateway;
[0096] Step f2: Resend the service identification information to each MPU process through the DDS gateway.
[0097] Specifically, in this embodiment of the invention, when any MPU process goes offline and restarts, the DDS gateway will also resend the service identification information to each MPU process, further ensuring the accuracy of the service status within each MPU process. For example Figure 7 As shown, MPU process 2 goes offline and restarts; when MPU process 2 is successfully restarted, it re-discovers services with the DDS gateway; the DDS gateway sends the MCU's service identification information to all MPU processes that need to access the MCU.
[0098] This embodiment also provides a service status notification device, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0099] like Figure 8 As shown, this embodiment provides a service status notification device, which is applied to an MPU and includes:
[0100] The power-on startup module 801 is used to start the DDS gateway and each MPU process.
[0101] The first connection establishment module 802 is used to perform DDS service discovery through the DDS gateway and the MCU group, so as to establish a communication connection between the DDS gateway and the MCUs in the MCU group. The MCU group includes one or more MCUs, and the communication connection between the MCUs is completed through DDS service discovery.
[0102] The identifier receiving module 803 is used to receive and save entity ID information and service identifier information sent by MCUs in the MCU group through the DDS gateway.
[0103] The second connection module 804 is used to perform DDS service discovery through the DDS gateway and each MPU process, so as to establish a communication connection between the DDS gateway and each MPU process.
[0104] The identifier forwarding module 805 is used to forward service identifier information to each MPU process through the DDS gateway, so that each MPU process marks the corresponding service as online based on the service identifier contained in the service identifier information. The service marked as online is used to represent the service that the MPU process can send request messages.
[0105] The identifier update module 806 is used to update the saved entity ID information and service identifier information when the state change of any MCU in the MCU group is detected by the DDS gateway, and resend the updated service identifier information to each MPU process so that each MPU process can re-mark the online status of each service according to the new service identifier information.
[0106] In this embodiment, a service status notification device is presented in the form of a functional unit. Here, a unit refers to an ASIC circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above-mentioned functions.
[0107] Further functional descriptions of the above modules are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0108] This invention also provides a computer device having the above-described features. Figure 8 The service status notification device shown.
[0109] Please see Figure 9 , Figure 9 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 9 As shown, the computer device includes one or more MPUs, memory, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other using different buses and can be mounted on a common motherboard or otherwise installed as needed. The MPU can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple MPUs and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-MPU system). Figure 9 Let's take an MPU as an example.
[0110] The memory stores instructions executable by at least one MPU to cause the at least one MPU to perform the method shown in the above embodiments.
[0111] The memory may include a stored program area and a stored data area, wherein the stored program area may store the operating system and applications required for at least one function; the stored data area may store data created based on the use of the computer device, etc. Furthermore, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory may optionally include memory remotely configured relative to the MPU, which can be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0112] The memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory may also include a combination of the above types of memory.
[0113] The computer device also includes a communication interface for communicating with other devices or communication networks.
[0114] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.
[0115] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A service status notification method, characterized in that, The method is applied to an MPU and includes: Start the DDS gateway and all MPU processes; DDS service discovery is performed through the DDS gateway and MCU group to enable communication connections to be established between the DDS gateway and the MCUs in the MCU group. The MCU group includes one or more MCUs, wherein the communication connections between the MCUs are completed through DDS service discovery. The DDS gateway receives and stores the entity ID information and service identification information sent by the MCUs in the MCU group. DDS service discovery is performed through the DDS gateway and each MPU process to establish a communication connection between the DDS gateway and each MPU process; The DDS gateway forwards the service identification information to each MPU process, so that each MPU process marks the corresponding service as online based on the service identifier contained in the service identification information. The service marked as online is used to characterize the service that the MPU process can send request messages. When the DDS gateway detects a state change in any MCU in the MCU group, it updates the saved entity ID information and service identifier information, and resends the updated service identifier information to each MPU process, so that each MPU process can re-mark the online status of each service according to the new service identifier information.
2. The method according to claim 1, characterized in that, When the DDS gateway detects a state change in any MCU in the MCU group, updating the saved entity ID information and service identifier information includes: When a newly powered-on first MCU appears in the MCU group, DDS service discovery is performed between the DDS gateway and the first MCU. The DDS gateway receives the first entity ID and the first service identifier sent by the first MCU, and adds the first entity ID and the first service identifier to the entity ID information and the service identifier information.
3. The method according to claim 1, characterized in that, When the DDS gateway detects a state change in any MCU in the MCU group, updating the saved entity ID information and service identifier information includes: The DDS gateway receives service request messages sent by the target MPU process and forwards the service request messages to the corresponding second MCU. If no response message from the second MCU in response to the service request message is received through the DDS gateway after a preset inactivation time, the second MCU is determined to be offline. The DDS gateway deletes the second entity ID and second service identifier belonging to the second MCU from the stored entity ID information and service identifier information to update the entity ID information and service identifier information.
4. The method according to claim 3, characterized in that, If the second MCU successfully restarts within the said deactivation time, the method further includes: The restarted second MCU is treated as a newly online MCU, and DDS service discovery is performed between the second MCU and the DDS gateway; The DDS gateway receives a third entity ID and a third service identifier sent by the second MCU, wherein the third entity ID is different from the second entity ID and the third service identifier is the same as the second service identifier. The third entity ID and the third service identifier are added to the entity ID information and the service identifier information respectively through the DDS gateway; When the third service identifier and the second service identifier are detected to be the same through the DDS gateway, after executing the step of deleting the second entity ID and the second service identifier belonging to the second MCU from the stored entity ID information and service identifier information through the DDS gateway to update the entity ID information and service identifier information, the step of resending the updated new service identifier information to each MPU process is abandoned.
5. The method according to claim 1, characterized in that, The method further includes: When the DDS gateway goes offline, after sending a service request message through the target MPU process, the target MPU process is controlled to detect whether the preset inactive time has elapsed. If the target MPU detects that no response message has been received after the inactive time, it controls the target MPU process to mark the service corresponding to the service request message as offline. When the DDS gateway restarts, DDS service discovery is re-performed through the DDS gateway with the MCU group and each MPU process. The second entity ID information and second service identifier information sent by the MCUs in the MCU group are received again through the DDS gateway; The DDS gateway forwards the second service identification information to each MPU process, so that each MPU process can re-mark the online status of each service according to the service identifier contained in the second service identification information. Delete the entity ID information and service identifier information saved before the DDS gateway restarts.
6. The method according to claim 1, characterized in that, The method further includes: When the first MPU process goes offline and restarts, DDS service discovery is re-performed with the first MPU process through the DDS gateway. The service identification information is resent to each MPU process via the DDS gateway.
7. The method according to claim 1, characterized in that, The method further includes: When a newly launched second MPU process appears in the MPU, DDS service discovery is performed through the DDS gateway and the second MPU process. The service identification information is resent to each MPU process via the DDS gateway.
8. A service status notification device, characterized in that, The device is applied to an MPU and includes: The power-on startup module is used to start the DDS gateway and each MPU process; The first connection establishment module is used to perform DDS service discovery through the DDS gateway and the MCU group, so as to enable the DDS gateway and the MCUs in the MCU group to establish a communication connection. The MCU group includes one or more MCUs, wherein the MCUs complete the communication connection through DDS service discovery. The identifier receiving module is used to receive and save entity ID information and service identifier information sent by the MCUs in the MCU group through the DDS gateway; The second connection establishment module is used to perform DDS service discovery through the DDS gateway and each MPU process, so as to establish a communication connection between the DDS gateway and each MPU process; The identifier forwarding module is used to forward the service identifier information to each MPU process through the DDS gateway, so that each MPU process marks the corresponding service as online based on the service identifier contained in the service identifier information. The service marked as online is used to characterize the service that the MPU process can send request messages. The identifier update module is used to update the stored entity ID information and service identifier information when the state change of any MCU in the MCU group is detected by the DDS gateway, and resend the updated service identifier information to each MPU process so that each MPU process can re-mark the online status of each service according to the new service identifier information.
9. A computer device, characterized in that, include: A memory and an MPU, which are communicatively connected to each other, wherein the memory stores computer instructions, and the MPU executes the computer instructions to perform the method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Data distribution communication method and system, computer equipment and storage medium
CN115913809A
Safe redundant automatic driving computing platform and control method thereof
CN111367726A
Interaction method and device of DDS gateway, electronic equipment and storage medium
CN116248775A