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

Through the gateway, the storage resources of the combined vehicle controller are coordinated, the problems of insufficient log storage resources and key log coverage are solved, the problem positioning and risk analysis efficiency is improved, distributed storage for the whole vehicle is realized, and costs are reduced.

CN119065851AActive Publication Date: 2024-12-03CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Insufficient log storage resources of vehicle controllers lead to inefficient problem location and risk analysis, and critical logs are overwritten, resulting in impact on positioning efficiency.

Method used

Through gateway coordination, the storage resources of each controller are integrated to provide shared storage space, ensuring that controllers with insufficient storage resources can store a large number of logs, avoid critical logs being overwritten, and optimize log transmission priority when CAN bus load is high.

Benefits of technology

It effectively solves the problem of insufficient log storage resources, improves problem positioning and risk analysis efficiency, reduces controller device configuration, makes up for the insufficient hardware storage resources, and realizes distributed storage for the entire vehicle, saving costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065851A_ABST
    Figure CN119065851A_ABST
Patent Text Reader

Abstract

The invention provides a log storage method of a vehicle controller, a whole vehicle log system and a storage medium, in the method, a gateway responds to a received storage sharing notification sent by a first controller, writes space information of a shared storage space into a preset information table, and further responds to a received storage allocation request sent by a second controller; through the space information recorded in the preset information table, the target storage space is allocated, and the space information of the target storage space is fed back to the second controller, so that the second controller sends the log data to the first controller providing the target storage space for storage. According to the method, redundant storage resources of all the controllers in the whole vehicle can be integrated, so that the controllers with insufficient storage resources are used for storing logs, the problem that in the prior art, insufficient log storage resources affect problem positioning and risk analysis is solved, and in addition, the problem that in the prior art, key logs are covered, and consequently the problem positioning efficiency is affected is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of automobile technology, and in particular to a log storage method of a vehicle controller, a whole vehicle log system and a storage medium. Background Art

[0002] Due to cost considerations, the storage resources of many vehicle controllers are currently limited, for example, usually between a few hundred KB and a few 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 for other information is not too large, and in most cases it can meet the needs. However, the demand for storage space for logs is relatively flexible. When storage resources are insufficient, usually only a small number of key logs are recorded, which affects the location of later problems and the analysis of potential risks. In addition, the existing technology usually sets the maximum storage number of logs. When the number of stored logs exceeds the set value, the previous logs will be cyclically overwritten. This also means that when locating problems, if key logs are overwritten, it will seriously affect the efficiency of locating the problem. Summary of the invention

[0004] In view of the above-mentioned defects or deficiencies in the prior art, the present application aims to provide a log storage method for a vehicle controller, a whole vehicle log system and a storage medium, so as to solve the problem location and risk analysis affected by insufficient log storage resources in the prior art, and to solve the problem location efficiency affected by the overwriting of key logs in the prior art.

[0005] The embodiment of the present application provides a log storage method of a vehicle controller, which is applied to a whole vehicle log system, wherein the whole vehicle log system includes at least one first controller, at least one second controller and a gateway, and the method includes: In response to 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 the preset information table; The gateway, in response to receiving the storage allocation request sent by the second controller, determines the target storage space 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 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 in the target storage space.

[0006] 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: The gateway determines, in response to receiving a storage allocation request sent by the second controller, a required amount of space of the second controller based on the storage allocation request; The gateway determines 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 gateway determines the target storage space allocated to the second controller in the shared storage space that meets the required space amount.

[0007] Optionally, the method further includes: If the gateway determines that there is no shared storage space whose shared space amount satisfies the required space amount, at least two shared storage spaces are combined as the target storage space of the second controller.

[0008] Optionally, the method further includes: The second controller sends 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.

[0009] Optionally, before feeding back the space information of the target storage space to the second controller, the method further includes: The gateway writes the space information of the target storage space into the preset information table; Accordingly, the method further includes: In response to receiving the 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 the preset information table.

