Air conditioner operation control method, system and equipment and storage medium

By retrieving and executing preprocessed air conditioning control tasks from pre-stored data structures, the uneven resource allocation and delay problems of traditional timing task scheduling in large-scale distributed environments are solved, and more efficient and accurate air conditioning timing tasks are achieved. implement.

CN119412787APending Publication Date: 2025-02-11SHANGHAI MEICON INTELLIGENT CONSTR CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411806544.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

Traditional timed task scheduling mechanisms may have problems such as uneven resource allocation, increased latency or failed execution in large-scale distributed environments.

Method used

By retrieving the preprocessed air conditioner control task to be executed from the pre-stored data structure, the task identifier is extracted, the corresponding air conditioner task execution logic is obtained, and the task execution logic is triggered when the predetermined execution time is reached.

Benefits of technology

The efficiency and accuracy of timed air conditioner operation control are improved, and the problems of uneven resource allocation and increased delays are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119412787A_ABST
    Figure CN119412787A_ABST
Patent Text Reader

Abstract

The invention discloses an air conditioner operation control method, system and device and a storage medium, and relates to the field of computers.The method comprises the steps that a plurality of to-be-executed air conditioner control tasks with preset execution time meeting set conditions are retrieved from a pre-stored data structure; extracting a task identifier of the air conditioner control task to be executed; corresponding air conditioner task execution logic is obtained based on the task identifier; and according to the preset execution time, corresponding air conditioner task execution logic is triggered. The pre-processed to-be-executed air conditioner control task is retrieved from the pre-stored data structure, so that the execution efficiency and accuracy of the air conditioner timing task are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to an air-conditioning operation control method, system, device and storage medium. Background Art

[0002] In daily work and life, scheduled tasks are often required to execute the planned work at the agreed time. In a distributed system environment, scheduling and executing scheduled tasks is a core requirement. For example, you can agree to restart the httpd server at 4 am every morning and send an email to a certain mailbox at 10 pm every night.

[0003] Traditional scheduled task scheduling mechanisms such as Cron (such as "0 0 10**?" means execution at 0:00 a.m. on the tenth day of every month) rely on operating system-level timers, which may lead to problems such as uneven resource allocation, increased latency, or execution failure in large-scale distributed environments. Summary of the invention

[0004] The main purpose of the present invention is to provide an air conditioning operation control method, system, device and storage medium, which improves the efficiency and accuracy of timed air conditioning operation control by retrieving pre-processed air conditioning control tasks to be executed from a pre-stored data structure.

[0005] In order to achieve the above objectives, the embodiments of the present application provide the following technical solutions:

[0006] According to a first aspect of an embodiment of the present application, there is provided an air conditioning operation control method, the method comprising:

[0007] Retrieving from a pre-stored data structure a number of to-be-executed air conditioning control tasks whose scheduled execution times meet set conditions;

[0008] Extracting a task identifier of the air conditioning control task to be executed;

[0009] Acquire the corresponding air conditioning task execution logic based on the task identifier;

[0010] According to reaching the predetermined execution time, the corresponding air-conditioning task execution logic is triggered.

[0011] Optionally, before retrieving from the pre-stored data structure a number of to-be-executed air-conditioning control tasks whose scheduled execution times meet the set conditions, the method further includes:

[0012] Determining a time point within a preset validity period that matches the scheduled execution time of the to-be-processed air conditioning control task;

[0013] Converting the time point into an execution timestamp corresponding to the air conditioning control task to be processed;

[0014] According to the order of the execution timestamps of the plurality of to-be-processed air-conditioning control tasks, the execution timestamps and the corresponding task identifiers of the to-be-processed air-conditioning control tasks are sequentially stored in the pre-stored data structure of the database.

[0015] Optionally, the determining a time point within a preset validity period that matches the scheduled execution time of the to-be-processed air-conditioning control task includes:

[0016] Acquire a timing sequence of the to-be-processed air conditioning control task, wherein the timing sequence is used to represent the predetermined execution time;

[0017] Parsing the timing sequence to obtain the scheduled execution time of the air conditioning control task to be processed;

[0018] According to the scheduled execution time of the air-conditioning control task to be processed, the time point is determined from within the preset validity period.

[0019] Optionally, retrieving from the pre-stored data structure a number of to-be-executed air conditioning control tasks whose scheduled execution times meet set conditions includes:

[0020] Convert the server current time to the current timestamp;

[0021] Traverse all execution timestamps in the pre-stored data structure, and determine that the pending air conditioning control tasks whose execution timestamps are less than or equal to the current timestamp are the pending air conditioning control tasks; the plurality of pending air conditioning control tasks include a startup task, a shutdown task, and a cooling task.

[0022] Optionally, acquiring the corresponding air-conditioning task execution logic based on the task identifier includes:

[0023] acquiring a power-on signal based on the task identifier of the power-on task, wherein the power-on signal is used to control the air conditioner to switch from a standby state to a working state; or,

[0024] acquiring a shutdown signal based on the task identifier of the shutdown task, wherein the shutdown signal is used to control the air conditioner to switch from the working state to the standby state; or,

[0025] A cooling signal is obtained based on the task identifier of the cooling task, where the cooling signal is used to control the air conditioner to operate in a cooling state according to cooling parameters, where the cooling parameters include a target temperature, a target wind speed, and a target swing angle.

[0026] Optionally, the retrieval of several air-conditioning control tasks to be executed whose scheduled execution times meet the set conditions from the pre-stored data structure is performed periodically according to a preset retrieval cycle, and the determination of the time point within the preset validity period that matches the scheduled execution time of the air-conditioning control task to be processed is performed periodically according to a preprocessing cycle, and the preset retrieval cycle is greater than the preprocessing cycle.

[0027] Optionally, before determining a time point within a preset validity period that matches the scheduled execution time of the to-be-processed air-conditioning control task, the method further includes:

[0028] Get the scheduled tasks set by the user;

[0029] Converting the scheduled execution time in the scheduled task into a timing sequence;

[0030] The timing sequence and task identifiers are stored in the database.

[0031] According to a second aspect of an embodiment of the present application, an air conditioning operation control system is provided, the system comprising:

[0032] A retrieval module, used to retrieve from a pre-stored data structure a number of to-be-executed air conditioning control tasks whose scheduled execution time meets a set condition;

[0033] A task identifier module, used to extract the task identifier of the air conditioning control task to be executed;

[0034] An execution logic acquisition module, used to acquire the corresponding air-conditioning task execution logic based on the task identifier;

[0035] The task execution module is used to trigger the corresponding air-conditioning task execution logic according to the arrival of the predetermined execution time.

[0036] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.

[0037] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. The computer-readable instructions can be executed by a processor to implement the method described in the first aspect above.

[0038] In summary, the embodiments of the present application provide an air conditioning operation control method, system, device and storage medium. By retrieving several to-be-executed air conditioning control tasks whose scheduled execution time meets the set conditions from a pre-stored data structure; extracting the task identifier of the to-be-executed air conditioning control task; obtaining the corresponding air conditioning task execution logic based on the task identifier; triggering the corresponding air conditioning task execution logic according to the arrival of the scheduled execution time. The system will retrieve a pre-set data structure, which stores all to-be-executed air conditioning control tasks and their scheduled execution times. The system finds out those to-be-executed air conditioning control tasks whose scheduled execution time meets specific conditions and extracts their task identifiers, which are used to uniquely identify each to-be-executed air conditioning control task. Further, according to this task identifier, the execution logic related to the to-be-executed air conditioning control task is obtained, that is, the specific operation or code that the task needs to execute. When the scheduled execution time arrives, the system will trigger the execution logic of these tasks, so that the to-be-executed air conditioning control tasks can be executed. By retrieving the pre-processed to-be-executed air conditioning control tasks from the pre-stored data structure, the efficiency and accuracy of the execution of the air conditioning timing tasks are improved. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0040] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.

[0041] Figure 1 A schematic diagram of a flow chart of an air conditioning operation control method provided in an embodiment of the present application;

[0042] Figure 2 The time preprocessing process of the scheduled task provided in the embodiment of the present application;

[0043] Figure 3 The timed air conditioning operation control process provided in the embodiment of the present application;

[0044] Figure 4 A structural diagram of a task execution system provided in an embodiment of the present application;

[0045] Figure 5 A structural diagram of an electronic device provided in an embodiment of the present application is shown;

[0046] Figure 6 A diagram showing a computer-readable storage medium provided by an embodiment of the present application.

[0047] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] It should be noted that all directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0050] In addition, in the present invention, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0051] In the present invention, unless otherwise clearly specified and limited, the terms "connection", "fixation", etc. should be understood in a broad sense. For example, "fixation" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0052] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0053] Figure 1 An air conditioning operation control method provided by an embodiment of the present application is shown, and the method includes:

[0054] Step 101: Retrieve from a pre-stored data structure a number of to-be-executed air conditioning control tasks whose scheduled execution time meets a set condition;

[0055] Step 102: extracting the task identifier of the air conditioning control task to be executed;

[0056] Step 103: acquiring corresponding air conditioning task execution logic based on the task identifier;

[0057] Step 104: triggering the corresponding air-conditioning task execution logic according to the arrival of the predetermined execution time.

[0058] The system will retrieve a pre-set data structure that stores all pending air conditioning control tasks that need to be executed and their scheduled execution times. The system finds those pending air conditioning control tasks whose scheduled execution times meet specific conditions and extracts their task identifiers, which are used to uniquely identify each pending air conditioning control task. Furthermore, the execution logic related to the pending air conditioning control task is obtained based on this task identifier, that is, the specific operations or codes that the task needs to perform. When the scheduled execution time arrives, the system will trigger the execution logic of these tasks so that the pending air conditioning control tasks can be executed.

[0059] In a possible implementation manner, before retrieving from the pre-stored data structure in step 101 a plurality of to-be-executed air conditioning control tasks whose scheduled execution times meet the set conditions, the method further includes:

[0060] Determine a time point within a preset validity period that matches the scheduled execution time of the pending air-conditioning control task; convert the time point into an execution timestamp corresponding to the pending air-conditioning control task; and store the execution timestamps and the corresponding task identifiers of the pending air-conditioning control tasks in the pre-stored data structure of the database in sequence according to the order of the execution timestamps of several pending air-conditioning control tasks.

[0061] In a possible implementation manner, determining a time point within a preset validity period that matches the scheduled execution time of the to-be-processed air conditioning control task includes:

[0062] Obtain a timing sequence of the pending air-conditioning control task, wherein the timing sequence is used to characterize the scheduled execution time; parse the timing sequence to obtain the scheduled execution time of the pending air-conditioning control task; and determine the time point within the preset validity period according to the scheduled execution time of the pending air-conditioning control task.

[0063] In a possible implementation manner, before determining a time point within a preset validity period that matches the scheduled execution time of the to-be-processed air-conditioning control task, the method further includes:

[0064] Acquire a scheduled task set by a user; convert the scheduled execution time in the scheduled task into a timing sequence; and store the timing sequence and task identifier in the database.

[0065] Before retrieving the pending air conditioning control tasks, the system will determine which time points within the preset validity period match the scheduled execution time of the pending air conditioning control tasks. The system will obtain and parse the task timing sequence to determine the exact scheduled execution time of the task and determine the time point accordingly. These time points are then converted into timestamps. The system will store the timestamps and the corresponding task identifiers in the pre-stored data structure of the database in the order of the execution timestamps of the tasks.

[0066] By determining and processing the scheduled execution time of tasks in advance, the system can ensure that all necessary data and resources are ready before the task is executed, avoiding problems caused by delays in data acquisition or resource allocation when the task is executed. The pre-processing method enables the system to respond more quickly to the arrival of the scheduled execution time, because the system already knows which tasks are about to be executed, and it can quickly trigger the execution logic of these tasks without the need for additional checks or processing during execution.

[0067] The user sets a scheduled task through the smart home application, requiring the air conditioner to be automatically turned on at 5 pm every day, and setting the target temperature to 24 degrees, the wind speed to low speed, and the swing angle to automatic. The scheduled task set by the user is sent to the system server, which converts the scheduled execution time into a timing sequence and parses this sequence to determine the exact scheduled execution time. The system determines the time point based on this scheduled execution time and converts it into an execution timestamp. The system stores the execution timestamp and the corresponding task identifier in the pre-stored data structure of the database for subsequent retrieval. Before 5 pm every day, the system converts the current time of the server to the current timestamp. The system traverses all execution timestamps in the pre-stored data structure and finds the pending air conditioning control tasks whose execution timestamps are less than or equal to the current timestamp. The system extracts the task identifiers of these pending tasks and obtains the corresponding air conditioning task execution logic based on the task identifiers.

[0068] In a possible implementation, in step 101, retrieving from a pre-stored data structure a number of to-be-executed air conditioning control tasks whose scheduled execution time meets a set condition includes:

