Log storage method of vehicle controller, whole vehicle log system and storage medium

By coordinating with the gateway in the vehicle log system, sharing and expanding the controller storage space, the problem of insufficient vehicle controller log storage is solved, the efficiency of problem location and risk analysis is improved, and distributed storage of the whole vehicle is realized.

CN119065851BActive Publication Date: 2025-11-18CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411235078.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2025-11-18
Estimated Expiration
2044-09-04

AI Technical Summary

Technical Problem

The existing vehicle controller has insufficient log storage resources, which leads to the overwriting of critical logs, affecting the efficiency of problem localization and risk analysis.

Method used

By coordinating controllers in the vehicle log system through a gateway, sharing storage space, and allocating excess storage resources to controllers with insufficient storage, the log storage can be expanded both statically and dynamically.

Benefits of technology

It effectively solves the problem of insufficient log storage resources, improves the efficiency of problem location and risk analysis capabilities, saves costs, reduces the configuration of control devices, makes up for the shortcomings of hardware storage, and realizes distributed storage for the whole vehicle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065851B_ABST
    Figure CN119065851B_ABST
Patent Text Reader

Abstract

The application provides a log storage method of a vehicle controller, a whole vehicle log system and a storage medium. In the method, the gateway writes space information of a shared storage space into a preset information table in response to receiving a storage sharing notification sent by a first controller, and then allocates a target storage space through the space information recorded in the preset information table and feeds back space information of the target storage space to a second controller in response to receiving a storage allocation request sent by the second controller, so that the second controller sends log data to the first controller providing the target storage space for storage. The method can integrate redundant storage resources of controllers in the whole vehicle, so as to provide the storage resource insufficient controller for storing logs, solve the influence problem positioning and risk analysis caused by insufficient log storage resources in the prior art, and solve the influence problem positioning efficiency caused by the key logs being covered in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of automobiles, in particular to a log storage method of a vehicle controller, a whole vehicle log system and a storage medium. BACKGROUND

[0002] Based on cost considerations, the storage resources of many vehicle controllers are currently greatly limited, for example, usually between several hundred KB and several MB. The information that a general controller needs to store includes configuration information, hardware information, diagnostic information, alarm information, device snapshots, log information, etc.

[0003] In addition to log information, the storage space required by other information is not too large, and in most cases it meets the demand. However, the demand for storage space by logs has great flexibility. When the storage resources are insufficient, only a small amount of key logs are usually recorded, which affects the positioning of later problems and the analysis of potential risks. Moreover, the prior art usually sets the maximum number of logs to be stored. When the number of stored logs exceeds the set value, the previous logs will be overwritten, which also affects the positioning efficiency of problems if the key logs are overwritten. SUMMARY

[0004] In view of the above defects or deficiencies in the prior art, the present application aims to provide a log storage method of a vehicle controller, a whole vehicle log system and a storage medium to solve the problems of insufficient log storage resources in the prior art, which affects problem positioning and risk analysis, and to solve the problem of key logs being overwritten in the prior art, which affects problem positioning efficiency.

[0005] The present application provides a log storage method of a vehicle controller, applied to a whole vehicle log system, the whole vehicle log system comprising at least one first controller, at least one second controller and a gateway, the method comprising:

[0006] The gateway writes the space information of the shared storage space provided by the first controller into a preset information table in response to receiving the storage sharing notification sent by the first controller;

[0007] The gateway determines the target storage space allocated to the second controller based on the space information recorded in the preset information table in response to receiving the storage allocation request sent by the second controller, and feeds back the space information of the target storage space to the second controller;

[0008] The second controller sends log data to the first controller providing the target storage space based on the space information of the target storage space, so that the first controller providing the target storage space stores the log data into the target storage space.

[0009] Optionally, the space information of the shared storage space includes a shared space amount of the shared storage space, and the gateway determines, in response to receiving the storage allocation request sent by the second controller, a target storage space allocated to the second controller based on the space information recorded in the preset information table, including:

[0010] The gateway determines, in response to receiving the storage allocation request sent by the second controller, a required space amount of the second controller based on the storage allocation request;

[0011] The gateway determines, based on the shared space amount of each shared storage space in the preset information table, whether there is a shared storage space whose shared space amount meets the required space amount, and if so, determines, in the shared storage space whose shared space amount meets the required space amount, the target storage space allocated to the second controller.

[0012] Optionally, the method further includes:

[0013] If the gateway determines that there is no shared storage space whose shared space amount meets the required space amount, the gateway combines at least two shared storage spaces as the target storage space of the second controller.

[0014] Optionally, the method further includes:

[0015] The second controller sends a log reading request to a first controller providing the target storage space based on the space information of the target storage space, so that the first controller providing the target storage space reads log data from the target storage space and sends the log data to the second controller.

[0016] Optionally, before the space information of the target storage space is fed back to the second controller, the method further includes:

[0017] The gateway writes the space information of the target storage space into the preset information table;

[0018] Correspondingly, the method further includes:

[0019] The gateway clears, in the preset information table, the space information of the target storage space allocated to the second controller in response to receiving a storage release request sent by the second controller.

[0020] Optionally, the method further includes:

[0021] The second controller sends a dynamic storage application request to the gateway in response to receiving a dynamic storage application instruction sent by a diagnostic instrument or a CAN tool;

[0022] The gateway determines the dynamic storage space allocated to the second controller based on the space information of each shared storage space in the preset information table and the space information of the target storage space in response to the dynamic storage application request, and feeds back the space information of the dynamic storage space to the second controller;

