Heating control method and system based on DQN

Through the heating control method based on DQN, using the MDP model and deep reinforcement learning algorithm, the problem of regulating the hot water temperature of the heating system under different weather conditions is solved, the stability and comfort control of the indoor temperature are achieved, and the operating efficiency of the heating system is improved. and stability.

CN118775944APending Publication Date: 2024-10-15HEILONGJIANG UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410979148.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

The existing heating control system cannot accurately control the hot water temperature under different weather conditions, resulting in unstable indoor temperatures and unable to meet the needs of modern heating systems for temperature stability and comfort.

Method used

A DQN-based heating control method is used to monitor outdoor, water supply and indoor temperatures in real time through sensors, build an MDP model, and use the DQN algorithm neural network to obtain the optimal heating control strategy, including the main network and the target network, combined with the ε-greedy attenuation mechanism, Replay Buffer and Fixed Q-targets mechanism optimize heating control strategy.

Benefits of technology

It significantly improves the learning stability and efficiency of the heating control system, and can adjust the water supply temperature in the shortest time, so that the indoor temperature reaches the preset target temperature, and the optimal operation of the heating system is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118775944A_ABST
    Figure CN118775944A_ABST
Patent Text Reader

Abstract

The invention discloses a heating control method and system based on a DQN. The method comprises the steps that S1, state information of outdoor temperature, water supply temperature and indoor temperature is monitored in real time through a sensor; s2, constructing an MDP model of the heating control system, wherein the MDP model comprises a state space, an action space and a reward function; the state space comprises outdoor temperature, water supply temperature and indoor temperature; the action space selects a set value of water supply temperature as a control action; the reward function is used for quantitative evaluation of heating control system strategy performance; s3, obtaining an optimal control strategy of the heating control system based on a DQN algorithm neural network according to the constructed MDP model of the heating control system; the DQN algorithm neural network comprises a main network and a target network, the indoor temperature can reach the preset target temperature by adjusting the water supply temperature within the shortest round, and the heating system is controlled to operate in the optimal mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of heating control systems, and more specifically to a heating control method and system based on DQN. Background Art

[0002] With the advancement of urbanization and the improvement of people's living standards, ensuring the stability and comfort of indoor temperature in winter has become the focus of people's livelihood. As a key component of urban infrastructure, the centralized heating system plays an irreplaceable role in improving people's livelihood with its economic efficiency, environmental protection and safety. However, as a key node connecting the heat source plant and indoor heating facilities, the heat exchange station faces many challenges in actual operation. The traditional climate compensator control strategy is difficult to meet the needs of modern heating systems for stable and comfortable indoor temperatures due to its simple model, extensive adjustment, and lack of real-time feedback and predictive control. Therefore, how to accurately control the hot water temperature under different weather conditions has become a key issue that needs to be urgently solved in the current heating control system.

[0003] Since the existing heating control system faces many uncertain factors, a stable and effective control strategy is needed. Deep Q Network (DQN), as an algorithm that combines the advantages of deep learning and reinforcement learning, provides a new idea for the optimization of heating control systems. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a heating control method and system based on DQN, so as to solve the problem that the heating system in the prior art cannot accurately control the hot water temperature under different weather conditions, and thus cannot stably maintain the indoor temperature.

[0005] To achieve the above object, the present invention provides the following technical solutions:

[0006] A heating control method based on DQN comprises the following steps:

[0007] S1, monitor the status information of outdoor temperature, water supply temperature and indoor temperature in real time through sensors;

[0008] S2. Based on the obtained state information of outdoor temperature, water supply temperature and indoor temperature, an MDP model of the heating control system is constructed, wherein the MDP model includes: a state space, an action space and a reward function; the state space includes: outdoor temperature, water supply temperature and indoor temperature; the action space selects the set value of the water supply temperature as the control action; the reward function is used for quantitative evaluation of the performance of the heating control system strategy;

[0009] S3. According to the constructed MDP model of the heating control system, the optimal control strategy of the heating control system is obtained based on the DQN algorithm neural network; the DQN algorithm neural network includes two neural networks: a main network Q(S,A;θ) and a target network Q(S,A;θ'), the main network Q(S,A;θ) is used to predict the Q value of the current state-action pair of the heating control system, and the target network Q(S,A;θ') is used to calculate the target Q value.

[0010] Furthermore, the state space, dynamic space and reward function in step S2 are expressed as follows:

[0011] The state space is expressed as:

[0012] The outdoor temperature is selected to represent the influence of the outdoor environment, and the indoor temperature is selected to represent the influence of the indoor environment. Therefore, the final environmental state includes three parts: outdoor temperature, water supply temperature and indoor temperature, which are specifically expressed as follows:

[0013] S t =(outdoor_temp t ,water_temp t ,indoor_temp t ) (1)

[0014] Among them, S t Represents the state of the environment at time t, which constitutes the state space S of the environment, outdoor_temp t 、water_temp t and indoor_temp t Respectively represent the outdoor temperature, water supply temperature and indoor temperature at time t, t is a time series mark, where: t = 0, 1, 2, ... T;

[0015] The action space is expressed as:

[0016] The set value of the water supply temperature is selected as the control action, and the action space is discretized, including three actions:

[0017]

[0018] Among them, A t represents the action selected at time t, forming the action space A, max_temp_change is the set water supply temperature adjustment value, where max_temp_change = 5;

[0019] The reward function is expressed as:

[0020]

[0021] Where target_temp = 23.5℃, which indicates the target indoor temperature that the heating control system wants to achieve, expressed as indoor_temp t The absolute value of the difference with target_temp is used to set the agent's reward and punishment function.

[0022] Furthermore, the DQN algorithm neural network in step S3 includes the following training steps:

[0023] Step 3-1, initialize the DQN network parameters and parameters in the training process, including initializing the network parameters θ of the main network Q(S,A;θ), the network parameters θ' of the target network Q(S,A;θ'), and the capacity N of the experience buffer pool;

[0024] Step 3-2, the agent selects an action to interact with the environment according to the strategy π, and introduces the probability parameter ε through the ε-greedy decay mechanism to control the balance between exploration and exploitation;

[0025] Step 3-3, store the five-element array (S, A, R, S', done) generated during the interaction between the agent and the environment in the experience buffer pool, where S represents the current environment state, A represents the action taken, R represents the reward obtained, S' represents the new environment state entered, and done marks whether S is a terminal state;

[0026] Step 3-4, obtain the next environment state S', calculate the reward R, store the five-element array (S, A, R, S', done) generated by the next environment state in the experience buffer pool, randomly obtain batch samples from the experience buffer pool to train the main network Q(S, A; θ), and determine whether the step size requirement is met. If so, copy the parameters of the main network Q(S, A; θ) to the target network Q(S, A; θ').

[0027] Furthermore, the DQN network parameters and the parameters in the training process are initialized in step 3-1, specifically:

[0028] At initialization, the network parameters θ of the main network and the network parameters θ' of the target network are the same, that is, θ = θ'. During the training process, θ is updated by minimizing the error between the output values ​​of the network parameters θ and θ', and the difference between the predicted value and the target Q value is reduced by the loss function calculated by formula (4). The calculation formula is as follows:

[0029] L(θ j )=E[Y j -Q(S j ,A;θj )] 2 Formula (4)

[0030] Among them, Y j is the target Q value at time j, S j and A represent the state at time j and the action taken at the current state, respectively. Q(S j ,A;θ j ) indicates that the main network is in a given state S j The predicted Q value at action A, E represents the expectation. In actual operation, this expectation is approximated by randomly drawing samples from the experience replay pool.

[0031] Then, the parameter θ is calculated by formula (5) j Find the partial derivative to obtain the error loss gradient, and then use the optimization algorithm to update the parameter θ j ;

[0032]

[0033] in, and They represent the loss function L(θ j ) and predicted Q values ​​about the main network parameters θ j gradient.

[0034] Furthermore, in step 3-2, the agent selects an action to interact with the environment according to the strategy π, specifically:

[0035] As shown below, the agent's training goal is to find the optimal strategy π* so that π* can obtain the highest expected return in all states.

[0036]

[0037] The probability parameter ε is introduced through the ε-greedy decay mechanism to control the balance between exploration and exploitation. The specific process is as follows:

[0038]

[0039] A larger probability parameter ε is set at the beginning of training by formula (8), and after each round of training, the probability parameter ε is multiplied by a decay factor less than 1:

[0040]

[0041] The present invention also provides a system for a heating control method based on DQN, the system comprising:

[0042] Data acquisition module: real-time monitoring of outdoor temperature, water supply temperature and indoor temperature status information through sensors;

[0043] Model building module: Based on the obtained state information of outdoor temperature, water supply temperature and indoor temperature, the MDP model of the heating control system is constructed, and the MDP model includes: state space, action space and reward function; the state space includes: outdoor temperature, water supply temperature and indoor temperature; the action space selects the set value of the water supply temperature as the control action; the reward function is used for quantitative evaluation of the performance of the heating control system strategy;

[0044] Allocation module: According to the constructed MDP model of the heating control system, the optimal control strategy of the heating control system is obtained based on the DQN algorithm neural network; the DQN algorithm neural network includes two neural networks: a main network Q(S,A;θ) and a target network Q(S,A;θ'), the main network Q(S,A;θ) is used to predict the Q value of the current state-action pair of the heating control system, and the target network Q(S,A;θ') is used to calculate the target Q value.

[0045] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the DQN-based heating control method when executing the computer program.

[0046] A computer-readable storage medium stores a computer program, which implements the steps of the DQN-based heating control method when executed by a processor.

[0047] According to the specific embodiments provided by the present invention, the present invention has the following technical effects:

[0048] In the training process of the present invention, the main network is trained and updated normally according to the steps, and the target network is updated by regularly copying the parameters of the main network, so as to stabilize the calculation of the target Q value and further stabilize the training process. The DQN algorithm can significantly improve the stability and efficiency of its learning; since the target network remains unchanged for a period of time, the agent can learn in a relatively static environment, so it is easier to find the correct optimization direction, effectively solving the problem of unstable training and low efficiency caused by the inclusion of the Q network to be learned in the target value of DQN, and significantly improving the performance of the DQN algorithm neural network; the Replay Buffer mechanism effectively breaks the time correlation between the data by storing the historical data of the interaction between the agent and the environment, and randomly extracts small batches of data for learning during the training process, thereby improving the learning efficiency. Fixed Q-targets improves the stability and convergence speed of training by decoupling the calculation of the target value from the update of the main network; as the training deepens, the decision-making ability of the agent is enhanced, and it can make the best choice based on the current state, achieving high reward returns, and can adjust the water supply temperature in the shortest round to make the indoor temperature reach the preset target temperature, and control the heating system to operate in the best way. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0050] The heating control method based on DQN of the present invention is further described below with reference to the accompanying drawings;