[0069] Convert the current time of the server to the current timestamp; traverse all execution timestamps in the pre-stored data structure, and determine that the pending air conditioning control tasks with execution timestamps less than or equal to the current timestamp are the pending air conditioning control tasks. The pending air conditioning control tasks include a startup task, a shutdown task, and a cooling task.

[0070] In a possible implementation, the acquiring the corresponding air conditioning task execution logic based on the task identifier includes:

[0071] A power-on signal is obtained based on the task identifier of the power-on task, and the power-on signal is used to control the air conditioner to switch from the standby state to the working state; or, a shutdown signal is obtained based on the task identifier of the shutdown task, and the shutdown signal is used to control the air conditioner to switch from the working state to the standby state; or, a cooling signal is obtained based on the task identifier of the cooling task, and the cooling signal is used to control the air conditioner to operate in the cooling state according to cooling parameters, and the cooling parameters include target temperature, target wind speed and target swing angle.

[0072] Automatically execute air conditioning control tasks, such as power on, power off, and cooling, according to preset time and conditions. The system retrieves pending tasks that meet the set conditions at the scheduled execution time and obtains the corresponding execution logic according to the task identifier to achieve precise control of the air conditioning equipment. Such a system can improve the convenience, energy saving, and user satisfaction of air conditioning use.

[0073] Assume that a user wants to remotely control the air conditioner at home through a mobile phone application to ensure that the air conditioner is turned on and adjusted to a suitable temperature and wind speed before returning home. The user sets a cooling task in the mobile phone application, scheduled to automatically turn on the air conditioner at 6 pm, and set the target temperature to 26 degrees, the wind speed to medium, and the swing angle to automatic. Timestamp conversion and task retrieval (step 101): At 6 pm, the system server converts the current time to a timestamp. The system traverses all execution timestamps in the pre-stored data structure and searches for pending air conditioning control tasks whose execution timestamps are less than or equal to the current timestamp. The system finds that the cooling task set by the user meets the conditions and marks it as a pending task. The system obtains the corresponding cooling signal based on the task identifier of the cooling task. The cooling signal includes a target temperature of 26 degrees, a target wind speed of medium, and a target swing angle of automatic. The system sends a cooling signal to the air conditioner. After receiving the signal, the air conditioner switches from the standby state to the working state and runs in the cooling state according to the cooling parameters. The compressor of the air conditioner starts, the temperature sensor starts to monitor the indoor temperature, the wind speed is adjusted to medium, and the swing angle is automatically adjusted to optimize air flow. When the user returns home at 6 pm, he finds that the air conditioner has been turned on according to the preset conditions, the indoor temperature is comfortable, and the wind speed and swing angle are also in line with expectations, thereby improving the user's living experience.

[0074] In a possible implementation, the retrieval of several pending air-conditioning control tasks whose scheduled execution times meet set conditions from a pre-stored data structure is performed periodically according to a preset retrieval cycle, and the determination of a time point within a preset validity period that matches the scheduled execution time of the pending air-conditioning control task is performed periodically according to a preprocessing cycle, and the preset retrieval cycle is greater than the preprocessing cycle.

[0075] Periodic retrieval and processing before the scheduled execution time can reduce the delay that may occur when the task is executed. Because the system already knows which tasks are about to be executed, it can allocate the necessary resources and processing power in advance, thereby reducing the waiting time during execution. The system periodically retrieves the air-conditioning control tasks to be executed according to the preset retrieval cycle (for example, every 5 minutes). The system also periodically processes the scheduled execution time of the air-conditioning control tasks to be processed according to the preset pre-processing cycle (for example, every 10 minutes) to determine the time point that matches the preset validity period. Since the retrieval cycle (5 minutes) is greater than the pre-processing cycle (10 minutes), the system can ensure that the scheduled execution time of all the air-conditioning control tasks to be processed has been processed and updated before the start of each retrieval cycle. By periodically retrieving and processing tasks, the system can optimize resource allocation according to the execution time of the tasks. For example, if the system knows that there will be a large number of tasks to be executed at a specific time point, it can allocate more resources in advance to process these tasks, thereby ensuring the efficiency of task execution.

[0076] In a possible implementation manner, after the scheduled execution times corresponding to the plurality of tasks in step 104 trigger the corresponding air conditioning task execution logic, the method further includes:

[0077] According to the successful execution, the status of the successfully executed air-conditioning control task to be executed is marked as a completed task; or, according to the failed execution, a reminder message of the failed air-conditioning control task to be executed is sent to the user device.

[0078] Assume that the user has set multiple air conditioning control tasks, including turning the air conditioner on and off at different times, and adjusting the temperature and wind speed. According to the process from step 101 to step 104, the system retrieves and executes the air conditioning control tasks preset by the user. For each task, the system triggers the corresponding execution logic when the scheduled execution time arrives. If the air conditioner successfully receives and executes the control command (for example, the air conditioner is successfully turned on and set to the specified temperature and wind speed), the system will update the status of the task in the database as "completed task". This status update can be used to record the historical execution of the task, and can also be used to avoid repeating the same task. If the air conditioner fails to successfully receive or execute the control command (for example, the air conditioner does not respond or the execution parameters are inconsistent with the preset), the system will generate a reminder message. This message will detail the reason for the failure, such as "the air conditioner did not respond" or "the execution parameter is wrong". The system sends this reminder message to the user's smart device (such as a smartphone or tablet). After receiving the notification, the user can take immediate action, such as resending the control command, checking the status of the air conditioner, or contacting technical support. The user decides whether further action is required based on the information in the reminder message. If necessary, users can manually intervene or modify the task settings to ensure that the air conditioner works as expected. In this way, the system can not only automatically perform air conditioning control tasks, but also provide feedback on the execution results, allowing users to understand and control the air conditioning status at home in a timely manner, enhancing the practicality and reliability of the smart home system.

[0079] Based on the same technical concept, the control logic of the air conditioner operation control method provided in the embodiment of the present application is applied not only to the operation of the air conditioner, but also to any scheduled task execution. The task execution method provided in the embodiment of the present application is described in detail below in conjunction with the accompanying drawings.

[0080] In the first stage, data is stored according to the set data storage format.

[0081] The database provided in the embodiment of the present application may be REDIS (Remote Dictionary Server). ZSET (Ordered Set) of REDIS is a data structure provided by REDIS, which adds a score to each element, and the score is used to sort the elements in the set. ZSET combines the characteristics of a set (unordered, unique elements) and the characteristics of an ordered list (sortable elements).

[0082] The embodiment of the present application uses the ZSET (ordered set) data structure in REDIS to store the information of scheduled tasks. The storage format of each task is as follows: Score: the next execution time point of the task, expressed in the form of a Unix timestamp. The Unix timestamp is a long integer number that represents the number of seconds since January 1, 1970 (UTC). Using the timestamp as the score can ensure that the ZSET is automatically sorted according to the execution time of the task, so that the task with the smallest score (timestamp) will be at the front, that is, it will be executed first. Member: The unique identifier of the task, that is, the task ID. This storage method allows tasks to be sorted according to their execution time, and tasks to be executed can be retrieved efficiently.

[0083] Phase 2: Preprocessing process.

[0084] Step 1: The system receives input including a Cron expression and a task ID. The Cron expression (the above timing sequence) defines the execution plan of the task, and the task ID is used to uniquely identify a task.

[0085] Step 2: Use the Cron parser to parse the input Cron expression. The parser needs to be able to understand each field in the expression and calculate the time point that matches the expression.

[0086] Step 3: The parser determines whether there is an execution time point that matches the Cron expression within the next 30 minutes. This step is to identify the tasks to be executed in advance so that they can be scheduled in time.

[0087] Step 4: For each determined execution time point, convert it to a Unix timestamp as the Score value.

[0088] Step 5: Store the task ID and the corresponding Unix timestamp Score value in the ZSET of REDIS. In this way, the execution time of each task is recorded in the ZSET for subsequent query and execution.

[0089] Traditional scheduled task scheduling mechanisms, such as Cron, rely on operating system-level timers to schedule task execution. Cron expressions, such as "0 0 10**?", are used to specify the execution time of a task. For example, this expression means that a task is executed once at 0:00 a.m. on the 10th day of each month. In a distributed task scheduling system, the main function of the Cron expression preprocessing module is to receive the Cron expression and parse it to determine whether there is a matching execution time point within the next 30 minutes. If so, it converts the task ID and the corresponding execution timestamp into a Score value and stores it in the ZSET data structure of REDIS.