[0023] The second controller feeds back an application success response to the diagnostic instrument or the CAN tool in response to the space information of the dynamic storage space.

[0024] Optionally, the second controller sends log data to the first controller providing the target storage space based on the space information of the target storage space, including:

[0025] The second controller determines a packet identifier when the log data is sent in the form of a packet according to the importance level and the data volume of the log data, wherein the packet identifier reflects the priority of packet sending;

[0026] The second controller sends the log data in the form of a packet to the CAN bus according to the packet identifier of each packet, so that the first controller providing the target storage space receives the log data from the CAN bus.

[0027] Optionally, the method further includes:

[0028] The gateway acquires the current transceiving data volume of each CAN channel in the CAN bus, and determines the current load rate of the CAN channel based on the current transceiving data volume and the maximum bandwidth of the CAN channel;

[0029] For each CAN channel, the gateway determines whether the current load rate is higher than at least one preset threshold value, and if so, determines a target log level according to the maximum value of the preset threshold value reached by the current load rate, and sends a high load notification to the second controller hung to the CAN channel;

[0030] The second controller sends log data meeting the target log level to the first controller providing the target storage space in response to the high load notification.

[0031] Embodiments of the present application also provide a whole vehicle log system, which includes at least one first controller, at least one second controller and a gateway, wherein:

[0032] The first controller is configured to send a storage sharing notification to the gateway;

[0033] The second controller is configured to send a storage allocation request to the gateway, and based on the space information of the target storage space fed back by the gateway, send the log data to the first controller that provides the target storage space, so that the first controller that provides the target storage space stores the log data in the target storage space;

[0034] The gateway is configured to, in response to receiving a storage sharing notification sent by a first controller, write the space information of the shared storage space provided by the first controller into a preset information table; in response to receiving a storage allocation request sent by a second controller, determine the target storage space allocated to the second controller based on the space information recorded in the preset information table, and feed back the space information of the target storage space to the second controller.

[0035] This application embodiment also provides an electronic device, the electronic device comprising:

[0036] Processor and memory;

[0037] The processor executes the steps of the log storage method for the vehicle controller provided in any embodiment of this application by calling the program or instructions stored in the memory.

[0038] This application also provides a computer-readable storage medium that stores a program or instructions that cause a computer to perform the steps of the log storage method for a vehicle controller provided in any embodiment of this application.

[0039] In summary, this application proposes a log storage method for a vehicle controller. In this method, upon receiving a storage sharing notification from a first controller, the gateway writes the space information of the shared storage space provided by the first controller into a preset information table. Then, upon receiving a storage allocation request from a second controller, the gateway allocates a target storage space to the second controller using the space information recorded in the preset information table and feeds back the target storage space information to the second controller. The second controller then sends log data to the first controller providing the target storage space, enabling the first controller to store the log data in the target storage space. This achieves log storage based on storage space expansion. This method can integrate redundant storage resources from various controllers in the vehicle, thereby freeing up storage resources... This method utilizes a sufficient number of controllers to store logs, compensating for the storage space shortage problem in some controllers. It enables controllers to store large amounts of logs, solving the problem of locating and analyzing risks caused by insufficient log storage resources in existing technologies. Furthermore, it improves the efficiency of locating the impact of critical logs being overwritten in existing technologies. In addition, this method can effectively save costs. For controllers with low storage resource requirements, it can reduce the configuration of controller devices without worrying about controller scalability. It can also make up for the shortcomings of existing hardware. For controllers that cannot meet the requirements of new functions due to insufficient storage, it can effectively make up for the problem of insufficient hardware storage resources. It can effectively integrate the vehicle's storage resources and realize a low-level vehicle distributed storage, which can facilitate the subsequent construction of a vehicle storage platform that shields the underlying controllers. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in the specific embodiments of this application or 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 this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0041] Figure 1 This is a flowchart of a log storage method for a vehicle controller provided in an embodiment of this application;

[0042] Figure 2 This is a schematic diagram of the structure of the vehicle log system provided in the embodiments of this application;

[0043] Figure 3 This is a schematic diagram of a static expansion process provided in an embodiment of this application;

[0044] Figure 4 This is a schematic diagram of a dynamic expansion process provided in an embodiment of this application;

[0045] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0046] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0047] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0048] Before providing a detailed description of the log storage method for the vehicle controller provided in the embodiments of this application, the technical problem solved by this method will be explained first.

[0049] In current technologies, when storage resources are insufficient, only a small number of critical logs are typically recorded. However, this only addresses the issue of log availability and fails to realize the full value of logs. Logs are crucial for quickly identifying the root cause of problems when system anomalies occur, improving problem-solving efficiency. Even when the system is running normally, reading logs may uncover potential risks; often, the system may not display any warning messages, but this doesn't mean its internal operations are entirely correct.

[0050] To achieve the goals of quickly resolving issues and early detection of hidden problems, simply logging a small number of critical logs is insufficient. Therefore, logging is necessary in the following situations to maximize system maintainability and testability: recording input / output information of key function interfaces, recording critical events, recording changes in internal states, recording the execution of abnormal branches, recording variables used to determine branch jumps, recording core operational processes, and recording the completion status of paired operations, such as memory allocation and deallocation.

[0051] A complete log should include, but is not limited to, the content mentioned above. For a somewhat complex system, the amount of log data will be quite substantial. In addition to the complexity of the log content, there are also requirements for the log recording time. Generally, a maximum number of logs is set. When the number of stored logs exceeds the set value, previous logs will be overwritten in a loop. This means that if critical logs are overwritten when troubleshooting, it will seriously affect the efficiency of troubleshooting.