[0010] Optionally, the method further includes: The second controller sends a dynamic storage application request to the gateway in response to receiving a dynamic storage application instruction sent by the diagnostic instrument or the CAN tool; The gateway, in response to the dynamic storage application request, 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 feeds back a successful application response to the diagnostic instrument or the CAN tool in response to the space information of the dynamic storage space.

[0011] Optionally, the second controller sends the log data to the first controller providing the target storage space based on the space information of the target storage space, including: The second controller determines, according to the importance level and data volume of the log data, a message identifier when the log data is sent in the form of a message, wherein the message identifier reflects the priority of the message sending; The second controller sends the log data in the form of messages 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.

[0012] Optionally, the method further includes: The gateway obtains the current amount of data sent and received by each CAN channel in the CAN bus, and determines the current load rate of the CAN channel based on the current amount of data sent and received 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 value. If so, the gateway determines the target log level according to the maximum value of the preset threshold values ​​reached by the current load rate, and sends a high load notification to the second controller mounted under the CAN channel; In response to the high load notification, the second controller sends the log data that meets the target log level to the first controller that provides the target storage space.

[0013] The embodiment of the present application further provides a vehicle log system, the vehicle log system comprising at least one first controller, at least one second controller and a gateway, wherein: The first controller is used to send a storage sharing notification to the gateway; The second controller is used 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 used to, in response to receiving a storage sharing notification sent by the first controller, write the space information of the shared storage space provided by the first controller into a preset information table, and in response to receiving a storage allocation request sent by the 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.

[0014] The present application also provides an electronic device, the electronic device comprising: Processor and memory; The processor is used to execute the steps of the log storage method of the vehicle controller provided in any embodiment of the present application by calling the program or instruction stored in the memory.

[0015] An embodiment of the present application also provides a computer-readable storage medium, which stores a program or instruction, and the program or instruction enables a computer to execute the steps of the log storage method of the vehicle controller provided in any embodiment of the present application.

[0016] In summary, the present application proposes a log storage method for a vehicle controller, in which the gateway, in response to receiving a storage sharing notification sent by the first controller, writes the space information of the shared storage space provided by the first controller into a preset information table, and then in response to receiving a storage allocation request sent by the second controller, allocates a target storage space to the second controller through the space information recorded in the preset information table, and feeds back the space information of the target storage space to the second controller, so that the second controller sends the log data to the first controller that provides the target storage space according to the space information of the target storage space, so that the first controller stores the log data in the target storage space, thereby realizing log storage based on storage space expansion. This method can integrate the redundant storage resources of each controller in the entire vehicle, thereby providing storage resources. Sufficient controllers are used to store logs, which makes up for the problem of insufficient storage space in some controllers, can help controllers store a large number of logs, solve the problem of insufficient log storage resources in the prior art, and improve the efficiency of problem location. In addition, the method can effectively save costs. For some controllers that do not require high storage resources, the configuration of controller devices can be reduced without worrying about the scalability of the controller. 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 storage resources of the entire vehicle and realize a bottom-level distributed storage of the entire vehicle, which can facilitate the subsequent construction of a vehicle storage platform that shields the underlying controller on this basis. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 is a flow chart of a log storage method of a vehicle controller provided in an embodiment of the present application; Figure 2 It is a structural diagram of the vehicle log system provided by the embodiment of the present application; Figure 3 This is a schematic diagram of a static expansion process provided by an embodiment of the present application; Figure 4 This is a schematic diagram of a dynamic expansion process provided by an embodiment of the present application; Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0019] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.

[0020] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0021] Before introducing in detail the log storage method of the vehicle controller provided in the embodiment of the present application, the technical problem solved by the method is first described.

[0022] In the prior art, when storage resources are insufficient, only a small number of key logs are usually recorded. However, this situation can only solve the problem of whether there are logs or not, and cannot bring out the value that logs should have. For logs, when the system is abnormal, the root cause of the problem can be quickly found through logs, which improves the efficiency of problem solving. Even if the system is running normally, potential risks may be found by reading logs. In many cases, although the system operation does not prompt problems, it does not mean that the system operation is completely correct.

