Heat supply system hydraulic unbalance real-time correction method and system based on federal learning
By introducing federated learning and blockchain technology into the heating system, combining edge computing and dynamic hydraulic balancing algorithms, the real-time and security problems of hydraulic imbalance correction in traditional heating systems are solved, and data privacy protection and second-level response heating system optimization is achieved.
Patent Information
- Application Number
- CN202510672602.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-23
- Publication Date
- 2025-09-02
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The hydraulic imbalance correction method of traditional heating systems relies on centralized monitoring and regulation, and has problems such as large data transmission delay, high communication bandwidth usage, privacy leakage risks and model update lag, making it difficult to meet real-time and security requirements.
The real-time correction method of hydraulic imbalance in the heating system based on federated learning is adopted. By deploying edge computing terminals on the user side, multi-dimensional heating data is collected in real time, LSTM neural network model is built, model parameters are transmitted using blockchain encryption, and weighted aggregation is performed on the central server to generate a global prediction model, and dynamically adjust the valve opening to achieve hydraulic balance.
It realizes data privacy protection and model collaborative optimization, and second-level response hydraulic balance correction, significantly improves the energy efficiency and user comfort of the heating system, and reduces hydraulic imbalance rate and energy consumption.
Smart Images

Figure CN120576413A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent control of heating systems, and in particular to a method and system for real-time correction of hydraulic imbalance in heating systems based on federated learning. Background Art
[0002] As an important part of urban infrastructure, the hydraulic balance of the heating system directly affects heating efficiency and user comfort. Traditional hydraulic imbalance correction methods mostly rely on centralized monitoring and regulation, such as dynamic adjustment strategies based on PID control algorithms or empirical formulas. Such methods usually require real-time uploading of temperature, valve opening and other data at each user end to a central server for analysis. This has problems such as large data transmission delays and high communication bandwidth usage, making it difficult to meet real-time requirements. In addition, the centralized processing mode involves the transmission and storage of large amounts of sensitive data, which is prone to privacy leakage risks. Especially when the scale of user-end data is huge, security and compliance face severe challenges.
[0003] In recent years, machine learning-based prediction models have been introduced into the field of heating system optimization, such as the use of LSTM neural networks to predict heat load demand. However, existing methods mostly use a centralized training model, which requires aggregating all user data to a single server. This not only limits the model's generalization ability, but also makes it difficult to adapt to dynamically changing heating scenarios. At the same time, traditional models have a long update cycle and are unable to quickly respond to real-time operating condition changes, resulting in delayed hydraulic imbalance correction, energy waste, and local overheating and underheating problems.
[0004] In addition, there are few solutions in existing technologies that take into account both data privacy and distributed collaborative optimization. Although federated learning technology has demonstrated the advantages of distributed training in other fields, its application in heating systems is still in the exploratory stage. How to combine edge computing, blockchain encrypted transmission and federated learning framework to achieve multi-node secure collaborative modeling and real-time control has become a technical difficulty that needs to be overcome urgently. Summary of the Invention
[0005] In response to the above-mentioned shortcomings of the prior art, the present invention provides a real-time correction method for hydraulic imbalance in a heating system based on federated learning and a system thereof, which can effectively solve the problems mentioned in the prior art.
[0006] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0007] The present invention provides a method for real-time correction of hydraulic imbalance in a heating system based on federated learning, comprising the following steps:
[0008] S1. Construct a first prediction model based on an LSTM neural network, and optimize and train the constructed first prediction model;
[0009] S2. Set up smart terminals with edge computing capabilities as federated nodes at the user end of the heating system to collect multi-dimensional heating data such as current indoor temperature, valve opening, heating period, outdoor temperature, and building heat transfer coefficient in real time to form a time series feature vector set.
[0010] S3. Preprocessing the multi-dimensional heating data;
[0011] S4. Input the preprocessed multi-dimensional heating data into the first prediction model, output the predicted value of the indoor temperature in the next hour, and extract the first prediction model parameters, wherein the first model parameters include a weight matrix, a bias vector, and a standardized mean square error value of the validation set;
[0012] S5. Each of the federated nodes encrypts the trained first prediction model parameters and periodically uploads them to the central server via the blockchain communication network.
[0013] S6. The central server uses a federated averaging algorithm to perform weighted aggregation on the received first prediction model parameters of each federated node to generate second prediction model parameters, where the second prediction model parameters include a global weight matrix and a global bias vector.
[0014] S7. The central server distributes the second prediction model parameters in reverse order to each federated node, and each federated node updates the parameters of the first prediction model based on the second prediction model parameters.
[0015] S8. Each federated node generates a heat load forecast value for a future period based on the updated first forecast model, and sends the load forecast value to the regional heat exchange station controller. The controller dynamically adjusts the valve opening of each user terminal according to the predicted load distribution of the entire network, thereby achieving real-time correction of the hydraulic balance of the heating system.
[0016] Among them, the first prediction model in step S1 includes an input layer, two LSTM hidden layers and a fully connected output layer; the time step of the model is 5, and each input of the input layer is a 5-dimensional vector, including indoor temperature, valve opening, heating period, outdoor temperature and building heat transfer coefficient; the hidden layer is two LSTM layers, the first LSTM layer contains 128 hidden units, receives input data, and returns the sequence output of all time steps; the second LSTM layer contains 64 hidden units, receives the output sequence of the first LSTM layer, and returns the output of the last time step; the fully connected output layer converts the output of the two LSTM hidden layers into a single prediction value, that is, the predicted value of the indoor temperature in the next 1 hour.
[0017] Furthermore, the specific steps of optimizing and training the constructed first prediction model in step S1 include:
[0018] S101. Collect historical data from a heating system database, where the historical data includes indoor temperature, valve opening, heating time period, outdoor temperature, and building heat transfer coefficient;
[0019] S102: Check historical data, identify and delete abnormal data, and supplement missing data by interpolating adjacent values. Specifically, the data is supplemented by the average value of valid similar data one hour before and after the abnormal data and the missing data.
[0020] S103, normalizing the time series feature vector set composed of historical data so that each feature value is mapped to the interval [0, 1];
[0021] S104. Divide the time series feature vector set into a training set and a test set in a ratio of 7:3. Set the model optimization parameters, select Adam as the optimization function, use mean square error as the objective function, set the learning rate to 0.000001, set the batch size to 32, select 32 samples for parameter update each time training, and set the number of iterations to 20,000.
[0022] Furthermore, the specific steps of step S4 are as follows:
[0023] S401. Construct the preprocessed multi-dimensional heating data into a time series feature vector set according to a time step of 5, forming an input matrix of dimension 5×5, where each row corresponds to a time step and each column corresponds to five features: indoor temperature, valve opening, heating period, outdoor temperature, and building heat transfer coefficient;
[0024] S402: The input layer of the first prediction model receives the input matrix and transmits it to the first LSTM hidden layer for time series feature extraction. The output dimension of the first LSTM hidden layer is 5×128, and the sequence output of all time steps is retained;
[0025] S403: Input the output sequence of the first LSTM hidden layer to the second LSTM hidden layer to extract the time series high-order features. The second LSTM hidden layer outputs the 64-dimensional feature vector of the last time step.
[0026] S404: Input the 64-dimensional feature vector of the second LSTM hidden layer into the fully connected output layer, and generate a predicted value of the indoor temperature in the next hour through linear transformation;
[0027] S405, extracting parameters of the first prediction model, including a weight matrix, a bias vector, and a standardized mean square error value of the validation set;
[0028] Weight matrix: Contains the input gate weight W of the first LSTM hidden layer i1 , forget gate weight W f1 , output gate weight W o1and candidate state weight W c1 , the input gate weight W of the second LSTM hidden layer i2 , forget gate weight W f2 , output gate weight W o2 and candidate state weight W c2 , and the fully connected layer weight W fc ;
[0029] Bias vector: includes the bias b of each gate unit in the first LSTM hidden layer i1 、b f1 、b o1 , and b c1 , the second LSTM hidden layer bias b i2 、b f2 、b o2 , and b c2 , and the fully connected layer bias b fc ;
[0030] Validation set standardized mean square error value: Calculate the standardized mean square error based on the test set divided in step S104. The formula is:
[0031]
[0032] Among them, NMSE is the standardized mean square error, y i is the true value, is the predicted value, is the variance of the true value of the validation set, and N is the number of samples;
[0033] S406: Encapsulate the weight matrix, bias vector, and validation set standardized mean square error value as the first step. Further, the specific steps of step S6 include:
[0034] S601: The central server decrypts the first prediction model parameters encrypted by each federated node and extracts the weight matrix, bias vector, and validation set normalized mean square error value of each node.
[0035] S602: Calculate the aggregation weight based on the standardized mean square error value of the validation set of each node. The smaller the error value, the higher the weight. The calculation formula is:
[0036]
[0037] Among them, a k is the aggregate weight of the k-th federated node, NMSE k is the normalized mean square error of the validation set of the kth federated node, where K is the total number of federated nodes;
[0038] S603: Based on the aggregate weight, perform weighted averaging on the weight matrices and bias vectors of all federated nodes to generate a global weight matrix W of the second prediction model. q and the global bias vector b q ;
[0039] S604: Integrate the weight matrix and the bias vector after weighted averaging to form a second prediction model parameter set for reverse distribution to the federated nodes.
[0040] Furthermore, the specific steps of step S7 are:
[0041] S701: The central server encrypts the second prediction model parameter set and distributes it to each federated node via the blockchain communication network.
[0042] S702: After receiving the encrypted second prediction model parameters, each federated node uses an asymmetric encryption algorithm to decrypt and extract the global weight matrix W. q and the global bias vector b q ;
[0043] S703: The federated node replaces the weight matrix and bias vector of the local first prediction model with the global weight matrix and global bias vector to complete the parameter update of the first prediction model.
[0044] S704: Verify the prediction performance of the updated first prediction model on local real-time data. If the prediction error exceeds a preset threshold, trigger reinitialization of the local model.
[0045] Furthermore, the specific steps of step S8 include:
[0046] S801. Each federated node inputs the real-time pre-processed multi-dimensional heating data based on the updated first prediction model and generates a heat load forecast value for the next hour.
[0047] S802: compress the heat load prediction value into a lightweight data packet through the edge computing terminal, add a timestamp and a node identifier, and send it to the regional heat exchange station controller;
[0048] S803: The regional heat exchange station controller aggregates load forecast values of all federated nodes in the entire network and constructs a dynamic load distribution diagram of the heating network;
[0049] S804. Calculate the target valve opening value for each user terminal using a hydraulic balance algorithm based on the dynamic load distribution diagram. The calculation formula is:
[0050]
[0051] Among them, θ target is the target valve opening, θcurrent is the current valve opening, Q pre is the predicted load value, Q act To monitor the load value in real time, Q base is the design basis load, λ is the preset adjustment coefficient;
[0052] S805. Send the target valve opening value to the corresponding federal node, drive the intelligent terminal to adjust the valve opening in real time, match the flow of the heating network with the heat load demand, and realize real-time correction of hydraulic balance.
[0053] Furthermore, the heat load forecast value for the next hour is generated by a heat load calculation model using the heat load forecast value, and the formula is:
[0054] Q=U·(T pred -T out )+β·Δθ vavle ;
[0055] Where U is the building heat transfer coefficient, Δθ vavle is the change in valve opening, through the current valve opening θ current Compared with the historical average, β is the influence factor of valve regulation on heat load, T pred is the indoor temperature forecast value for the next hour output by the updated first forecast model, T out The outdoor temperature is collected in real time.
[0056] The real-time correction system for hydraulic imbalance in heating systems based on federated learning includes:
[0057] Prediction model building module, used to build and train an LSTM neural network model for predicting indoor temperature;
[0058] Data acquisition and processing module, used to collect multi-dimensional heating data in real time and complete pre-processing;
[0059] Federated learning aggregation module, used to achieve encrypted parameter transmission and global model aggregation;
[0060] Thermal load prediction and control module, used to convert temperature prediction value into thermal load prediction value and dynamically adjust valve opening;
[0061] The data acquisition and processing module includes an edge data acquisition unit for real-time acquisition of indoor temperature, valve opening, heat use period, outdoor temperature, and building heat transfer coefficient data of the user terminal; a time series feature construction unit for constructing the data into a 5×5 time series feature matrix according to a time step of 5 to form the time series feature vector set in claim 1; a real-time preprocessing unit for detecting outliers through threshold screening, and dynamically correcting them using a sliding window mean, and forward filling or linear interpolation of missing values;
[0062] The federated learning aggregation module includes a parameter encryption unit, which is used to encrypt local model parameters using an asymmetric encryption algorithm; a blockchain transmission unit, which is used to periodically upload encrypted parameters to a central server through a blockchain communication network and receive decrypted global parameters; a weighted aggregation unit, which is used to calculate the aggregation weight based on the verification set NMSE value of each node and generate a global weight matrix and bias vector; a parameter update unit, which is used to replace local model parameters with global parameters and trigger model retraining when the updated NMSE exceeds the threshold.
[0063] Furthermore, the heat load prediction and control module includes:
[0064] Load calculation unit, used for calculation based on the formula Q=U·(T pred -T out )+β·Δθ vavle , convert the temperature prediction value into the heat load prediction value;
[0065] Dynamic load integration unit, used to aggregate the heat load forecast values of federated nodes across the entire network and construct a dynamic load distribution map;
[0066] The hydraulic balance control unit is used to calculate the valve opening target value and send the valve opening target value to the smart terminal for real-time adjustment.
[0067] Compared with the prior art, the technical solution provided by the present invention has the following beneficial effects:
[0068] 1. The present invention constructs a distributed control framework of "federated learning + blockchain + edge computing" in the heating system. Each federated node transmits model parameters through the blockchain network in encrypted form, rather than the original data, and dynamically aggregates and generates a global model on the central server, achieving the dual goals of data privacy protection and model collaborative optimization. This architecture not only avoids the risks of centralized storage of sensitive data, but also ensures the credibility of parameter transmission through the tamper-proof nature of the blockchain, resolving the contradiction between privacy and efficiency in traditional centralized systems.
[0069] 2. The present invention deploys a local prediction model with dual LSTM hidden layers on the edge intelligent terminal, directly generates temperature and heat load forecasts for the next hour based on real-time data, and feeds the prediction results back to the regional controller through lightweight communication. Combined with a dynamic hydraulic balance algorithm, such as the valve opening target value formula, a "prediction-aggregation-control" closed-loop system is formed to achieve second-level response and precise flow distribution. This design breaks through the lag of traditional open-loop control, compressing the delay of model updates and valve adjustments from hours to minutes, significantly improving energy efficiency and user comfort.
[0070] 3. The present invention proposes a federal parameter aggregation mechanism with the standardized mean square error of the validation set as the weight. Compared with the equal weight distribution of traditional federal averaging, this method gives greater weight to nodes with higher prediction accuracy, effectively integrates the differentiated heating characteristics of multiple regions, and significantly improves the generalization ability of the global model. It is especially suitable for scenarios with uneven data distribution of multiple nodes in the heating system, avoiding the problem of single model bias. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. Those skilled in the art can also derive other drawings based on these drawings without inventive effort.
[0072] Figure 1 Schematic diagram of the method flow of the present invention;
[0073] Figure 2 Schematic diagram of the system structure of the present invention. DETAILED DESCRIPTION
[0074] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0075] The present invention will be further described below with reference to the embodiments.
[0076] Example 1: Reference Figure 1 , a real-time correction method for hydraulic imbalance in a heating system based on federated learning, comprising the following steps:
[0077] S1. Construct a first prediction model based on an LSTM neural network, and optimize and train the constructed first prediction model;
[0078] S2. Set up smart terminals with edge computing capabilities as federated nodes at the user end of the heating system to collect multi-dimensional heating data such as current indoor temperature, valve opening, heating period, outdoor temperature, and building heat transfer coefficient in real time to form a time series feature vector set.
[0079] S3. Preprocessing multi-dimensional heating data;
[0080] S4. Input the preprocessed multi-dimensional heating data into the first prediction model, output the predicted value of the indoor temperature in the next hour, and extract the first prediction model parameters, which include the weight matrix, the bias vector, and the standardized mean square error value of the validation set;
[0081] S5. Each federated node encrypts the trained first prediction model parameters and periodically uploads them to the central server via the blockchain communication network.
[0082] S6. The central server uses a federated averaging algorithm to perform weighted aggregation on the first prediction model parameters received from each federated node to generate second prediction model parameters. The second prediction model parameters include a global weight matrix and a global bias vector.
[0083] S7. The central server distributes the second prediction model parameters to each federated node, and each federated node updates the parameters of the first prediction model based on the second prediction model parameters.
[0084] S8. Each federated node generates a heat load forecast value for the future period based on the updated first forecast model and sends the load forecast value to the regional heat exchange station controller. The controller dynamically adjusts the valve opening of each user end according to the predicted load distribution of the entire network to achieve real-time correction of the hydraulic balance of the heating system.
[0085] Among them, the first prediction model in step S1 includes an input layer, two LSTM hidden layers and a fully connected output layer; the time step of the model is 5, and each input of the input layer is a 5-dimensional vector, including indoor temperature, valve opening, heating period, outdoor temperature and building heat transfer coefficient; the hidden layer is two LSTM layers, the first LSTM layer contains 128 hidden units, receives input data, and returns the sequence output of all time steps; the second LSTM layer contains 64 hidden units, receives the output sequence of the first LSTM layer, and returns the output of the last time step; the fully connected output layer converts the output of the two LSTM hidden layers into a single prediction value, that is, the predicted value of the indoor temperature in the next 1 hour.
[0086] Furthermore, the specific steps of optimizing and training the constructed first prediction model in step S1 include:
[0087] S101. Collect historical data from the heating system database, where the historical data includes indoor temperature, valve opening, heating time period, outdoor temperature, and building heat transfer coefficient;
[0088] S102: Check historical data, identify and delete abnormal data, and supplement missing data by interpolating adjacent values. Specifically, the data is supplemented by the average value of valid similar data one hour before and after the abnormal data and the missing data.
[0089] S103, normalizing the time series feature vector set composed of historical data so that each feature value is mapped to the interval [0, 1];
[0090] S104. Divide the time series feature vector set into a training set and a test set in a ratio of 7:3. Set the model optimization parameters, select Adam as the optimization function, use mean square error as the objective function, set the learning rate to 0.000001, set the batch size to 32, select 32 samples for parameter update each time training, and set the number of iterations to 20,000.
[0091] Furthermore, the specific steps of step S4 are as follows:
[0092] S401. Construct the preprocessed multi-dimensional heating data into a time series feature vector set according to a time step of 5, forming an input matrix of dimension 5×5, where each row corresponds to a time step and each column corresponds to five features: indoor temperature, valve opening, heating period, outdoor temperature, and building heat transfer coefficient;
[0093] S402: The input layer of the first prediction model receives the input matrix and transmits it to the first LSTM hidden layer for time series feature extraction. The output dimension of the first LSTM hidden layer is 5×128, and the sequence output of all time steps is retained;
[0094] S403: Input the output sequence of the first LSTM hidden layer to the second LSTM hidden layer to extract the time series high-order features. The second LSTM hidden layer outputs the 64-dimensional feature vector of the last time step.
[0095] S404: Input the 64-dimensional feature vector of the second LSTM hidden layer into the fully connected output layer, and generate a predicted value of the indoor temperature in the next hour through linear transformation;
[0096] S405, extracting parameters of the first prediction model, including a weight matrix, a bias vector, and a standardized mean square error value of the validation set;
[0097] Weight matrix: Contains the input gate weight W of the first LSTM hidden layer i1 , forget gate weight W f1 , output gate weight W o1 and candidate state weight W c1 , the input gate weight W of the second LSTM hidden layer i2 , forget gate weight W f2 , output gate weight W o2 and candidate state weight W c2 , and the fully connected layer weight W fc ;
[0098] Bias vector: includes the bias b of each gate unit in the first LSTM hidden layer i1、b f1 、b o1 , and b c1 , the second LSTM hidden layer bias b i2 、b f2 、b o2 , and b c2 , and the fully connected layer bias b fc ;
[0099] Validation set standardized mean square error value: Calculate the standardized mean square error based on the test set divided in step S104. The formula is:
[0100]
[0101] Among them, NMSE is the standardized mean square error, y i is the true value, is the predicted value, is the variance of the true value of the validation set, and N is the number of samples;
[0102] S406: Encapsulate the weight matrix, bias vector, and validation set standardized mean square error value into the first step. Further, the specific steps of step S6 include:
[0103] S601. The central server decrypts the first prediction model parameters encrypted by each federated node and extracts the weight matrix, bias vector, and normalized mean square error value of the validation set of each node.
[0104] S602: Calculate the aggregation weight based on the standardized mean square error value of the validation set of each node. The smaller the error value, the higher the weight. The calculation formula is:
[0105]
[0106] Among them, a k is the aggregate weight of the k-th federated node, NMSE k is the normalized mean square error of the validation set of the kth federated node, where K is the total number of federated nodes;
[0107] S603: Based on the aggregate weight, perform weighted averaging on the weight matrices and bias vectors of all federated nodes to generate the global weight matrix W of the second prediction model. q and the global bias vector b q ;
[0108] S604: Integrate the weight matrix and the bias vector after weighted averaging to form a second prediction model parameter set for reverse distribution to the federated nodes.
[0109] Furthermore, the specific steps of step S7 are:
[0110] S701. The central server encrypts the second prediction model parameter set and distributes it to each federated node via the blockchain communication network.
[0111] S702: After receiving the encrypted second prediction model parameters, each federated node uses an asymmetric encryption algorithm to decrypt and extract the global weight matrix W. q and the global bias vector b q ;
[0112] S703: The federated node replaces the weight matrix and bias vector of the local first prediction model with the global weight matrix and global bias vector to complete the parameter update of the first prediction model.
[0113] S704: Verify the prediction performance of the updated first prediction model on local real-time data. If the prediction error exceeds a preset threshold, trigger reinitialization of the local model.
[0114] Furthermore, the specific steps of step S8 include:
[0115] S801. Each federated node inputs the real-time pre-processed multi-dimensional heating data based on the updated first prediction model and generates a heat load forecast value for the next hour.
[0116] S802: Compress the heat load prediction value into a lightweight data packet through the edge computing terminal, add a timestamp and node identifier, and send it to the regional heat exchange station controller;
[0117] S803: The regional heat exchange station controller aggregates the load forecast values of the federated nodes of the entire network and constructs a dynamic load distribution diagram of the heating network;
[0118] S804. Based on the dynamic load distribution diagram, a hydraulic balance algorithm is used to calculate the target valve opening value for each user end. The calculation formula is:
[0119]
[0120] Among them, θ target is the target valve opening, θ current is the current valve opening, Q pre is the predicted load value, Q act To monitor the load value in real time, Q base is the design basis load, λ is the preset adjustment coefficient;
[0121] S805. Send the target valve opening value to the corresponding federal node, drive the intelligent terminal to adjust the valve opening in real time, match the flow of the heating network with the heat load demand, and realize real-time correction of hydraulic balance.
[0122] Furthermore, the heat load forecast value for the next hour is generated by the heat load calculation model, and the heat load forecast value is as follows:
[0123] Q=U·(T pred -T out )+β·Δθ vavle ;
[0124] Where U is the building heat transfer coefficient, Δθ vavle is the change in valve opening, through the current valve opening θ current Compared with the historical average, β is the influence factor of valve regulation on heat load, T pred is the indoor temperature forecast value for the next hour output by the updated first forecast model, T out The outdoor temperature is collected in real time.
[0125] In a specific embodiment, 1,000 user terminals are selected as federated nodes in the heating network, and each node is deployed with an intelligent terminal that integrates a temperature sensor, a valve controller, and an edge computing unit. The terminal collects real-time data on indoor temperature, valve opening, heating period, outdoor temperature, and building heat transfer coefficient at 5-minute intervals. A local LSTM model is trained using 30 days of historical data. The model input is a 5×5 time series feature matrix with a time step of 5 and a feature number of 5. It uses two LSTM hidden layers (128 and 64 units) and a fully connected output layer. During the training process, outliers are removed, missing values are interpolated using the mean of the adjacent 2 hours, and features are normalized to the range [0,1]. After training, the model parameters, including the weight matrix, bias vector, and validation set NMSE value, are extracted and uploaded to the central server after encryption using RSA-2048.
[0126] The central server decrypts the encrypted parameters it receives every hour and dynamically assigns an aggregation weight based on each node's validation set NMSE value. Lower errors are assigned higher weights, and global model parameters are generated through weighted averaging. For example, if a node has an NMSE of 0.12, its weight is 0.45; if another node has an NMSE of 0.15, its weight is 0.38. These aggregated global parameters are encrypted and distributed to each federated node via the blockchain network, based on the Hyperledger Fabric framework, replacing the local model parameters and completing the model update.
[0127] The updated local model predicts the indoor temperature in the next hour based on real-time data, such as rising from 22°C to 23.5°C, and uses the heat load formula Q = U (T pred -T out )+β·Δθ vavleTo calculate the heat load, such as 28.6kW, the regional controller summarizes the forecast value of the entire network, constructs a dynamic load distribution diagram, and uses the hydraulic balance algorithm to calculate the target valve opening. For example, the current opening of 60% is adjusted to 59.7%, and the valve is driven to adjust in real time to ensure that the flow of the heating network matches the heat demand.
[0128] If the prediction error (NMSE) after a node update exceeds a threshold set at 0.3, the local model is reinitialized and retrained until the error meets the target. Implementation tests have shown that the system's fully encrypted data transmission is tamper-proof, blockchain verification has a 100% success rate, valve control delays are less than 2 minutes, hydraulic imbalance rates are reduced from 12% to 3%, pump station energy consumption is reduced by 18%, and user indoor temperature fluctuations are reduced from ±3°C to ±0.5°C, validating the efficiency and security of this solution.
[0129] The test results are shown in the following table:
[0130]
[0131]
[0132] Table 1: Implementation test data table
[0133] Table 1 shows that this embodiment combines federated learning with blockchain technology to achieve distributed collaborative modeling and real-time control in seconds under privacy protection, providing a scalable technical path for correcting hydraulic imbalances in complex heating systems.
[0134] Example 2: Reference Figure 2 , a real-time correction system for hydraulic imbalance in heating systems based on federated learning, including:
[0135] Prediction model building module, used to build and train an LSTM neural network model for predicting indoor temperature;
[0136] Data acquisition and processing module, used to collect multi-dimensional heating data in real time and complete pre-processing;
[0137] Federated learning aggregation module, used to achieve encrypted parameter transmission and global model aggregation;
[0138] Thermal load prediction and control module, used to convert temperature prediction value into thermal load prediction value and dynamically adjust valve opening;
[0139] The data acquisition and processing module includes an edge data acquisition unit for real-time acquisition of indoor temperature, valve opening, heat use period, outdoor temperature, and building heat transfer coefficient data of the user terminal; a time series feature construction unit for constructing the data into a 5×5 time series feature matrix according to a time step of 5 to form the time series feature vector set in claim 1; a real-time preprocessing unit for detecting outliers through threshold screening, and dynamically correcting them using a sliding window mean, and forward filling or linear interpolation of missing values;
[0140] The federated learning aggregation module includes a parameter encryption unit, which is used to encrypt local model parameters using an asymmetric encryption algorithm; a blockchain transmission unit, which is used to periodically upload encrypted parameters to a central server through a blockchain communication network and receive decrypted global parameters; a weighted aggregation unit, which is used to calculate the aggregation weight based on the verification set NMSE value of each node and generate a global weight matrix and bias vector; a parameter update unit, which is used to replace local model parameters with global parameters and trigger model retraining when the updated NMSE exceeds the threshold.
[0141] Furthermore, the heat load prediction and control module includes:
[0142] Load calculation unit, used for calculation based on the formula Q=U·(T pred -T out )+β·Δθ vavle , convert the temperature prediction value into the heat load prediction value;
[0143] Dynamic load integration unit, used to aggregate the heat load forecast values of federated nodes across the entire network and construct a dynamic load distribution map;
[0144] The hydraulic balance control unit is used to calculate the valve opening target value and send the valve opening target value to the smart terminal for real-time adjustment.
[0145] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements will not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A real-time correction method for hydraulic imbalance in a heating system based on federated learning, characterized in that: The following steps are involved: S1. Construct a first prediction model based on an LSTM neural network, and optimize and train the constructed first prediction model; S2. Set up smart terminals with edge computing capabilities as federated nodes at the user end of the heating system to collect multi-dimensional heating data such as current indoor temperature, valve opening, heating period, outdoor temperature, and building heat transfer coefficient in real time to form a time series feature vector set. S3. Preprocessing the multi-dimensional heating data; S4. Input the preprocessed multi-dimensional heating data into the first prediction model, output the predicted value of the indoor temperature in the next hour, and extract the first prediction model parameters, wherein the first model parameters include a weight matrix, a bias vector, and a standardized mean square error value of the validation set; S5. Each of the federated nodes encrypts the trained first prediction model parameters and periodically uploads them to the central server via the blockchain communication network. S6. The central server uses a federated averaging algorithm to perform weighted aggregation on the received first prediction model parameters of each federated node to generate second prediction model parameters, where the second prediction model parameters include a global weight matrix and a global bias vector. S7. The central server distributes the second prediction model parameters in reverse order to each federated node, and each federated node updates the parameters of the first prediction model based on the second prediction model parameters. S8. Each federated node generates a heat load forecast value for a future period based on the updated first forecast model, and sends the load forecast value to the regional heat exchange station controller. The controller dynamically adjusts the valve opening of each user terminal according to the predicted load distribution of the entire network, thereby achieving real-time correction of the hydraulic balance of the heating system. Among them, the first prediction model in step S1 includes an input layer, two LSTM hidden layers and a fully connected output layer; the time step of the model is 5, and each input of the input layer is a 5-dimensional vector, including indoor temperature, valve opening, heating period, outdoor temperature and building heat transfer coefficient; the hidden layer is two LSTM layers, the first LSTM layer contains 128 hidden units, receives input data, and returns the sequence output of all time steps; the second LSTM layer contains 64 hidden units, receives the output sequence of the first LSTM layer, and returns the output of the last time step; the fully connected output layer converts the output of the two LSTM hidden layers into a single prediction value, that is, the predicted value of the indoor temperature in the next 1 hour.
2. The method for real-time correction of hydraulic imbalance in a heating system based on federated learning according to claim 1 is characterized in that: The specific steps of optimizing and training the constructed first prediction model in step S1 include: S101. Collect historical data from a heating system database, where the historical data includes indoor temperature, valve opening, heating time period, outdoor temperature, and building heat transfer coefficient; S102: Check historical data, identify and delete abnormal data, and supplement missing data by interpolating adjacent values. Specifically, the data is supplemented by the average value of valid similar data one hour before and after the abnormal data and the missing data. S103, normalizing the time series feature vector set composed of historical data so that each feature value is mapped to the interval [0, 1]; S104. Divide the time series feature vector set into a training set and a test set in a ratio of 7:
3. Set the model optimization parameters, select Adam as the optimization function, use mean square error as the objective function, set the learning rate to 0.000001, set the batch size to 32, select 32 samples for parameter update each time training, and set the number of iterations to 20,000.
3. The method for real-time correction of hydraulic imbalance in a heating system based on federated learning according to claim 1 is characterized in that: The specific steps of step S4 are as follows: S401. Construct the preprocessed multi-dimensional heating data into a time series feature vector set according to a time step of 5, forming an input matrix of dimension 5×5, where each row corresponds to a time step and each column corresponds to five features: indoor temperature, valve opening, heating period, outdoor temperature, and building heat transfer coefficient; S402: The input layer of the first prediction model receives the input matrix and transmits it to the first LSTM hidden layer for time series feature extraction. The output dimension of the first LSTM hidden layer is 5×128, and the sequence output of all time steps is retained; S403: Input the output sequence of the first LSTM hidden layer to the second LSTM hidden layer to extract the time series high-order features. The second LSTM hidden layer outputs the 64-dimensional feature vector of the last time step. S404: Input the 64-dimensional feature vector of the second LSTM hidden layer into the fully connected output layer, and generate a predicted value of the indoor temperature in the next hour through linear transformation; S405, extracting parameters of the first prediction model, including a weight matrix, a bias vector, and a standardized mean square error value of the validation set; Weight matrix: Contains the input gate weight W of the first LSTM hidden layer i1 , forget gate weight W f1 , output gate weight W o1 and candidate state weight W c1 , the input gate weight W of the second LSTM hidden layer i2 , forget gate weight W f2 , output gate weight W o2 and candidate state weight W c2 , and the fully connected layer weight W fc ; Bias vector: includes the bias b of each gate unit in the first LSTM hidden layer i1 、b f1 、b o1 , and b c1 , the second LSTM hidden layer bias b i2 、b f2 、b o2 , and b c2 , and the fully connected layer bias b fc ; Validation set standardized mean square error value: Calculate the standardized mean square error based on the test set divided in step S104. The formula is: Among them, NMSE is the standardized mean square error, y i is the true value, is the predicted value, is the variance of the true value of the validation set, and N is the number of samples; S406: Encapsulate the weight matrix, bias vector, and validation set normalized mean square error value into a first prediction model parameter set for federated learning parameter aggregation.
4. The method for real-time correction of hydraulic imbalance in a heating system based on federated learning according to claim 1 is characterized in that: The specific steps of step S6 include: S601: The central server decrypts the first prediction model parameters encrypted by each federated node and extracts the weight matrix, bias vector, and validation set normalized mean square error value of each node. S602: Calculate the aggregation weight based on the standardized mean square error value of the validation set of each node. The smaller the error value, the higher the weight. The calculation formula is: Among them, a k is the aggregate weight of the k-th federated node, NMSE k is the normalized mean square error of the validation set of the kth federated node, where K is the total number of federated nodes; S603: Based on the aggregate weight, perform weighted averaging on the weight matrices and bias vectors of all federated nodes to generate a global weight matrix W of the second prediction model. q and the global bias vector b q ; S604: Integrate the weight matrix and the bias vector after weighted averaging to form a second prediction model parameter set for reverse distribution to the federated nodes.
5. The method for real-time correction of hydraulic imbalance in a heating system based on federated learning according to claim 1 is characterized in that: The specific steps of step S7 are: S701: The central server encrypts the second prediction model parameter set and distributes it to each federated node via the blockchain communication network. S702: After receiving the encrypted second prediction model parameters, each federated node uses an asymmetric encryption algorithm to decrypt and extract the global weight matrix W. q and the global bias vector b q ; S703: The federated node replaces the weight matrix and bias vector of the local first prediction model with the global weight matrix and global bias vector to complete the parameter update of the first prediction model. S704: Verify the prediction performance of the updated first prediction model on local real-time data. If the prediction error exceeds a preset threshold, trigger reinitialization of the local model.
6. The method for real-time correction of hydraulic imbalance in a heating system based on federated learning according to claim 1 is characterized in that: The specific steps of step S8 include: S801. Each federated node inputs the real-time pre-processed multi-dimensional heating data based on the updated first prediction model and generates a heat load forecast value for the next hour. S802: compress the heat load prediction value into a lightweight data packet through the edge computing terminal, add a timestamp and a node identifier, and send it to the regional heat exchange station controller; S803: The regional heat exchange station controller aggregates load forecast values of all federated nodes in the entire network and constructs a dynamic load distribution diagram of the heating network; S804. Calculate the target valve opening value for each user terminal using a hydraulic balance algorithm based on the dynamic load distribution diagram. The calculation formula is: Among them, θ target is the target valve opening, θ current is the current valve opening, Q pre is the predicted load value, Q act To monitor the load value in real time, Q base is the design basis load, λ is the preset adjustment coefficient; S805. Send the target valve opening value to the corresponding federal node, drive the intelligent terminal to adjust the valve opening in real time, match the flow of the heating network with the heat load demand, and achieve real-time correction of the hydraulic balance.
7. The method for real-time correction of hydraulic imbalance in a heating system based on federated learning according to claim 6 is characterized in that: The heat load forecast value for the next hour is generated by the heat load calculation model using the heat load forecast value, and the formula is: Q=U·(T pred -T out )+β·Δθ vavle ; Where U is the building heat transfer coefficient, Δθ vavle is the change in valve opening, through the current valve opening θ current Compared with the historical average, β is the influence factor of valve regulation on heat load, T pred is the indoor temperature forecast value for the next hour output by the updated first forecast model, T out The outdoor temperature is collected in real time.
8. A real-time correction system for hydraulic imbalance in heating systems based on federated learning, characterized by: include: Prediction model building module, used to build and train an LSTM neural network model for predicting indoor temperature; Data acquisition and processing module, used to collect multi-dimensional heating data in real time and complete pre-processing; Federated learning aggregation module, used to achieve encrypted parameter transmission and global model aggregation; Thermal load prediction and control module, used to convert temperature prediction value into thermal load prediction value and dynamically adjust valve opening; The data acquisition and processing module includes an edge data acquisition unit for real-time acquisition of indoor temperature, valve opening, heat use period, outdoor temperature, and building heat transfer coefficient data of the user terminal; a time series feature construction unit for constructing the data into a 5×5 time series feature matrix according to a time step of 5 to form the time series feature vector set in claim 1; a real-time preprocessing unit for detecting outliers through threshold screening, and dynamically correcting them using a sliding window mean, and forward filling or linear interpolation of missing values; The federated learning aggregation module includes a parameter encryption unit, which is used to encrypt local model parameters using an asymmetric encryption algorithm; a blockchain transmission unit, which is used to periodically upload encrypted parameters to a central server through a blockchain communication network and receive decrypted global parameters; a weighted aggregation unit, which is used to calculate the aggregation weight based on the verification set NMSE value of each node and generate a global weight matrix and bias vector; a parameter update unit, which is used to replace local model parameters with global parameters and trigger model retraining when the updated NMSE exceeds the threshold.
9. The real-time correction system for hydraulic imbalance in a heating system based on federated learning according to claim 8 is characterized in that: The heat load prediction and control module includes: Load calculation unit, used for calculation based on the formula Q=U·(T pred -T out )+β·Δθ vavle , convert the temperature prediction value into the heat load prediction value; Dynamic load integration unit, used to aggregate the heat load forecast values of federated nodes across the entire network and construct a dynamic load distribution map; The hydraulic balance control unit is used to calculate the valve opening target value and send the valve opening target value to the smart terminal for real-time adjustment.
Citation Information
Cited By
Data processing method for pipe network balance debugging based on pressure waves
CN120850821A
A data processing method for pressure wave-based pipe network balance debugging
CN120850821B
Neural network-based wastewater denitrification method and device
CN120864681A
Constant-temperature load dynamic modeling method based on federated learning and domain knowledge enhancement
CN120995427A
Industrial report management method and system based on distributed storage
CN121722751A