[0052] Therefore, in order to solve the above problems, this application proposes a log storage method for vehicle controllers. Considering that different controllers have different storage spaces, and that some controllers have sufficient storage resources but low storage requirements, the excess storage space of such controllers can be shared with other controllers to solve the problem of insufficient log storage resources in the prior art.

[0053] Figure 1 This is a flowchart illustrating a vehicle controller log storage method according to an embodiment of this application. The vehicle controller log storage method is applied to a vehicle log system, which includes at least one first controller, at least one second controller, and a gateway.

[0054] Figure 2 This is a schematic diagram of the structure of the vehicle log system provided in the embodiments of this application, as shown below. Figure 2 As shown, the first controller and the second controller can be connected to the gateway via a CAN (Controller Area Network) bus; that is, the first controller and the second controller can be mounted on the CAN bus, and data can be transmitted between the first controller and the second controller via the CAN bus.

[0055] In this system, the first controller can be a controller capable of providing storage space for other controllers, and can be represented by an S-ECU. The second controller can be a controller that needs to use the storage space provided by other controllers, and can be represented by a C-ECU. For example, controllers with excess storage space can be designated as the first controller and controllers with insufficient storage space can be designated as the second controller in advance, based on the functions of each controller and their log requirements.

[0056] See Figure 1 The specific methods for storing logs for the vehicle controller include:

[0057] S110. Upon receiving the storage sharing notification sent by the first controller, the gateway writes the space information of the shared storage space provided by the first controller into a preset information table.

[0058] The first controller can send a storage sharing notification to the gateway after startup, informing the gateway of the amount of shared storage space it can provide and the starting offset address of that space. In other words, the storage sharing notification describes the amount of shared storage space and the starting offset address of the first controller. The amount of shared storage space can be specified by the first controller during program initialization and can be preset.

[0059] Specifically, after receiving the storage sharing notification sent by the first controller, the gateway can register the shared storage space provided by the first controller. For example, it can write the space information of the shared storage space into a preset information table to complete the registration of the shared storage space.

[0060] The preset information table can be a table maintained in the gateway to record the shared storage space provided by each first controller. The preset information table can include the space information of each shared storage space, which can consist of the identifier of the first controller providing the shared storage space, the amount of shared storage space (i.e., the space size), and the starting offset address of the space. For example, Table 1 shows one such preset information table.

[0061] Table 1. A preset information table

[0062]

[0063] In Table 1, the S-ECU column identifies the first controller providing the shared storage space, the S-SIZE column indicates the amount of shared storage space, and the S-OFFSET column indicates the starting offset address of the shared storage space, i.e., the offset address of the shared storage space within the first controller's storage space. The C-ECU column identifies the second controller using this shared storage space as the target storage space, the C-SIZE column indicates the size of this target storage space, and the C-OFFSET column indicates the starting offset address of this target storage space within the corresponding first controller.

[0064] For example, when the gateway receives a storage sharing notification sent by the first controller, it creates a new row in the preset information table, fills in the amount of shared space and the starting offset address of the space in the storage sharing notification into the preset record table, and writes the identifier of the first controller into the preset record table accordingly.

[0065] After all controllers in the vehicle are started, all of the first controllers will send a storage sharing notification to the gateway. The gateway can then record the space information of the shared storage space provided by each first controller through the above steps.

[0066] It should be noted that, in this embodiment of the application, the preset information table is a table that can be persistently stored in the gateway. After any controller restarts, the information recorded in the preset information table for the restarted controller will not change.

[0067] S120. Upon receiving a storage allocation request from the second controller, the gateway determines the target storage space to be allocated to the second controller based on the space information recorded in the preset information table, and feeds back the space information of the target storage space to the second controller.

[0068] Specifically, the second controller can send a storage allocation request to the gateway after startup and a set time has elapsed. This storage allocation request can include the amount of storage space the second controller needs to request.

[0069] It should be noted that the reason why the second controller needs to wait a set time after startup before sending the storage allocation request is that when all controllers of the vehicle are started, in order to ensure that the gateway writes the space information of the shared storage space provided by all the first controllers into the preset information table first, all the second controllers can wait for a set time (such as 10 seconds) so that the gateway can record all the shared storage space first, which will facilitate the subsequent allocation of storage space to all the second controllers.

[0070] After receiving a storage allocation request from the second controller, the gateway can allocate target storage space to the second controller according to the required space amount in the storage allocation request and the space information recorded in the preset information table, and then feed back the space information of the target storage space to the second controller. The space information of the target storage space includes the identifier of the first controller providing the target storage space and the starting offset address of the target storage space.

[0071] In one specific implementation, the space information of the shared storage space includes the amount of shared space. In response to receiving a storage allocation request from the second controller, the gateway determines the target storage space to be allocated to the second controller based on the space information recorded in a preset information table, including:

[0072] In response to receiving a storage allocation request from the second controller, the gateway determines the required space amount of the second controller based on the storage allocation request. Based on the shared space amount of each shared storage space in the preset information table, the gateway determines whether there is a shared storage space with a shared space amount that meets the required space amount. If so, the gateway determines the target storage space to be allocated to the second controller from among the shared storage spaces that meet the required space amount.

[0073] Specifically, the gateway can analyze the storage allocation request sent by the second controller to determine the required space amount of the second controller. Furthermore, the gateway can determine whether there is a shared storage space with a shared space amount greater than the required space amount based on the shared space amount of each shared storage space in a preset information table. For example, it can sequentially determine whether the shared space amount of each shared storage space is greater than the required space amount according to the order recorded in the preset information table.