[0023] To achieve the goal of quickly solving problems and discovering hidden problems in advance, it is not possible to record only a small number of key logs. Therefore, it is necessary to record logs in the following situations to ensure that the system is maintainable and measurable to the maximum. For example: record the input and output information of key function interfaces, record the key events generated, record the changes in internal states, record the execution of abnormal branches, record the variables used to determine branch jumps, record the core operation process, and record the completion of paired operations, such as memory allocation and release.

[0024] A complete log should include but not be limited to the above mentioned contents. For a slightly complex system, the data volume of the above log will be quite large. In addition to the complexity of the log content, there are also requirements for log recording time. Generally, the maximum number of logs to be stored is set. When the number of stored logs exceeds the set value, the previous logs will be overwritten cyclically. This will cause the key logs to be overwritten when locating the problem, which will seriously affect the efficiency of locating the problem.

[0025] Therefore, in order to solve the above problems, the present application proposes a log storage method for a vehicle controller. Taking into account that different controllers have different storage spaces, and the storage resources of all controllers are sufficient but the storage demand is not high, the excess storage space of such controllers can be shared with other controllers for use, so as to solve the problem of insufficient log storage resources in the prior art.

[0026] Figure 1 The present invention provides a flow chart of a log storage method of a vehicle controller provided in an embodiment of the present invention. The log storage method of the vehicle controller is applied to a whole vehicle log system, which includes at least one first controller, at least one second controller and a gateway.

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

[0028] The first controller may be a controller that can provide storage space for other controllers, which may be represented by S-ECU, and the second controller may be a controller that needs to use the storage space provided by other controllers, which may be represented by C-ECU. For example, according to the functions of each controller and the demand for logs, the controller with excess storage space may be set as the first controller, and the controller with insufficient storage space may be set as the second controller.

[0029] See also Figure 1 , the log storage method of the vehicle controller specifically includes: S110: In response to receiving the storage sharing notification sent by the first controller, the gateway writes space information of the shared storage space provided by the first controller into a preset information table.

[0030] Among them, after startup, the first controller can send a storage sharing notification to the gateway to inform the gateway of the shared space amount and space starting offset address of the shared storage space that can be provided. That is, the storage sharing notification describes the shared space amount and space starting offset address of the shared storage space of the first controller. The shared space amount of the shared storage space can be specified by the first controller during the program initialization process and can be set in advance.

[0031] Specifically, after receiving the storage sharing notification sent by the first controller, the gateway may register the shared storage space provided by the first controller, for example, by writing the space information of the shared storage space into a preset information table to complete the registration of the shared storage space.

[0032] The preset information table may be a table maintained in the gateway for recording the shared storage space provided by each first controller. The preset information table may include the space information of each shared storage space, and the space information of the shared storage space may be composed of the identifier of the first controller providing the shared storage space, the shared space amount of the shared storage space (i.e., the space size), and the space start offset address. Exemplarily, as shown in Table 1, a preset information table is shown.

[0033] Table 1 A preset information table

[0034] In Table 1, the S-ECU column indicates the identifier of the first controller providing the shared storage space, the S-SIZE column indicates the shared space amount of the shared storage space, and the S-OFFSET column indicates the space start offset address of the shared storage space, that is, the offset address of the shared storage space in the storage space of the first controller. The C-ECU column indicates the identifier of the second controller using the shared storage space as the target storage space, the C-SIZE column indicates the space size of the target storage space, and the C-OFFSET column indicates the space start offset address of the target storage space in the corresponding first controller.

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

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

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

[0038] S120. In response to receiving the storage allocation request sent by the second controller, the gateway determines the target storage space 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.

[0039] Specifically, the second controller may send a storage allocation request to the gateway after being started and after a set time has passed, wherein the storage allocation request may include the required amount of storage space that the second controller needs to apply for.

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

[0041] After receiving the storage allocation request sent by the second controller, the gateway can allocate the 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 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 space starting offset address of the target storage space.

[0042] In a specific implementation, 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 a 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: In response to receiving a storage allocation request sent by the second controller, the gateway determines the required space amount of the second controller based on the storage allocation request; the gateway determines 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, and if so, determines the target storage space to be allocated to the second controller in the shared storage space that meets the required space amount.

