Power consumption management method, system and device and readable storage medium

By acquiring the actual state and continuous idle time of the microcontroller unit, adaptively selecting different levels of sleep modes, solving the problem of low flexibility in power consumption management methods in the prior art, achieving lower power consumption and higher stability and reliability.

CN119536495APending Publication Date: 2025-02-28SHENZHEN XINWEI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411425783.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-02-28

Smart Images

  • Figure CN119536495A_ABST
    Figure CN119536495A_ABST
Patent Text Reader

Abstract

The invention discloses a power consumption management method, system and device and a readable storage medium, and is used for a micro-control unit, and the power consumption management method comprises the steps: obtaining an actual state of the micro-control unit; under the condition that the actual state is the idle state, determining the continuous idle time of the idle state; determining a target sleep mode according to the continuous idle time and a plurality of preset to-be-selected sleep modes of different levels; and switching the micro-control unit into the target sleep mode. According to the embodiment of the invention, different levels of to-be-selected sleep modes can be adaptively selected according to the continuous idle time, so that the power consumption is reduced, the flexibility is good, and the stability and reliability of the micro-control unit can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field related to embedded systems, and in particular to a power consumption management method, system, device and readable storage medium. Background Art

[0002] Embedded low power management is a method to optimize the energy consumption of embedded systems. It is mainly used for battery-powered devices or devices that need to run for a long time. Its core goal is to extend the battery life of the device or reduce the power consumption of the device through effective power management and energy-saving technology. However, the existing power management method only controls the sleep state when the microcontroller unit is in an idle state, and does not take into account the specific situation of the microcontroller unit to perform more specific sleep control. It has low flexibility, low stability and reliability of the microcontroller unit. Summary of the invention