[0074] If there is a shared storage space that meets the required space quantity, then a portion of that shared storage space, with a size equal to the required space quantity, can be selected as the target storage space for the second controller.

[0075] Through this implementation method, it is possible to sequentially determine whether the amount of shared space in each shared storage space in the preset information table meets the required amount of space. In this way, a target storage space is allocated to the second controller in the shared storage space that meets the required amount of space, and a target storage space that directly meets the required amount of space can be provided to the second controller first.

[0076] In this embodiment of the application, considering that there may be a situation where all the shared storage spaces in the preset information table cannot meet the required space, in such cases, a target storage space composed of multiple shared storage spaces can also be provided to the second controller.

[0077] Optionally, the method provided in this application embodiment further includes:

[0078] If the gateway determines that there is no shared storage space that meets the required space quantity, it will combine at least two shared storage spaces as the target storage space for the second controller.

[0079] Specifically, if there is no shared storage space in the preset information table that meets the required space quantity, multiple shared storage spaces can be combined according to the shared space quantity of each shared storage space to serve as the target storage space allocated to the second controller.

[0080] For example, if S-ECU_1 provides 200K of shared storage space, S-ECU_2 provides 200K of shared storage space, S-ECU_3 provides 150K of shared storage space, and C-ECU_1 requires 500K of space, then the shared storage space provided by S-ECU_1 and S-ECU_2 can be used as the target storage space. At the same time, an additional 100K of space can be allocated from the shared storage space provided by S-ECU_3 as the target storage space.

[0081] Through the above optional implementation methods, when all the shared storage spaces in the preset information table are insufficient to meet the required space amount, the required space amount of the second controller can be met by allocating multiple spaces to the second controller, thus avoiding allocation failure.

[0082] Of course, in addition to this method, if it is determined that there is no shared storage space that meets the required space, the allocation failure response can be sent directly to the second controller. The second controller can then reduce the required space based on the allocation failure response and resend the storage allocation request.

[0083] In this embodiment of the application, after allocating target storage space to the second controller, if the second controller no longer has a need for space expansion, the allocation to the second controller can be cancelled to release the target storage space for use by other controllers.

[0084] In one specific implementation, before feeding back the spatial information of the target storage space to the second controller, the method further includes: the gateway writing the spatial information of the target storage space into a preset information table;

[0085] Accordingly, the method provided in this application embodiment further includes: in response to receiving a storage release request sent by the second controller, the gateway clears the space information of the target storage space allocated to the second controller in a preset information table.

[0086] Specifically, after determining the target storage space to be allocated to the second controller, the gateway can write the space information of the target storage space into a preset information table to record the allocated shared storage space in the preset information table. At the same time, when allocating space for other second controllers in the future, the amount of shared space of each shared storage space in the preset information table can be the initial value minus the amount already allocated as the target storage space.

[0087] Correspondingly, after allocating target storage space to the second controller, the second controller can send a storage release request to the gateway when it no longer needs to use the target storage space. Then, based on the storage release request, the gateway can clear the space information of the target storage space allocated to the second controller in the preset information table.

[0088] The above implementation method can release the allocated storage space, making it easier for other controllers to continue using it, and further improving the utilization rate of storage space.

[0089] S130, the second controller sends the log data to the first controller that provides the target storage space based on the space information of the target storage space, so that the first controller that provides the target storage space stores the log data in the target storage space.

[0090] The second controller, after generating log data, can determine whether the address to which the log data needs to be written is local memory or remote memory before writing the log data. If it is local memory, the log data is written directly to local memory.

[0091] If it is a remote storage device, the second controller sends the log data to the first controller that provides the target storage space. At the same time, it sends the space start offset address in the space information of the target storage space to the first controller. Then, the first controller writes the log data to the target storage space according to the space start offset address.

[0092] In this embodiment of the application, in addition to enabling the second controller to send log data to the first controller for storage, the second controller can also read log data from the first controller.

[0093] Optionally, the method provided in this application embodiment further includes:

[0094] Based on the spatial information of the target storage space, the second controller sends a log read request to the first controller that provides the target storage space, so that the first controller that provides the target storage space reads log data from the target storage space and sends the log data to the second controller.

[0095] If the second controller needs to read the written log data, it can first determine whether the address to be read is local memory or remote memory. If it is local memory, it can read directly from the local memory.

[0096] If it is a remote storage device, a log read request can be generated and sent to the first controller. This log read request includes the starting offset address of the target storage space from its spatial information. Furthermore, after receiving the log read request, the first controller can read the log data from the target storage space and send it back to the second controller.

[0097] Through the above implementation method, the second controller can read log data from the first controller, which facilitates subsequent problem localization and analysis.

[0098] It should be noted that, in this embodiment, the gateway records the space information of the shared storage space provided by the first controller in a preset information table, and allocates target storage space to the second controller and records the space information in the preset information table. This can be understood as static storage expansion of the controller. This is because the content recorded in the preset information table will not change with the restart of the controller. In other words, the storage space allocated to the second controller will not be canceled due to the restart of the second controller. Static storage expansion is suitable for situations where storage space needs to be expanded based on certain functional considerations during the design phase. When a controller needs to complete a certain function, but its storage space is insufficient to meet the requirements, it can consider requesting a controller with spare storage space to provide the required storage space.