[0043] The gateway may analyze the required space amount of the second controller according to the storage allocation request sent by the second controller. Further, the gateway may determine whether there is a shared storage space whose shared space amount is greater than the required space amount according to the shared space amount of each shared storage space in the preset information table. For example, the gateway may determine whether the shared space amount of each shared storage space is greater than the required space amount in the order recorded in the preset information table.

[0044] If there is a shared storage space that meets the required space amount, a portion of space with the same size as the required space amount may be selected from the shared storage space as the target storage space of the second controller.

[0045] Through this implementation, it is possible to determine in turn whether the shared space amount of each shared storage space in the preset information table meets the required space amount, thereby allocating target storage space to the second controller in the shared storage space that meets the required space amount, and being able to preferentially provide the second controller with a target storage space that directly meets the required space amount.

[0046] In the embodiment of the present application, considering that all shared storage spaces in the preset information table may not be able to meet the required space amount, for such a situation, a target storage space composed of multiple shared storage spaces can also be provided to the second controller.

[0047] Optionally, the method provided in the embodiment of the present application further includes: If the gateway determines that there is no shared storage space whose shared space quantity meets the required space quantity, at least two shared storage spaces are combined as the target storage space of the second controller.

[0048] Specifically, if there is no shared storage space in the preset information table whose shared space quantity meets the required space quantity, multiple shared storage spaces may be combined according to the shared space quantities of the respective shared storage spaces as the target storage space allocated to the second controller.

[0049] For example, 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, 100K of space can be allocated from the shared storage space provided by S-ECU_3 as the target storage space.

[0050] Through the above optional implementation, when all shared storage spaces in the preset information table cannot meet the required space, the required space of the second controller can be met by allocating multiple spaces to the second controller to avoid allocation failure.

[0051] Of course, in addition to this method, when it is determined that there is no shared storage space whose shared space amount meets the required space amount, an allocation failure response can be directly fed back to the second controller. Based on the allocation failure response, the second controller can reduce the required space amount and resend the storage allocation request.

[0052] In the embodiment of the present application, after allocating the target storage space for the second controller, if the second controller no longer needs to expand its space, the allocation to the second controller can be canceled to release the target storage space for use by other controllers.

[0053] In a specific implementation, before feeding back the space information of the target storage space to the second controller, the method further includes: the gateway writing the space information of the target storage space into a preset information table; Correspondingly, the method provided by the embodiment of the present application also 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 the preset information table.

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

[0055] Correspondingly, after allocating target storage space to the second controller, the second controller can send a storage release request to the gateway when the target storage space is no longer needed. 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.

[0056] Through the above implementation, the allocated storage space can be released, which is convenient for subsequent use by other controllers, and further improves the utilization rate of the storage space.

[0057] S130: The second controller sends the 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 in the target storage space.

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

[0059] If it is a remote storage, the second controller sends the log data to the first controller that provides the target storage space, and at the same time, sends the space starting offset address in the space information of the target storage space to the first controller, and then the first controller writes the log data to the target storage space according to the space starting offset address.

[0060] In the embodiment of the present 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.

[0061] Optionally, the method provided in the embodiment of the present application further includes: The second controller sends 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 the log data from the target storage space and sends the log data to the second controller.

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

[0063] If it is a remote storage, a log read request can be generated and sent to the first controller, wherein the log read request includes the space start offset address in the space information of the target storage space. Further, after receiving the log read request, the first controller can read the log data from the target storage space and feed it back to the second controller.

[0064] Through the above implementation, the second controller can read log data from the first controller, which is convenient for subsequent problem location and analysis.

[0065] It should be noted that in the embodiment of the present application, the gateway records the space information of the shared storage space provided by the first controller in the preset information table, and allocates the target storage space to the second controller and records the space information in the preset information table, which can be understood as the static expansion of the controller's storage. 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 cancelled due to the restart of the second controller. Static expansion of storage is applicable to 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 is limited by its storage space and cannot meet the demand, it can consider requesting a controller with sufficient storage space to provide it with the required storage space.