[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a power consumption management method, which can adaptively select different levels of sleep modes to be selected according to the continuous idle time to reduce power consumption, has good flexibility, and can improve the stability and reliability of the micro control unit.

[0004] The present invention also provides a power consumption management system, a control device for executing the power consumption management method, and a computer-readable storage medium.

[0005] The power consumption management method according to the first aspect of the present invention is used for a micro control unit, and the method includes: Acquiring the actual state of the microcontroller unit; In the case where the actual state is an idle state, determining a continuous idle time of the idle state; Determine a target sleep mode according to the continuous idle time and a plurality of preset different levels of sleep modes to be selected; The micro control unit is switched to the target sleep mode.

[0006] The power consumption management method according to the embodiment of the present invention has at least the following beneficial effects: By determining the continuous idle time of the idle state when the actual state of the microcontroller unit is an idle state, and setting different levels of sleep modes to be selected, selecting the sleep mode to be selected at the corresponding level as the target sleep mode according to the length of the continuous idle time, and finally switching the microcontroller unit to the target sleep mode, compared with the existing power consumption management method that only controls sleep when the microcontroller unit is in an idle state, the power consumption management method of the embodiment of the present invention can adaptively select different levels of sleep modes to be selected according to the continuous idle time to reduce power consumption, has good flexibility, and can improve the stability and reliability of the microcontroller unit.

[0007] According to some embodiments of the present invention, determining the target sleep mode according to the continuous idle time and the preset multiple different levels of sleep modes to be selected includes: Determine a target time threshold corresponding to each of the sleep modes to be selected; According to the continuous idle time and the target time thresholds corresponding to the sleep modes to be selected, one of the sleep modes to be selected at multiple different levels is selected as the target sleep mode.

[0008] According to some embodiments of the present invention, the target time threshold corresponding to each of the sleep modes to be selected is obtained by the following steps: Determining the power consumption level corresponding to each of the sleep modes to be selected; The corresponding target time threshold is set according to the power consumption level of each sleep mode to be selected, wherein as the power consumption level increases, the corresponding target time threshold decreases.

[0009] According to some embodiments of the present invention, selecting one of the sleep modes to be selected from a plurality of different levels as the target sleep mode according to the continuous idle time and the target time threshold corresponding to each of the sleep modes to be selected, includes: The target time thresholds corresponding to the sleep modes to be selected are arranged in ascending order, so that two adjacent target time thresholds form a sub-time interval, and the smallest target time threshold among the multiple target time thresholds and zero form a sub-time interval, so as to obtain a plurality of sub-time intervals corresponding to the multiple target time thresholds one by one; If the continuous idle time is greater than the left endpoint value of the target time interval and less than or equal to the right endpoint value of the target time interval, the sleep mode to be selected corresponding to the right endpoint value of the target time interval is determined as the target sleep mode, wherein the target time interval is one of the multiple sub-time intervals.

[0010] According to some embodiments of the present invention, the plurality of sleep modes to be selected are respectively a first sleep mode, a second sleep mode and a third sleep mode, wherein the target time threshold corresponding to the first sleep mode is recorded as a first time threshold, the target time threshold corresponding to the second sleep mode is recorded as a second time threshold, the target time threshold corresponding to the third sleep mode is recorded as a third time threshold, and the second time threshold is greater than the first time threshold and less than the third time threshold; The selecting one of the sleep modes to be selected from a plurality of different levels as the target sleep mode according to the continuous idle time and the target time threshold corresponding to each sleep mode to be selected includes: If the continuous idle time is less than or equal to the first time threshold, determining the first sleep mode as the target sleep mode; If the continuous idle time is greater than the first time threshold and less than or equal to the second time threshold, determining the second sleep mode as the target sleep mode; If the continuous idle time is greater than the second time threshold and less than or equal to the third time threshold, the third sleep mode is determined as the target sleep mode.

[0011] According to some embodiments of the present invention, the actual state is obtained by the following steps: Acquiring the task execution status, external event triggering status and timer status of the micro control unit; The actual state is determined according to at least one of the task execution state, the external event triggering state and the timer state.

[0012] According to some embodiments of the present invention, determining the actual state according to at least one of the task execution state, the external event triggering state and the timer state includes: If the task execution status indicates that the task is not executed, determining the actual state as the idle state; If the external event triggering state indicates that it has been triggered, determining the actual state as the idle state; If the timer status indicates that the timer is not running or the timer has reached a preset time, the actual state is determined to be the idle state.

[0013] The power consumption management system according to the second aspect of the present invention is used for a micro control unit, and the system includes: An actual state acquisition unit, used to acquire the actual state of the micro control unit; an idle time determination unit, configured to determine a continuous idle time of the idle state when the actual state is the idle state; A target sleep mode determination unit, configured to determine a target sleep mode according to the continuous idle time and a plurality of preset different levels of sleep modes to be selected; A mode switching unit is used to switch the micro control unit to the target sleep mode.

[0014] The power consumption management system according to the embodiment of the present invention has at least the following beneficial effects: By determining the continuous idle time of the idle state when the actual state of the microcontroller unit is an idle state, and setting different levels of sleep modes to be selected, selecting the sleep mode to be selected at the corresponding level as the target sleep mode according to the length of the continuous idle time, and finally switching the microcontroller unit to the target sleep mode, compared with the existing power consumption management method that only controls sleep when the microcontroller unit is in an idle state, the power consumption management system of the embodiment of the present invention can adaptively select different levels of sleep modes to be selected according to the continuous idle time to reduce power consumption, has good flexibility, and can improve the stability and reliability of the microcontroller unit.

[0015] According to the third aspect of the present invention, the control device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the power consumption management method as described in the first aspect of the embodiment above when executing the computer program. Since the control device adopts all the technical solutions of the power consumption management method of the above embodiment, it has at least all the beneficial effects brought by the technical solutions of the above embodiment.

[0016] According to the computer-readable storage medium of the fourth aspect embodiment of the present invention, computer executable instructions are stored, and the computer executable instructions are used to execute the power consumption management method as described in the first aspect embodiment. Since the computer-readable storage medium adopts all the technical solutions of the power consumption management method of the above embodiment, it at least has all the beneficial effects brought by the technical solutions of the above embodiment.

[0017] Other features and advantages of the present invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which: Figure 1 is a flow chart of a power consumption management method according to an embodiment of the present invention; Figure 2 yes Figure 1 Specific flow chart of step S300; Figure 3 is a flow chart of obtaining a target time threshold according to an embodiment of the present invention; Figure 4 yes Figure 2 Specific flow chart of step S320; Figure 5 is a flowchart of obtaining the actual state of an embodiment of the present invention; Figure 6 FIG. 4 is a system block diagram of a power consumption management system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0019] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0020] In the description of the present invention, if there is a description of first, second, etc., it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