[0051] Figure 1 is a control flow chart of a heating control system in a heating control method based on DQN provided by the present invention;

[0052] Figure 2 It is a process diagram of a heating control system in a heating control method based on DQN provided by the present invention;

[0053] Figure 3 It is a heating control MDP process diagram in the heating control method based on DQN provided by the present invention;

[0054] Figure 4 It is a Q-Network update process diagram in the DQN-based heating control method provided by the present invention;

[0055] Figure 5 It is a DQN strategy optimization control flow chart in the DQN-based heating control method provided by the present invention;

[0056] Figure 6 It is a curve diagram of the change of the number of training rounds in the heating control method based on DQN provided by the present invention;

[0057] Figure 7 It is a schematic diagram of the experience buffer pool in the DQN-based heating control method provided by the present invention;

[0058] Figure 8 It is a pre-training process in the experience buffer pool in the DQN-based heating control method provided by the present invention;

[0059] Fig. 9 It is a target Q network update process diagram in the DQN-based heating control method provided by the present invention;

[0060] Fig.10 It is a training process diagram of a stable target Q value in a heating control method based on DQN provided by the present invention;

[0061] Fig.11 is a schematic diagram of a heating control algorithm in a heating control method based on DQN provided by the present invention;

[0062] Fig.12 It is a heating control framework diagram in the heating control method based on DQN provided by the present invention;

[0063] Fig.13 It is a schematic diagram of a neural network for approximating the action value function Q in the heating control method based on DQN provided by the present invention;

[0064] Fig.14 It is a schematic diagram of the convergence of the reward function in the DQN-based heating control method provided by the present invention;

[0065] Fig.15 It is a schematic diagram of average indoor temperature values ​​under different room temperature thresholds in the heating control method based on DQN provided by the present invention;

[0066] Fig.16 It is a schematic diagram of indoor temperature distribution under different room temperature thresholds in the heating control method based on DQN provided by the present invention;

[0067] Fig.17 It is a schematic diagram of the total number of training rounds in the heating control method based on DQN provided by the present invention;

[0068] Fig.18 It is a schematic diagram of the total reward in a training round in the heating control method based on DQN provided by the present invention;

[0069] Fig.19It is a schematic diagram of round loss in the number of training rounds in the heating control system based on the DQN network provided by the present invention;

[0070] Fig. 20 It is a schematic diagram of the final indoor temperature in the heating control method based on DQN provided by the present invention;

[0071] Fig.21 It is a hyperparameter diagram of the heating control algorithm in the DQN-based heating control method provided by the present invention. DETAILED DESCRIPTION

[0072] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

[0073] In order to better understand the purpose, structure and function of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings.

[0074] like Figure 1 Shown and Figure 2 As shown, the present invention provides a heating control method based on a DQN network, including the following embodiments: S1, monitoring the status information of outdoor temperature, water supply temperature and indoor temperature in real time through sensors;