[0066] In an embodiment of the present application, taking into account some temporary application scenarios, such as when a second controller is abnormal, if you want to analyze the cause of the abnormality through logs, but the storage space of the logs is still limited, resulting in the key logs when the abnormality occurs being overwritten, at this time you can temporarily specify a shared storage space for the second controller to use, that is, dynamic storage expansion.

[0067] In a specific implementation, the method provided in the embodiment of the present application further includes the following steps: Step 11, the second controller sends a dynamic storage application request to the gateway in response to receiving a dynamic storage application instruction sent by the diagnostic instrument or the CAN tool; Step 12: In response to the dynamic storage application 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; Step 13: The second controller responds to the space information of the dynamic storage space and feeds back a successful application response to the diagnostic instrument or the CAN tool.

[0068] Among them, in the above step 11, the user can send a dynamic storage request instruction to the diagnostic instrument or CAN tool through the host computer, so that the diagnostic instrument or CAN tool can send a dynamic storage request instruction to the second controller.

[0069] Specifically, after receiving the dynamic storage application instruction, the second controller may send a dynamic storage application request to the gateway to apply for an additional dynamic storage space through the dynamic storage application request. The dynamic storage application request may include the requested space amount.

[0070] Furthermore, in step 12, after the gateway receives the dynamic storage application request, it can determine whether the shared storage space that provides the target storage space to the second controller can continue to provide dynamic storage space based on the space information of each shared storage space in the preset information table and the space information of the target storage space. If so, the dynamic storage space can continue to be divided in the shared storage space, and the space information of the dynamic storage space can be fed back to the second controller. At the same time, the space information of the dynamic storage space can also be recorded in the preset information table.

[0071] Furthermore, after receiving the space information of the dynamic storage space, the second controller can feedback a successful application response to the diagnostic instrument 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 writes the log data to the dynamic storage space. The specific process can refer to the log data writing of the target storage space, and will not be repeated here.

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

[0073] Through the above implementation, dynamic expansion of the storage of the second controller can be achieved. After allocating target storage space to the second controller, temporary dynamic storage space can continue to be allocated to the second controller based on further storage requirements for logs in certain application scenarios. This is suitable for temporary application scenarios and further ensures log analysis efficiency and problem location accuracy.

[0074] In the embodiment of the present application, 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, in the embodiment of the present application, two methods are provided to avoid the risk of affecting normal business due to storage space sharing.

[0075] In an example, the second controller sends the log data to the first controller providing the target storage space based on the space information of the target storage space, including the following steps: Step 21, the second controller determines a message identifier when the log data is sent in the form of a message according to the importance level and data volume of the log data, wherein the message identifier reflects the priority of the message sending; Step 22: The second controller sends the log data to the CAN bus in the form of a message, so that the first controller providing the target storage space receives the log data from the CAN bus according to the message identifier of each message.

[0076] Wherein, in step 21, before sending the log data, the second controller may determine a message identifier when the log data is sent in the form of a message according to the importance level and data volume of the log data, and the message identifier may be a CAN-ID.

[0077] Specifically, the importance level of the log data may be the level of the log data, such as Error, Warning, Info, Debug, Trace, etc. The message identifier can reflect the priority of message sending. When multiple messages with different message identifiers are sent at the same time, the message with a smaller identifier is sent first, that is, when the second controller obtains the message from the CAN bus, it sends the message in sequence according to the message identifier. The smaller the message identifier, the higher the message sending priority.

[0078] For example, if the importance level of the log data is high and the data volume is small, a smaller message identifier can be determined to assign a higher priority to it; if the importance level of the log data is low and the data volume is large, a larger message identifier can be determined to assign a lower priority to it. It should be noted that the message identifier of the log data should be larger than the message identifier of the normal business flow data. In other words, the priority of the log data should be lower than the priority of the normal business flow data.

[0079] Further, in step 22, the second controller can send the log data in sequence to the CAN bus in the form of messages according to the message identifiers of the messages, and the messages carry the receiver information of the messages in addition to the log data. All controllers can obtain each message from the CAN bus, wherein the first controller providing the target storage space for the second controller can receive the log data from the CAN bus according to the receiver information.