[0021] In the description of the present invention, it should be understood that descriptions involving orientation, such as orientation or positional relationship indicated as up, down, etc., are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention 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 therefore should not be understood as a limitation on the present invention.

[0022] In the description of the present invention, it should be noted that, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention in combination with the specific content of the technical solution.

[0023] First, some nouns involved in this application are analyzed: Embedded low power management: is a method to optimize the energy consumption of embedded systems, mainly used for battery-powered devices or devices that need to run for a long time. Its core goal is to extend the battery life of the device or reduce the power consumption of the device through effective power management and energy-saving technology. It is mainly used to dynamically manage various peripherals of microcontroller units or electronic pen devices.

[0024] The following will be combined Figures 1 to 5 The power consumption management method of the embodiment of the present invention is described clearly and completely. Obviously, the embodiment described below is only a part of the embodiments of the present invention, not all the embodiments.

[0025] The power consumption management method according to the first aspect of the present invention is used for a micro control unit, and the method includes but is not limited to steps S100 to S400: Step S100, obtaining the actual state of the micro control unit; Step S200: when the actual state is an idle state, determine the continuous idle time of the idle state; Step S300, determining a target sleep mode according to the continuous idle time and a plurality of preset different levels of sleep modes to be selected; Step S400: Switch the micro control unit to a target sleep mode.

[0026] In step S100 of the embodiment of the present invention, the actual state of the micro control unit includes a running state and an idle state. In the micro control unit, there are usually multiple tasks or threads running at the same time, and the task execution state of these tasks can be monitored to determine whether the micro control unit is in an idle state. If all tasks have been completed and there is no new task to be executed, it can be considered that the micro control unit is in an idle state, otherwise it is in a running state.

[0027] If the microcontroller unit needs to respond to external events (such as sensor data acquisition, communication data processing, etc.), it can be determined whether the microcontroller unit is in an idle state by monitoring the external event triggering state of the external event. When there is no external event to be processed, the microcontroller unit can be considered to be in an idle state, otherwise it is in a running state.

[0028] It is also possible to determine whether the micro control unit is in an idle state by monitoring the timer state. If the timer is not running or the timer has reached a preset time, it can be considered that the micro control unit is in an idle state, otherwise it is in a running state.

[0029] In some embodiments of the present invention, the actual state of the microcontroller unit can be determined by any one of the task execution state, the external event trigger state and the timer state alone, or the task execution state, the external event trigger state and the timer state can be combined to determine the actual state of the microcontroller unit. Specifically, when any one of the task execution state, the external event trigger state and the timer state indicates that the actual state of the microcontroller unit is the running state, the actual state of the microcontroller unit is determined to be the running state; when the task execution state, the external event trigger state and the timer state all indicate that the actual state of the microcontroller unit is the idle state, the actual state of the microcontroller unit is determined to be the idle state.

[0030] It should be noted that how to determine the actual state of the microcontroller unit by combining the task execution state, external event trigger state and timer state can be changed according to actual conditions, and the determination method exemplified in the embodiment of the present invention cannot be regarded as a limitation of the present invention.

[0031] The idle state determination method of the embodiment of the present invention is highly flexible, and can monitor the power consumption of each component of the system, optimize the modules or components with large power consumption in a targeted manner, design corresponding energy-saving management strategies for different application scenarios, and take different power consumption optimization measures according to actual usage. For example, if the power consumption of an external event is large, it can be determined whether the microcontroller unit is in an idle state based on the external event trigger state, and then the continuous idle time of the idle state can be determined, and then the target sleep mode can be determined based on the continuous idle time and the preset multiple different levels of sleep modes to be selected.

[0032] In step S200 of the embodiment of the present invention, the continuous idle time can be monitored by a timer. When it is detected that the actual state of the micro control unit is an idle state, the timer is started and starts timing, and the cumulative time calculated by the timer is the continuous idle time. During the timer timing process, if a trigger event occurs, indicating that the actual state of the micro control unit has been converted to a running state, the count value of the timer is cleared and the counting is restarted; if a keep-alive event occurs, the count value of the timer is cleared and the counting is stopped, and the timer is restarted and counted after the keep-alive event is exited.