[0099] In this application embodiment, considering that in some temporary application scenarios, such as when a second controller malfunctions, if we want to analyze the cause of the malfunction through logs, but the log storage space is still limited, resulting in the key logs at the time of the malfunction being overwritten, we can temporarily designate a shared storage space for the second controller to use, that is, dynamic storage expansion.

[0100] In one specific implementation, the method provided in this application further includes the following steps:

[0101] Step 11: In response to receiving the dynamic storage request instruction sent by the diagnostic instrument or CAN tool, the second controller sends a dynamic storage request to the gateway;

[0102] Step 12: In response to the dynamic storage request, the gateway determines the dynamic storage space allocated to the second controller based on the space information of each shared storage space and the space information of the target storage space in the preset information table, and feeds back the space information of the dynamic storage space to the second controller.

[0103] Step 13: The second controller responds to the space information of the dynamic storage space and sends a successful response to the diagnostic tool or CAN tool.

[0104] In step 11 above, the user can send a dynamic storage request command to the diagnostic tool or CAN tool through the host computer, so that the diagnostic tool or CAN tool can send a dynamic storage request command to the second controller.

[0105] Specifically, after receiving a dynamic storage request instruction, the second controller can send a dynamic storage request to the gateway to request an additional dynamic storage space. The dynamic storage request can include the amount of space requested.

[0106] Furthermore, in step 12, after the gateway receives the dynamic storage request, it can determine whether the shared storage space for the target storage space provided to the second controller can still provide dynamic storage space based on the space information of each shared storage space and the space information of the target storage space in the preset information table. If so, it can continue to divide the shared storage space into dynamic storage space and feed back the space information of the dynamic storage space to the second controller. At the same time, it can also record the space information of the dynamic storage space in the preset information table.

[0107] Furthermore, after receiving the space information of the dynamic storage space, the second controller can send a successful response to the diagnostic tool or CAN tool. After that, the second controller can send the log data to the first controller corresponding to the dynamic storage space, so that the first controller can write the log data to the dynamic storage space. The specific process can be referred to the log data writing of the target storage space, which will not be repeated here.

[0108] It should be noted that the dynamic storage space allocated to the second controller can be cleared after the second controller restarts. That is, the dynamic storage space can be understood as a temporarily allocated storage space. When the gateway detects that the second controller has restarted, it can clear the space information of the dynamic storage space of the second controller from the preset information table.

[0109] Through the above implementation method, the storage of the second controller can be dynamically expanded. After allocating the target storage space to the second controller, temporary dynamic storage space can be allocated to the second controller according to the further storage needs of logs in certain application scenarios. This is suitable for temporary application scenarios and further ensures the efficiency of log analysis and the accuracy of problem location.

[0110] In this embodiment, considering that the transmission of log data between the first controller and the second controller mainly relies on the CAN bus, that is, the storage space is shared through the CAN bus. However, when the amount of shared data is large, the load on the CAN bus will increase, which may affect the normal business between the controllers. Therefore, in order to solve this problem, this embodiment provides two methods to avoid the risk of affecting normal business caused by the sharing of storage space.

[0111] In one example, the second controller sends log data to the first controller that provides the target storage space based on the space information of the target storage space, including the following steps:

[0112] Step 21: The second controller determines the message identifier when the log data is sent in message form based on the importance level and data volume of the log data. The message identifier reflects the priority of message transmission.

[0113] Step 22: The second controller sends the log data to the CAN bus in the form of messages, so that the first controller, which provides the target storage space, can receive the log data from the CAN bus according to the message identifier of each message.

[0114] In step 21, before sending log data, the second controller can determine the message identifier when sending log data in message form according to the importance level and data volume of the log data. The message identifier can be CAN-ID.

[0115] Specifically, the importance level of log data can be a log data level, such as Error, Warning, Info, Debug, Trace, etc. Message identifiers reflect the priority of message transmission. When multiple messages with different identifiers are transmitted simultaneously, the message with the smaller identifier is transmitted first. That is, when the second controller obtains messages from the CAN bus, it transmits the messages sequentially according to their identifiers; the smaller the message identifier, the higher the transmission priority.

[0116] For example, if log data has a high importance level and a small data volume, a smaller message identifier can be assigned to it to determine a higher priority; conversely, if log data has a low importance level and a large data volume, a larger message identifier can be assigned to it to determine a lower priority. It should be noted that the message identifier for log data should be greater than that for normal business flow data; in other words, the priority of log data should be lower than that of normal business flow data.

[0117] Furthermore, in step 22, the second controller can sequentially send log data to the CAN bus in the form of messages according to the message identifier of each message. In addition to the log data, the message also carries the recipient information of the message. All controllers can obtain each message from the CAN bus. Among them, the first controller, which provides the target storage space for the second controller, can receive log data from the CAN bus according to the recipient information.

[0118] Through steps 21-22 above, message identifiers can be generated based on the importance level and data volume of log data, thereby prioritizing log data and preventing the transmission of log data under shared storage from affecting normal business operations between controllers.

[0119] In addition to prioritizing log data, the transmission of normal business data can also be protected by monitoring the load rate of the CAN channel. In another example, the method provided in this application embodiment further includes the following steps:

[0120] Step 31: The gateway obtains the current data transmission and reception volume of each CAN channel in the CAN bus, and determines the current load rate of the CAN channel based on the current data transmission and reception volume and the maximum bandwidth of the CAN channel.

[0121] Step 32: For each CAN channel, the gateway determines whether the current load rate is higher than at least one preset threshold. If so, it determines the target log level based on the maximum value of the preset thresholds reached by the current load rate and sends a high load notification to the second controller connected to the CAN channel.

