A HVAC control method and device based on reinforcement learning
By applying the reinforcement learning method in the HVAC system and constructing a strategy model for the HVAC intelligent agent, the problem of insufficient accuracy and scalability of the HVAC control system in the existing technology is solved, and more efficient and flexible HVAC control is achieved. Reduced energy consumption.
Patent Information
- Application Number
- CN202310140498.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-20
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2043-02-20
AI Technical Summary
Existing HVAC control systems have problems with low accuracy, weak timeliness, and poor scalability in multi-dimensional control. Rule-based and model-based methods each have limitations, making it difficult to effectively process high-dimensional data and respond to environmental changes.
A method based on reinforcement learning is used to construct a strategy model for the HVAC agent. A reward function is constructed through state parameters and behavioral parameters, and the optimization strategy model is updated to achieve dynamic control. It is suitable for the interaction process between the agent and the environment, and trains and updates the agent. strategies to maintain fitness and reduce energy consumption.
It improves the accuracy and flexibility of the HVAC control system, reduces energy consumption, and is suitable for processing high-dimensional data. The system is simpler and more efficient, and can dynamically respond to environmental changes.
Smart Images

Figure CN115950080B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure belongs to the technical field of HVAC control, and specifically relates to a HVAC control method, device, equipment and medium based on reinforcement learning. Background Art
[0002] Heating Ventilation and Air Conditioning (HVAC) refers to the equipment responsible for heating, ventilation and air conditioning indoors or in cars, and is commonly found in large non-residential buildings. One of the main purposes of HVAC design is to maintain thermal comfort within a building (or other space). Thermal comfort refers to the human body's perception and preference for physical environments such as temperature, humidity, and wind speed. Therefore, thermal comfort is also an important indicator in building performance simulation.
[0003] The purpose of the HVAC control system is to ensure indoor thermal comfort and air quality by controlling various variables, such as heating, cooling, ventilation, humidity, etc., so as to maintain a long-term suitable state. With the introduction of the concept of low-carbon energy conservation and environmental protection, the HVAC control system pays more and more attention to reducing energy consumption or carbon emissions during the control process. However, the HVAC control system is very complex, involving many variables in the control process, and there are correlations or contradictions between the variables. Therefore, the models or methods in the control field have problems of low accuracy, weak timeliness, and poor scalability in multi-dimensional control systems such as HVAC.
[0004] Existing control methods for HVAC control systems can be divided into the following two categories: one is a rule-based method, and the other is a model-based method.
[0005] Rule-based methods usually require a good understanding of the thermodynamic principles of HVAC. First, control specifications and guidelines are artificially formulated based on this knowledge. Then, in a real environment, the HVAC operating status is measured, evaluated, and manipulated according to the formulated specifications and guidelines. However, rule-based methods have a high technical threshold due to their strong requirements for professional knowledge. In addition, specific rules need to be formulated for each different scenario, resulting in poor flexibility of the method.
[0006] Although the model-based approach does not require familiarity with the working principles of each link, it usually requires an understanding of certain HVAC thermodynamic principles. In addition, the influence of the surrounding environment, such as human flow and external weather, must be taken into account, and then a traditional control model, a machine learning model, etc., must be established based on a certain goal, such as using a regression-based method to predict indoor temperature changes. At the same time, some analytical tools are needed for simulation or real operation control to obtain training data. However, the model-based approach has errors. If the operation control is simulated with the help of analytical tools, there must be errors compared to the real environment control, which leads to biased training data, so the trained model is also biased; in addition, the computational efficiency is low. When the traditional control method is used for modeling, it is difficult to handle high-dimensional data, and the computational overhead is relatively large; finally, the accuracy is low and the scalability is insufficient under long-term regulation. The environment and equipment conditions of the actual scene will change over time, which makes it difficult for the fixed model to cope with the changing environment and equipment. In the long run, there will be prediction deviations, resulting in a decrease in accuracy. When there are increases or decreases in the environment and equipment, the model needs to be retrained, and there is a problem of insufficient scalability. Summary of the invention
[0007] The present disclosure aims to solve at least one of the technical problems existing in the prior art and provide a HVAC control method, device, equipment and medium based on reinforcement learning.
[0008] One aspect of the present disclosure provides a HVAC control method based on reinforcement learning, the method comprising:
[0009] Build a reinforcement learning-based HVAC agent strategy model;
[0010] Constructing the rewards of reinforcement learning based HVAC based on state parameters and behavior parameters;
[0011] Optimizing the strategy model according to the reward update;
[0012] The intelligent agent updates the behavior parameters according to the updated and optimized strategy model and performs corresponding new behaviors, and the environment obtains new state parameters according to the new behaviors to complete the regulation of HVAC.
[0013] Optionally, the state parameters include indoor temperature, outdoor temperature and energy consumption, and the behavior parameters include heating temperature setting value and cooling temperature setting value.
[0014] Optionally, constructing a reward for HVAC based on reinforcement learning according to the state parameter and the behavior parameter includes:
[0015] constructing a reward function according to the indoor temperature and the energy consumption;
[0016] Constructing the cumulative reward function according to the reward function and the discount factor;
[0017] A loss function is constructed according to the cumulative reward function and the behavior parameters.
[0018] Optionally, constructing a reward function according to the indoor temperature and the energy consumption includes:
[0019]
[0020] Among them, r is the reward, e n is the energy consumption, n∈{1,2,3...}, temp i is the indoor temperature, i∈{1,2,3,...}, e m is the maximum energy consumption, temp o is the optimal temperature, c1 and c2 are coefficients.
[0021] Optionally, constructing the cumulative reward function according to the reward function and the discount factor includes:
[0022]
[0023] Among them, R is the cumulative reward, E represents the expectation, γ is the discount factor, π is the strategy, θ is the parameter of the strategy, T is the number of interactions between the agent and the environment, and t is the tth interaction between the agent and the environment.
[0024] Optionally, constructing a loss function according to the cumulative reward function includes:
[0025] Constructing a clip loss function, an adaptive loss function with KL penalty, and error terms of the strategy and value function according to the cumulative reward function;
[0026] The loss function is constructed according to the clip loss function, the adaptive loss function with KL penalty, and the sum of the error terms of the strategy and value function.
[0027] Optionally, the clip loss function is constructed according to the cumulative reward function include:
[0028]
[0029] Among them, h t (θ) is the ratio of the strategy to the old strategy, V(s t ) is the cumulative reward function R in state s t The expected value at is the state value function, is the advantage function.
[0030] Optionally, constructing a clip loss function according to the cumulative reward function includes:
[0031] When the advantage function is positive, no restriction is imposed on the loss function;
[0032] Otherwise, the loss function is limited not to exceed the threshold.
[0033] Optionally, the updating and optimizing the policy model according to the reward includes:
[0034] Minimize the loss function to complete the training of the strategy model;
[0035] The strategy model is trained multiple times to achieve update and optimization of the strategy model.
[0036] Another aspect of the present disclosure provides a HVAC control device based on reinforcement learning, the device comprising:
[0037] A modeling module for building a policy model for HVAC agents based on reinforcement learning;
[0038] A reward building module for building rewards for reinforcement learning-based HVAC based on state parameters and behavior parameters;
[0039] An optimization model, used to optimize the strategy model according to the reward update;
[0040] The control module is used for the intelligent agent to update the behavior parameters according to the updated and optimized strategy model and make corresponding new behaviors. The environment obtains new state parameters according to the new behaviors to complete the control of HVAC.
[0041] Another aspect of the present disclosure provides an electronic device, including:
[0042] one or more processors;
[0043] A storage unit is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors can implement a HVAC control method based on reinforcement learning as described above.
[0044] Another aspect of the present disclosure provides a computer-readable storage medium having a computer program stored thereon.
[0045] When the computer program is executed by a processor, it can implement a HVAC control method based on reinforcement learning as described above.
[0046] In a HVAC control method, device, equipment and medium based on reinforcement learning in an embodiment of the present disclosure, reinforcement learning is applied to the HVAC control system. Through the interaction process between the intelligent agent and the environment, the strategy of the intelligent agent is trained and updated so that it can achieve the goal of maintaining a suitable state and reducing energy consumption. Through dynamic control, the long-term suitable state of the environment, that is, thermal comfort, is maintained, while energy consumption is reduced to a certain extent. The entire system is relatively simpler, more flexible, more computationally efficient, and more suitable for processing high-dimensional data. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A schematic block diagram of an example electronic device for implementing a HVAC control method and device based on reinforcement learning according to an embodiment of the present disclosure;
[0048] Figure 2 A schematic flow chart of a HVAC control method based on reinforcement learning according to another embodiment of the present disclosure;
[0049] Figure 3 A schematic block diagram of reinforcement learning of a HVAC control method based on reinforcement learning according to another embodiment of the present disclosure;
[0050] Figure 4 This is a structural schematic diagram of a HVAC control device based on reinforcement learning according to another embodiment of the present disclosure. DETAILED DESCRIPTION
[0051] In order to enable those skilled in the art to better understand the technical solution of the present disclosure, the present disclosure is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0052] Unless otherwise specified, the technical terms or scientific terms used in the present disclosure shall have the usual meanings understood by persons with ordinary skills in the field to which the present disclosure belongs. The terms "including" or "comprising" used in the present disclosure do not limit the shapes, numbers, steps, actions, operations, components, originals and / or groups thereof mentioned, nor do they exclude the presence or addition of one or more other different shapes, numbers, steps, actions, operations, components, originals and / or groups thereof, or the addition of these. In the description of the present disclosure, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0053] Unless otherwise specifically stated, the relative arrangement of the components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure. At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the drawings are not drawn according to the actual proportional relationship, and the techniques, methods and devices known to ordinary technicians in the relevant fields may not be discussed in detail, but where appropriate, the techniques, methods and devices shown should be considered as part of the authorized specification. In all examples shown and discussed here, any specific other examples may have different values. It should be noted that similar symbols and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further discussed in subsequent drawings.
[0054] It should be mentioned before discussing in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the operations (steps) as sequential processes, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the operations can be rearranged. The process can be terminated when the operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0055] First, refer to Figure 1 An example electronic device is described for implementing a HVAC control method and apparatus based on reinforcement learning in an embodiment of the present disclosure.
[0056] like Figure 1 As shown, the electronic device 200 includes one or more processors 210, one or more storage devices 220, an input device 230, an output device 240, etc. These components are interconnected through a bus system and / or other forms of connection mechanisms 250. It should be noted that Figure 1 The components and structures of the electronic device shown are merely exemplary and non-limiting. The electronic device may also have other components and structures as required.
[0057] Exemplarily, the processor can effectively perform a series of operations such as data access, data storage, data processing, and data analysis on large-scale real-time data from multiple sources and heterogeneity.
[0058] The processor 210 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
[0059] The storage device 220 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor may run the program instructions to implement the client functions (implemented by the processor) and / or other desired functions in the embodiments of the present disclosure described below. Various applications and various data may also be stored in the computer-readable storage medium, for example, various data used and / or generated by the application, etc.
[0060] The input device 230 may be a device used by a user to input instructions, and may include one or more of a keyboard, a mouse, a microphone, a touch screen, and the like.
[0061] The output device 240 may output various information (eg, images or sounds) to the outside (eg, a user), and may include one or more of a display, a speaker, and the like.
[0062] Exemplarily, an example electronic device for implementing a HVAC control method and apparatus based on reinforcement learning according to an embodiment of the present disclosure may be implemented as a smartphone or a tablet computer.
[0063] Next, we will refer to Figure 2 and Figure 3 A HVAC control method based on reinforcement learning is described according to an embodiment of the present disclosure.
[0064] like Figure 2 As shown, a HVAC control method based on reinforcement learning includes:
[0065] S100: Building a policy model for HVAC agents based on reinforcement learning.
[0066] For example, Figure 3 As shown in the figure, reinforcement learning refers to the process of optimizing strategies by maximizing rewards during the continuous interaction between the agent and the environment. During the reinforcement learning training process, the agent needs to continuously interact with the environment, that is, the environment outputs the current state to the agent, and the agent outputs the behavior at the next moment based on this state. The environment updates and outputs a new state based on this behavior, and this process repeats. The strategy defines the behavior of the agent for a given state, which is a mapping from state to behavior. During the interaction between the agent and the environment, after obtaining the current state of the environment, the agent will select the next behavior according to the strategy π.
[0067] Specifically, in this step, different strategies π may be selected according to actual circumstances. For example, a neural network structure may be used to construct a strategy model of an intelligent agent, but the embodiments of the present disclosure are not limited to this.
[0068] Exemplarily, in this step, the policy parameter θ can be used to construct a policy model, that is, different policy parameters and policy models lead to different mappings from states to behaviors.
[0069] Exemplarily, different reinforcement learning algorithms may be selected in this step, for example, using the Proximal Policy Optimization (PPO) algorithm, which is not limited in the embodiments of the present disclosure.
[0070] S200: Constructing a reinforcement learning based HVAC reward based on state parameters and behavior parameters.
[0071] Specifically, in this step, during the interaction between the intelligent agent and the environment, after the intelligent agent performs a certain behavior, the environment will respond accordingly, and its specific manifestation is the state. In the specific use process, different parameters can be selected to represent the state according to the actual situation, that is, different state parameters can be selected. For example, the state parameters include indoor temperature, outdoor temperature and energy consumption.
[0072] Specifically, in this step, during the interaction between the intelligent agent and the environment, after obtaining the current state of the environment, the intelligent agent will select the next behavior according to the strategy π. During specific use, different parameters can be selected to represent the behavior according to actual conditions, that is, different behavior parameters can be selected. Exemplarily, the behavior parameters include heating temperature setting values and cooling temperature setting values.
[0073] Specifically, in this step, different state parameters and behavior parameters may be selected according to actual usage to construct a HVAC reward based on reinforcement learning. For example, a reward may be constructed based on indoor temperature, and the disclosed embodiment is not limited to this.
[0074] S300: Optimizing the strategy model according to the reward update.
[0075] Specifically, in this step, different methods can be selected according to actual usage to update the optimization strategy model according to the reward. For example, the optimization strategy model can be updated by maximizing the reward, which is not limited in the embodiments of the present disclosure. For example, in this embodiment, the optimization strategy model can be updated by updating the parameter θ of the optimization strategy.
[0076] S400: The intelligent agent updates the behavior parameters according to the updated and optimized strategy model and performs corresponding new behaviors. The environment obtains new state parameters according to the new behaviors to complete the regulation of HVAC.
[0077] Specifically, in this step, since the strategy is a mapping from state to behavior, after the strategy model is updated and the state parameters are input into the strategy model, the strategy model will output the updated behavior parameters and make corresponding new behaviors based on the updated behavior parameters. For example, after the indoor temperature is input into the strategy model, the strategy model will output the updated heating temperature setting value and the cooling temperature setting value, and control the HVAC system to perform cooling or heating behaviors based on the heating temperature setting value and the cooling temperature setting value, thereby achieving control over the HVAC. Thereafter, the environment obtains new state parameters, such as the new indoor temperature, based on the above-mentioned cooling or heating behaviors of the HVAC, and the environment inputs the new state parameters into the intelligent agent, thereby completing the feedback of the environment to the intelligent agent's state parameters and completing the closed loop of HVAC regulation.
[0078] Exemplarily, in this step, the environment is a simulation environment. In the actual control process, if you want to obtain a large amount of training data in a real environment, you need to manually install sensors in the real environment, record the sensor data as the state for a long time, and record the data of external factors as the behavior, such as the switch of the light, the setting value of the air conditioner temperature, etc. This process is very time-consuming and labor-intensive, so the mainstream method is usually to build a simulation environment to interact with the intelligent agent to obtain data for subsequent modeling and training.
[0079] Exemplarily, in this embodiment, EnergyPlus9.3.0 software is used to build a simulation environment. This software can build simulated buildings and obtain various sensor data inside them, which is very suitable as an environment for reinforcement learning. Exemplarily, the specific construction process is as follows: First, use the software to customize the structure of the building, such as the location, area, floor, flow of people, etc. of a certain area in the building. Then, select real weather data for a period of time and input it into the software to complete the construction of the simulation environment. In the experiment of this embodiment, weather data for the whole year of 2013 in Seattle was selected to build a simulation environment of buildings containing 15 areas for subsequent reinforcement learning training.
[0080] Exemplarily, based on the simulation environment used in this step, the state in this embodiment is composed of the following three aspects, and the state space S is formed based on the states of the following three aspects:
[0081] a) As mentioned above when building the simulation environment, the building of the simulation environment in this embodiment is composed of
[0082] 15 regions, therefore, the state space S contains the indoor temperature temp of these 15 regions i ,i∈{1,2,3,...,15}.
[0083] b) In addition to the indoor temperature, the changes in the outdoor environment must also be considered during the HVAC control process. Therefore, the state space also includes two outdoor temperatures.
[0084] c) In order to measure the energy consumption during the HAVC control process, this embodiment uses the energy consumption of three locations n ,n∈{1,2,3} is included in the state space S.
[0085] Therefore, the state space
[0086] For example, based on the simulation environment used in this step, this embodiment regulates the operation of HVAC, in which the main operations are the heating temperature setting value and the cooling temperature setting value. Since the building in the simulation environment of this embodiment includes 15 areas, the behavior space A of this embodiment consists of 30 setting values, and the behavior space A = {a p},p∈{1,2,3,...,30}.
[0087] It should be noted that, during specific use, you can choose to use a simulation environment or a real environment according to actual conditions. If a simulation environment is used, you can choose different simulation environment construction methods and data selection methods according to actual conditions. The above-mentioned simulation environment construction, data selection, and state space and behavior space construction are only exemplary descriptions, and the embodiments of the present disclosure do not limit this.
[0088] A HVAC control method based on reinforcement learning in an embodiment of the present disclosure applies reinforcement learning to the HVAC control system. Through the interaction process between the intelligent agent and the environment, the strategy of the intelligent agent is trained and updated so that it can maintain a suitable state. In addition, the method is suitable for the interaction between the intelligent agent and the simulation environment. The real environment can be simulated by building a simulation environment to improve the accuracy and efficiency of training. The entire system is relatively simpler, more flexible, more computationally efficient, and more suitable for processing high-dimensional data.
[0089] A HVAC control method based on reinforcement learning in an embodiment will be further described below.
[0090] Exemplarily, after step S400, the method further includes:
[0091] S500: The agent loops through steps S200 to S400, or the agent loops through steps S300 to S400.
[0092] Specifically, in this step, after the agent receives the new state parameters, it re-updates the optimization strategy model according to the new state parameters through step S300, and then re-updates the behavior parameters through step S400, thereby achieving continuous updating of the agent strategy.
[0093] Exemplarily, in this step, the reward may be reconstructed according to the new state parameters through step S200, or the reward may not be reconstructed, and the embodiments of the present disclosure are not limited to this.
[0094] Exemplarily, in this step, the stopping method of the cycle can be determined according to actual usage conditions, for example, limiting a fixed number of cycles, setting a cycle stop command, etc., and the embodiments of the present disclosure are not limited to this.
[0095] A HVAC control method based on reinforcement learning in an embodiment of the present disclosure continuously trains and updates the strategy of the intelligent agent through multiple interactions between the intelligent agent and the environment, and maintains the long-term suitable state of the environment through dynamic control.
[0096] The specific steps of step S200 in a HVAC control method based on reinforcement learning in an embodiment will be further described below.
[0097] Exemplarily, in step S200, constructing a HVAC reward based on reinforcement learning according to the state parameter and the behavior parameter includes:
[0098] S210: Constructing a reward function according to the indoor temperature and the energy consumption.
[0099] Exemplarily, in this step, the reward function r is:
[0100]
[0101] Among them, r is the reward, e n is the energy consumption, n∈{1,2,3...}, temp i is the indoor temperature, i∈{1,2,3,...}, e m is the maximum energy consumption, temp o is the optimal temperature, c1 and c2 are coefficients, and c1>0, c2<0.
[0102] Specifically, since a simulation environment of a building containing 15 areas was exemplarily built in the previous text when performing environmental simulation, i here can be exemplarily selected as i∈{1,2,3,...15}; n can be exemplarily selected as n∈{1,2,3}, indicating that three energy consumptions are selected.
[0103] From the above formula, we can see that the reward function is mainly composed of energy consumption e n and temperature i The former limits the total energy consumption to be not too large, and the latter limits the indoor temperature to be as close to the optimal temperature as possible. Since the two dimensions are different, they need to be standardized first, that is, Then, calculate the reward according to the above formula.
[0104] S220: Constructing the cumulative reward function according to the reward function and the discount factor.
[0105] Exemplarily, in this step, the cumulative reward function R is:
[0106]
[0107] Among them, R is the cumulative reward, E represents the expectation, γ is the discount factor, π is the strategy, θ is the parameter of the strategy, T is the number of interactions between the agent and the environment, and t is the tth interaction between the agent and the environment.
[0108] In this step, based on step S210, the expectation of future long-term rewards, i.e., cumulative rewards, is calculated. Since in the long run, the more distant rewards are less affected by current behavior, a discount factor γ can be applied to reduce the impact of distant rewards.
[0109] S230: Constructing a loss function according to the cumulative reward function and the behavior parameters.
[0110] Specifically, in this step, a specific method for constructing the loss function may be selected according to actual usage, and the embodiments of the present disclosure do not limit this.
[0111] A HVAC control method based on reinforcement learning in an embodiment of the present disclosure applies reinforcement learning to the HVAC control system. On the one hand, a reward function is constructed by using indoor temperature and energy consumption, so that the control system can reduce energy consumption while maintaining a suitable state, so as to achieve the goal of maintaining long-term thermal comfort and reducing energy consumption to a certain extent. On the other hand, a cumulative reward function is used to construct rewards. Since the cumulative reward is the expectation of long-term rewards in the future, the use of cumulative rewards can make reinforcement learning a process of continuously optimizing strategies by maximizing cumulative rewards during the continuous interaction between the intelligent agent and the environment, so as to reduce the degree to which long-term rewards are affected by current behaviors, thereby improving the control accuracy of the control system.
[0112] The specific steps of step S230 in a HVAC control method based on reinforcement learning in an embodiment will be further described below.
[0113] Exemplarily, in step S230, constructing a loss function according to the cumulative reward function includes:
[0114] S231: Construct a clip loss function, an adaptive loss function with KL penalty, and an error term of a strategy and value function according to the cumulative reward function.
[0115] Specifically, in this step, the clip loss function is constructed according to the cumulative reward function include:
[0116]
[0117]
[0118]
[0119] Clip loss function for:
[0120]
[0121] Among them, h t (θ) is the strategy π θ With the old strategy The ratio of t to the environment, V(s t ) is the cumulative reward function R in state s t The expected value at is the state value function, s t is the data of the parameters in the state space S at the tth interaction, is the advantage function, k is the number of trainings, a t represents the behavior of the agent at the tth interaction, r t is the reward at the tth interaction, ∈ is a hyperparameter, which can be preset according to the actual situation. For example, in this embodiment, V(s t ) as the value function.
[0122] If not h t (θ) imposes restrictions, and a very large gradient will be obtained during gradient update. That is, if the update direction is not conducive to the current strategy, obtaining a very large gradient will make the strategy worse and worse, so restrictions need to be imposed.
[0123] One way to impose restrictions is to At this time, when the advantage function is positive, No limit, otherwise the loss function is limited Don't make it too large, so that when updating parameters, it will not be updated too much in an unfavorable direction. Specifically, the loss function can be limited not to exceed a threshold value. For example, the threshold value can be selected according to actual usage, and this is not limited in the embodiments of the present disclosure.
[0124] Specifically, in this step, the adaptive loss function with KL penalty is constructed according to the cumulative reward function. include:
[0125]
[0126] Among them, KL represents the calculation of KL divergence, and β is a constant.
[0127] make but
[0128]
[0129] For example, if each update requires resampling to calculate the value function V(s t ), which is too inefficient. Therefore, a critic is usually used to estimate the value function, which is a neural network with the same structure as the policy. targ , are the evaluation parameters and evaluation value functions corresponding to d calculated by the evaluator respectively; The KL divergence in measures the difference in the distribution of strategies before and after the update. Using this as a penalty term can effectively limit the loss from being too large. In addition, if a certain strategy is the target, then d and d can be compared by the above formula targ If the difference between the two is too large, the parameter β will be expanded to twice the original value, that is, the weight of the penalty term will be increased in subsequent training to further limit the loss size. Otherwise, the weight of the penalty term will be reduced and the restriction will be relaxed to achieve the effect of dynamically limiting the loss.
[0130] Specifically, in this step, constructing the error term of the strategy and value function according to the cumulative reward function includes:
[0131] Since the policy and value functions can share the parameters of the neural network during training, it is necessary to increase the error terms of the policy and value functions, namely:
[0132]
[0133] Furthermore, the entropy of the state can be added as a penalty term, that is, S[π θ ](s t ), where V θ (s t ) is the cumulative reward function R in state s when the strategy is θ t The expected value at .
[0134] S232: Construct the loss function according to the clip loss function, the adaptive loss function with KL penalty, the error term of the strategy and value function, and the sum of the penalty terms.
[0135] Exemplarily, in this step, α1 and α2 are both constants, and the final loss function L in this embodiment is t for:
[0136]
[0137] The specific steps of step S300 in a HVAC control method based on reinforcement learning in an embodiment will be further described below.
[0138] Exemplarily, in step S300, optimizing the strategy model according to the reward update includes:
[0139] S310: Minimize the loss function L t , to complete the training of the strategy model.
[0140] S320: training the strategy model multiple times to achieve update and optimization of the strategy model.
[0141] For example, in this embodiment, when a computer program is used to execute a HVAC control method based on reinforcement learning in this embodiment, let N be the number of agents for parallel computing, M be the number of minibatches, that is, the minimum number of samples, K be the number of epochs, that is, the number of trainings, and iter be the total number of iterations. The specific process of each round of training is as follows:
[0142] a) is the strategy of the agent in this round, interacts with the environment T times, and calculates the advantage function Compute N groups in parallel.
[0143] b) Select M groups of data as batch and use SGD to minimize L t To update the parameters. Repeat the above process for K epochs to get the updated θ.
[0144] c) Let θ old =θ.
[0145] Repeat the above process iter times to complete the training.
[0146] The following will refer to Figure 4 A HVAC control device based on reinforcement learning according to another embodiment of the present disclosure is described.
[0147] For example, Figure 4As shown, a HVAC control device 100 based on reinforcement learning includes:
[0148] A modeling module 110, for building a strategy model of a HVAC agent based on reinforcement learning;
[0149] A reward construction module 120 for constructing a reward for a HVAC system based on reinforcement learning according to state parameters and behavior parameters;
[0150] An optimization model 130, configured to optimize the strategy model according to the reward update;
[0151] The control module 140 is used for the intelligent agent to update the behavior parameters according to the updated and optimized strategy model and make corresponding new behaviors. The environment obtains new state parameters according to the new behaviors to complete the control of HVAC.
[0152] A HVAC control device based on reinforcement learning in an embodiment of the present disclosure applies reinforcement learning to the HVAC control system, and through the interaction process between the intelligent agent and the environment, trains and updates the strategy of the intelligent agent so that it can maintain a suitable state.
[0153] Furthermore, this embodiment also discloses an electronic device, including:
[0154] one or more processors;
[0155] A storage unit is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors can implement a HVAC control method based on reinforcement learning as described above.
[0156] Furthermore, this embodiment also discloses a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the HVAC control method based on reinforcement learning described above can be implemented.
[0157] The computer-readable medium may be included in the apparatus, device, or system of the present disclosure, or may exist independently.
[0158] In data processing, video stream data, image data, database data and statistical result data are processed using data processing tools that are consistent with their respective data types. In data management, integrated management tools are used to form a unified data management directory, index, standard, etc. The accessed data is processed and stored in stages, and the whole cycle is associated and analyzed.
[0159] Among them, computer-readable storage media can be any tangible media that contains or stores a program, which can be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment. More specific examples include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, an optical fiber, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0160] The computer-readable storage medium may also include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code, specific examples of which include but are not limited to electromagnetic signals, optical signals, or any suitable combination thereof.
[0161] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0162] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present disclosure, but the present disclosure is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and substance of the present disclosure, and these modifications and improvements are also considered to be within the scope of protection of the present disclosure.
Claims
1. A HVAC control method based on reinforcement learning, characterized in that: The method comprises: Build a reinforcement learning-based HVAC agent strategy model; Constructing the rewards of reinforcement learning based HVAC based on state parameters and behavior parameters; Optimizing the strategy model according to the reward update; The intelligent agent updates the behavior parameters according to the updated and optimized strategy model and performs corresponding new behaviors, and the environment obtains new state parameters according to the new behaviors to complete the regulation of HVAC; The state parameters include indoor temperature, outdoor temperature and energy consumption, and the behavior parameters include heating temperature setting value and cooling temperature setting value; The reward of HVAC based on reinforcement learning is constructed according to the state parameters and the behavior parameters, including: constructing a reward function according to the indoor temperature and the energy consumption; Constructing a cumulative reward function based on the reward function and the discount factor; Constructing a loss function according to the cumulative reward function and the behavior parameter; The constructing a reward function according to the indoor temperature and the energy consumption comprises: Among them, r is the reward, e n is the energy consumption, n∈{1,2,3...}, temp i is the indoor temperature, i∈{1,2,3,...}, e m is the maximum energy consumption, temp o is the optimal temperature, c1 and c2 are coefficients; The constructing a cumulative reward function according to the reward function and the discount factor comprises: Where R is the cumulative reward, E represents the expectation, γ is the discount factor, π is the strategy, θ is the parameter of the strategy, T is the number of interactions between the agent and the environment, and t is the tth interaction between the agent and the environment; The constructing a loss function according to the cumulative reward function comprises: Constructing a clip loss function, an adaptive loss function with KL penalty, and error terms of the strategy and value function according to the cumulative reward function; Constructing the loss function according to the clip loss function, the adaptive loss function with KL penalty, and the sum of the error terms of the strategy and value function; The step of updating and optimizing the strategy model according to the reward comprises: Minimize the loss function to complete the training of the strategy model; The strategy model is trained multiple times to achieve update and optimization of the strategy model.
2. A HVAC control method based on reinforcement learning according to claim 1, characterized in that: The clip loss function is constructed according to the cumulative reward function include: Among them, h t (θ) is the ratio of the strategy to the old strategy, V(s t ) is the cumulative reward function R in state s t The expected value at is the state value function, is the advantage function.
3. A HVAC control method based on reinforcement learning according to claim 2, characterized in that: The constructing a clip loss function according to the cumulative reward function comprises: When the advantage function is positive, no restriction is imposed on the loss function; Otherwise, the loss function is limited not to exceed the threshold.
4. A HVAC control device based on reinforcement learning, characterized in that: The device comprises: A modeling module for building a policy model for HVAC agents based on reinforcement learning; A reward building module for building rewards for reinforcement learning-based HVAC based on state parameters and behavior parameters; An optimization model, used to optimize the strategy model according to the reward update; A control module, which is used for the agent to update the behavior parameters according to the updated and optimized strategy model and make corresponding new behaviors, and the environment obtains new state parameters according to the new behaviors to complete the control of HVAC; The state parameters include indoor temperature, outdoor temperature and energy consumption, and the behavior parameters include heating temperature setting value and cooling temperature setting value; The reward of HVAC based on reinforcement learning is constructed according to the state parameters and the behavior parameters, including: constructing a reward function according to the indoor temperature and the energy consumption; Constructing a cumulative reward function based on the reward function and the discount factor; Constructing a loss function according to the cumulative reward function and the behavior parameter; The constructing a reward function according to the indoor temperature and the energy consumption comprises: Among them, r is the reward, e n is the energy consumption, n∈{1,2,3...}, temp i is the indoor temperature, i∈{1,2,3,...}, e m is the maximum energy consumption, temp o is the optimal temperature, c1 and c2 are coefficients; The constructing a cumulative reward function according to the reward function and the discount factor comprises: Where R is the cumulative reward, E represents the expectation, γ is the discount factor, π is the strategy, θ is the parameter of the strategy, T is the number of interactions between the agent and the environment, and t is the tth interaction between the agent and the environment; The constructing a loss function according to the cumulative reward function comprises: Constructing a clip loss function, an adaptive loss function with KL penalty, and error terms of the strategy and value function according to the cumulative reward function; Constructing the loss function according to the clip loss function, the adaptive loss function with KL penalty, and the sum of the error terms of the strategy and value function; The step of updating and optimizing the strategy model according to the reward comprises: Minimize the loss function to complete the training of the strategy model; The strategy model is trained multiple times to achieve update and optimization of the strategy model.