[0033] In step S300 of the embodiment of the present invention, the sleep degree of the microcontroller unit is gradually increased according to the length of the continuous idle time. Multiple levels of sleep modes to be selected can be set, such as: low power mode, standby mode and deep sleep mode, each level corresponds to a different power consumption level, when the continuous idle time is short, a sleep mode with lower power consumption is selected, when the continuous idle time is long, it is gradually switched to a deeper sleep mode to reduce power consumption. Each level of sleep mode to be selected can also correspond to different times required to restore the microcontroller unit to the operating state, when the continuous idle time is short, a sleep mode that can quickly restore the microcontroller unit to the operating state is selected, when the continuous idle time is long, a sleep mode that is relatively slow to restore the microcontroller unit to the operating state is selected.

[0034] It should be noted that multiple levels of sleep modes to be selected may also correspond to other actions required by the microcontroller unit after entering the sleep mode. The specific actions can be obtained by analyzing the relationship between the continuous idle time and the different sleep modes to be selected based on actual conditions, and should not be regarded as a limitation of the present invention.

[0035] In addition, it should be noted that the specific sleep mode to be selected may also include more other sleep modes, which cannot be regarded as a limitation of the present invention.

[0036] In some embodiments of the present invention, after step S400 of the embodiment of the present invention, that is, after entering the target sleep mode, the sleep / wake-up mechanism is enabled to ensure the real-time performance of the system, monitor the wake-up trigger conditions, and wake up the microcontroller unit in time to achieve intermittent sleep of the microcontroller unit.

[0037] In some embodiments, the microcontroller unit can be awakened by an external event: the external event can be a trigger, a sensor, an input signal, or a state change of an external interrupt pin. When an external event occurs, the microcontroller unit can be awakened by a corresponding interrupt service program or an external interrupt and the corresponding task can be executed.

[0038] In other embodiments, the microcontroller unit can also be awakened by internal events: the internal event can be a timer overflow, a timer counter reaching a preset value, a hardware timer or a software timer reaching a specified time, etc. When an internal event occurs, the microcontroller unit can be awakened by a specific interrupt service program or timer interrupt and the corresponding task can be executed.

[0039] If the microcontroller is awakened by an external event, it is necessary to set the corresponding trigger conditions of the external interrupt pin or configure the parameters of the timer interrupt; if the microcontroller is awakened by an internal event, it is necessary to configure the timer counting method or the trigger conditions of the timer interrupt. When an external event or internal event occurs, the microcontroller will be awakened and execute the corresponding interrupt service program or jump to the instruction after awakening.

[0040] According to the power consumption management method of the embodiment of the present invention, by determining the continuous idle time of the idle state when the actual state of the microcontroller unit is the idle state, and setting different levels of sleep modes to be selected, the sleep mode to be selected of the corresponding level is selected as the target sleep mode according to the length of the continuous idle time, and finally the microcontroller unit is switched to the target sleep mode. Compared with the existing power consumption management method that only controls the sleep mode when the microcontroller unit is in the idle state, the power consumption management method of the embodiment of the present invention can adaptively select different levels of sleep modes to be selected according to the continuous idle time to reduce power consumption, has good flexibility, and can improve the stability and reliability of the microcontroller unit.

[0041] In some embodiments of the present invention, reference Figure 2 Step S300 specifically includes but is not limited to steps S310 to S320: Step S310, determining a target time threshold corresponding to each sleep mode to be selected; Step S320 : selecting one of the sleep modes to be selected from a plurality of different levels of sleep modes to be selected as a target sleep mode according to the continuous idle time and the target time thresholds corresponding to the sleep modes to be selected.

[0042] By directly setting the target time threshold corresponding to each sleep mode to be selected, multiple sleep modes to be selected can be graded. By comparing the continuous idle time and the size of each target time threshold, it is determined which level of sleep mode to be selected is reached, and the target sleep mode is determined. This can quickly determine the target sleep mode and improve the system response speed.

[0043] In some embodiments of the present invention, reference Figure 3 The target time threshold corresponding to each sleep mode to be selected is obtained through step S311 to step S312: Step S311, determining the power consumption level corresponding to each sleep mode to be selected; Step S312: setting a corresponding target time threshold according to the power consumption level of each sleep mode to be selected, wherein the corresponding target time threshold decreases as the power consumption level increases.