[0122] Step 33: In response to the high load notification, the second controller sends log data that meets the target log level to the first controller that provides the target storage space.

[0123] The CAN bus can consist of multiple CAN channels, and each CAN channel can connect to multiple controllers. In step 31 above, the gateway can obtain the current data transmission and reception volume of each CAN channel in real time, and calculate the current load rate of the CAN channel by combining the maximum bandwidth of each CAN channel.

[0124] Furthermore, in step 32, if the gateway detects that the current load rate of the CAN channel is higher than at least one preset threshold, it indicates that the current load rate is high. The preset threshold can be a pre-set load rate threshold that requires limiting log levels. Each preset threshold corresponds to a different log level restriction; the higher the preset threshold, the higher the log level of the log data that can be sent.

[0125] Specifically, if the gateway detects that the current load rate is higher than at least one preset threshold, it can use the maximum value among all preset thresholds that the current load rate exceeds as the target log level, where the target log level can be understood as the log level of the log data that the second controller can send.

[0126] Furthermore, the gateway can send high-load notifications to all second controllers connected to the CAN channel, where the high-load notification may include the target log level.

[0127] In step 33, after receiving a high load notification, the second controller can send log data that meets the target log level to the first controller that provides the target storage space, thereby shutting down the sending of log data with lower log levels.

[0128] By monitoring the channel load rate and combining it with various preset thresholds, the busy level of the CAN channel can be determined, thereby limiting the log level of the log data that can be sent. This achieves the goal of accurately controlling the second controller to send logs and avoids the transmission of log data under shared storage from affecting the normal business between controllers.

[0129] The vehicle controller log storage method provided in this application embodiment involves a gateway responding to a storage sharing notification sent by a first controller by writing the space information of the shared storage space provided by the first controller into a preset information table. Then, responding to a storage allocation request sent by a second controller, the gateway allocates a target storage space to the second controller using the space information recorded in the preset information table and feeds back the space information of the target storage space to the second controller. The second controller then sends log data to the first controller providing the target storage space based on the space information of the target storage space, enabling the first controller to store the log data in the target storage space. This achieves log storage based on storage space expansion. This method can integrate redundant storage resources of various controllers in the vehicle, thereby providing storage for those with insufficient storage resources. The controller is used to store logs, which makes up for the storage space shortage of some controllers. It can help the controller store a large number of logs, solve the problem of locating and analyzing the impact of insufficient log storage resources in the existing technology, and improve the efficiency of locating the impact of critical logs being overwritten in the existing technology. In addition, this method can effectively save costs. For some controllers with low storage resource requirements, it can reduce the configuration of controller devices without worrying about the controller's scalability. It can also make up for the shortcomings of existing hardware. For some controllers that cannot meet the requirements of new functions due to insufficient storage, it can effectively make up for the problem of insufficient hardware storage resources. It can effectively integrate the vehicle's storage resources and realize a low-level vehicle distributed storage, which can facilitate the subsequent construction of a vehicle storage platform that shields the underlying controller.

[0130] Regarding static storage expansion, taking the example of a C-ECU (second controller) with 500K of storage space but lacking 200K of storage space, and an S-ECU (first controller) with 2000K of storage space but having 500K more storage space, the entire static expansion process will be illustrated.

[0131] like Figure 3 As shown, Figure 3 This is a schematic diagram of a static expansion process provided in an embodiment of this application. First, after the S-ECU starts, it can notify the gateway that it has 500K of space available. The gateway then updates the storage expansion information table (i.e., the preset information table). After the C-ECU starts, it delays for 10 seconds and requests 200K of storage space from the gateway. After the gateway allocates 200K of storage space, it updates the storage expansion information table and notifies the C-ECU that the S-ECU can provide 200K of storage space. Further, after generating logs, the C-ECU can send the logs to the S-ECU for storage. If the C-ECU needs to read logs, it can send a log read request to the S-ECU, providing the starting position and number of logs to be read. The S-ECU then sends the logs to be read to the C-ECU.

[0132] Regarding dynamic storage expansion, continuing with the above example, if the C-ECU uses the 200K storage space of the S-ECU and still needs 300K of storage space, then the UDS (Unified Diagnostic Services) routine can be used to issue a command to the C-ECU to temporarily request an additional 300K of storage space.

[0133] like Figure 4 As shown, Figure 4 This is a schematic diagram illustrating a dynamic expansion process provided in an embodiment of this application. First, the diagnostic tool or CAN tool can request 300K of storage space from the C-ECU. Then, the C-ECU requests 300K of storage space from the gateway. The gateway queries the storage information table, finds the required storage information, updates the table, and then notifies the C-ECU that the S-ECU can provide 300K of storage space. Furthermore, the C-ECU can return a response message indicating whether the request was successful or failed. When generating logs, the C-ECU can send the logs to the S-ECU for storage. When reading logs, it can send a log read request to the S-ECU, providing the starting position and number of logs to be read. The S-ECU then sends the logs to be read to the C-ECU.

[0134] The method provided in this application can save costs. For controllers with low storage resource requirements, it can reduce the configuration of controller devices without worrying about future scalability. Furthermore, it can compensate for the shortcomings of existing hardware solutions. Some existing controllers, due to insufficient design considerations, suffer from insufficient memory, making it impossible to meet some key new functional requirements. The method provided in this application can effectively compensate for the lack of hardware storage resources. In addition, it can effectively integrate the vehicle's storage resources. The method provided in this application is a low-level implementation of vehicle distributed storage technology. A vehicle storage platform that shields the underlying controller concept can be built on this platform. All controllers can use this vehicle storage platform as an external storage space for data storage, which effectively integrates discrete controller information, providing a vehicle-wide perspective for data organization and analysis.

