2.2. Method Description
2.2.1. Hydraulic Model of the ACWS Network under Simulated Leakage Conditions
The Dymola platform is a multidisciplinary system modeling and simulation tool based on the Modelica language (an object-oriented physical modeling language) [
19]. It has a library of models and simulation specialties suitable for multiple engineering domains, and has proven its applicability in the engineering field, while “Modelica.Fluid” provides the basis for developing the network hydraulic model. However, the existing components cannot meet the simulation under leakage conditions, so for this paper we developed a hydraulic model that can simulate different leakage conditions based on the Dymola platform.
The model is shown in
Figure 4. In the event that a leak occurs at a certain point on the pipe, the simulated leakage is divided into two pipes—“pipe1” and “pipe2”—and the two pipes are connected by a tee junction without pressure loss, and then connected by a “negative flow source” (corresponding to the source module in
Figure 4), which can be set by the user. All of the above components are “packaged” into a new element.
By setting the flow rate of the “negative flow source” and the ratio of the length of each pipe to the total pipe length (i.e., the simulated pipe leakage volume and leakage location), the model is built under different leakage conditions. In order to verify the accuracy of the hydraulic model of the pipe leakage, the classical theoretical calculation method and the simulation method based on the hydraulic model are used to calculate the pressure difference between the inlet and outlet of the same pipe, and the model is verified by comparing the calculation results (details in
Appendix A).
2.2.2. Cuckoo Search Algorithm for the Identification of Network Resistance Characteristics
The hydraulic model established using Dymola described in
Section 2.2.1 is not sufficient to simulate the actual pipe network system. In the actual pipe network, there are factors such as pipe corrosion, internal wall scaling, etc. The resistance characteristics of the pipe network inevitably deviate from the initial design calculation values, and the key to establishing an accurate hydraulic model of the pipe network lies in the identification of the resistance characteristics of the pipe network. Optimization algorithms are a common method for the identification of pipe network resistance characteristics. The performance of the cuckoo search algorithm was compared with that of the particle swarm algorithm, differential evolution algorithm, artificial bee swarm algorithm, and other algorithms based on various test functions [
20], showing that the cuckoo search algorithm has fewer parameters, simple operation, easy implementation, generality and robustness, and excellent local and global search capabilities with comprehensive advantages. Meanwhile, the object of this paper is similar to the research objects in the literature on the identification of pipe resistance characteristics, so the cuckoo search algorithm was used in this study to help improve the hydraulic model.
Before applying the optimization algorithm, it is necessary to determine the objective function of the identification of the resistance characteristics of the pipe network in this study. The purpose is that the final identification parameters optimized by the algorithm can make the simulated parameters of the hydraulic model as close as possible to the actual monitored values. In this study, the sum of the absolute value of the relative error between the actual monitored values and the model-simulated values of each sensor (pressure and flow rate) in the pipe network system is used as the objective function, and the formula is shown in Equation (1):
where
Z is the number of conditions involved in the calibration;
NP and
NQ represent the numbers of pressure and flow sensors installed in the network system, respectively;
Pm, and
Ps represent the monitored and simulated pressures, respectively; and
Qm and
Qs represent the monitored and simulated pipe section flow rates, respectively. There are also implicit constraints between the simulated pressure
Ps and the simulated pipe flow
Qs, i.e., the hydraulic balance equations (i.e., nodal continuity equation, basic loop energy equation, and Bernoulli’s equation) of the network itself need to be met.
The process of identifying the resistance characteristics of the ACWS network based on the cuckoo search algorithm is as follows:
Step 1: Build a pipe network simulation model based on deterministic parameters.
Step 2: Set parameters such as population size, discovery probability Pa, maximum number of iterations N of the algorithm, and random initialization of bird’s nest locations, with each set of bird’s nest locations representing a set of pipe resistance characteristic coefficients to be identified.
Step 3: Substitute each nesting position into the pipe network simulation model to calculate the objective function value of each nesting position (i.e., each set of pipe resistance characteristic coefficients), and compare them to obtain the current optimal nesting position and the optimal objective function value.
Step 4: Keep the optimal nest location in the previous generation, update the nest locations other than the optimal nest using Lévy flight, and calculate the corresponding objective function value, compare the obtained objective function value with the current optimal value, and update the current optimal objective function value [
21].
Step 5: Compare the random number r with the discovery probability Pa. If r > Pa, change the nest location once randomly; if not, keep it the same. Finally, retain the optimal set of nest locations.
Step 6: If the maximum number of iteration generations has been reached or the search precision requirement has been met, continue to the next step; otherwise, return to Step 4
Step 7: Output the global optimal nest location, which is the optimal resistance coefficient of the pipe network in this search process.
The optimal results obtained according to the above steps are used as the pipe network resistance coefficients of the hydraulic model, making the hydraulic model more accurate and closer to the actual operation of the system.
2.2.3. Adam Optimization Algorithm for the LFD Model
“BP neural network” usually refers to multilayer feedforward neural networks trained with the error backpropagation (BP) algorithm. BP neural networks have been widely used in many engineering fields—such as pattern recognition, intelligent control, fault diagnosis, image recognition processing, and optimization computation—due to their nonlinear mapping capability, self-learning and self-adaptive capability, and generalization capability.
The Adam (adaptive moment estimation) optimization algorithm is an improved algorithm for traditional BP neural networks, which adopts independent adaptive learning rates for different parameters by calculating the first-order moment estimation and second-order moment estimation of the gradient during the training of the neural network [
22]. It has been experimentally shown that neural networks based on the Adam optimization algorithm not only have faster training speed compared to other stochastic optimization methods, but also do not easily fall into local optima, and have excellent performance in practice. Therefore, this study uses the Adam optimization algorithm as the kernel for the LFD model of the ACWS.
This paper adopts the concept of hierarchy in the structure of the LFD model [
23]. On the one hand, the ACWS undertakes the building’s heat and cold load, and there are a variety of control methods, such as fixed-flow and variable-flow systems, variable-flow systems that contain the supply and return main-fixed temperature control systems, supply and return main-fixed differential pressure control systems, and the most unfavorable end-fixed differential pressure control systems. The control system is complex; on the other hand, the length of each pipe section in the ACWS is unevenly distributed, and the number of stages varies greatly—the long pipes may be hundreds of meters, while the short pipes may only be one or two meters. If all the pipes are diagnosed with leakage faults, this will affect the diagnosis time and reduce efficiency, while there is research showing that two-stage fault diagnosis, compared to single-fault diagnosis (a single diagnosis to identify the section of the leaky pipe and the leakage location), has higher diagnostic accuracy as well as relatively less training time [
24], which not only reduces the complexity of fault diagnosis and the training time of diagnosis, but can also adjust the fault diagnosis process and improve the efficiency of fault diagnosis according to the user’s needs in the actual application process. Therefore, this paper uses the two-stage LFD model for fault diagnosis of the ACWS pipe network.
The leakage conditions are simulated by the improved hydraulic model, and the sample datasets under different conditions are obtained. Then, the two-stage LFD model is trained by setting the parameters of the Adam optimization algorithm (such as the number of hidden layer nodes, the activation function of the hidden layer, and the regularization parameter). The training and testing process of the neural network was achieved in this study using the Python programming language.
2.2.4. LFD Model Performance Evaluation Indicators
In order to verify the application effect of the LFD model, it is also necessary to introduce indicators to measure the performance of the two-stage LFD model [
25]. Since the two-stage LFD models solve different types of problems, different performance evaluation indicators need to be used, as shown in
Table 1.
First-stage diagnosis is a typical multiple-classification task, so it uses the model performance evaluation indicators commonly used for classification tasks: precision, recall, and F1 score. For the binary classification task, the samples can be classified into four cases according to the combination of true and predicted categories: TP (true positive), FP (false positive), TN (true negative), and FN (false negative).
Second-stage diagnosis is a typical regression task, so its performance needs to be evaluated using different evaluation indicators from first-stage leakage diagnosis. The commonly used performance evaluation indicators for regression tasks are shown in
Table 1, where m denotes the total number of samples,
represents the true marker of
,
represents the prediction result of the learner for
, and
represents the average of the m sets of true values.
2.3. Case Study
Taking a Guangzhou (China) metro station’s ACWS system pipe network project as an example, the ACWS form is a primary pump variable-flow system with fixed differential pressure control for the supply and return mains. The chilled water system has a supply and return water temperature of 10 and 17 °C, respectively. The system pressure point is set at the entrance of the circulating water pump, and the pressure is 32.3 kPa. Pressure sensors are set for the cold source and each terminal device’s import and export, and flow sensors are set for the chilled water main pipe and each terminal device’s return branch pipe.
In order to model the actual pipe network system on the Dymola platform, the system needs to be reasonably simplified, as follows: ① the chiller, the pump, and other equipment in the room are combined into one node (cold source); ② if two pipes are connected and there is no node in the middle, the two pipes are combined into the same pipe; ③ the local resistance of the fittings in the pipe is expressed using the length of the straight pipe section of the same diameter as the connected pipe (i.e., the local resistance’s equivalent length). The supply and return water system, with pipe section numbers, is shown in
Figure 5.
The case pipe network includes 1 cold source (S), 9 terminal devices (T1–T9), 30 pipes (pipe1–pipe30), and 31 sensor monitoring points (11 flow sensors and 20 pressure sensors), where the basic parameters of each pipe section are shown in
Figure 6.
The cuckoo search algorithm was used to identify the resistance characteristics of the case pipe network, and the parameters are shown in
Table 2. The training curves of the optimization algorithms show that when the number of iterations reaches 100, the average and optimal fitness values of the algorithms no longer decrease significantly, and the algorithms can be considered to have reached convergence. In order to avoid the random error in the single identification process, the algorithm was operated independently 10 times, and the average value of the 10 identification results was taken as the final result of the identification of the resistance characteristics of the pipe network.
A sufficient number of training samples is a prerequisite for a satisfactory diagnostic performance of a pipe network LFD model, and the more comprehensive the leakage conditions contained, the more abundant the training data, and the better the performance of the final training diagnostic model. However, it is very difficult—almost impossible—to obtain a large and comprehensive set of fault condition data via experimental testing or historical data logging for the ACWS network in this case. Therefore, the Dymola model simulation was used to obtain the data samples required for the training of the LFD model. The simulated leakage conditions were as follows: for each pipe leak point setting in the case study, the ratio of the distance from the start of the pipe section to the total pipe length was selected as 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, or 0.95, while the ratio of the possible leakage volume from the total circulating water volume was selected as 1%, 1.5%, 2%, 2.5%, 3%, 3.5%, 4%, 4.5%, or 5%.
According to the above setting conditions, for the 30 pipes in the case pipe network system, each pipe has 19 possible leakage points, and each leakage point can have 9 different degrees of leakage. For each leakage working condition, 5130 sets of simulated data samples can be obtained, one by one. At the same time, taking into account the random error of the sensor measurement process in the actual case, a certain amount of artificial noise is added to the original data generated by the simulation model, and the artificially added noise X follows a normal distribution with a mean of 0 and a standard deviation of σ. The accuracy level of the case pipe network sensor is 0.2%FS (full-scale, range), and according to the “3σ” criterion of normal distribution, σ is taken as 1/3 of 0.2% FS.
In the settings of the first-stage LFD model, all data samples are randomly divided into a training set and a test set at a ratio of 9:1. The random partitioning process takes the form of stratified sampling. The training set is used to train the BP neural network model, while the test set is used to replace the fault data monitored in the actual case. The neural network adopts a single-hidden-layer structure. The parameter settings of the Adam optimization BP neural network algorithm used for the first-stage LFD model are presented in
Table 3.
In the settings of the second-stage LFD model, the length threshold θL = 50 m is set as the basis for determining whether to perform secondary diagnosis of leaks according to the conditions of the case system. The output of the second-stage LFD model is the exact location of the leakage point in the ACWS, which is expressed as the distance of the leakage point from the beginning of the pipe section/the total length of the leakage pipe. Due to the fact that the second-stage LFD model is also based on the BP neural network model, its training and testing methods are essentially the same as those of the first-stage LFD model. Some of the settings are different, as follows: the training and testing sets are randomly divided at a ratio of 7:3, and the activation function is a ReLU function.