[0044] In some embodiments, multiple levels of sleep modes to be selected can be set, such as: low power mode, standby mode and deep sleep mode, each level corresponds to a different power consumption level, the power consumption of standby mode is lower than that of low power mode, but higher than that of deep sleep mode. When the continuous idle time is short, the sleep mode with lower power consumption is selected. When the continuous idle time is long, it is gradually switched to a deeper sleep mode to reduce power consumption, so that the degree of power consumption reduction of the microcontroller unit can be adaptively controlled. Compared with the existing power consumption management method that only controls sleep when the microcontroller unit is in an idle state, the power consumption management method of the embodiment of the present invention has good flexibility and can improve the stability and reliability of the microcontroller unit.

[0045] In some embodiments of the present invention, reference Figure 4 Step S320 specifically includes but is not limited to steps S321 to S322: Step S321, arranging the target time thresholds corresponding to the sleep modes to be selected in ascending order so that two adjacent target time thresholds form a sub-time interval, and the smallest target time threshold among the multiple target time thresholds and zero form a sub-time interval, so as to obtain multiple sub-time intervals corresponding to the multiple target time thresholds one by one; Step S322: If the continuous idle time is greater than the left endpoint value of the target time interval and less than or equal to the right endpoint value of the target time interval, the sleep mode to be selected corresponding to the right endpoint value of the target time interval is determined as the target sleep mode, wherein the target time interval is one of multiple sub-time intervals.

[0046] The target time thresholds corresponding to multiple sleep modes to be selected are arranged in order from small to large to form multiple sub-time intervals, which correspond to the relationship between the size of the continuous idle time and the levels of the multiple sleep modes to be selected. As the continuous idle time increases, by judging in which sub-time interval the continuous idle time falls, it is determined which sleep mode to be selected as the target sleep mode, which can improve the response speed of the system and quickly determine the target sleep mode.

[0047] In some embodiments of the present invention, the multiple sleep modes to be selected are respectively a first sleep mode, a second sleep mode and a third sleep mode, wherein the target time threshold corresponding to the first sleep mode is recorded as the first time threshold, the target time threshold corresponding to the second sleep mode is recorded as the second time threshold, and the target time threshold corresponding to the third sleep mode is recorded as the third time threshold, and the second time threshold is greater than the first time threshold and less than the third time threshold; According to the continuous idle time and the target time threshold corresponding to each sleep mode to be selected, one of the sleep modes to be selected at multiple levels is selected as the target sleep mode, including: If the continuous idle time is less than or equal to the first time threshold, determining the first sleep mode as the target sleep mode; If the continuous idle time is greater than the first time threshold and less than or equal to the second time threshold, determining the second sleep mode as the target sleep mode; If the continuous idle time is greater than the second time threshold and less than or equal to the third time threshold, the third sleep mode is determined as the target sleep mode.

[0048] In some embodiments, the first sleep mode is a low power mode, the second sleep mode is a standby mode, and the third sleep mode is a deep sleep mode. The power consumption of the standby mode is lower than that of the low power mode, but higher than that of the deep sleep mode. The first time threshold can be set to 5, the second time threshold can be set to 10, and the third time threshold can be set to 15. When the continuous idle time is less than or equal to 5, the microcontroller unit is controlled to switch to the low power mode; when the continuous idle time is greater than 5 and less than or equal to 10, the microcontroller unit is controlled to switch to the standby mode; when the continuous idle time is greater than 10 and less than or equal to 15, the microcontroller unit is controlled to switch to the deep sleep mode. When the continuous idle time is short, a sleep mode with lower power consumption is selected, and when the continuous idle time is long, it is gradually switched to a deeper sleep mode to reduce power consumption. Compared with the existing power consumption management method that only controls sleep when the microcontroller unit is in an idle state, the power consumption management method of the embodiment of the present invention can adaptively select different levels of sleep modes to be selected according to the continuous idle time to reduce power consumption, has good flexibility, and can improve the stability and reliability of the microcontroller unit.

[0049] It should be noted that the number of sleep modes to be selected, the specific sleep modes, and the specific size of the corresponding target time threshold mentioned in the above embodiments can all be changed according to actual needs and cannot be regarded as a limitation of the present invention.