[0090] Cron expression is a string that defines the execution schedule of a task. The module parses the Cron expression and converts it into a time rule that can be understood by the system. The parsing process includes determining the time units such as year, month, day, hour and minute in the expression. Based on the parsed time rule, the module calculates whether there is a matching execution time point in the next 30 minutes. If a matching execution time point is found, the module converts the task ID and the corresponding execution timestamp into a Score value. This Score value is usually a timestamp indicating the next execution time of the task. The task ID (as Value) and the corresponding Score value (as Score) are stored in the ZSET data structure of REDIS. ZSET is an ordered set that can sort elements according to the Score value, which is very suitable for task scheduling scenarios. The module returns the result of the operation, including whether the task information is successfully stored in REDIS, and any related error information or warnings.

[0091] Figure 2 The time preprocessing process of the scheduled task provided in the embodiment of the present application is shown, which specifically includes:

[0092] Step 1: Read the list of scheduled tasks executed within the validity period in the database according to the set preprocessing cycle. The length of the scheduled task list is i, and the initial counter j is 0.

[0093] Step 2: Determine whether the counter value j is less than the length i of the task list, that is, whether there are still unprocessed tasks in the task list; if so, it means there are still unprocessed tasks, and execute step 3; if not, jump to step 1 after setting the preprocessing period (for example, 1 minute) and start again from step 1.

[0094] Step 3: Read the jth data in the task list.

[0095] Step 4: Parse the execution time based on the Cron expression of the task of the j-th data.

[0096] Step 5: Determine whether the parsed execution time is within the preset time, such as within the next 30 minutes. If yes, go to step 6; if not, jump to step 7.

[0097] Step 6: Convert the execution time into a timestamp and represent it as a score, and take the task ID as the value and store it in the ZSET set of REDIS.

[0098] Step 7: Increase the counter j by 1. Return to step 2 and continue the loop.

[0099] By calculating and storing the task information to be executed in advance, this module can significantly improve the efficiency of task scheduling. The preprocessing of Cron expressions ensures the accuracy of task scheduling and avoids execution delays or failures caused by time calculation errors. Using REDIS as middleware, this module can be easily expanded to support larger-scale task scheduling needs.

[0100] The third aspect: task execution process.

[0101] Step 1: According to the set task execution cycle, periodically (for example, every minute) query all tasks whose score values ​​are less than or equal to the current Unix timestamp from REDIS's ZSET. This timestamp is the UNIX timestamp converted from the current server time. The query result contains the IDs of the tasks to be executed. These IDs correspond to the elements in ZSET, and their score values ​​are the scheduled execution times of the tasks. Periodically use the timestamp converted from the current server time as the score value to query all tasks in REDIS ZSET whose scores are less than or equal to the current time. These tasks are considered to be executed in the next period of time, so they can be taken out and executed immediately.

[0102] Step 2: Extract the task ID from the query results. The ID identifies the task that needs to be executed.

[0103] Step 3: Use the task ID to query the database or other storage system to obtain the task details and execution logic.

[0104] Step 4: Based on the obtained task details, trigger the corresponding task execution logic, which may involve calling external services, executing scripts, or other predetermined operations.

[0105] In system design, a task execution cycle is set, which should be greater than the preprocessing cycle. The preprocessing cycle is the frequency at which the system checks and prepares tasks, while the task execution cycle is the frequency at which tasks are actually executed. Ensuring that the task execution cycle is greater than the preprocessing cycle can prevent tasks from being executed before they are ready.

[0106] During the task execution process, the system needs to monitor the status of the task and record the execution results of the task. If the task is successfully executed, update the task status to "completed". If the task fails to execute, perform corresponding operations according to the error handling strategy, such as retrying, recording error logs, or sending alarms. Through this implementation method, the system can efficiently and accurately manage and execute scheduled tasks while ensuring that the execution of tasks will not miss the scheduled time point. This REDIS-based scheduled task scheduling method is particularly suitable for distributed system environments that require high concurrency and high availability.

[0107] Figure 3 The following is a flow chart showing the execution process of a scheduled task provided by an embodiment of the present application, which specifically includes:

[0108] Step 1: Query the ZSET set of REDIS for a list of task IDs whose scores are less than or equal to the timestamp value converted from the current server time. Determine the length of the task ID list as i. Initialize the counter j to 0.

[0109] Step 2: Check if j is less than i. If yes, go to step 3; if not, sleep for 1 minute and then go to step 1.

[0110] Step 3: Read the jth data in the task ID list.