[0075] S2. Based on the obtained state information of outdoor temperature, water supply temperature and indoor temperature, an MDP model of the heating control system is constructed, wherein the MDP model includes: a state space, an action space and a reward function; the state space includes: outdoor temperature, water supply temperature and indoor temperature; the action space selects the set value of the water supply temperature as the control action; the reward function is used for quantitative evaluation of the performance of the heating control system strategy;

[0076] S3. According to the constructed MDP model of the heating control system, the optimal control strategy of the heating control system is obtained based on the DQN algorithm neural network; the DQN algorithm neural network includes two neural networks: a main network Q(S,A;θ) and a target network Q(S,A;θ'), the main network Q(S,A;θ) is used to predict the Q value of the current state-action pair of the heating control system, and the target network Q(S,A;θ') is used to calculate the target Q value.

[0077] It should be noted that the sensors are responsible for real-time perception and monitoring of environmental status information such as outdoor temperature, water supply temperature and indoor temperature. As the center of the system, the controller receives data from the sensors, adjusts the set value of the water supply temperature based on the heating control strategy, and makes control decisions. Subsequently, the heating system will operate according to the heating adjusted by the controller and act on the environment, and feedback adjusts the indoor temperature after heating. For example, if the current indoor temperature is lower than the target indoor temperature, the heating system will increase the water supply temperature until the indoor temperature reaches the preset target temperature. Otherwise, the heating system will lower the water supply temperature until the target indoor temperature is reached. Figure 1 Shown is the design of a heating control system.

[0078] In the implementation of the heating control system, the intelligent agent plays a vital role. The intelligent agent intelligently makes control decisions based on the current environmental status, and converts these decisions into specific control instructions, which are transmitted to the heating system. The heating system adjusts its operating state according to the received instructions, and then acts on the indoor environment to produce a new environmental state. Finally, the intelligent agent calculates the reward value by comparing the actual indoor temperature obtained by feedback with the target indoor temperature, and evaluates the effect of the control action. Through continuous learning and optimization, the intelligent agent can gradually find the optimal control strategy that maximizes the reward under various environmental conditions, ensuring the efficient and stable operation of the heating system, thereby improving the overall heating effect. Figure 2 Shown is the control flow of the heating control system.

[0079] like Figure 3 As shown in the figure, the heating control system selects the appropriate water supply temperature to maintain the required target indoor temperature based on the current indoor environmental state and the external environmental influence. The indoor temperature at the next time step is only determined by the indoor temperature, outdoor temperature and water supply temperature of the temperature control system under the current state, which is independent of the previous environmental state. Therefore, the heating control process can be regarded as an MDP, defining the interaction between the temperature control system and the environment in the form of state, action and reward.

[0080] In order to establish the MDP, this section defines the relevant MDP elements, which are described as follows:

[0081] ① State space

[0082] The selection of water supply temperature is mainly affected by the indoor environment and the outdoor environment. In view of the many factors affecting the indoor and outdoor environments, and considering the availability of data, monitoring methods and many other factors, this application mainly selects the environmental variable outdoor temperature to represent the impact of the outdoor environment. In addition, considering that the indoor temperature collected is the bedroom temperature of each household in the Golden Champagne Community, which is a personal place with less mobility, the indoor temperature is selected to represent the impact of the indoor environment. Therefore, the final environmental state consists of three parts: outdoor temperature, water supply temperature and indoor temperature, which are specifically expressed as follows:

[0083] S t =(outdoor_temp t ,water_temp t , indoor_temp t )

[0084] Among them, S t Represents the state of the environment at time t, forming the state space S of the environment, outdoor_temp t 、water_temp t ; and indoor_temp t They represent the outdoor temperature, water supply temperature and indoor temperature at time t respectively, and t is the time series mark (t=0, 1, 2, ...T).

[0085] ②Action Space

[0086] The heating control system mainly changes the state of the environment by adjusting the water supply temperature. Therefore, this paper selects the set value of the water supply temperature as the control action. In order to maintain the balance between the complexity and solvability of the problem, the action space is discretized, including three possible actions:

[0087]

[0088] Among them, A t It represents the action selected at time t, forming the action space A. max_temp_change is the set water supply temperature adjustment value. In this heating control system, max_temp_change is set to 5.

[0089] ③Reward and punishment function

[0090] The reward value is a quantitative evaluation of the performance of the heating control system strategy. The present invention uses the target indoor temperature of 23.5°C as the evaluation index of the heating system performance. The primary goal of heating control is to ensure the physical comfort of indoor residents, and 23.5°C can achieve energy conservation and environmental protection while ensuring comfort. Therefore, the present invention sets the reward and punishment function as shown below:

[0091]