[0135] For the same purpose, embodiments of this application also provide a vehicle log system, which includes at least one first controller, at least one second controller, and a gateway, wherein:

[0136] The first controller is configured to send a storage sharing notification to the gateway;

[0137] The second controller is configured to send a storage allocation request to the gateway, and based on the space information of the target storage space fed back by the gateway, send the log data to the first controller that provides the target storage space, so that the first controller that provides the target storage space stores the log data in the target storage space;

[0138] The gateway is configured to, in response to receiving a storage sharing notification sent by a first controller, write the space information of the shared storage space provided by the first controller into a preset information table; in response to receiving a storage allocation request sent by a second controller, determine the target storage space allocated to the second controller based on the space information recorded in the preset information table, and feed back the space information of the target storage space to the second controller.

[0139] In some implementations, the space information of the shared storage space includes the amount of shared space. The gateway is further configured to respond to receiving a storage allocation request sent by the second controller, determine the required space amount of the second controller based on the storage allocation request, and determine whether there is a shared storage space whose shared space amount meets the required space amount based on the shared space amount of each shared storage space in the preset information table. If so, the target storage space to be allocated to the second controller is determined from the shared storage spaces that meet the required space amount.

[0140] In some implementations, the gateway is further configured to combine at least two shared storage spaces as the target storage space for the second controller if it is determined that there is no shared storage space whose shared space quantity meets the required space quantity.

[0141] In some implementations, the second controller is further configured to send a log read request to the first controller providing the target storage space based on the space information of the target storage space, so that the first controller providing the target storage space reads log data from the target storage space and sends the log data to the second controller.

[0142] In some implementations, the gateway is further configured to write the space information of the target storage space into the preset information table, and, in response to receiving a storage release request sent by the second controller, clear the space information of the target storage space allocated to the second controller from the preset information table.

[0143] In some implementations, the second controller is further configured to send a dynamic storage request to the gateway in response to receiving a dynamic storage request instruction from a diagnostic instrument or a CAN tool, and to send a successful request response to the diagnostic instrument or the CAN tool in response to the space information of the dynamic storage space.

[0144] The gateway is also configured to respond to the dynamic storage request by determining the dynamic storage space allocated to the second controller based on the space information of each shared storage space in the preset information table and the space information of the target storage space, and feeding back the space information of the dynamic storage space to the second controller.

[0145] In some implementations, the second controller is further configured to determine a message identifier for sending the log data in message form based on the importance level and data volume of the log data, wherein the message identifier reflects the priority of message transmission; and to send the log data in message form to the CAN bus according to the message identifier of each message, so that the first controller providing the target storage space receives the log data from the CAN bus.

[0146] In some implementations, the gateway is further configured to obtain the current data transmission and reception volume of each CAN channel in the CAN bus, and determine the current load rate of the CAN channel based on the current data transmission and reception volume and the maximum bandwidth of the CAN channel; for each CAN channel, determine whether the current load rate is higher than at least one preset threshold; if so, determine the target log level based on the maximum value of the preset threshold reached by the current load rate, and send a high load notification to the second controller connected to the CAN channel.

[0147] The second controller is further configured to, in response to the high load notification, send log data that meets the target log level to the first controller providing the target storage space.

[0148] The vehicle log system provided in this application embodiment can execute the steps in the log storage method of the vehicle controller provided in this application method embodiment, and has the execution steps and beneficial effects, which will not be repeated here.

[0149] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 As shown, the electronic device 400 includes one or more processors 401 and memory 402.

[0150] The processor 401 may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 400 to perform desired functions.

[0151] The memory 402 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 401 may execute the program instructions to implement the log storage method of the vehicle controller in any embodiment of this application described above, and / or other desired functions. Various contents such as initial extrinsic parameters and thresholds may also be stored in the computer-readable storage medium.

[0152] In one example, the electronic device 400 may further include an input device 403 and an output device 404, these components being interconnected via a bus system and / or other forms of connection mechanisms (not shown). The input device 403 may include, for example, a keyboard, a mouse, etc. The output device 404 may output various information to the outside, including warning messages, braking force, etc. The output device 404 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.

[0153] Of course, for the sake of simplicity, Figure 5 Only some of the components of the electronic device 400 relevant to this application are shown in this illustration; components such as buses, input / output interfaces, etc., are omitted. In addition, the electronic device 400 may include any other suitable components depending on the specific application.

[0154] In addition to the methods and devices described above, embodiments of this application may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps of the log storage method for a vehicle controller provided in any embodiment of this application.

[0155] The computer program product can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this application. The programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0156] Furthermore, embodiments of this application may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps of the log storage method for the vehicle controller provided in any embodiment of this application.

[0157] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.

[0158] It should be noted that the terminology used in this application is for the purpose of describing specific embodiments only and is not intended to limit the scope of this application. As shown in the specification and claims of this application, unless the context clearly indicates otherwise, words such as "a," "an," "an," and / or "the" do not specifically refer to the singular and may also include the plural. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, or apparatus. Without further limitations, an element defined by the phrase "comprising an..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes said element.

[0159] It should also be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on this application. Unless otherwise expressly specified and limited, the terms "installed," "connected," "linked," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication between two elements. For those skilled in the art, the specific meaning of the above terms in this application can be understood according to the specific circumstances.