[0080] Through the above steps 21 and 22, a message identifier can be generated according to the importance level and data volume of the log data, so as to prioritize the log data, thereby preventing the transmission of log data in shared storage from affecting normal services between controllers.

[0081] 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 the embodiment of the present application also includes the following steps: Step 31, the gateway obtains the current amount of data sent and received by each CAN channel in the CAN bus, and determines the current load rate of the CAN channel based on the current amount of data sent and received and the maximum bandwidth of the CAN channel; Step 32: For each CAN channel, the gateway determines whether the current load rate is higher than at least one preset threshold. If so, the gateway determines the target log level according to the maximum value of the preset thresholds reached by the current load rate, and sends a high load notification to the second controller mounted under the CAN channel; Step 33: In response to the high load notification, the second controller sends the log data that meets the target log level to the first controller that provides the target storage space.

[0082] The CAN bus may be composed of multiple CAN channels, and each CAN channel may be equipped with multiple controllers. In the above step 31, the gateway may obtain the current amount of data sent and received by each CAN channel in real time, and calculate the current load rate of the CAN channel in combination with the maximum bandwidth of each CAN channel.

[0083] Further, 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 means that the current load rate is high. The preset threshold can be a preset load rate critical value that needs to limit the log level, and each preset threshold corresponds to a different restricted log level. The higher the preset threshold, the higher the log level of the restricted log data that can be sent.

[0084] Specifically, if the gateway detects that the current load rate is higher than at least one preset threshold, it can set the corresponding restricted log level as the target log level based on the maximum value of all preset thresholds exceeded by the current load rate, where the target log level can be understood as the log level of the log data that the second controller can send.

[0085] Furthermore, the gateway may send a high load notification to all second controllers mounted under the CAN channel, wherein the high load notification may include a target log level.

[0086] In step 33 , after receiving the high load notification, the second controller may send the log data that meets the target log level to the first controller that provides the target storage space, so as to close the sending of the log data with a lower log level.

[0087] Through the above steps 31 to 33, the busyness of the CAN channel can be determined by monitoring the channel load rate and combining various preset thresholds, thereby limiting the log level of the log data that can be sent, thereby achieving the purpose of accurately controlling the second controller to send logs and avoiding the transmission of log data under shared storage affecting the normal business between controllers.

[0088] The log storage method of the vehicle controller provided in the embodiment of the present application, in which the gateway responds to receiving the storage sharing notification sent by the first controller, writes the space information of the shared storage space provided by the first controller into the preset information table, and then responds to receiving the storage allocation request sent by the second controller, allocates the target storage space to the second controller through the space information recorded in the preset information table, and feeds back the space information of the target storage space to the second controller, so that the second controller sends the log data to the first controller that provides the target storage space according to the space information of the target storage space, so that the first controller stores the log data in the target storage space, realizing log storage based on storage space expansion, and the method can integrate the redundant storage resources of each controller in the whole vehicle, thereby providing storage resources insufficient for the second controller. The controller is used to store logs, which makes up for the problem of insufficient storage space in some controllers, can help the controller store a large number of logs, solve the problem of insufficient log storage resources in the prior art, and reduce the efficiency of problem location. In addition, the method can effectively save costs. For some controllers that do not require high storage resources, it can reduce the configuration of controller devices and do not have to worry about the scalability of the controller. 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 storage resources of the entire vehicle and realize a bottom-level distributed storage of the entire vehicle, which can facilitate the subsequent construction of a vehicle storage platform that shields the underlying controller on this basis.

[0089] For static storage expansion, the entire static expansion process is illustrated by taking the case where C-ECU (second controller) has 500K storage space, lacks 200K storage space, and S-ECU (first controller) has 2000K storage space, with 500K excess storage space as an example.

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

[0091] For dynamic storage expansion, continuing with the above example, that is, C-ECU uses 200K storage space of S-ECU, and C-ECU needs 300K storage space. Then, you can use the UDS (Unified Diagnostic Services) routine to issue instructions to C-ECU to temporarily apply for an additional 300K storage space.