[0050] In some embodiments of the present invention, reference Figure 5 , the actual state is obtained through step S110 to step S120: Step S110, obtaining the task execution status, external event triggering status and timer status of the micro control unit; Step S120: determining the actual state according to at least one of the task execution state, the external event triggering state and the timer state.

[0051] There are usually multiple tasks or threads running simultaneously in a microcontroller unit. The task execution status of these tasks can be monitored to determine whether the microcontroller unit is in an idle state. If all tasks have been completed and there are no new tasks to be executed, the microcontroller unit can be considered to be in an idle state, otherwise it is in a running state.

[0052] If the microcontroller unit needs to respond to external events (such as sensor data acquisition, communication data processing, etc.), it can be determined whether the microcontroller unit is in an idle state by monitoring the external event triggering state of the external event. When there is no external event to be processed, the microcontroller unit can be considered to be in an idle state, otherwise it is in a running state.

[0053] It is also possible to determine whether the micro control unit is in an idle state by monitoring the timer state. If the timer is not running or the timer has reached a preset time, it can be considered that the micro control unit is in an idle state, otherwise it is in a running state.

[0054] In some embodiments of the present invention, the actual state of the microcontroller unit can be determined by any one of the task execution state, the external event trigger state and the timer state alone, or the task execution state, the external event trigger state and the timer state can be combined to determine the actual state of the microcontroller unit. Specifically, when any one of the task execution state, the external event trigger state and the timer state indicates that the actual state of the microcontroller unit is the running state, the actual state of the microcontroller unit is determined to be the running state; when the task execution state, the external event trigger state and the timer state all indicate that the actual state of the microcontroller unit is the idle state, the actual state of the microcontroller unit is determined to be the idle state.

[0055] It should be noted that how to determine the actual state of the microcontroller unit by combining the task execution state, external event trigger state and timer state can be changed according to actual conditions, and the determination method exemplified in the embodiment of the present invention cannot be regarded as a limitation of the present invention.

[0056] The idle state determination method of the embodiment of the present invention is highly flexible, and can monitor the power consumption of each component of the system, optimize the modules or components with large power consumption in a targeted manner, design corresponding energy-saving management strategies for different application scenarios, and take different power consumption optimization measures according to actual usage. For example, if the power consumption of an external event is large, it can be determined whether the microcontroller unit is in an idle state based on the external event trigger state, and then the continuous idle time of the idle state can be determined, and then the target sleep mode can be determined based on the continuous idle time and the preset multiple different levels of sleep modes to be selected.

[0057] In some embodiments of the present invention, determining the actual state according to at least one of a task execution state, an external event triggering state, and a timer state includes: If the task execution status indicates that the task is not executed, the actual state is determined to be an idle state; If the external event trigger state indicates that it has been triggered, the actual state is determined to be the idle state; If the timer state indicates that the timer is not running or the timer has reached a preset time, the actual state is determined to be an idle state.

[0058] In some embodiments, there are usually multiple tasks or threads running simultaneously in the micro control unit, and the task execution status of these tasks can be monitored to determine whether the micro control unit is in an idle state. If all tasks have been completed and there are no new tasks to be executed, the micro control unit can be considered to be in an idle state, otherwise it is in a running state.

[0059] In other embodiments, if the microcontroller unit needs to respond to external events (such as sensor data collection, communication data processing, etc.), it can be determined whether the microcontroller unit is in an idle state by monitoring the external event triggering state of the external event. When there is no external event to be processed, the microcontroller unit can be considered to be in an idle state, otherwise it is in a running state.

[0060] In other embodiments, it is possible to determine whether the micro control unit is in an idle state by monitoring the timer state. If the timer is not running or the timer has reached a preset time, it can be considered that the micro control unit is in an idle state, otherwise it is in a running state.

[0061] In some embodiments of the present invention, the actual state of the microcontroller unit can be determined by any one of the task execution state, the external event trigger state and the timer state alone, or the task execution state, the external event trigger state and the timer state can be combined to determine the actual state of the microcontroller unit. Specifically, when any one of the task execution state, the external event trigger state and the timer state indicates that the actual state of the microcontroller unit is the running state, the actual state of the microcontroller unit is determined to be the running state; when the task execution state, the external event trigger state and the timer state all indicate that the actual state of the microcontroller unit is the idle state, the actual state of the microcontroller unit is determined to be the idle state.