[0111] Step 4: Get the task details and schedule the task.

[0112] Step 5: Increase the counter j by 1. Return to step 2 and continue the loop.

[0113] Since the system checks tasks periodically rather than triggering in real time, using "less than or equal to current time" ensures that tasks scheduled to be executed in the previous check cycle are not missed. For example, if the system checks once a minute, then when checking at 12:05, all tasks scheduled to be executed before 12:05 should be executed. If you only query tasks with a score less than the current time, you may miss tasks that should be executed at the current time. For example, if the current time is 12:00:00, the score of tasks scheduled to be executed at 12:00:00 should be equal to the current time. If the equal case is not included, these tasks will be missed. In a distributed system, the execution of tasks may be delayed. Even if the scheduled execution time of a task has arrived, the actual execution may start later. By querying tasks with a score less than or equal to the current time, the system can tolerate a certain delay and ensure that tasks will not be skipped even if there is a slight delay. By querying only tasks with a score less than or equal to the current time, you can avoid tasks scheduled to be executed in the future from being executed in advance. This ensures that tasks are executed in the scheduled time order.

[0114] The module performs query operations at a certain time interval (for example, every minute). This interval can be adjusted according to the needs and performance of the system. At each query, the module converts the current server time to a timestamp. This timestamp will be used as the score value for querying REDIS ZSET. Using the converted timestamp as the score value, the module queries REDIS ZSET for all tasks whose scores are less than or equal to the current timestamp. These tasks are scheduled to be executed at or before the current time.

[0115] For the tasks found, the module takes them out of the REDIS ZSET and performs the corresponding operations based on the specific content of the task. This may include starting a service, sending a notification, performing a computation, etc. After the task is executed, the module updates the status of the task to reflect that the task has been completed. This may involve updating a record in the database or sending a status update message.

[0116] If any exceptions or errors are encountered while executing tasks, the module will record these exceptions and handle them according to the predefined error handling strategy. This may include a retry mechanism, error notification, or task rollback. The module returns the operation results, including the number of successfully executed tasks, the number of failed tasks, and any relevant error information or warnings.

[0117] In summary, the embodiment of the present application provides an air conditioning operation control method, which retrieves a number of to-be-executed air conditioning control tasks whose scheduled execution time meets set conditions from a pre-stored data structure; extracts the task identifier of the to-be-executed air conditioning control task; obtains the corresponding air conditioning task execution logic based on the task identifier; and triggers the corresponding air conditioning task execution logic according to the arrival of the scheduled execution time. By retrieving the pre-processed to-be-executed air conditioning control tasks from the pre-stored data structure, the efficiency and accuracy of the scheduled task execution are improved.

[0118] Based on the same technical concept, the embodiment of the present application also provides an air conditioning operation control system. Figure 4 As shown, the system comprises:

[0119] A retrieval module 401 is used to retrieve from a pre-stored data structure a number of to-be-executed air conditioning control tasks whose scheduled execution time meets a set condition;

[0120] A task identifier module 402 is used to extract the task identifier of the air conditioning control task to be executed;

[0121] An execution logic acquisition module 403 is used to acquire the corresponding air conditioning task execution logic based on the task identifier;

[0122] The task execution module 404 is used to trigger the corresponding air-conditioning task execution logic according to the arrival of the predetermined execution time.

[0123] The present application also provides an electronic device corresponding to the method provided in the above embodiment. Figure 5 , which shows an electronic device diagram provided by some embodiments of the present application. The electronic device 20 may include: a processor 200, a memory 201, a bus 202 and a communication interface 203, wherein the processor 200, the communication interface 203 and the memory 201 are connected via the bus 202; the memory 201 stores a computer program that can be run on the processor 200, and the processor 200 executes the method provided by any of the aforementioned embodiments of the present application when running the computer program.

[0124] The memory 201 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one physical port (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0125] The bus 202 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 201 is used to store programs, and the processor 200 executes the programs after receiving execution instructions. The method disclosed in any implementation of the aforementioned embodiment of the present application may be applied to the processor 200, or implemented by the processor 200.

[0126] The processor 200 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 200. The above processor 200 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and completes the steps of the above method in combination with its hardware.

[0127] The electronic device provided in the embodiment of the present application and the method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, operated or implemented by them.