[0092] like Figure 4 As shown, Figure 4 This is a schematic diagram of a dynamically expanded process provided by an embodiment of the present application. First, the diagnostic instrument or CAN tool can apply for 300K of storage space from the C-ECU, and then the C-ECU applies for 300K of storage space from the gateway. The gateway queries the storage information table, finds the storage information that meets the requirements, and updates the table, and then notifies the C-ECU that the S-ECU can provide 300K of storage space. Further, the C-ECU can return a response message of success or failure of the application. When generating a log, the C-ECU can send the log to the S-ECU for storage. When reading a log, it can send a log read request to the S-ECU, provide the starting position of the log to be read and the number of logs, and then the S-ECU sends the log to be read to the C-ECU.

[0093] The method provided in the embodiment of the present application can save costs. For some controllers that do not require high storage resources, the configuration of controller devices can be reduced without worrying about future scalability. In addition, it can make up for the shortcomings of existing hardware solutions. Some existing controllers are not sufficiently considered during design, resulting in insufficient memory and unable to meet some key new functional requirements. The method provided in the embodiment of the present application can effectively make up for the lack of hardware storage resources. In addition, the storage resources of the entire vehicle can be effectively integrated. The method provided in the embodiment of the present application is a bottom-level implementation of the distributed storage technology of the entire vehicle. On this basis, a layer of entire vehicle storage platform that shields the concept of the underlying controller can be constructed. All controllers can use the entire vehicle storage platform as an external storage space for data storage, which effectively integrates the discrete controller information together and provides a vehicle perspective for data collation and analysis.

[0094] Based on the same purpose, an embodiment of the present application also provides a vehicle log system, which includes at least one first controller, at least one second controller and a gateway, wherein: The first controller is used to send a storage sharing notification to the gateway; The second controller is used 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 used to, in response to receiving a storage sharing notification sent by the first controller, write the space information of the shared storage space provided by the first controller into a preset information table, and in response to receiving a storage allocation request sent by the 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.

[0095] In some embodiments, the space information of the shared storage space includes the shared space amount of the shared storage space. The gateway is also used to determine the required space amount of the second controller based on the storage allocation request in response to receiving a storage allocation request sent by the second controller; based on the shared space amount of each shared storage space in the preset information table, determine whether there is a shared storage space with a shared space amount that meets the required space amount; if so, determine the target storage space allocated to the second controller in the shared storage space that meets the required space amount.

[0096] In some embodiments, the gateway is further configured to combine at least two shared storage spaces as the target storage space of the second controller if it is determined that there is no shared storage space whose shared space amount satisfies the required space amount.

[0097] In some embodiments, the second controller is further used 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.

[0098] In some embodiments, the gateway is further used 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 in the preset information table.

[0099] In some embodiments, the second controller is further configured to, in response to receiving a dynamic storage application instruction sent by the diagnostic instrument or the CAN tool, send a dynamic storage application request to the gateway, and, in response to the space information of the dynamic storage space, feed back a successful application response to the diagnostic instrument or the CAN tool; The gateway is also used to respond to the dynamic storage application request, determine 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 feed back the space information of the dynamic storage space to the second controller.

[0100] In some embodiments, the second controller is further used to determine a message identifier when the log data is sent in the form of a message based on the importance level and data volume of the log data, wherein the message identifier reflects the priority of message sending; and send the log data in the form of a message 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.

[0101] In some embodiments, the gateway is further used to obtain the current amount of data sent and received by each CAN channel in the CAN bus, and determine the current load rate of the CAN channel based on the current amount of data sent and received 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 value, and if so, determine the target log level according to the maximum value of the preset threshold values ​​reached by the current load rate, and send a high load notification to the second controller mounted under the CAN channel; The second controller is further configured to send the log data meeting the target log level to the first controller providing the target storage space in response to the high load notification.

[0102] The vehicle log system provided in the embodiment of the present application can execute the steps in the log storage method of the vehicle controller provided in the method embodiment of the present application, and the execution steps and beneficial effects are no longer repeated here.

[0103] Figure 5 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device 400 includes one or more processors 401 and a memory 402 .

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