[0062] In some embodiments of the present invention, the actual state of the microcontroller unit can be indicated by setting a working state flag. When the microcontroller unit is in the running state, the working state flag is "1", and when the microcontroller unit is in the idle state, the working state flag is "0", so that the system can quickly confirm the actual state of the microcontroller unit. Specifically, the task execution state of the task in the microcontroller unit can be monitored to determine whether the microcontroller unit is in the idle state. If all tasks have been completed and there are no new tasks to be executed, the microcontroller unit can be considered to be in the idle state, and the working state flag is set to "0"; otherwise, it is in the running state, and the working state flag is set to "1". It is also possible to determine whether the microcontroller unit is in the idle state by monitoring the external event triggering state of the external event. When there is no external event to be processed, the microcontroller unit can be considered to be in the idle state, and the working state flag is set to "0"; otherwise, it is in the running state, and the working state flag is set to "1". It is also possible to determine whether the microcontroller unit is in an idle state by monitoring the timer status. If the timer is not running or the timer has reached the preset time, the microcontroller unit can be considered to be in an idle state, and the working state flag is set to "0"; otherwise, it is in a running state, and the working state flag is set to "1".

[0063] In some embodiments, the power consumption management method of the embodiment of the present invention further includes but is not limited to the following steps: Initialize the power consumption monitoring module and low power consumption algorithm; Regularly monitor system tasks, obtain monitoring results, and monitor the resource status of the microcontroller unit; According to the monitoring results, determine whether it is necessary to trigger the low power mode (i.e., sleep mode). If necessary, when switching to the low power mode, turn off unnecessary modules or configure registers to reduce power consumption; After entering the low power mode, the sleep / wake-up mechanism is enabled to ensure the real-time performance of the system, monitor the wake-up trigger conditions, and wake up the microcontroller unit in time; Periodically optimize and adjust the power consumption of the microcontroller unit, and dynamically adjust the power consumption management strategy based on real-time monitoring results; Monitor abnormal situations (such as abnormal power consumption or system stability issues) and take corresponding preset processing measures according to the abnormal situations to ensure safe and stable operation of the system; When the microcontroller unit does not need to run, a shutdown operation is performed to further reduce power consumption, while ensuring safe shutdown and data preservation.

[0064] The power consumption management method of the embodiment of the present invention can realize intermittent sleep of the micro control unit and reduce the power consumption of the micro control unit to a minimum.

[0065] refer to Figure 6 According to the power consumption management system of the second embodiment of the present invention, which is used for a micro control unit, the system includes an actual state acquisition unit, an idle time determination unit, a target sleep mode determination unit and a mode switching unit.

[0066] An actual state acquisition unit, used to acquire the actual state of the microcontroller unit; an idle time determination unit, for determining a continuous idle time of the idle state when the actual state is the idle state; A target sleep mode determination unit, configured to determine a target sleep mode according to a continuous idle time and a plurality of preset different levels of sleep modes to be selected; The mode switching unit is used to switch the micro control unit to a target sleep mode.

[0067] The specific implementation of the power consumption management system is basically the same as the specific implementation of the above power consumption management method, and will not be repeated here.

[0068] According to the power consumption management system of the embodiment of the present invention, by determining the continuous idle time of the idle state when the actual state of the microcontroller unit is the idle state, and setting different levels of sleep modes to be selected, the sleep mode to be selected of the corresponding level is selected as the target sleep mode according to the length of the continuous idle time, and finally the microcontroller unit is switched to the target sleep mode. Compared with the existing power consumption management method that only controls the sleep mode when the microcontroller unit is in the idle state, the power consumption management system of the embodiment of the present invention can adaptively select different levels of sleep modes to be selected according to the continuous idle time to reduce power consumption, has good flexibility, and can improve the stability and reliability of the microcontroller unit.

[0069] In addition, an embodiment of the present invention further provides a control device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor and the memory may be connected via a bus or other means.

[0070] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0071] The non-transient software program and instructions required to implement the air conditioner control method of the above embodiment are stored in the memory, and when executed by the processor, the power consumption management method of the above embodiment is executed.

[0072] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0073] In addition, an embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are executed by a processor or controller, for example, by the above-mentioned processor, so that the above-mentioned processor can execute the power consumption management method in the above-mentioned embodiment.