[0160] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. The above descriptions are only preferred embodiments of this application. It should be noted that due to the limitations of written expression, while there are objectively infinite specific structures, those skilled in the art can make several improvements, modifications, or changes without departing from the principles of this application, and can also combine the above technical features in an appropriate manner. These improvements, modifications, changes, or combinations, or the direct application of the inventive concept and technical solution to other situations without modification, should all be considered within the scope of protection of this application.

Claims

1. A method for storing logs of a vehicle controller, characterized in that, An application to a vehicle log system, the vehicle log system including at least one first controller, at least one second controller, and a gateway, wherein a controller with excess storage space is designated as the first controller, and a controller with insufficient storage space is designated as the second controller, the method comprising: In response to receiving a storage sharing notification from the first controller, the gateway writes the space information of the shared storage space provided by the first controller into a preset information table; In response to receiving a storage allocation request from the second controller, the gateway determines the target storage space to be allocated to the second controller based on the space information recorded in the preset information table, and feeds back the space information of the target storage space to the second controller. The second controller sends the log data to the first controller that provides the target storage space based on the space information of the target storage space, so that the first controller that provides the target storage space stores the log data in the target storage space; The method further includes: The gateway obtains the current transmit and receive data volume of each CAN channel in the CAN bus, and determines the current load rate of the CAN channel based on the current transmit and receive data volume and the maximum bandwidth of the CAN channel. For each CAN channel, the gateway determines whether the current load rate is higher than at least one preset threshold. If so, it determines the target log level based on the maximum value among the preset thresholds reached by the current load rate and sends a high load notification to the second controller connected to the CAN channel. In response to the high load notification, the second controller sends log data that meets the target log level to the first controller that provides the target storage space.

2. The method according to claim 1, characterized in that, The shared storage space information includes the amount of shared storage space. In response to receiving a storage allocation request from the second controller, the gateway determines the target storage space to be allocated to the second controller based on the space information recorded in the preset information table, including: The gateway responds to receiving a storage allocation request from the second controller and determines the required space amount of the second controller based on the storage allocation request; Based on the amount of shared space in each shared storage space in the preset information table, the gateway determines whether there is a shared storage space whose amount of shared space meets the required amount of shared space. If so, it determines the target storage space to be allocated to the second controller from among the shared storage spaces that meet the required amount of shared space.

3. The method according to claim 2, characterized in that, The method further includes: If the gateway determines that there is no shared storage space with a shared space quantity that meets the required space quantity, then at least two shared storage spaces will be combined as the target storage space for the second controller.

4. The method according to claim 1, characterized in that, The method further includes: Based on the space information of the target storage space, the second controller sends a log read request to the first controller that provides the target storage space, so that the first controller that provides the target storage space reads log data from the target storage space and sends the log data to the second controller.

5. The method according to claim 1, characterized in that, Before feeding back the spatial information of the target storage space to the second controller, the method further includes: The gateway writes the spatial information of the target storage space into the preset information table; Accordingly, the method further includes: In response to receiving a storage release request from the second controller, the gateway clears the space information of the target storage space allocated to the second controller from the preset information table.

6. The method according to claim 1, characterized in that, The method further includes: In response to receiving a dynamic storage request instruction from a diagnostic instrument or CAN tool, the second controller sends a dynamic storage request to the gateway; In response to the dynamic storage request, the gateway determines the dynamic storage space allocated to the second controller based on the space information of each shared storage space in the preset information table and the space information of the target storage space, and feeds back the space information of the dynamic storage space to the second controller. The second controller responds to the space information of the dynamic storage space and sends a successful application response to the diagnostic instrument or the CAN tool.

7. The method according to claim 1, characterized in that, The second controller, based on the space information of the target storage space, sends log data to the first controller providing the target storage space, including: The second controller determines the message identifier when the log data is sent in message form based on the importance level and data volume of the log data, wherein the message identifier reflects the priority of message transmission; The second controller sends the log data to the CAN bus in message form according to the message identifier of each message, so that the first controller providing the target storage space can receive the log data from the CAN bus.

8. A vehicle log system, characterized in that, The vehicle log system includes at least one first controller, at least one second controller, and a gateway. Controllers with excess storage space are designated as the first controller, and controllers with insufficient storage space are designated as the second controller. The first controller is configured to send a storage sharing notification to the gateway; The second controller is configured to send a storage allocation request to the gateway, and based on the space information of the target storage space fed back by the gateway, send the log data to the first controller that provides the target storage space, so that the first controller that provides the target storage space stores the log data in the target storage space; The gateway is configured to, in response to receiving a storage sharing notification sent by a first controller, write the space information of the shared storage space provided by the first controller into a preset information table; in response to receiving a storage allocation request sent by a second controller, determine the target storage space allocated to the second controller based on the space information recorded in the preset information table, and feed back the space information of the target storage space to the second controller. The gateway is also used to obtain the current data transmission and reception volume of each CAN channel in the CAN bus, and determine the current load rate of the CAN channel based on the current data transmission and reception volume and the maximum bandwidth of the CAN channel; for each CAN channel, it is determined whether the current load rate is higher than at least one preset threshold. If so, the target log level is determined according to the maximum value of the preset threshold reached by the current load rate, and a high load notification is sent to the second controller connected to the CAN channel. The second controller is further configured to, in response to the high load notification, send log data that meets the target log level to the first controller providing the target storage space.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program or instructions that cause a computer to perform the steps of the log storage method for a vehicle controller as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Log data storage method and device, multi-core system, electronic equipment and medium

    CN117194361A

  • Vehicle inter-domain storage sharing method and device, domain controller and storage medium

    CN117827491A