[0105] 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 (cache), etc. 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 run the program instructions to implement the log storage method of the vehicle controller of any embodiment of the present application described above and / or other desired functions. Various contents such as initial external parameters, thresholds, etc. may also be stored in the computer-readable storage medium.

[0106] In one example, the electronic device 400 may further include: an input device 403 and an output device 404, which are 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 early warning prompt information, braking force, etc. The output device 404 may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.

[0107] Of course, to simplify, Figure 5 Only some of the components related to the present application in the electronic device 400 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application conditions, the electronic device 400 may also include any other appropriate components.

[0108] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the log storage method for the vehicle controller provided in any embodiment of the present application.

[0109] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0110] In addition, an embodiment of the present application may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps of the log storage method for the vehicle controller provided in any embodiment of the present application.

[0111] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0112] It should be noted that the terms used in this application are only for describing specific embodiments, rather than limiting the scope of this application. As shown in the specification and claims of this application, unless the context clearly indicates an exception, the words "one", "a", "a kind of" and / or "the" do not specifically refer to the singular, but may also include the plural. The terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method or device including the elements.

[0113] It should also be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. Unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", etc. should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0114] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and its core ideas of this application. The above is only the preferred implementation method of this application. It should be pointed out that due to the limitations of textual expression and the objective existence of infinite specific structures, ordinary technicians in this technical field 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 concept and technical solution of the invention to other occasions without improvement, should be regarded as the scope of protection of this application.

Claims

1. A log storage method for a vehicle controller, characterized in that: Applied to a vehicle log system, the vehicle log system includes at least one first controller, at least one second controller and a gateway, and the method includes: In response to 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 the preset information table; The gateway, in response to receiving the storage allocation request sent by the second controller, determines the target storage space 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 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 in the target storage space.

2. The method according to claim 1, characterized in that 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 a 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: The gateway, in response to receiving a storage allocation request sent by the second controller, determines a required space amount of the second controller based on the storage allocation request; The gateway determines 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, determines the target storage space allocated to the second controller in the shared storage space that meets the required space amount.

3. The method according to claim 2, characterized in that The method further comprises: If the gateway determines that there is no shared storage space whose shared space amount satisfies the required space amount, at least two shared storage spaces are combined as the target storage space of the second controller.

4. The method according to claim 1, characterized in that: The method further comprises: The second controller sends 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.

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

6. The method according to claim 1, characterized in that The method further comprises: The second controller sends a dynamic storage application request to the gateway in response to receiving a dynamic storage application instruction sent by the diagnostic instrument or the CAN tool; The gateway, in response to the dynamic storage application request, 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 feeds back a successful application response to the diagnostic instrument or the CAN tool in response to the space information of the dynamic storage space.

7. The method according to claim 1, characterized in that 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, including: The second controller determines, according to the importance level and data volume of the log data, a message identifier when the log data is sent in the form of a message, wherein the message identifier reflects the priority of the message sending; The second controller sends the log data in the form of messages 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.

8. The method according to claim 1, characterized in that The method further comprises: The gateway obtains the current amount of data sent and received by each CAN channel in the CAN bus, and determines the current load rate of the CAN channel based on the current amount of data sent and received 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 value. If so, the gateway determines the target log level according to the maximum value of the preset threshold values ​​reached by the current load rate, and sends a high load notification to the second controller mounted under the CAN channel; In response to the high load notification, the second controller sends the log data that meets the target log level to the first controller that provides the target storage space.

9. 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, wherein: The first controller is used to send a storage sharing notification to the gateway; The second controller is used 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 used to, in response to receiving a storage sharing notification sent by the first controller, write the space information of the shared storage space provided by the first controller into a preset information table, and in response to receiving a storage allocation request sent by the 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.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or an instruction, and the program or the instruction enables a computer to execute the steps of the log storage method of the vehicle controller according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Log processing method and device, electronic equipment, storage medium and vehicle

    CN115509453A

  • Log security management method and device, platform and medium

    CN115883200A

  • Log management method and device of vehicle-mounted system and computer readable storage medium

    CN116561088A

  • Server log storage method and device, storage medium and electronic device

    CN116662285A

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

    CN117194361A