Task processing method and system of battery management system, storage medium and product
By predicting the execution time of the subtask of the battery management system, flexibly adjusting the maximum allowable time, the timeout and resource waste caused by unreasonable task allocation are solved, and the stability and reliability of the system are improved.
Patent Information
- Application Number
- CN202510341826.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-07-18
AI Technical Summary
In the existing battery management system, the maximum allowable duration of task allocation is set unreasonably, resulting in frequent tasks timeouts or waste of resources, affecting system performance and stability.
By obtaining the progress information of the battery management system, predict the execution time of each subtask, and flexibly adjust the maximum allowable time to ensure the smooth execution of the task and improve system stability and reliability.
It realizes the maximum allowable duration of subtasks flexibly adjusting the maximum allowable duration in the battery management system, reducing the risk of task timeout, and improving resource utilization and system performance.
Smart Images

Figure CN120335990A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of operating systems, and particularly to a task processing method, system, storage medium, and product for a battery management system. Background Art
[0002] During the execution of battery management tasks, the battery management system often divides tasks into smaller subtasks and assigns a corresponding maximum allowable duration to each subtask. If the maximum allowable duration is set too small, it may cause tasks to time out frequently. If it is set too large, it will result in a waste of resources in the battery management system. Therefore, how to reasonably allocate the maximum allowable duration is crucial. Summary of the Invention
[0003] Embodiments of this application provide a task processing method, system, storage medium, and product for a battery management system, which can flexibly adjust the maximum allowable duration corresponding to each subtask, enabling the target task to be executed smoothly and improving the stability and reliability of the battery management system.
[0004] In a first aspect, embodiments of this application provide a task processing method for a battery management system. The method includes:
[0005] Obtain progress information during the execution of a target task by the battery management system, where the target task includes multiple subtasks;
[0006] Determine the predicted execution time of each subtask according to the progress information;
[0007] Adjust the maximum allowable duration corresponding to each subtask according to the predicted execution time;
[0008] Continue to execute the target task based on the adjusted maximum allowable duration corresponding to each subtask.
[0009] In this way, the predicted execution time of each subtask can be predicted through the progress information of the target task, so that during the execution of the target task, the maximum allowable duration corresponding to each subtask can be flexibly adjusted, enabling the target task to be executed smoothly and improving the stability and reliability of the battery management system.
[0010] In some embodiments, obtaining progress information during the execution of a target task by the battery management system may include:
[0011] When at least one subtask times out during the execution of the target task by the battery management system; or,
[0012] When the system load index of the battery management system meets a preset load condition;
[0013] Obtain progress information during the execution of a target task by the battery management system.
[0014] In this way, when there is a timeout in the already executed subtasks or the system load is too high, it can be considered that there may be a problem with the time allocation of the current target task. Therefore, it is necessary to predict the execution time of each subtask and flexibly adjust based on the prediction results to achieve the purpose of improving system performance and resource utilization.
[0015] In some embodiments, adjusting the maximum allowable duration corresponding to each subtask according to the predicted execution time may include:
[0016] When the predicted execution time of the target subtask is greater than the maximum allowable duration corresponding to the target subtask, determine the first difference between the predicted execution time and the maximum allowable duration;
[0017] When the first difference is greater than or equal to the first difference threshold, increase the maximum allowable duration according to the first difference;
[0018] Wherein, the target subtask is any subtask.
[0019] In this way, when the predicted execution time of a certain subtask is greater than the current maximum allowable duration and the difference between them is large, the maximum allowable duration can be increased so that the subtask can be executed based on the increased maximum allowable duration, reducing the risk of subtask timeout and improving system performance.
[0020] In some embodiments, the target subtask is a periodic task; the method may further include:
[0021] Reduce the sleep time of the target subtask according to the first difference.
[0022] In this way, for periodic tasks, the sleep time can be reduced based on the difference between the predicted execution time and the maximum allowable duration to ensure that when the predicted execution time of a single periodic subtask is extended, a sufficient number of periodic subtasks can still be completed within the expected time period, thereby ensuring that other tasks and system performance are not affected.
[0023] In some embodiments, the target subtask is a task of a preset task type, and the task of the preset task type is a task whose execution situation affects the performance of the battery management system; the method may further include:
[0024] Increase the priority of the target subtask according to the first difference.
[0025] In this way, the priority of critical subtasks can be increased to ensure that when the predicted execution time of critical subtasks is extended, they can still be completed within the specified time, thereby ensuring that other tasks and system performance are not affected.
[0026] In some embodiments, increasing the priority of a target subtask according to a first difference may include:
[0027] Arrange at least one first subtask in ascending order of priority to obtain a subtask sequence; wherein, the priority of the first subtask is higher than that of the target subtask;
[0028] Traverse the predicted execution times of the first subtasks in the subtask sequence in order of the subtask sequence;
[0029] Statistically calculate the total predicted execution time corresponding to the currently traversed first subtask and all previous first subtasks, and stop the loop until the total predicted execution time is greater than or equal to the first difference, and increase the priority of the target subtask to a target priority.
[0030] In this way, based on the predicted execution times of other subtasks whose priorities are higher than that of the critical subtask, it can be calculated to which level the priority of the critical subtask needs to be increased to meet the requirement of completion within the specified time when the predicted execution time of the critical subtask is extended, that is, to ensure the rationality of the increased priority.
[0031] In some embodiments, statistically calculating the total predicted execution time corresponding to the currently traversed first subtask and all previous first subtasks, and stopping the loop until the total predicted execution time is greater than or equal to the first difference, and increasing the priority of the target subtask to a target priority includes:
[0032] Obtain the first total predicted execution time corresponding to the i-th first subtask and all previous first subtasks in the subtask sequence, where i is a positive integer;
[0033] When the first total predicted execution time is greater than or equal to the first difference, increase the priority of the target subtask to a first priority, where the first priority is higher than the priority of the i-th first subtask and lower than or equal to the priority of the (i + 1)-th first subtask, and the target priority includes the first priority.
[0034] In this way, when the first total predicted execution time corresponding to the i-th first subtask and all previous first subtasks is greater than or equal to the first difference, the priority of the target subtask can be increased to before the i-th first subtask to meet the requirement of the target subtask being completed within the specified time.
[0035] In some embodiments, the method further includes:
[0036] When the predicted execution time of the i-th first subtask is less than the first difference, obtain the second total predicted execution time corresponding to the (i + 1)-th first subtask and all previous first subtasks in the subtask sequence;
[0037] In the case where the second total predicted execution time is greater than or equal to the first difference, increase the priority of the target subtask to the second priority, where the second priority is higher than the priority of the (i + 1)-th first subtask and lower than or equal to the priority of the (i + 2)-th first subtask, and the target priority includes the second priority.
[0038] In this way, when the first total predicted execution time corresponding to the i-th first subtask and all the previous first subtasks is less than the first difference, it is possible to continue to determine whether the second total predicted execution time corresponding to adding the (i + 1)-th first subtask is greater than or equal to the first difference, so as to determine the priority corresponding to the requirement that the target subtask is completed within the specified time, that is, to ensure the rationality of the increased priority.
[0039] In some embodiments, the target subtask is a task of a preset task type, and the task of the preset task type is a task whose execution situation affects the performance of the battery management system; the method may further include:
[0040] Determine a second subtask, where the second subtask is not a task of the preset task type, and the priority of the second subtask satisfies a preset priority condition;
[0041] Reduce the maximum allowable duration corresponding to the second subtask.
[0042] In this way, the maximum allowable duration of non-critical subtasks with lower priority can be automatically adjusted to ensure that the time requirements of critical subtasks are met, and thus ensure that other tasks and system performance are not affected.
[0043] In some embodiments, adjusting the maximum allowable duration corresponding to each subtask according to the predicted execution time may include:
[0044] In the case where the predicted execution time of the target subtask is less than the maximum allowable duration corresponding to the target subtask, determine a second difference between the maximum allowable duration and the predicted execution time;
[0045] In the case where the second difference is greater than or equal to the second difference threshold, reduce the maximum allowable duration according to the second difference;
[0046] Wherein, the target subtask is any subtask.
[0047] In this way, in the case where the predicted execution time of a certain subtask is less than the current maximum allowable duration and the difference between the two is large, the maximum allowable duration can be reduced to achieve the purpose of releasing resources.
[0048] In some embodiments, determining the predicted execution time of each subtask according to the progress information may include:
[0049] Input the progress information into the prediction model to obtain the predicted execution times of each subtask output by the prediction model. The prediction model is trained based on multiple training samples, and each training sample includes a progress information sample of the target task and the predicted execution time labels of each subtask corresponding to the progress information sample.
[0050] In this way, the predicted execution times of each subtask corresponding to the progress information of the target task can be predicted by the prediction model trained based on the training samples including the progress information samples of the target task and the predicted execution time labels of each subtask corresponding to the progress information samples, laying a foundation for flexibly adjusting the maximum allowable duration of each subtask subsequently.
[0051] In some embodiments, the prediction model can be trained in the following manner:
[0052] Obtain multiple training samples;
[0053] According to the predicted execution time labels of each subtask in the multiple training samples, obtain the time series data labels of each subtask;
[0054] In the case where the time series data labels are not stationary, perform differencing processing on the time series data labels to obtain target time series data labels. The target time series data labels include the target predicted execution time labels corresponding to the progress information samples;
[0055] Train the initial model according to the progress information samples and the target predicted execution time labels of each subtask corresponding to the progress information samples to obtain the prediction model.
[0056] In this way, multiple training samples including the progress information samples of the target task and the predicted execution time labels of each subtask corresponding to the progress information samples can be obtained, and in the case where the time series data labels of each subtask in the multiple training samples are not stationary, perform differencing processing on the time series data labels to obtain target time series data labels. The target time series data labels are more reasonable and accurate, and then a prediction model with higher accuracy can be trained according to the progress information samples and the target predicted execution time labels of each subtask corresponding to the progress information samples, so that more accurate predicted execution times of each subtask can be predicted by the prediction model, laying a foundation for flexibly adjusting the maximum allowable duration of each subtask subsequently.
[0057] In some embodiments, training the initial model according to the progress information samples and the target predicted execution time labels of each subtask corresponding to the progress information samples to obtain the prediction model may include:
[0058] Train the initial model according to the progress information samples and the predicted execution time labels of each subtask corresponding to the progress information samples to obtain the first model;
[0059] Obtain multiple test samples, where each test sample includes the progress information test sample of the target task and the predicted execution time test labels of each subtask corresponding to the progress information test sample;
[0060] Evaluate the first model with multiple test samples to obtain the evaluation metrics corresponding to the first model;
[0061] When the evaluation metrics corresponding to the first model meet the preset convergence conditions, determine the first model as the prediction model;
[0062] When the evaluation metrics corresponding to the first model do not meet the preset convergence conditions, optimize the first model to obtain the prediction model.
[0063] In this way, the prediction model can be optimized, improving the accuracy of the prediction model, and thus improving the accuracy of the predicted execution time of each subtask.
[0064] In a second aspect, an embodiment of the present application further provides a battery management system, and the device includes:
[0065] An information acquisition unit, configured to acquire the progress information during the execution of the target task by the battery management system, where the target task includes multiple subtasks;
[0066] A controller, configured to determine the predicted execution time of each subtask according to the progress information;
[0067] A task scheduler, configured to adjust the maximum allowed duration corresponding to each subtask according to the predicted execution time;
[0068] A task executor, configured to continue to execute the target task based on the adjusted maximum allowed duration corresponding to each subtask.
[0069] In this way, it is possible to predict the predicted execution time of each subtask through the progress information of the target task, so as to flexibly adjust the maximum allowed duration corresponding to each subtask during the execution of the target task, enabling the target task to be executed smoothly and improving the stability and reliability of the battery management system.
[0070] In a third aspect, an embodiment of the present application provides an electronic device, and the device includes: a processor and a memory storing program instructions; when the processor executes the program instructions, the method of the first aspect is implemented.
[0071] In a fourth aspect, an embodiment of the present application provides a machine-readable storage medium, on which program instructions are stored, and when the program instructions are executed by a processor, the method of the first aspect is implemented.
[0072] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device is caused to execute the method of the first aspect.
[0073] The above description is only an overview of the technical solution of the present application. In order to be able to understand the technical means of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other objects, features and advantages of the present application more obvious and understandable, the following specifically describes the specific embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required to be used in the embodiments of the present application. Obviously, the following described drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the drawings.
[0075] Figure 1 One of the schematic flowcharts of the task processing method provided by the embodiment of the present application;
[0076] Figure 2 Another schematic flowchart of the task processing method provided by the embodiment of the present application;
[0077] Figure 3 Another schematic flowchart of the task processing method provided by the embodiment of the present application;
[0078] Figure 4 Another schematic flowchart of the task processing method provided by the embodiment of the present application;
[0079] Figure 5 Another schematic flowchart of the task processing method provided by the embodiment of the present application;
[0080] Figure 6 Another schematic flowchart of the task processing method provided by the embodiment of the present application;
[0081] Figure 7 Another schematic flowchart of the task processing method provided by the embodiment of the present application;
[0082] Figure 8 Schematic structural diagram of the battery management system provided by the embodiment of the present application;
[0083] Figure 9 Schematic structural diagram of the electronic device provided by the embodiment of the present application.
[0084] In the drawings, the drawings are not drawn to actual scale. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0085] The embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings and examples. The following detailed description of the examples and the drawings are used to exemplarily illustrate the principle of the present application, but cannot be used to limit the scope of the present application, that is, the present application is not limited to the described embodiments.
[0086] In the description of the present application, it should be noted that unless otherwise specified, the meaning of "a plurality" is two or more; the orientation or positional relationship indicated by terms such as "upper", "lower", "left", "right", "inner", "outer", etc. is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus cannot be understood as a limitation to the present application. In addition, terms such as "first", "second", "third", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. "Vertical" is not strictly vertical, but within the allowable error range. "Parallel" is not strictly parallel, but within the allowable error range.
[0087] Referring to "embodiments" in the present application means that specific features, structures, or characteristics described in connection with the embodiments can be included in at least one embodiment of the present application. The appearance of this phrase in various positions in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art explicitly and implicitly understand that the embodiments described in the present application can be combined with other embodiments.
[0088] If there is no special instruction, all embodiments and optional embodiments of the present application can be combined with each other to form a new technical solution.
[0089] If there is no special instruction, all technical features and optional technical features of the present application can be combined with each other to form a new technical solution.
[0090] If there is no special instruction, all steps of the present application can be carried out in sequence or randomly, preferably in sequence. For example, the method includes steps (a) and (b), indicating that the method may include steps (a) and (b) carried out in sequence, or may also include steps (b) and (a) carried out in sequence. For example, it is mentioned that the method may further include step (c), indicating that step (c) can be added to the method in any order. For example, the method may include steps (a), (b), and (c), or may also include steps (a), (c), and (b), or may also include steps (c), (a), and (b), etc.
[0091] The Battery Management System (BMS) in this application is used to implement at least one of the functions of state monitoring, state analysis, charge and discharge control, safety protection, information management, thermal management, and high-voltage power distribution for battery cells. In addition, the battery management system in this application can also implement the functions of a controller in an electrical device, such as implementing the functions of a Vehicle Control Unit (VCU), a Motor Control Unit (MCU), etc. This application does not limit this.
[0092] It should be noted that the battery management system in this application can be integrated as a controller in a battery device, such as integrated in a battery pack or an energy storage electrical box;
[0093] The battery management system in this application can also be integrated as a controller in an electrical device, such as integrated in a vehicle or a vehicle chassis;
[0094] The battery management system in this application can also be integrated as a controller in a charging device, such as integrated in a charging device or a battery swapping device;
[0095] The battery management system in this application can also be deployed as control software in a server. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, such as vehicle networking cloud, APP background, etc.
[0096] During the execution of battery management tasks (such as battery state monitoring tasks, power estimation tasks, balancing control tasks, etc.), the battery management system often divides the tasks into finer parts. When allocating a processor to each subtask, a corresponding maximum allowed duration (i.e., the execution time slice of the subtask) will be configured. After the execution time slice is used up, the system will allocate the processor to the next subtask. If the maximum allowed duration is set too small, it may cause tasks to time out frequently. If it is set too large, it will result in waste of resources of the battery management system. Therefore, how to reasonably allocate the maximum allowed duration is crucial.
[0097] In the actual application process, due to the interference of system load or other external factors, the execution time of each subtask may change, resulting in the problem that the preset maximum allowable duration is unreasonable. To address this issue, in related technologies, often after the task of a certain project is completed, based on the execution situation of this task, the maximum allowable duration of each subtask of the task of the next project is adjusted. This method ignores the impact of frequent timeouts or resource waste on system performance caused by the unreasonable maximum allowable duration of each subtask of the task being executed.
[0098] Based on this, the embodiments of the present application provide a task processing method, system, storage medium, and product for a battery management system to solve the above technical problems. First, the task processing method provided by the embodiments of the present application is introduced below.
[0099] Please refer to Figure 1 , the embodiments of the present application provide a task processing method, which may include:
[0100] Step 101, obtain the progress information during the execution of the target task by the battery management system, where the target task includes multiple subtasks.
[0101] In step 101, the target task may be the task corresponding to a certain project in the battery management system, and the target task can be divided into multiple subtasks. For example, if the target task is the balancing control task corresponding to the balancing control project, the balancing control task may include subtasks such as high-voltage control task, braking system control task, etc.
[0102] The progress information during the execution of the target task by the battery management system can be obtained, where the progress information may include the execution situation of the subtasks that have been executed, and the execution situation may include information such as the execution time and whether it times out corresponding to the subtasks that have been executed.
[0103] Step 102, determine the predicted execution time of each subtask according to the progress information.
[0104] In step 102, the predicted execution time of each subtask that is being executed or not executed can be predicted according to the progress information. Exemplarily, if the progress information lags behind the expectation, it can be considered that the predicted execution time of each subtask may be longer than the expected execution time, and the predicted execution time of each subtask can be calculated according to the degree of lag. If the progress information exceeds the expectation, it can be considered that the predicted execution time of each subtask may be shorter than the expected execution time, and the predicted execution time of each subtask can be calculated according to the degree of excess.
[0105] The predicted execution time of each subtask can also be predicted based on the progress information and a pre-trained prediction model. No specific limitation is made here.
[0106] Step 103: Adjust the maximum allowable duration corresponding to each subtask according to the predicted execution time.
[0107] In step 103, it can be understood that when the system allocates a processor to a subtask, a maximum allowable duration will be assigned to the subtask. After the maximum allowable duration is used up, the system will allocate the processor to the next subtask. If the predicted execution time of a certain subtask is greater than the maximum allowable duration corresponding to the subtask, it may cause the subtask to time out. If the predicted execution time of a certain subtask is less than the maximum allowable duration corresponding to the subtask, it may cause waste of resources.
[0108] Therefore, the maximum allowable duration corresponding to each subtask can be adjusted according to the predicted execution time. For example, the maximum allowable duration corresponding to each subtask can be adjusted to be equal to the predicted execution time of each subtask, or the maximum allowable duration corresponding to each subtask can be adjusted to be slightly greater than the predicted execution time of each subtask. It can be specifically set according to actual requirements and is not specifically limited here.
[0109] Step 104: Continue to execute the target task based on the adjusted maximum allowable duration corresponding to each subtask.
[0110] In step 104, the target task can be continued to be executed based on the adjusted maximum allowable duration corresponding to each subtask, so as to flexibly adjust the maximum allowable duration of its subtasks during the execution of the target task.
[0111] In this way, the predicted execution time of each subtask can be predicted through the progress information of the target task, so that during the execution of the target task, the maximum allowable duration corresponding to each subtask can be flexibly adjusted, enabling the target task to be executed smoothly and improving the stability and reliability of the battery management system.
[0112] In some embodiments, obtaining the progress information during the execution of the target task by the battery management system may include:
[0113] When at least one subtask times out during the execution of the target task by the battery management system; or,
[0114] When the system load index of the battery management system meets the preset load condition;
[0115] Obtain the progress information during the execution of the target task by the battery management system.
[0116] In this embodiment, if at least one subtask times out during the execution of the target task by the battery management system, it can be considered that the overall execution of the target task may time out, which will affect the execution of the next task and thus the overall system performance. Therefore, at this time, the progress information during the execution of the target task by the battery management system can be obtained, and then the predicted execution time of each subtask can be predicted through the progress information of the target task. Thus, during the execution of the target task, the maximum allowed duration corresponding to each subtask can be flexibly adjusted to enable the target task to be executed smoothly, improving the stability and reliability of the battery management system.
[0117] If the system load index of the battery management system meets the preset load condition, it can be considered that the current system resources are tense and task execution needs to be optimized to improve resource utilization. At this time, the progress information during the execution of the target task by the battery management system can also be obtained, and then the predicted execution time of each subtask can be predicted through the progress information of the target task. Thus, during the execution of the target task, the maximum allowed duration corresponding to each subtask can be flexibly adjusted.
[0118] It can be understood that the system load index can include the usage rate of the Central Processing Unit (CPU), the CPU idle rate, the memory occupancy rate, the bus communication load, etc. Taking the CPU idle rate as an example, when the CPU idle rate is less than the preset idle threshold, for example, the CPU idle rate is 30%, it can be considered that the system load index of the battery management system meets the preset load condition.
[0119] In this way, when the executed subtasks time out or the system load is too high, it can be considered that there may be a problem with the time allocation of the current target task. Therefore, it is necessary to predict the execution time of each subtask and flexibly adjust based on the prediction results to achieve the purpose of improving system performance and resource utilization.
[0120] In some embodiments, as Figure 2 shown, adjusting the maximum allowed duration corresponding to each subtask according to the predicted execution time may include:
[0121] Step 201, when the predicted execution time of the target subtask is greater than the maximum allowed duration corresponding to the target subtask, determine the first difference between the predicted execution time and the maximum allowed duration;
[0122] Step 202, when the first difference is greater than or equal to the first difference threshold, increase the maximum allowed duration according to the first difference;
[0123] wherein, the target subtask is any subtask.
[0124] In this embodiment, if the predicted execution time of a certain target subtask is greater than the maximum allowable duration corresponding to the target subtask, at this time, the first difference between the predicted execution time and the maximum allowable duration can be calculated.
[0125] If the first difference is less than the first difference threshold, it can be considered that the predicted execution time exceeds the time limit by a short margin, and there is a possibility of self-recovery during the subsequent execution of the system, that is, the risk of timeout when the target subtask is executed is relatively low, and no adjustment is required.
[0126] If the first difference is greater than or equal to the first difference threshold, it can be considered that the risk of timeout when the target subtask is executed is relatively high. At this time, the maximum allowable duration can be increased according to the first difference. For example, in some examples, the adjusted maximum allowable duration = maximum allowable duration + first difference.
[0127] It can be understood that the first difference threshold can be set according to actual requirements in combination with empirical values, and no specific limitation is made here.
[0128] In this way, when the predicted execution time of a subtask is greater than the current maximum allowable duration and the difference between the two is large, the maximum allowable duration can be increased, so that the subtask can be executed based on the increased maximum allowable duration, reducing the risk of subtask timeout and improving the system performance.
[0129] In some embodiments, the target subtask is a periodic task; the method may further include:
[0130] Reducing the sleep time of the target subtask according to the first difference.
[0131] In this embodiment, if the target subtask is a periodic task, after the maximum allowable duration of a single target subtask is increased, the sleep time of the target subtask can also be reduced according to the first difference. For example, it is expected that the target subtask will be executed N times, its sleep time is t1, and the maximum allowable duration is t2. Then the overall time-consuming of the periodic task is t2*N + t1*(N - 1). At this time, if the maximum allowable duration of a single target subtask is increased by the first difference Δt2, the sleep time of the target subtask can be reduced, and the reduced value of the sleep time is Δt1, and Δt1 = Δt2*N / (N - 1).
[0132] In this way, for a periodic task, the sleep time can be reduced based on the difference between the predicted execution time and the maximum allowable duration, so as to ensure that when the predicted execution time of a single periodic subtask is extended, a sufficient number of periodic subtasks can still be completed within the expected time period, thereby ensuring that other tasks and system performance are not affected.
[0133] In some embodiments, the target subtask is a task of a preset task type, and the task of the preset task type is a task whose execution affects the performance of the battery management system; the method may further include:
[0134] According to the first difference, increase the priority of the target subtask.
[0135] In this embodiment, the target subtask may be a task of a preset task type, and the task of the preset task type can be regarded as a key subtask predefined by the system, and its execution affects the performance of the battery management system. The judgment criteria for key subtasks are mainly based on system requirements, task priorities, and considerations of safety and stability, which are not specifically limited here.
[0136] When the predicted execution time of the key subtask increases, in order to ensure that the key subtask can be completed within the specified time, the priority of the key subtask can also be increased so that the key subtask can be executed as early as possible.
[0137] The priority of the target subtask can be increased according to the first difference. In some examples, the larger the first difference, the higher the increased priority can be.
[0138] In this way, the priority of the key subtask can be increased to ensure that it can still be completed within the specified time when the predicted execution time of the key subtask is extended, thereby ensuring that other tasks and system performance are not affected.
[0139] In some embodiments, as Figure 3 shown, increasing the priority of the target subtask according to the first difference may include:
[0140] Step 301: Arrange at least one first subtask in ascending order of priority to obtain a subtask sequence; wherein, the priority of the first subtask is higher than the priority of the target subtask;
[0141] Step 302: Traverse the predicted execution time of the first subtasks in the subtask sequence in the order of the subtask sequence in a loop;
[0142] Step 303: Statistically calculate the total predicted execution time corresponding to the currently traversed first subtask and all previous first subtasks until the total predicted execution time is greater than or equal to the first difference, then stop the loop and increase the priority of the target subtask to the target priority.
[0143] In this embodiment, the first difference between the predicted execution time of the target subtask and the maximum allowable duration is Δt. First, the first subtasks with priorities higher than that of the target subtask can be determined. The at least one first subtask is arranged in ascending order of priority to obtain a subtask sequence. In other words, in the subtask sequence, the closer the priority of the first subtask ranked earlier is to the priority of the target subtask.
[0144] The total predicted execution time of the first subtasks in the subtask sequence can be traversed cyclically to determine whether the target subtask can be guaranteed to be executed within the specified time before its priority is raised to a certain first subtask. If it cannot be executed within the specified time, continue to obtain the predicted execution time of the next first subtask, and compare the total predicted execution time after adding the predicted execution time of the next first subtask with the first difference to determine whether the target subtask can be guaranteed to be executed within the specified time before its priority is raised to the next first subtask.
[0145] In this way, based on the predicted execution times of other subtasks with priorities higher than the critical subtask, it can be calculated to which level the priority of the critical subtask needs to be raised to meet the requirement of being completed within the specified time when the predicted execution time of the critical subtask is extended, that is, to ensure the rationality of the raised priority.
[0146] In some embodiments, as Figure 4 shown, the total predicted execution time corresponding to the currently traversed first subtask and all previous first subtasks is statistically calculated. Until the total predicted execution time is greater than or equal to the first difference, the loop is stopped, and the priority of the target subtask is raised to the target priority, which may include:
[0147] Step 401: Obtain the first total predicted execution time corresponding to the i-th first subtask and all previous first subtasks in the subtask sequence, where i is a positive integer;
[0148] Step 402: When the first total predicted execution time is greater than or equal to the first difference, raise the priority of the target subtask to the first priority, where the first priority is higher than the priority of the i-th first subtask and lower than or equal to the priority of the (i + 1)-th first subtask, and the target priority includes the first priority.
[0149] In this embodiment, for example, the subtask sequence includes subtask A, subtask B, and subtask C with priorities from low to high.
[0150] At this time, the predicted execution time of subtask A can be obtained. If the predicted execution time of subtask A is greater than or equal to Δt, the priority of the target subtask can be raised to between subtask A and subtask B, that is, during execution, the target subtask will be executed first, and then subtask A.
[0151] If the predicted execution time of subtask A is less than Δt, the total predicted execution time of subtask A and task B can be obtained. If the total predicted execution time of subtask A and task B is greater than or equal to Δt, the priority of the target subtask can be increased to between subtask B and subtask C. That is, during execution, the target subtask will be executed first, followed by subtask B and subtask A.
[0152] In this way, when the total predicted execution time corresponding to the i-th first subtask and all previous first subtasks is greater than or equal to the first difference, the priority of the target subtask can be increased to before the i-th first subtask to meet the requirement for the target subtask to be completed within the specified time.
[0153] In some embodiments, as Figure 5 shown, the method may further include:
[0154] Step 501, when the predicted execution time of the i-th first subtask is less than the first difference, obtain the second total predicted execution time corresponding to the (i + 1)-th first subtask and all previous first subtasks in the subtask sequence;
[0155] Step 502, when the second total predicted execution time is greater than or equal to the first difference, increase the priority of the target subtask to the second priority, where the second priority is higher than the priority of the (i + 1)-th first subtask and lower than or equal to the priority of the (i + 2)-th first subtask, and the target priority includes the second priority.
[0156] In this embodiment, if the total predicted execution time of subtask A and task B is less than Δt, the total predicted execution time of subtask A, task B, and task C can be obtained. If the total predicted execution time of subtask A, task B, and task C is greater than or equal to Δt, the priority of the target subtask can be increased above subtask C. That is, during execution, the target subtask will be executed first, followed by subtask C, subtask B, and subtask A.
[0157] In this way, when the total predicted execution time corresponding to the i-th first subtask and all previous first subtasks is less than the first difference, it can be continuously determined whether the second total predicted execution time after adding the (i + 1)-th first subtask is greater than or equal to the first difference, so as to determine the priority corresponding to the requirement for the target subtask to be completed within the specified time, that is, to ensure the rationality of the increased priority.
[0158] In some embodiments, as Figure 6 shown, the target subtask is a task of a preset task type, and the task of the preset task type is a task whose execution situation affects the performance of the battery management system; the method may further include:
[0159] Step 601: Determine a second subtask, where the second subtask is not a task of a preset task type, and the priority of the second subtask meets a preset priority condition.
[0160] Step 602: Reduce the maximum allowable duration corresponding to the second subtask.
[0161] In this embodiment, non-critical subtasks with lower priorities can be determined first. When the maximum allowable duration of a critical subtask needs to be increased, the maximum allowable duration corresponding to these non-critical subtasks with lower priorities can be directly reduced to meet the execution time requirements of the critical subtask.
[0162] In this way, the maximum allowable duration of non-critical subtasks with lower priorities can be automatically adjusted to ensure that the time requirements of critical subtasks are met, and thus ensure that other tasks and system performance are not affected.
[0163] In some embodiments, as Figure 7 shown, adjusting the maximum allowable duration corresponding to each subtask according to the predicted execution time may include:
[0164] Step 701: When the predicted execution time of a target subtask is less than the maximum allowable duration corresponding to the target subtask, determine a second difference between the maximum allowable duration and the predicted execution time.
[0165] Step 702: When the second difference is greater than or equal to a second difference threshold, reduce the maximum allowable duration according to the second difference.
[0166] Wherein, the target subtask is any subtask.
[0167] In this embodiment, if the predicted execution time of a certain target subtask is less than the maximum allowable duration corresponding to the target subtask, the second difference between the maximum allowable duration and the predicted execution time can be calculated at this time.
[0168] If the second difference is less than the second difference threshold, it can be considered that the time for the target subtask to finish executing in advance is very short, and the system resources that can be saved are limited, so there is no need for adjustment. If the second difference is greater than or equal to the second difference threshold, the maximum allowable duration can be reduced according to the second difference. For example, in some examples, the adjusted maximum allowable duration = maximum allowable duration - second difference.
[0169] It can be understood that the second difference threshold can be set according to actual needs in combination with empirical values, and no specific limitation is made here.
[0170] In this way, when the predicted execution time of a certain subtask is less than the current maximum allowable duration and the difference between the two is large, the maximum allowable duration can be reduced to achieve the purpose of releasing resources.
[0171] In some embodiments, determining the predicted execution time of each subtask according to the progress information may include:
[0172] Input the progress information into a prediction model to obtain the predicted execution time of each subtask output by the prediction model; wherein, the prediction model is trained based on a plurality of training samples, and each training sample includes a progress information sample of a target task and the predicted execution time label of each subtask corresponding to the progress information sample.
[0173] In this embodiment, the execution time of each subtask corresponding to different progress information of the target task can be collected to obtain a plurality of training samples including the progress information sample of the target task and the predicted execution time label of each subtask corresponding to the progress information sample. The prediction model is pre-trained based on the training samples.
[0174] Subsequently, the prediction model can be directly applied. The progress information can be input into the prediction model to obtain the predicted execution time of each subtask output by the prediction model.
[0175] In this way, based on the prediction model trained by the training samples including the progress information sample of the target task and the predicted execution time label of each subtask corresponding to the progress information sample, the predicted time series data corresponding to the progress information of the target task can be predicted. Furthermore, the predicted execution time of each subtask can be calculated based on the predicted time series data, laying a foundation for flexibly adjusting the maximum allowable duration of each subtask in the future.
[0176] In some embodiments, the prediction model can be trained in the following manner:
[0177] Obtain a plurality of training samples;
[0178] According to the predicted execution time label of each subtask in the plurality of training samples, obtain the time series data label of each subtask;
[0179] In the case where the time series data label is not stationary, perform differencing processing on the time series data label to obtain the target time series data label; wherein, the target time series data label includes the target predicted execution time label corresponding to the progress information sample;
[0180] Train the initial model according to the progress information sample and the target predicted execution time label of each subtask corresponding to the progress information sample to obtain the prediction model.
[0181] In this embodiment, the execution time data of each sub-task corresponding to different progress information can be collected through the system's performance monitoring tool or a specific interface, obtaining multiple training samples. Each training sample includes a progress information sample of the target task and the predicted execution time labels of each sub-task corresponding to the progress information sample.
[0182] Based on the predicted execution time labels of each sub-task in the multiple training samples, the time series data labels of each sub-task can be formed. In other words, the time series data labels of a single sub-task can be formed based on multiple execution time data corresponding to different progress information of the sub-task.
[0183] The stationarity of the time series data labels can be detected using methods such as visual analysis or statistical tests.
[0184] Exemplarily, a time series plot can be drawn to observe whether there are obvious trends or seasonality. If the time series plot shows an obvious upward or downward trend in the execution time over time, it can be considered that the time series data labels are non-stationary. The stationarity of the time series data labels can also be tested through the ADF (Augmented Dickey-Fuller Test) or KPSS (Kwiatkowski-Phillips-Schmidt-Shin Test). If the statistical test results indicate that the time series has a unit root, it can be considered that the time series data labels are non-stationary.
[0185] If the time series data labels are non-stationary, first-order differencing, second-order differencing, etc. can be performed until the time series data labels become stationary. When performing differencing, it should be noted that the number of differencing times cannot be too many to avoid losing too much information.
[0186] After differencing, the target time series data labels can be obtained. The target time series data labels can include the target predicted execution time labels of the sub-task corresponding to different progress information samples.
[0187] An appropriate initial model can be selected according to the characteristics and requirements of the time series data labels. Common model types include autoregressive moving average model, autoregressive integrated moving average model, seasonal autoregressive integrated moving average model, etc.
[0188] For example, after differencing, if the target time series data labels do not have obvious seasonality and the autocorrelation and partial autocorrelation functions show certain patterns, an autoregressive moving average model or an autoregressive integrated moving average model can be selected as the initial model. If the target time series data labels have seasonality, the initial model can be a seasonal autoregressive integrated moving average model.
[0189] The initial model can be trained based on the progress information samples and the target predicted execution time labels of each subtask corresponding to the progress information samples to obtain a prediction model. Exemplarily, based on the progress information samples and the target predicted execution time labels of each subtask corresponding to the progress information samples, methods such as the least squares method and maximum likelihood estimation can be used to estimate the parameters of the initial model. It can be understood that when training the prediction model, attention needs to be paid to selecting appropriate parameter ranges and initial values to improve the training efficiency and accuracy.
[0190] In this way, multiple training samples including the progress information samples of the target task and the predicted execution time labels of each subtask corresponding to the progress information samples can be obtained. And when the time series data labels of each subtask in the multiple training samples are non-stationary, the time series data labels are differenced to obtain the target time series data labels. Among them, the target time series data labels are more reasonable and accurate. Furthermore, a prediction model with higher accuracy can be trained based on the progress information samples and the target predicted execution time labels of each subtask corresponding to the progress information samples, so that the predicted execution times of more accurate subtasks can be predicted by the prediction model, laying a foundation for flexibly adjusting the maximum allowable duration of each subtask subsequently.
[0191] In some embodiments, training the initial model based on the progress information samples and the target predicted execution time labels of each subtask corresponding to the progress information samples to obtain a prediction model may include:
[0192] Training the initial model based on the progress information samples and the target predicted execution time labels of each subtask corresponding to the progress information samples to obtain a first model;
[0193] Obtaining multiple test samples, where each test sample includes the progress information test sample of the target task and the predicted execution time test labels of each subtask corresponding to the progress information test sample;
[0194] Evaluating the first model using the multiple test samples to obtain the evaluation metrics corresponding to the first model;
[0195] When the evaluation metrics corresponding to the first model meet the preset convergence conditions, determining the first model as the prediction model;
[0196] When the evaluation metrics corresponding to the first model do not meet the preset convergence conditions, optimizing the first model to obtain the prediction model.
[0197] In this embodiment, after training the initial model based on the progress information samples and the target predicted execution time labels of each subtask corresponding to the progress information samples to obtain a first model, multiple test samples can be used to check the fitting effect and the nature of the residuals of the first model.
[0198] Exemplarily, the progress information test samples of the target task can be input into the first model to obtain the predicted execution time values of each subtask output by the first model. Compare the predicted execution time values of each subtask with the predicted execution time test labels of each subtask to obtain a comparison result.
[0199] Based on the comparison results corresponding to multiple test samples, the autocorrelation function and partial autocorrelation function of the residuals can be plotted to check whether the residuals are white noise. The goodness-of-fit indicators of the first model can also be calculated, such as the R-squared value, Akaike information criterion, and Bayesian information criterion.
[0200] If the autocorrelation function and partial autocorrelation function of the residuals are within the confidence interval and the goodness-of-fit indicators are good, it indicates that the first model has a good fitting effect, and the first model can be used as the prediction model. If there is obvious autocorrelation or partial autocorrelation in the residuals, or the goodness-of-fit indicators are poor, it is necessary to readjust the model parameters or select other types of initial models for retraining.
[0201] In this way, the prediction model can be optimized, improving the accuracy of the prediction model, thereby improving the accuracy of the predicted execution time of each subtask.
[0202] In some examples, the prediction model can be used to predict the execution time of future subtasks. A confidence interval for the predicted execution time can be given to evaluate the uncertainty of the prediction. At the same time, the prediction results can also be adjusted and corrected according to the actual situation.
[0203] According to the predicted execution time of each subtask predicted by the prediction model, adjust the time arrangement and resource allocation of the system. The priorities, maximum allowed durations, sleep times, etc. of each subtask can be adjusted to improve the performance and stability of the system.
[0204] After adjusting the maximum allowed duration, the effect of dynamic time adjustment can also be evaluated by comparing the maximum allowed duration, system performance indicators, etc. before and after the adjustment. Statistical methods can also be used to analyze whether the difference before and after the adjustment is significant to determine whether the adjustment measures are effective. If the total execution time of the target task is significantly shortened and the response time of the system is faster after the adjustment, it indicates that the dynamic time adjustment has a good effect. If the adjustment effect is not obvious or there are negative effects, it may be necessary to re-correct the prediction model or adjust the strategy.
[0205] Based on the task processing method provided in the above embodiments, the present application can also provide a corresponding embodiment of a battery management system.
[0206] As Figure 8 shown, the battery management system 900 may include:
[0207] An information collection unit 901, configured to obtain progress information during the battery management system executing a target task, where the target task includes a plurality of subtasks;
[0208] A controller 902, configured to determine the predicted execution time of each subtask according to the progress information;
[0209] A task scheduler 903, configured to adjust the maximum allowable duration corresponding to each subtask according to the predicted execution time;
[0210] A task executor 904, configured to continue executing the target task based on the adjusted maximum allowable duration corresponding to each subtask.
[0211] In some embodiments, the information collection unit 901 may further be configured to:
[0212] When at least one subtask execution times out during the battery management system executing the target task; or,
[0213] When the system load index of the battery management system meets a preset load condition;
[0214] Obtain progress information during the battery management system executing the target task.
[0215] In this way, when the executed subtasks time out or the system load is too high, it can be considered that there may be a problem with the time allocation of the current target task. Therefore, it is necessary to predict the execution time of each subtask and flexibly adjust based on the prediction result to achieve the purpose of improving system performance and resource utilization.
[0216] In some embodiments, the task scheduler 903 may further be configured to:
[0217] When the predicted execution time of a target subtask is greater than the maximum allowable duration corresponding to the target subtask, determine a first difference between the predicted execution time and the maximum allowable duration;
[0218] When the first difference is greater than or equal to a first difference threshold, increase the maximum allowable duration according to the first difference;
[0219] Wherein, the target subtask is any subtask.
[0220] In this way, when the predicted execution time of a certain subtask is greater than the current maximum allowable duration and the difference between them is large, the maximum allowable duration can be increased so that the subtask can be executed based on the increased maximum allowable duration, reducing the risk of subtask timeout and improving system performance.
[0221] In some embodiments, the target subtask is a periodic task; the task scheduler 903 may further be configured to:
[0222] Reduce the sleep time of the target subtask according to the first difference.
[0223] In this way, for periodic tasks, based on the difference between the predicted execution time and the maximum allowed duration, the sleep time can be reduced to ensure that, in the case of an extended predicted execution time for a single periodic subtask, a sufficient number of periodic subtasks can still be completed within the expected time period, thereby ensuring that other tasks and system performance are not affected.
[0224] In some embodiments, the target subtask is a task of a preset task type, and the task of the preset task type is a task whose execution situation affects the performance of the battery management system; the task scheduler 903 can also be used for:
[0225] Increase the priority of the target subtask according to the first difference.
[0226] In this way, the priority of the critical subtask can be increased to ensure that it can still be completed within the specified time in the case of an extended predicted execution time of the critical subtask, thereby ensuring that other tasks and system performance are not affected.
[0227] In some embodiments, the task scheduler 903 can also be used for:
[0228] Arrange at least one first subtask in ascending order of priority to obtain a subtask sequence; wherein, the priority of the first subtask is higher than that of the target subtask;
[0229] Traverse the predicted execution times of the first subtasks in the subtask sequence in the order of the subtask sequence;
[0230] Statistically calculate the total predicted execution time corresponding to the currently traversed first subtask and all previous first subtasks, and stop the loop until the total predicted execution time is greater than or equal to the first difference, and increase the priority of the target subtask to the target priority.
[0231] In this way, based on the predicted execution times of other subtasks whose priorities are higher than that of the critical subtask, it can be calculated to which level the priority of the critical subtask needs to be increased to meet the requirement of being completed within the specified time, that is, to ensure the rationality of the increased priority.
[0232] In some embodiments, the task scheduler 903 can also be used for:
[0233] Obtain the first total predicted execution time corresponding to the i-th first subtask and all previous first subtasks in the subtask sequence, where i is a positive integer;
[0234] When the first total predicted execution time is greater than or equal to the first difference, increase the priority of the target subtask to the first priority, where the first priority is higher than the priority of the \(i\)th first subtask and lower than or equal to the priority of the \((i + 1)\)th first subtask, and the target priority includes the first priority.
[0235] In this way, when the first total predicted execution time corresponding to the \(i\)th first subtask and all the previous first subtasks is greater than or equal to the first difference, the priority of the target subtask can be increased to before the \(i\)th first subtask to meet the requirement for the target subtask to be completed within the specified time.
[0236] In some embodiments, the task scheduler 903 can also be used for:
[0237] When the predicted execution time of the \(i\)th first subtask is less than the first difference, obtain the second total predicted execution time corresponding to the \((i + 1)\)th first subtask and all the previous first subtasks in the subtask sequence;
[0238] When the second total predicted execution time is greater than or equal to the first difference, increase the priority of the target subtask to the second priority, where the second priority is higher than the priority of the \((i + 1)\)th first subtask and lower than or equal to the priority of the \((i + 2)\)th first subtask, and the target priority includes the second priority.
[0239] In this way, when the first total predicted execution time corresponding to the \(i\)th first subtask and all the previous first subtasks is less than the first difference, it can be continuously determined whether the second total predicted execution time after adding the \((i + 1)\)th first subtask is greater than or equal to the first difference, so as to determine the priority corresponding to the requirement for the target subtask to be completed within the specified time, that is, to ensure the rationality of the increased priority.
[0240] In some embodiments, the target subtask is a task of a preset task type, and the task of the preset task type is a task whose execution situation affects the performance of the battery management system; the task scheduler 903 can also be used for:
[0241] Determine a second subtask, where the second subtask is not a task of the preset task type and the priority of the second subtask meets the preset priority condition;
[0242] Reduce the maximum allowed duration corresponding to the second subtask.
[0243] In this way, the maximum allowed duration of non-critical subtasks with lower priority can be automatically adjusted to ensure that the time requirements of critical subtasks are met, and thus ensure that other tasks and system performance are not affected.
[0244] In some embodiments, the task scheduler 903 can also be used for:
[0245] When the predicted execution time of the target subtask is less than the maximum allowable duration corresponding to the target subtask, determine a second difference between the maximum allowable duration and the predicted execution time;
[0246] When the second difference is greater than or equal to the second difference threshold, reduce the maximum allowable duration according to the second difference;
[0247] Wherein, the target subtask is any subtask.
[0248] In this way, when the predicted execution time of a certain subtask is less than the current maximum allowable duration and the difference between them is large, the maximum allowable duration can be reduced to achieve the purpose of releasing resources.
[0249] In some embodiments, the controller 902 can also be used for:
[0250] Input the progress information into the prediction model to obtain the predicted execution time of each subtask output by the prediction model; wherein, the prediction model is trained based on a plurality of training samples, and each training sample includes a progress information sample of the target task and predicted execution time labels of each subtask corresponding to the progress information sample.
[0251] In this way, the predicted time series data corresponding to the progress information of the target task can be predicted based on the prediction model trained by the training samples including the progress information samples of the target task and the predicted execution time labels of each subtask corresponding to the progress information samples. Furthermore, the predicted execution time of each subtask can be calculated based on the predicted time series data, laying a foundation for flexibly adjusting the maximum allowable duration of each subtask subsequently.
[0252] In some embodiments, the information acquisition unit 901 can also be used for:
[0253] Obtain a plurality of training samples;
[0254] According to the predicted execution time labels of each subtask in the plurality of training samples, obtain the time series data labels of each subtask;
[0255] The processor is used for:
[0256] When the time series data label is not stationary, perform differencing processing on the time series data label to obtain the target time series data label;
[0257] Train the initial model according to the progress information sample and the target predicted execution time labels of each subtask corresponding to the progress information sample to obtain the prediction model; wherein, the initial model is a model corresponding to any one of a plurality of preset model types.
[0258] In this way, multiple training samples including progress information samples of the target task and predicted execution time labels of each subtask corresponding to the progress information samples can be obtained. When the time series data labels of each subtask in the multiple training samples are non-stationary, differential processing is performed on the time series data labels to obtain target time series data labels. Among them, the target time series data labels are more reasonable and accurate. Furthermore, a prediction model with higher accuracy can be trained based on the progress information samples and the target predicted execution time labels of each subtask corresponding to the progress information samples, so that the predicted execution times of each subtask can be predicted more accurately by the prediction model, laying a foundation for flexibly adjusting the maximum allowable duration of each subtask in the future.
[0259] In some embodiments, the processor can also be used for:
[0260] Training an initial model according to the progress information samples and the target predicted execution time labels of each subtask corresponding to the progress information samples to obtain a first model;
[0261] Obtaining multiple test samples, where each test sample includes a progress information test sample of the target task and predicted execution time test labels of each subtask corresponding to the progress information test sample;
[0262] Evaluating the first model using the multiple test samples to obtain evaluation metrics corresponding to the first model;
[0263] When the evaluation metrics corresponding to the first model meet the preset convergence conditions, determining the first model as the prediction model;
[0264] When the evaluation metrics corresponding to the first model do not meet the preset convergence conditions, optimizing the first model to obtain the prediction model.
[0265] In this way, the prediction model can be optimized, the accuracy of the prediction model is improved, and thus the accuracy of the predicted execution times of each subtask is improved.
[0266] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiments of the present application, and are devices corresponding to the detection method of the above-mentioned battery cell baking equipment. All implementation manners in the above method embodiments are applicable to the embodiments of this device. For its specific functions and the technical effects brought, please refer to the method embodiment part specifically, and will not be elaborated here.
[0267] Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiments can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of this application. The specific working processes of the units and modules in the above system can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated here.
[0268] Referring to Figure 9 , the electronic device 1000 may include a processor 1001 and a memory 1002 storing programs or instructions. When the processor 1001 executes the programs, the steps in any of the foregoing method embodiments are implemented.
[0269] Exemplarily, the program may be divided into one or more modules / units, and one or more modules / units are stored in the memory 1002 and executed by the processor 1001 to complete this application. One or more modules / units may be a series of program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the program in the device.
[0270] Specifically, the above-mentioned processor 1001 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.
[0271] The memory 1002 may include a mass storage for data or instructions. By way of example and not limitation, the memory 1002 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. In a suitable case, the memory 1002 may include removable or non-removable (or fixed) media. In a suitable case, the memory 1002 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 1002 is a non-volatile solid state memory.
[0272] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical, or other physical / tangible memory storage device. Thus, generally, the memory includes one or more tangible (non-transitory) readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0273] The processor 1001 reads and executes the programs or instructions stored in the memory 1002 to implement any one of the methods in the above embodiments.
[0274] In one example, the electronic device may further include a communication interface 1003 and a bus 1004. Among them, the processor 1001, the memory 1002, and the communication interface 1003 are connected through the bus 1004 to complete communication with each other.
[0275] The communication interface 1003 is mainly used to implement communication between each module, device, unit, and / or device in the embodiments of the present application.
[0276] The bus 1004 includes hardware, software, or both, and couples the components of the online data flow charging device to each other. By way of example and not limitation, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses or a combination of two or more of these. In a suitable case, the bus 1004 may include one or more buses. Although the embodiments of the present application describe and illustrate specific buses, the present application contemplates any suitable bus or interconnect.
[0277] In addition, in combination with the methods in the above embodiments, the embodiments of the present application may provide a machine-readable storage medium to implement. Programs or instructions are stored on the machine-readable storage medium; when the programs or instructions are executed by a processor, any one of the methods in the above embodiments is implemented. The machine-readable storage medium can be read by a machine such as a computer.
[0278] Another embodiment of the present application further provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is configured to run programs or instructions to implement each process of the above method embodiment and can achieve the same technical effects. To avoid repetition, details are not described herein again.
[0279] It should be understood that the chip mentioned in the embodiment of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip, etc.
[0280] The embodiment of the present application provides a computer program product, which is stored in a machine-readable storage medium and is executed by at least one processor to implement each process of the above method embodiment and can achieve the same technical effects. To avoid repetition, details are not described herein again.
[0281] It should be clear that the present application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order between steps after understanding the spirit of the present application.
[0282] It should also be noted that the functional modules shown in the above structural block diagrams can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a functional card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium or transmitted via a data signal carried in a carrier wave on a transmission medium or a communication link. A "machine-readable medium" can include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical discs, hard disks, fiber optic media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet or an intranet.
[0283] It should also be noted that the exemplary embodiments mentioned in the present application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above steps. That is, the steps can be executed in the order mentioned in the embodiments, or different from the order in the embodiments, or several steps can be executed simultaneously.
[0284] Aspects of the present disclosure have been described above with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and program products according to embodiments of the present disclosure. It should be understood that each block in the flowchart and / or block diagram, and the combinations of blocks in the flowchart and / or block diagram, can be implemented by computer programs or instructions. These programs or instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine, such that the instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the functions / actions specified in one or more blocks of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It is also understood that each block in the block diagram and / or flowchart, and the combinations of blocks in the block diagram and / or flowchart, can also be implemented by dedicated hardware that performs the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0285] Although the present application has been described with reference to preferred embodiments, various improvements can be made to it and components therein can be replaced with equivalents without departing from the scope of the present application. In particular, as long as there is no structural conflict, the various technical features mentioned in each embodiment can be combined in any way. The present application is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.
Claims
1. A task processing method for a battery management system, characterized in that The method includes: Obtaining progress information during the battery management system's execution of a target task, where the target task includes multiple subtasks; Determining the predicted execution time of each subtask according to the progress information; Adjusting the maximum allowable duration corresponding to each subtask according to the predicted execution time; Continuing to execute the target task based on the adjusted maximum allowable duration corresponding to each subtask.
2. The method according to claim 1, wherein The obtaining of the progress information during the battery management system's execution of the target task includes: When at least one of the subtasks times out during the battery management system's execution of the target task; or when the system load indicator of the battery management system meets a preset load condition; obtaining the progress information during the battery management system's execution of the target task.
3. The method according to claim 1 or 2, characterized in that The adjusting of the maximum allowable duration corresponding to each subtask according to the predicted execution time includes: When the predicted execution time of a target subtask is greater than the maximum allowable duration corresponding to the target subtask, determining a first difference between the predicted execution time and the maximum allowable duration; When the first difference is greater than or equal to a first difference threshold, increasing the maximum allowable duration according to the first difference; Wherein, the target subtask is any subtask.
4. The method according to claim 3, wherein The target subtask is a periodic task; the method further includes: Reducing the sleep time of the target subtask according to the first difference.
5. The method according to claim 3 or 4, wherein The target subtask is a task of a preset task type, and the task of the preset task type is a task whose execution situation affects the performance of the battery management system; the method further includes: Increasing the priority of the target subtask according to the first difference.
6. The method according to claim 5, characterized in that, The increasing of the priority of the target subtask according to the first difference includes: Arranging at least one first subtask in ascending order of priority to obtain a subtask sequence; wherein, the priority of the first subtask is higher than the priority of the target subtask; Cyclically traversing the predicted execution time of the first subtasks in the subtask sequence in the order of the subtask sequence; counting the total predicted execution time corresponding to the currently traversed first subtask and all the previous first subtasks until the total predicted execution time is greater than or equal to the first difference, then stopping the loop and increasing the priority of the target subtask to a target priority.
7. The method according to claim 6, characterized in that According to counting the total predicted execution time corresponding to the currently traversed first subtask and all the previous first subtasks until the total predicted execution time is greater than or equal to the first difference, then stopping the loop and increasing the priority of the target subtask to a target priority, includes: Obtaining the first total predicted execution time corresponding to the i-th first subtask and all the previous first subtasks in the subtask sequence, where i is a positive integer; In the case where the first total predicted execution time is greater than or equal to the first difference, increase the priority of the target subtask to a first priority, where the first priority is higher than the priority of the \(i\)th first subtask and lower than or equal to the priority of the \((i + 1)\)th first subtask, and the target priority includes the first priority.
8. The method according to claim 7, wherein The method further includes: In the case where the predicted execution time of the \(i\)th first subtask is less than the first difference, obtain the second total predicted execution time corresponding to all the first subtasks up to and including the \((i + 1)\)th first subtask in the subtask sequence; In the case where the second total predicted execution time is greater than or equal to the first difference, increase the priority of the target subtask to a second priority, where the second priority is higher than the priority of the \((i + 1)\)th first subtask and lower than or equal to the priority of the \((i + 2)\)th first subtask, and the target priority includes the second priority.
9. The method according to claim 3, wherein The target subtask is a task of a preset task type, and the task of the preset task type is a task whose execution situation affects the performance of the battery management system; the method further includes: Determine a second subtask, where the second subtask is not a task of the preset task type, and the priority of the second subtask satisfies a preset priority condition; Reduce the maximum allowable duration corresponding to the second subtask.
10. The method according to any one of claims 1 to 9, characterized in that The adjusting the maximum allowable duration corresponding to each subtask according to the predicted execution time includes: In the case where the predicted execution time of the target subtask is less than the maximum allowable duration corresponding to the target subtask, determine a second difference between the maximum allowable duration and the predicted execution time; In the case where the second difference is greater than or equal to a second difference threshold, reduce the maximum allowable duration according to the second difference; Wherein, the target subtask is any subtask.
11. The method according to any one of claims 1 to 10, characterized in that, The determining the predicted execution time of each subtask according to the progress information includes: Input the progress information into a prediction model to obtain the predicted execution time of each subtask output by the prediction model; wherein, the prediction model is trained based on a plurality of training samples, and each training sample includes a progress information sample of the target task and predicted execution time labels of each subtask corresponding to the progress information sample.
12. The method according to claim 11, wherein The prediction model is trained in the following manner: Obtain the plurality of training samples; According to the predicted execution time labels of each subtask in the plurality of training samples, obtain time series data labels of each subtask; In the case where the time series data labels are not stationary, perform a differencing process on the time series data labels to obtain target time series data labels; wherein, the target time series data labels include target predicted execution time labels corresponding to the progress information samples; Train an initial model according to the progress information samples and the target predicted execution time labels of each subtask corresponding to the progress information samples to obtain the prediction model.
13. The method according to claim 12, wherein Training the initial model based on the progress information sample and the target predicted execution time labels of each subtask corresponding to the progress information sample to obtain the prediction model includes: Training the initial model according to the progress information sample and the target predicted execution time labels of each subtask corresponding to the progress information sample to obtain a first model; Obtaining a plurality of test samples, wherein each test sample includes a progress information test sample of the target task and predicted execution time test labels of each subtask corresponding to the progress information test sample; Evaluating the first model using the plurality of test samples to obtain evaluation metrics corresponding to the first model; When the evaluation metrics corresponding to the first model meet the preset convergence condition, determining the first model as the prediction model; When the evaluation metrics corresponding to the first model do not meet the preset convergence condition, optimizing the first model to obtain the prediction model.
14. A battery management system, characterized in that, The system includes: An information acquisition unit for acquiring progress information during the execution of a target task by a battery management system, where the target task includes a plurality of subtasks; A controller for determining the predicted execution time of each subtask according to the progress information; A task scheduler for adjusting the maximum allowable duration corresponding to each subtask according to the predicted execution time; A task executor for continuing to execute the target task based on the adjusted maximum allowable duration corresponding to each subtask.
15. A machine-readable storage medium, characterized in that, A program or instruction is stored on the machine-readable storage medium, and when the program or instruction is executed by a processor, the method described in any one of claims 1-13 is implemented.
16. A computer program product, characterized in that, When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is caused to execute the method described in any one of claims 1-13.