[0092] Where target_temp = 23.5℃, which indicates the target indoor temperature that the system wants to achieve, expressed as indoor_temp t The absolute value of the difference between the target_temp and the target_temp is used to set the agent's reward and punishment function, which helps the agent to have a clear and clear goal orientation, so that it can effectively learn and find the best strategy in the heating control system.

[0093] DQN Algorithm Process

[0094] DQN is an important algorithm in deep reinforcement learning. It combines the advantages of Q-learning and deep learning, replaces the traditional Q-table with a neural network, and enables the agent to handle high-dimensional state space. The core of the algorithm is to use a deep neural network to approximate the value function Q(S,A), which represents the expected cumulative reward that can be obtained by performing action A in state S. The specific update formula is as follows:

[0095]

[0096] Among them, Y t is the target Q value at time t, is the predicted Q value at time t, That is, it represents the error at the moment, based on which DQN can be updated.

[0097] In DQN, two neural networks are usually used: a main network and a target network, where Q(S j ,A;θ j )、Q(S j ,A;θ j ') represent the output of the main network and the target network respectively. The main network is used to predict the Q value of the current state-action pair, while the target network is used to calculate the target Q value; therefore, in DQN, it is no longer updating the Q-table, but updating the Q network. In this way, DQN can learn the optimal strategy in a continuous environment without knowing the specific model of the environment in advance. The specific update process of the Q network is as follows Figure 4 As shown;

[0098] At initialization, the parameters of the main network and the target network are the same, that is, θ = θ'. During training, θ is updated by minimizing the error between the output values ​​of the two. The loss function aims to reduce the difference between the predicted and target Q values, and the calculation formula is as follows:

[0099] L(θ j )=E[Y j -Q(S j ,A;θ j )]2

[0100] Then the parameter θ j , find the partial derivative to obtain the error loss gradient (as shown below), and then use the optimization algorithm to update the parameter θ j :

[0101]

[0102] The present invention applies the DQN algorithm to the heating control system. The agent can learn how to adjust the water supply temperature by interacting with the environment of the heating control system to ensure that the indoor temperature reaches the preset target temperature. The agent observes the state of the current environment and uses a neural network to predict the Q value that may be obtained under different actions, thereby selecting the action that can maximize the expected cumulative reward. In this way, the agent can gradually learn how to efficiently control the water supply temperature and adapt to different environments and operating conditions.

[0103] DQN Strategy Optimization

[0104] ①ε-greedy decay mechanism

[0105] like Figure 5 As shown in Figure 2, in DQN, the agent will choose an action to interact with the environment according to the strategy π, and the agent's training goal is to find the optimal strategy * so that * can obtain the highest expected return in all states

[0106]

[0107] In order to achieve a balance between environmental exploration and exploitation, the ε-greedy selection strategy is used. ε-greedy controls the balance between exploration and exploitation by introducing the probability parameter ε. The specific process is as follows:

[0108]

[0109] The ε decay mechanism is introduced. By setting a larger ε value at the beginning of training and multiplying the ε value by a decay factor less than 1 after each round of training, the ε value is gradually reduced, so that the training process gradually shifts from exploration to utilization.

[0110]

[0111] In the above formula, by setting ε min ≠0, which can prevent the agent from completely stopping exploration.

[0112] like Figure 6 The figure shows the curve of ε changing with the number of training rounds.

[0113] The ε decay mechanism can ensure that the agent fully explores the environment, collects information and discovers potential better strategies in the early stages of training, and gradually turns to using the learned knowledge to optimize behavior and improve agent performance in the later stages of training. This mechanism helps the agent discover more potential strategies in the early stages of training and stably optimize these strategies in the later stages, allowing the agent to optimize strategies more stably in the later stages of training.

[0114] ②Replay Buffer experience replay mechanism

[0115] like Figure 7 As shown in the figure, in order to effectively utilize the data generated by the interaction between the agent and the environment during the agent training process, the present invention introduces the concept of experience buffer pool. The experience buffer pool is a specially designed container for storing the five-element array (S, A, R, S', done) generated during the interaction between the agent and the environment, where S represents the current state, A represents the action taken, R represents the reward obtained, S' represents the new state entered, and done marks whether S is a terminal state.

[0116] like Figure 8 As shown in the figure, each time the agent interacts with the environment, the generated experience data is packaged and stored in the buffer pool. When the Q network parameters need to be updated and the amount of data in the buffer pool reaches a preset threshold, the agent will randomly extract a fixed-size data subset from it to update the Q network. This small batch gradient learning method allows the agent to use historical data to optimize its parameters while avoiding the problem of high correlation between consecutive data samples.

[0117] By using the historical data in the buffer pool, the agent can use every experience more effectively during the training process, which not only improves the efficiency and stability of learning, but also reduces the risk of overfitting. At the same time, the diversity of historical data also ensures that the agent can learn more robust strategies. In addition, the experience replay mechanism also makes the reinforcement learning algorithm an off-policy learning algorithm, thereby improving the utilization of data and the flexibility of the algorithm.

[0118] ③Fixed Q-targets fixed target network mechanism

[0119] like Fig. 9 As shown, in DQN, the target value Y is used t During training, due to Y tThe Q network to be learned contains a Q network, and the update of the Q network will affect the calculation of the target value, forming a "moving target" effect, which leads to an unstable and inefficient learning process. To solve this problem, the present invention introduces a fixed target network mechanism. The core idea of ​​this method is to separate the calculation of the target value from the Q network used to estimate the action value, where the parameters of the target network are delayed copies of the parameters of the main network, which are used to calculate Y t :

[0120] like Fig.10 As shown in the figure, during the training process, the main network is trained and updated normally according to the steps, and the target network regularly copies the parameters of the main network for update, thereby stabilizing the calculation of the target Q value and thus stabilizing the training process. This method effectively decouples the calculation of the target value from the update of the main network, so that the target value remains unchanged for a period of time, thus forming a "fixed target" effect.

[0121] By introducing the Fixed Q-targets mechanism, the DQN algorithm can significantly improve its learning stability and efficiency. Since the target network remains unchanged for a period of time, the agent can learn in a relatively static environment, making it easier to find the correct optimization direction. This effectively solves the problem of unstable training and low efficiency caused by the inclusion of the Q network to be learned in the target value of DQN, and significantly improves the performance of the DQN algorithm.

[0122] DQN Algorithm Design

[0123] The present invention optimizes the control strategy of the heating system based on the DQN algorithm, in which the heating system, as an intelligent agent, selects and executes the optimal strategy through continuous interactive training with the environment to achieve optimal control of the heating system. The algorithm code flow is as follows Fig.11 As shown;

[0124] DQN uses a deep neural network to approximate the action-value function and uses back-propagation and gradient descent to optimize network parameters. The key to this algorithm is the introduction of the Replay Buffer mechanism and the Fixed Q-targets mechanism. The ReplayBuffer mechanism effectively breaks the temporal correlation between data and improves learning efficiency by storing historical data of the agent's interaction with the environment and randomly extracting small batches of data for learning during training. Fixed Q-targets improves the stability and convergence speed of training by decoupling the calculation of the target value from the update of the main network.

[0125] like Fig.12 As shown, the structural framework of the heating control system based on the DQN algorithm is provided:

[0126] (III) Experimental design of heating control system

[0127] This invention constructs an indoor research environment with a certain community in Changchun City as the object, and selects relevant data pre-processed from November 1, 2022 to February 28, 2023 as the research sample. In order to train and optimize the heating control model, the data is divided into a training set and a test set, of which about 80% of the data is used for model training, and the remaining 20% ​​of the data is used to test model performance. In the DQN algorithm, this paper uses a deep neural network to approximate the Q-value function. The neural network structure includes an input layer, two hidden layers and an output layer. The layers are fully connected to transmit information. The input layer receives the state information of the area environment. The hidden layer uses ReLU as the activation function, and the output layer outputs the Q value corresponding to each action under different states. The hyperparameter settings of the heating control algorithm are as follows: Fig.21 shown.

[0128] The specific process of approximating the action value function Q with a neural network is as follows: Fig.13 The input of the neural network is the state S observed by the agent at time t. t , feature extraction is performed through two hidden layers, each containing 64 neurons. Finally, the number of neurons in the output layer matches the number of actions available in the action space A to predict the expected return of each action in a given state. This network structure can effectively approximate complex Q functions and guide the decision-making process of the intelligent agent.

[0129] Analysis of experimental results of heating control system This paper evaluates the DQN strategy optimizer in two parts: one is the model convergence effect, and the other is the control strategy optimization effect. The evaluation is carried out by comparing the target room temperature value, mainly examining its impact on the stability and comfort of the indoor temperature output by the simulator, and taking the difference loss from the target temperature as the measurement standard. When the loss value approaches zero, it means that the indoor temperature control effect is more ideal. First, the algorithm is trained, and relevant information such as the change trend of the Q value during the training process is obtained. Secondly, the change of indoor temperature under different target room temperature thresholds is analyzed. Finally, this method is compared with some other control methods, and the performance of different control algorithms is analyzed.

[0130] Convergence performance of DQN control algorithm

[0131] like Fig.14 As shown in Figure 2, the rewards of the DQN-based control algorithm change during the training phase. Fig.15 It can be seen that in the early stage of training, due to the lack of experience of the agent, control actions were mainly taken through exploration, resulting in large fluctuations in rewards.

[0132] However, as the number of training rounds increases, the agent accumulates experience and uses historical data to learn and update strategies, and the reward gradually stabilizes. The experimental results show that after 200 rounds of training, the total reward of the control algorithm stabilizes in the range of [150,200], indicating that the agent can effectively cope with the environment and achieve stable control of the target temperature (set at 23.5℃).

[0133] Performance at different target room temperature thresholds

[0134] In order to meet the diverse target room temperature requirements of heating companies, this paper sets different indoor temperature thresholds according to the specific requirements of the company in the design of the reward and punishment function. The following is an in-depth analysis of the average indoor temperature and final indoor temperature distribution under different room temperature thresholds. The figure below shows the average indoor temperature under different room temperature thresholds. Fig.15 It can be seen that the average value of the indoor temperature is highly consistent with the target value. Fig.16 represents the final indoor temperature distribution of each training round under different room temperature thresholds. Fig.16 It can be seen that the final indoor temperature of each round of training is closely distributed around the set room temperature threshold. The above analysis results show that the DQN algorithm can accurately control the final indoor temperature of different requirements and has excellent control performance under different target room temperature thresholds.

[0135] Strategy optimization effect of DQN control algorithm

[0136] In order to explore the performance of the DQN algorithm in the heating control system, the following visualization is used for specific analysis. The total round length represents the number of times the heating system adjusts the water supply temperature to achieve the target indoor temperature.

[0137] according to Fig.17 As shown in the figure, by observing the changes in the total length of the rounds during the training process, it is found that in the early stage of training, in order to accurately control the indoor temperature to the target value, the water supply temperature of the heating system is adjusted frequently, resulting in a longer duration of the entire training round. However, as the training progresses, the controller gradually optimizes the strategy and finally achieves a stable control effect in the later stage of training. The total length of the round is stable at 13-14. Note that the slight fluctuations in the later stage are due to the minimum exploration rate maintained by the agent on the environment.

[0138] Further analysis of the changing trend of the total round reward shows that Fig.18 It can be seen that as the training progresses, the agent's decision-making ability is enhanced, and it can make the best choice based on the current state and achieve high reward returns. In the later stage of training, the total reward of the round stabilizes at around 180, indicating that the agent has learned a relatively stable control strategy. Also, because the agent still maintains a certain degree of exploratory nature in the later stage of training, the total reward of the round fluctuates slightly around 180.

[0139] In addition, from Fig.19 and Fig. 20 By observing the changes in the round loss, we found that as the training progresses, the loss function value gradually decreases, indicating that the agent is gradually optimizing its control strategy. Combined with the fact that the indoor temperature can reach the set target value in the later stage of training shown in the indoor temperature curve below, we can conclude that the agent in the heating control system has learned the optimal strategy during the training process, and can adjust the water supply temperature to make the indoor temperature reach the preset target temperature in the shortest round, and control the heating system to operate in the best way.

[0140] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A heating control method based on DQN, characterized in that: The following steps are involved: S1, monitor the status information of outdoor temperature, water supply temperature and indoor temperature in real time through sensors; S2. Based on the obtained state information of outdoor temperature, water supply temperature and indoor temperature, an MDP model of the heating control system is constructed, wherein the MDP model includes: a state space, an action space and a reward function; the state space includes: outdoor temperature, water supply temperature and indoor temperature; the action space selects the set value of the water supply temperature as the control action; the reward function is used for quantitative evaluation of the performance of the heating control system strategy; S3. According to the constructed MDP model of the heating control system, the optimal control strategy of the heating control system is obtained based on the DQN algorithm neural network; the DQN algorithm neural network includes two neural networks: a main network Q(S,A;θ) and a target network Q(S,A;θ'), the main network Q(S,A;θ) is used to predict the Q value of the current state-action pair of the heating control system, and the target network Q(S,A;θ') is used to calculate the target Q value.

2. The heating control method based on DQN according to claim 1, characterized in that: The expressions of the state space, dynamic space and reward function in step S2 are as follows: The state space is expressed as: The outdoor temperature is selected to represent the influence of the outdoor environment, and the indoor temperature is selected to represent the influence of the indoor environment. Therefore, the final environmental state includes three parts: outdoor temperature, water supply temperature and indoor temperature, which are specifically expressed as follows: S t =(outdoor_temp t ,water_temp t ,indoor_temp t ) (1) Among them, S t Represents the state of the environment at time t, which constitutes the state space S of the environment, outdoor_temp t 、water_temp t and indoor_temp t Respectively represent the outdoor temperature, water supply temperature and indoor temperature at time t, t is a time series mark, where: t = 0, 1, 2, ... T; The action space is expressed as: The set value of the water supply temperature is selected as the control action, and the action space is discretized, including three actions: Among them, A t represents the action selected at time t, forming the action space A, max_temp_change is the set water supply temperature adjustment value, where max_temp_change = 5; The reward function is expressed as: Where target_temp = 23.5℃, which indicates the target indoor temperature that the heating control system wants to achieve, expressed as indoor_temp t The absolute value of the difference with target_temp is used to set the agent's reward and punishment function.

3. The heating control method based on DQN according to claim 1, characterized in that: The DQN algorithm neural network in step S3 includes the following training steps: Step 3-1, initialize the DQN network parameters and parameters in the training process, including initializing the network parameters θ of the main network Q(S,A;θ), the network parameters θ' of the target network Q(S,A;θ'), and the capacity N of the experience buffer pool; Step 3-2, the agent selects an action to interact with the environment according to the strategy π, and introduces the probability parameter ε through the ε-greedy decay mechanism to control the balance between exploration and exploitation; Step 3-3, store the five-element array (S, A, R, S', done) generated during the interaction between the agent and the environment in the experience buffer pool, where S represents the current environment state, A represents the action taken, R represents the reward obtained, S' represents the new environment state entered, and done marks whether S is a terminal state; Step 3-4, obtain the next environment state S', calculate the reward R, store the five-element array (S, A, R, S', done) generated by the next environment state in the experience buffer pool, randomly obtain batch samples from the experience buffer pool to train the main network Q(S, A; θ), and determine whether the step size requirement is met. If it is met, copy the parameters of the main network Q(S, A; θ) to the target network Q(S, A; θ').

4. The heating control method based on DQN according to claim 3 is characterized in that: In step 3-1, the DQN network parameters and the parameters in the training process are initialized as follows: At initialization, the network parameters θ of the main network and the network parameters θ' of the target network are the same, that is, θ = θ'. During the training process, θ is updated by minimizing the error between the output values ​​of the network parameters θ and θ', and the difference between the predicted value and the target Q value is reduced by the loss function calculated by formula (4). The calculation formula is as follows: L(θ j ) = E[Y j - Q(S j , A; θ j )] 2 Equation (4) Among them, Y j is the target Q value at time j, S j and A represent the state at time j and the action taken at the current state, respectively. Q(S j ,A;θ j ) indicates that the main network is in a given state S j The predicted Q value at action A, E represents the expectation. In actual operation, this expectation is approximated by randomly drawing samples from the experience replay pool. Then, the parameter θ is calculated by formula (5) j Find the partial derivative to obtain the error loss gradient, and then use the optimization algorithm to update the parameter θ j ; in, and They represent the loss function L(θ j ) and predicted Q values ​​about the main network parameters θ j gradient.

5. The heating control method based on DQN according to claim 3, characterized in that: In step 3-2, the agent selects an action to interact with the environment according to the strategy π, specifically: As shown below, the agent’s training goal is to find the optimal strategy π * , so that π * The highest expected return in all states The probability parameter ε is introduced through the ε-greedy decay mechanism to control the balance between exploration and exploitation. The specific process is as follows: A larger probability parameter ε is set at the beginning of training by formula (8), and after each round of training, the probability parameter ε is multiplied by a decay factor less than 1:

6. A system for executing the DQN-based heating control method according to any one of claims 1 to 5, characterized in that: The system comprises: Data acquisition module: real-time monitoring of outdoor temperature, water supply temperature and indoor temperature status information through sensors; Model building module: Based on the obtained state information of outdoor temperature, water supply temperature and indoor temperature, the MDP model of the heating control system is constructed, and the MDP model includes: state space, action space and reward function; the state space includes: outdoor temperature, water supply temperature and indoor temperature; the action space selects the set value of the water supply temperature as the control action; the reward function is used for quantitative evaluation of the performance of the heating control system strategy; Allocation module: According to the constructed MDP model of the heating control system, the optimal control strategy of the heating control system is obtained based on the DQN algorithm neural network; the DQN algorithm neural network includes two neural networks: a main network Q(S,A;θ) and a target network Q(S,A;θ'), the main network Q(S,A;θ) is used to predict the Q value of the current state-action pair of the heating control system, and the target network Q(S,A;θ') is used to calculate the target Q value.

7. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the DQN-based heating control method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the DQN-based heating control method according to any one of claims 1 to 5 are implemented.

Citation Information

Cited By

  • DQN-based enterprise AI introduction opportunity optimization method and device

    CN120875615A