[0074] It will be appreciated by those skilled in the art that all or some of the steps and systems in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transient medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0075] The embodiments of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the relevant technical field without departing from the purpose of the present invention.

Claims

1. A power consumption management method for a micro control unit, characterized in that: The method comprises: Acquiring the actual state of the microcontroller unit; In the case where the actual state is an idle state, determining a continuous idle time of the idle state; Determine a target sleep mode according to the continuous idle time and a plurality of preset different levels of sleep modes to be selected; The micro control unit is switched to the target sleep mode.

2. The power consumption management method according to claim 1, characterized in that: The step of determining the target sleep mode according to the continuous idle time and the preset multiple levels of sleep modes to be selected includes: Determine a target time threshold corresponding to each of the sleep modes to be selected; According to the continuous idle time and the target time thresholds corresponding to the sleep modes to be selected, one of the sleep modes to be selected at multiple different levels is selected as the target sleep mode.

3. The power consumption management method according to claim 2, characterized in that: The target time threshold corresponding to each of the sleep modes to be selected is obtained by the following steps: Determining the power consumption level corresponding to each of the sleep modes to be selected; The corresponding target time threshold is set according to the power consumption level of each sleep mode to be selected, wherein as the power consumption level increases, the corresponding target time threshold decreases.

4. The power consumption management method according to claim 2, characterized in that: The selecting one of the sleep modes to be selected from a plurality of different levels as the target sleep mode according to the continuous idle time and the target time threshold corresponding to each sleep mode to be selected includes: The target time thresholds corresponding to the sleep modes to be selected are arranged in ascending order, so that two adjacent target time thresholds form a sub-time interval, and the smallest target time threshold among the multiple target time thresholds and zero form a sub-time interval, so as to obtain a plurality of sub-time intervals corresponding to the multiple target time thresholds one by one; If the continuous idle time is greater than the left endpoint value of the target time interval and less than or equal to the right endpoint value of the target time interval, the sleep mode to be selected corresponding to the right endpoint value of the target time interval is determined as the target sleep mode, wherein the target time interval is one of the multiple sub-time intervals.

5. The power consumption management method according to claim 2, characterized in that: The multiple sleep modes to be selected are respectively a first sleep mode, a second sleep mode and a third sleep mode, wherein the target time threshold corresponding to the first sleep mode is recorded as a first time threshold, the target time threshold corresponding to the second sleep mode is recorded as a second time threshold, and the target time threshold corresponding to the third sleep mode is recorded as a third time threshold, and the second time threshold is greater than the first time threshold and less than the third time threshold; The selecting one of the sleep modes to be selected from a plurality of different levels as the target sleep mode according to the continuous idle time and the target time threshold corresponding to each sleep mode to be selected includes: If the continuous idle time is less than or equal to the first time threshold, determining the first sleep mode as the target sleep mode; If the continuous idle time is greater than the first time threshold and less than or equal to the second time threshold, determining the second sleep mode as the target sleep mode; If the continuous idle time is greater than the second time threshold and less than or equal to the third time threshold, the third sleep mode is determined as the target sleep mode.

6. The power consumption management method according to claim 1, characterized in that: The actual state is obtained by the following steps: Acquiring the task execution status, external event triggering status and timer status of the micro control unit; The actual state is determined according to at least one of the task execution state, the external event triggering state and the timer state.

7. The power consumption management method according to claim 6, characterized in that: The determining the actual state according to at least one of the task execution state, the external event triggering state and the timer state comprises: If the task execution status indicates that the task is not executed, determining the actual state as the idle state; If the external event triggering state indicates that it has been triggered, determining the actual state as the idle state; If the timer status indicates that the timer is not running or the timer has reached a preset time, the actual state is determined to be the idle state.

8. A power consumption management system, characterized in that: The system comprises: An actual state acquisition unit, used to acquire the actual state of the micro control unit; an idle time determination unit, configured to determine a continuous idle time of the idle state when the actual state is the idle state; A target sleep mode determination unit, configured to determine a target sleep mode according to the continuous idle time and a plurality of preset different levels of sleep modes to be selected; A mode switching unit is used to switch the micro control unit to the target sleep mode.

9. A control device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the power consumption management method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing computer-executable instructions, characterized in that: The computer executable instructions are used to execute the power consumption management method according to any one of claims 1 to 7.