[0128] The present application also provides a computer-readable storage medium corresponding to the method provided in the above embodiment. Figure 6 The computer-readable storage medium shown is a CD 30 on which a computer program (ie, a program product) is stored. When the computer program is run by a processor, the method provided in any of the aforementioned embodiments is executed.

[0129] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.

[0130] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the method provided in the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, run or implemented by the application program stored therein.

[0131] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and that those skilled in the art may design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets should not be constructed as a limitation to the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of multiple such elements. The present application may be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim that lists several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names.

[0132] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

[0133] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.

Claims

1. An air conditioning operation control method, characterized in that: The method comprises: Retrieving from a pre-stored data structure a number of to-be-executed air conditioning control tasks whose scheduled execution times meet set conditions; Extracting a task identifier of the air conditioning control task to be executed; Acquire the corresponding air conditioning task execution logic based on the task identifier; According to reaching the predetermined execution time, the corresponding air-conditioning task execution logic is triggered.

2. The method according to claim 1, characterized in that Before retrieving from the pre-stored data structure a plurality of to-be-executed air conditioning control tasks whose scheduled execution times meet the set conditions, the method further includes: Determine a time point within a preset validity period that matches the scheduled execution time of the air conditioning control task to be processed; Converting the time point into an execution timestamp corresponding to the air conditioning control task to be processed; According to the order of the execution timestamps of the plurality of to-be-processed air-conditioning control tasks, the execution timestamps and the corresponding task identifiers of the to-be-processed air-conditioning control tasks are sequentially stored in the pre-stored data structure of the database.

3. The method according to claim 2, characterized in that The determining of a time point within a preset validity period that matches the scheduled execution time of the to-be-processed air conditioning control task includes: Acquire a timing sequence of the to-be-processed air conditioning control task, wherein the timing sequence is used to represent the predetermined execution time; Parsing the timing sequence to obtain the scheduled execution time of the air conditioning control task to be processed; According to the scheduled execution time of the air-conditioning control task to be processed, the time point is determined from within the preset validity period.

4. The method according to claim 2, characterized in that The step of retrieving from the pre-stored data structure a plurality of to-be-executed air conditioning control tasks whose scheduled execution time satisfies the set conditions comprises: Convert the server current time to the current timestamp; Traverse all execution timestamps in the pre-stored data structure, and determine that the pending air conditioning control tasks whose execution timestamps are less than or equal to the current timestamp are the pending air conditioning control tasks; the plurality of pending air conditioning control tasks include a startup task, a shutdown task, and a cooling task.

5. The method according to claim 4, characterized in that The acquiring the corresponding air conditioning task execution logic based on the task identifier includes: acquiring a power-on signal based on the task identifier of the power-on task, wherein the power-on signal is used to control the air conditioner to switch from a standby state to a working state; or, acquiring a shutdown signal based on the task identifier of the shutdown task, wherein the shutdown signal is used to control the air conditioner to switch from the working state to the standby state; or, A cooling signal is obtained based on the task identifier of the cooling task, where the cooling signal is used to control the air conditioner to operate in a cooling state according to cooling parameters, where the cooling parameters include a target temperature, a target wind speed, and a target swing angle.

6. The method according to claim 2, characterized in that The retrieving from the pre-stored data structure several air-conditioning control tasks to be executed whose scheduled execution times meet the set conditions is performed periodically according to a preset retrieval cycle, and the determining of the time point within the preset validity period that matches the scheduled execution time of the air-conditioning control task to be processed is performed periodically according to a preprocessing cycle, and the preset retrieval cycle is greater than the preprocessing cycle.

7. The method according to claim 2, characterized in that Before determining a time point within a preset validity period that matches the scheduled execution time of the to-be-processed air-conditioning control task, the method further includes: Get the air conditioning timer control task set by the user; Converting the scheduled execution time in the air conditioning timing control task into a timing sequence; The timing sequence and task identifiers are stored in the database.

8. An air conditioning operation control system, characterized in that: The system comprises: A retrieval module, used to retrieve from a pre-stored data structure a number of to-be-executed air conditioning control tasks whose scheduled execution time meets a set condition; A task identifier module, used to extract the task identifier of the air conditioning control task to be executed; An execution logic acquisition module, used to acquire the corresponding air-conditioning task execution logic based on the task identifier; The task execution module is used to trigger the corresponding air-conditioning task execution logic according to the arrival of the predetermined execution time.

9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and the computer-readable instructions can be executed by a processor to implement the method according to any one of claims 1-7.