A pipeline transient flow forward prediction method, device, equipment and medium

By constructing and training a positive prediction model for transient flow in pipelines, and combining pipeline parameters and boundary constraints, the problem of low prediction efficiency for transient flow in pipelines is solved, achieving efficient and accurate prediction of pipeline head and flow rate, and avoiding the need for fine mesh generation.

CN121031396BActive Publication Date: 2026-02-17YANGJIANG NUCLEAR POWER +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511577538.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-31
Publication Date
2026-02-17
Estimated Expiration
2045-10-31

AI Technical Summary

Technical Problem

In predicting transient flow in pipelines, existing technologies struggle to improve prediction efficiency under complex boundary conditions and large solution domains, resulting in low computational efficiency.

Method used

An initial positive prediction model for transient flow in a pipeline is constructed. The loss is calculated by simulating the loss using training samples and pipeline parameters. The model is then trained by combining boundary constraints to obtain a well-trained positive prediction model for transient flow in a pipeline. Spatiotemporal sequence data is used for prediction to avoid fine mesh partitioning.

Benefits of technology

It improves the efficiency of pipeline transient flow prediction, ensures that the model learns the real physical laws even with missing data, achieves efficient and accurate prediction of unknown nodes, and reduces the need for large amounts of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121031396B_ABST
    Figure CN121031396B_ABST
Patent Text Reader

Abstract

This application relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device, and medium for forward prediction of transient flow in pipelines. In this application, based on a constraint model and boundary constraints that constrain the head and flow rate of the pipeline, the loss of the initial forward prediction model for transient flow in the pipeline is calculated. This ensures that even when the head and flow rate of the pipeline are missing, the model can learn the physical laws implicit in the real data, efficiently and accurately predicting the head and flow rate of the pipeline at unknown nodes. The prediction of the pipeline head and flow rate is based on the spatial and temporal coordinates of the pipeline configuration points. Prediction based on spatiotemporal sequence data eliminates the need for more refined grid division of the data, thereby improving the corresponding prediction efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and in particular to a pipe transient flow forward prediction method, device, equipment and medium. BACKGROUND

[0002] With the development of contemporary big data and big computing power technology, deep learning (DL) has developed. The breakthrough of deep neural networks, combined with the improvement of GPU computing power, further enables DL algorithms to automatically learn complex features from data. Currently, DL has shown strong computing and recognition capabilities in image recognition, natural language processing, autonomous driving, etc., but it relies on large-scale data sets for training, and in the problem of pipe transient flow prediction, the data size often cannot meet this training requirement. The physical laws contained in the problem of hydraulics can mostly be represented by partial differential equations. In order to solve these equation systems, numerical solution methods such as finite volume method and finite difference method have been developed and applied. They take the discretization of the control equation as the core, divide the continuous physical domain into a finite number of discrete units through meshing, and then discretize the differential form of the physical law, and finally convert it into an algebraic equation system, which is solved by numerical iteration to obtain the physical quantity of each discrete unit. Numerical solution algorithms have highly optimized parallel algorithms (such as MPI distributed computing and GPU acceleration) in mature scenarios such as "regular geometry, standard equation", and the computing efficiency is extremely high, but when the boundary conditions are complex or the solution domain is too large, in order to ensure the solution accuracy, the numerical algorithm must be more finely meshed, which will greatly reduce the computing efficiency and make it difficult to obtain real-time prediction results. Therefore, in the problem of pipe transient flow prediction, how to improve the efficiency of pipe transient flow prediction has become a problem that needs to be solved. SUMMARY

[0003] In view of this, the embodiments of the present application provide a pipe transient flow forward prediction method, device, equipment and medium to solve the problem of low pipe transient flow prediction efficiency in the problem of pipe transient flow prediction.

[0004] In a first aspect, the embodiments of the present application provide a pipe transient flow forward prediction method, which comprises:

[0005] An initial pipe transient flow forward prediction model and a training sample are constructed, the training sample is input into the initial pipe transient flow forward prediction model, and a sample predicted water head and a sample predicted flow rate are output, wherein the input of the initial pipe transient flow forward prediction model is a spatial coordinate and a time, and the output is a water head and a flow rate, and the training sample is a sampling spatial coordinate and a sampling time of N sampling points determined from a pipe to be predicted, N being an integer greater than zero;

[0006] obtain pipeline parameters of the to-be-predicted pipeline, simulate the to-be-predicted pipeline according to the pipeline parameters, and obtain an initial pipeline model; and calculate a first loss according to the initial pipeline model, the sample predicted water head, and the sample predicted flow rate;

[0007] train the initial pipeline transient flow forward prediction model according to the first loss, and obtain a trained pipeline transient flow forward prediction model;

[0008] obtain real-time coordinates representing positions of to-be-measured points on the to-be-predicted pipeline and real-time time representing water flow from an inlet of the to-be-predicted pipeline to the to-be-measured points, input the real-time coordinates and the real-time time into the trained pipeline transient flow forward prediction model, and output pipeline transient flow forward prediction results representing water head and flow rate.

[0009] In a second aspect, an embodiment of the present application provides a pipeline transient flow forward prediction device, which comprises:

[0010] a construction module, configured to construct an initial pipeline transient flow forward prediction model and a training sample, input the training sample into the initial pipeline transient flow forward prediction model, and output a sample predicted water head and a sample predicted flow rate, wherein an input of the initial pipeline transient flow forward prediction model is spatial coordinates and time, and an output of the initial pipeline transient flow forward prediction model is water head and flow rate, and the training sample is sampling spatial coordinates and sampling time of N sampling points determined from a to-be-predicted pipeline, N being an integer greater than zero;

[0011] a first calculation module, configured to obtain pipeline parameters of the to-be-predicted pipeline, simulate the to-be-predicted pipeline according to the pipeline parameters, and obtain an initial pipeline model, and calculate a first loss according to the initial pipeline model, the sample predicted water head, and the sample predicted flow rate;

[0012] a first training module, configured to train the initial pipeline transient flow forward prediction model according to the first loss, and obtain a trained pipeline transient flow forward prediction model;

[0013] an output module, configured to obtain real-time coordinates representing positions of to-be-measured points on the to-be-predicted pipeline and real-time time representing water flow from an inlet of the to-be-predicted pipeline to the to-be-measured points, input the real-time coordinates and the real-time time into the trained pipeline transient flow forward prediction model, and output pipeline transient flow forward prediction results representing water head and flow rate.

[0014] In a third aspect, an embodiment of the present application provides a computer device, which comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the pipe transient flow forward prediction method according to the first aspect when executing the computer program.

[0015] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the pipe transient flow forward prediction method according to the first aspect.

[0016] Compared with the prior art, the present application has the following beneficial effects:

[0017] In the present application, the loss of the initial pipe transient flow forward prediction model is calculated according to the constraint model and the boundary constraint condition for constraining the water head and flow of the pipe, so that the model can learn the physical law implied by the real data and efficiently and accurately predict the unknown node pipe water head and flow in the case of missing pipe water head and flow. The pipe water head and flow are predicted according to the spatial coordinates and time coordinates of the pipe configuration points, and the prediction is based on the space-time sequence data, so that more fine grid division of the data is not required, thereby improving the prediction efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0019] Figure 1 is an application environment schematic diagram of a pipe transient flow forward prediction method provided by an embodiment of the present application;

[0020] Figure 2 is a flow schematic diagram of a pipe transient flow forward prediction method provided by an embodiment of the present application;

[0021] Figure 3 is a comparison diagram of a prediction result and a reference value based on the method provided by an embodiment of the present application;

[0022] Figure 4 is a structural schematic diagram of a pipe transient flow forward prediction device provided by an embodiment of the present application;

[0023] Figure 5 is a structural schematic diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0024] The technical solutions in the embodiments of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0025] In the following description, specific details are set forth in connection with the particular systems, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. However, persons skilled in the art will appreciate that they can be practiced without

[0026] It should be understood that the term "comprising" as used in the specification and in the claims indicates the presence of the recited features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0027] It should also be understood that the term "and / or" as used in the specification and in the claims indicates any combination of one or more of the associated listed items and all possible combinations of those items.

[0028] As used in the specification and in the claims, the term "if" can be interpreted as meaning "when" or "once" or "in response to a determination" or "in response to a detection" depending on the context. Similarly, the phrase "if determined" or "if detected [the described condition or event]" can be interpreted to mean "once determined" or "in response to a determination" or "once detected [the described condition or event]" or "in response to a detection [the described condition or event]" depending on the context.

[0029] In addition, in the description of the specification and the appended claims, the terms "first", "second", "third", etc. are only used for differentiation in description, and cannot be understood as indicating or implying relative importance.

[0030] Reference within the specification to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places within the specification are not necessarily all referring to the same embodiment, although it can. The terms "including," "comprising," "having" and variations thereof are meant to encompass the items listed thereafter and equivalents thereof as well as additional items. Unless specified otherwise, the terms "connected," "coupled," and "pathway" are used broadly and encompass both direct and indirect connections, couplings, and pathways.

[0031] Embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0032] The basic technology of artificial intelligence generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. The software technology of artificial intelligence mainly includes computer vision technology, robot technology, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc.

[0033] It should be understood that the size of the serial number of each step in the following embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0034] In order to illustrate the technical solutions of the present application, the following will be described by specific embodiments.

[0035] An embodiment of the present application provides a pipe transient flow forward prediction method, which can be applied to, for example Figure 1The application environment is a client-server application environment, in which a client communicates with a server. The client includes, but is not limited to, a palmtop computer, a desktop computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cloud computer device, a personal digital assistant (PDA), and the like. The server can be a standalone server or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, a content delivery network (CDN), and a big data and artificial intelligence platform, and the like.

[0036] In order to illustrate the technical solutions of the present application, specific examples are used in the following description.

[0037] Referring to Figure 2 is a flowchart of a pipe transient flow forward prediction method provided by an embodiment of the present application, as shown in Figure 2 The pipe transient flow forward prediction method can include the following steps.

[0038] S201: An initial pipe transient flow forward prediction model and a training sample are constructed, the training sample is input into the initial pipe transient flow forward prediction model, and a sample predicted head and a sample predicted flow are output, wherein the input of the initial pipe transient flow forward prediction model is a spatial coordinate and a time, the output is a head and a flow, the training sample is a sampling spatial coordinate and a sampling time of N sampling points determined from a pipe to be predicted, and N is an integer greater than zero.

[0039] In step S201, the initial pipe transient flow forward prediction model is a neural network model, the type of the neural network model is a fully connected neural network, and the training sample is a sampling spatial coordinate and a sampling time of N sampling points determined from the pipe to be predicted, wherein the sampling spatial coordinate is the position of the sampling point on the pipe to be predicted, and the sampling time is the time of the water flow from the inlet of the pipe to be predicted to the sampling point.

[0040] In this embodiment, the initial pipe transient flow forward prediction model is constructed, wherein the initial pipe transient flow forward prediction model contains 6 hidden layers, the number of neurons in each layer is 50, and the type of the activation function is tanh. The forward propagation process is as follows:

[0041]

[0042] wherein, and respectively represent the first a weight matrix and a bias vector of the layer, is an activation function.

[0043] The output layer adopts a double-output structure, corresponding to water head and flow rate prediction respectively:

[0044]

[0045] wherein, and respectively represent the prediction of the water head and the flow rate of the neural network at the sampling point , and is the set of all network parameters.

[0046] To ensure effective training of the network, the weight matrix is initialized by the Glorot normal method, that is:

[0047] (7)

[0048] wherein and are the number of neurons of the i-th layer and the (i+1)-th layer respectively. The bias vector is initialized as a zero vector. The set of configuration points is input into the network in sequence, and the corresponding prediction results

[0049] , are obtained through the above calculation process. In the embodiment, the sampling space coordinates and the sampling time of the N sampling points determined from the pipeline to be predicted are taken as training samples, wherein N is 2000, and can also be other numerical values, which are not limited in the embodiment. The training samples are input into the initial pipeline transient flow forward prediction model, and the sample predicted water head and the sample predicted flow rate are output.

[0050] It should be noted that the neural network corresponding to the initial pipeline transient flow forward prediction model is composed of 8 layers, wherein the 0-th layer is the input layer, the 7-th layer is the output layer, the input of the i-th layer network is the weighted sum of the (i-1)-th layer network under the weight and bias coefficient, and then the output value of the layer is obtained by activating through the activation function.

[0051] It should be noted that when the N sampling points determined from the pipeline to be predicted are used, the Latin hypercube sampling method can be used for sampling, which can ensure that the sampling points of each dimension are uniformly covered, and at the same time, the "sample sparsity" problem of traditional random sampling in high dimension can be avoided.

[0052] It should be noted that when the N sampling points determined from the pipeline to be predicted are used, the Latin hypercube sampling method can be used for sampling, which can ensure that the sampling points of each dimension are uniformly covered, and at the same time, the "sample sparsity" problem of traditional random sampling in high dimension can be avoided.

[0053] ​In this embodiment, an initial pipe transient flow forward prediction model is constructed, the input of the initial pipe transient flow forward prediction model is spatial coordinates and time, and the initial pipe transient flow forward prediction model can efficiently output a full sequence of pipe water head and flow.

[0054] In step S202, the pipe parameters of the to-be-predicted pipe are obtained, the to-be-predicted pipe is simulated according to the pipe parameters, an initial pipe model is obtained, and a first loss is calculated according to the initial pipe model, the sample predicted water head, and the sample predicted flow.

[0055] In step S202, the pipe parameters of the to-be-predicted pipe are obtained, the to-be-predicted pipe is simulated according to the pipe parameters, an initial pipe model is obtained, and a first loss is calculated according to the initial pipe model, the sample predicted water head, and the sample predicted flow. Pipe The inner diameter of the to-be-predicted pipe, the water hammer wave speed, and the like. The to-be-predicted pipe is simulated to obtain an initial pipe model. According to the initial pipe model, the sample predicted water head, and the sample predicted flow, a first loss is calculated, wherein the first loss is a loss under the constraint of the initial pipe model.

[0056] In this embodiment, the pipe parameters of the to-be-predicted pipe are obtained, the to-be-predicted pipe is simulated according to the pipe parameters, an initial pipe model is obtained, and the formula of the initial pipe model is as follows:

[0057]

[0058]

[0059] Among them, is the pipe cross-sectional area of the to-be-predicted pipe, is the sampling spatial coordinates of the sampling point, is the sampling point flow, is the gravitational acceleration, is the water head of the sampling point, is the friction coefficient, is Pipe , is the inner diameter of the to-be-predicted pipe, is the water hammer wave speed. The formula for calculating the water hammer wave speed is as follows:

[0060]

[0061] Among them, is the water hammer wave speed, is the bulk modulus of the fluid, is the Young's modulus of the pipe material, is the wall thickness of the to-be-predicted pipe. is the inner diameter of the to-be-predicted pipe, The density of water. In this embodiment, the length of the pipe to be predicted is 500. The inner diameter of the pipe to be predicted is 1.81. The water hammer wave velocity is set to 1000. And it remains constant, with a friction coefficient of 0.012, and the maximum flow rate when the gate is fully open is 0.314. The positive prediction time is 10. The default unit for water head is set to .

[0062] It should be noted that the initial pipeline model is obtained by simulating the pipeline to be predicted based on the basic equations of water hammer.

[0063] In this embodiment, the initial pipeline model is used as a constraint condition to constrain the sample predicted head and sample predicted flow rate, and the corresponding loss is calculated. Based on the initial pipeline model, sample predicted head, and sample predicted flow rate, the first loss is calculated using the following formula:

[0064]

[0065] in, The first loss, The number of sampling points. The sampling spatial coordinates and sampling time for each sampling point. For the initial pipeline model, the parameters of the forward prediction model for transient flow in the initial pipeline are... The output results are as follows. The sample predicted head and sample predicted flow rate are input into the initial pipeline model, as shown below:

[0066]

[0067]

[0068]

[0069] in, Let i be the sampling space coordinates of the i-th sampling point. Let i be the sampling time for the i-th sampling point. Predict flow rate for the sample. These are the predicted head values ​​for the samples.

[0070] In this embodiment, the first loss is calculated based on the initial pipeline model, the predicted head, and the predicted flow rate of the samples. Loss calculation is not performed using measured data. The loss is constrained by physical equations, which significantly reduces the data requirement by replacing some data information with universal physical laws. Furthermore, the head / flow rate distribution of the entire pipeline can be "derived" from sparse data using the equations of transient flow in the pipeline, avoiding prediction distortion caused by data gaps.

[0071] S203: training the initial pipe transient flow forward prediction model according to the first loss to obtain a trained pipe transient flow forward prediction model.

[0072] In step S203, the initial pipe transient flow forward prediction model is trained according to the first loss, and the parameters in the initial pipe transient flow forward prediction model are adjusted to obtain a trained pipe transient flow forward prediction model.

[0073] In this embodiment, the gradient of the first loss with respect to each pipe transient flow forward prediction model parameter is calculated, and the parameters are adjusted according to the gradient (such as w = w - learning rate x gradient) at a learning rate to reduce the loss in the next round until the value of the first loss is less than a preset threshold, or the first loss converges, or the number of training reaches a preset number threshold, and the training is stopped to obtain a trained pipe transient flow forward prediction model.

[0074] In this embodiment, the initial pipe transient flow forward prediction model is trained according to the first loss, so as to train the initial pipe model based on the constraint of the initial pipe model, so that the sample predicted head and sample predicted flow output by the trained pipe transient flow forward prediction model can satisfy the initial pipe model, and the physical meaning of the trained pipe transient flow forward prediction model is improved.

[0075] Optionally, training the initial pipe transient flow forward prediction model to obtain a trained pipe transient flow forward prediction model further comprises:

[0076] obtaining a boundary constraint condition of the pipe to be predicted, and calculating a second loss according to the boundary constraint condition and the output result of the initial pipe transient flow forward prediction model under the boundary constraint condition;

[0077] According to the first loss and the second loss, a target loss is calculated.

[0078] According to the target loss, the initial pipe transient flow forward prediction model is trained to obtain a trained pipe transient flow forward prediction model.

[0079] In this embodiment, the boundary constraint condition of the pipe to be predicted is obtained, wherein the boundary constraint condition includes a spatial constraint condition and a time constraint condition. The second loss is calculated according to the boundary constraint condition and the output result of the boundary initial pipe transient flow forward prediction model under the boundary constraint condition, wherein the output result of the boundary initial pipe transient flow forward prediction model under the boundary constraint condition includes the sample predicted head and sample predicted flow of the corresponding sampling point under the boundary constraint condition.

[0080] According to the boundary constraint condition, a boundary training sample is constructed, the boundary training sample is input into an initial pipe transient flow forward prediction model, and a boundary sample predicted water head and a boundary sample predicted flow are output. The boundary training sample is a sampling point at a boundary of a pipe to be predicted.

[0081] The boundary constraint condition includes a space constraint condition and a time constraint condition.

[0082] The formula of the space constraint condition is as follows:

[0083]

[0084]

[0085] wherein, is an upstream pressure boundary of the pipe to be predicted, is a position of the upstream pressure boundary, is a downstream flow boundary of the pipe to be predicted, is a position of the downstream flow boundary, is a flow value at the position of the downstream flow boundary. It should be noted that, , and are determined according to actual conditions, for example, is 100 m, is 500 m, is .

[0086] The formula of the time constraint condition is as follows:

[0087]

[0088] wherein, is a flow at a start time, is a flow value at the start time. is determined according to actual conditions, for example, is 0.314 .

[0089] When the second loss is calculated according to the boundary constraint condition and the output result of the initial pipe transient flow forward prediction model under the boundary constraint condition, first, the sampling point, i.e., the boundary training sample, is determined according to the constraint condition. For example, at the upstream pressure boundary x=0 =100 m (space boundary), at the initial t=0 = 0 (time boundary), Q = 0.314 m3 / s at x = 100 m downstream. The sampling points under spatial constraints can be (x = 0, t), such as 10 points, (x = 100, t) (t e [0, 10 s]. The sampling points under time constraints can be (x, t = 0) (x e [0, 100 m], etc.

[0090] The boundary training sample is input into the initial pipe transient flow forward prediction model, and the boundary sample predicted head and the boundary sample predicted flow are output. According to the boundary sample predicted head and the boundary sample predicted flow, and the constraint value under the corresponding boundary constraint condition, the second loss is calculated.

[0091] It should be noted that the second loss includes a spatial constraint loss and a time constraint loss. The spatial constraint loss can make the boundary sample predicted head and the boundary sample predicted flow output by the initial pipe transient flow forward prediction model satisfy the head and flow under the spatial constraint condition as much as possible. That is, at the corresponding sampling point, the output boundary sample predicted head is as close as possible to , and the output boundary sample predicted flow is as close as possible to . The time constraint loss can make the boundary sample predicted head and the boundary sample predicted flow output by the initial pipe transient flow forward prediction model satisfy the head and flow under the time constraint condition as much as possible. That is, at the corresponding sampling point, the output boundary sample predicted flow is as close as possible to .

[0092] The spatial constraint loss calculation formula is as follows:

[0093]

[0094] wherein, is the spatial constraint loss, is the number of sampling points under the spatial boundary constraint, that is, the number of sampling points at the upstream pressure boundary and the downstream flow boundary, is the sampling point under the spatial boundary constraint, is the initial pipe transient flow forward prediction model output result, including the boundary sample predicted head and the boundary sample predicted flow, wherein the sampling point is satisfies the spatial constraint condition, that is, or . is the head and flow at the sampling point under the spatial boundary constraint, .

[0095] The time constraint loss calculation formula is as follows:

[0096]

[0097] wherein, is a time constraint loss, is a number of sampling points under a time boundary constraint, i.e., a number of sampling points at a start time, is a number of sampling points under a space boundary constraint, is an initial pipe transient flow forward prediction model output result at time t, including a boundary sample predicted water head and a boundary sample predicted flow, wherein a sampling point is satisfies a time constraint condition. is a number of sampling points under a time boundary constraint, is an initial flow at time t, as .

[0098] The space constraint loss and the time constraint loss are added to obtain a second loss.

[0099] In this embodiment, the second loss is calculated according to the boundary constraint condition and the output result of the initial pipe transient flow forward prediction model under the boundary constraint condition. In order to use the second loss for boundary constraint, guide the network to quickly converge to the correct solution, and improve the training efficiency.

[0100] When the target loss is calculated according to the first loss and the second loss, the first loss and the second loss can be added to obtain the target loss. The initial pipe transient flow forward prediction model is trained according to the target loss to obtain the trained pipe transient flow forward prediction model. During training, the gradient of the target loss to each pipe transient flow forward prediction model parameter is calculated, and the parameter is adjusted according to the gradient (such as w = w - learning rate × gradient) at a “learning rate”, which reduces the loss of the next round, until the value of the target loss is less than a preset threshold, or the target loss converges, or the training times reach a preset number of times threshold, and the training is stopped to obtain the trained pipe transient flow forward prediction model.

[0101] In this embodiment, the first loss and the second loss are combined to train the initial pipe transient flow forward prediction model to improve the physical meaning of the trained pipe transient flow forward prediction model.

[0102] Optionally, the target loss is calculated according to the first loss and the second loss, including:

[0103] A second weight value of the second loss is calculated according to the second loss and the boundary constraint condition;

[0104] A first weight value of the first loss is calculated according to a difference between the second weight value and 1;

[0105] The first loss and the second loss are weighted and summed according to the first weight value and the second weight value to calculate the target loss.

[0106] In this embodiment, corresponding weight values ​​are dynamically assigned to the first loss and the second loss, so that the weight values ​​of the first loss and the second loss are adjusted with the number of training iterations, thereby avoiding the weights being dominated by a loss of a large magnitude. Based on the second loss and boundary constraints, the second weight value of the second loss is calculated. When calculating the second weight value of the second loss, since the initial stage of training the initial pipeline transient flow forward prediction model requires forcing the model to satisfy boundary conditions to avoid non-physical interpretations, a relatively large value is set for the second loss weight value. This can be based on the boundary conditions... The initial head at t=0 and the corresponding losses at the initial flow rate at t=0 are set. Calculation. The initial head and the corresponding initial pipe transient flow positive prediction model at that time The first absolute value of the difference between the boundary sample predicted head at t=0 and the corresponding initial pipeline transient flow forward prediction model at t=0. The second absolute value of the difference between the output boundary sample predicted flow is used to normalize the first and second absolute values, resulting in normalized first and second absolute values. The sum of these normalized first and second absolute values ​​is then calculated and classified. A larger sum corresponds to a higher classification level and a larger second weight value. For example, a classification level of 3 corresponds to a weight of 0.8, and a classification level of 2 corresponds to a weight of 0.6, and so on. As the initial pipeline transient flow forward prediction model is trained, the second loss decreases, and the corresponding second weight value decreases. The first weight value of the first loss is calculated based on the difference between the second weight value and 1. Finally, the target loss is calculated by weighted summing of the first and second losses based on the first and second weight values.

[0107] In another embodiment, classification can also be performed based on the value of the second loss. The larger the value, the higher the corresponding classification level. The higher the classification level, the larger the corresponding weight value. For example, a classification level of 3 corresponds to a weight value of 0.8, and a classification level of 2 corresponds to a weight value of 0.6, etc. The first weight value of the first loss is calculated based on the difference between the second weight value and 1. The first loss and the second loss are then weighted and summed to calculate the target loss.

[0108] In this embodiment, the weights of the first loss and the second loss are dynamically allocated, allowing the model to adapt to the core contradictions throughout the entire training cycle. This avoids the rigidity and limitations of static weights while also taking into account the physical reality of the boundary constraints and the consistency of the equation fitting rules, ultimately achieving a model output that is "faster convergent, more accurate, and more in line with engineering needs".

[0109] Optionally, the initial pipeline transient flow forward prediction model is trained based on the first loss to obtain a trained pipeline transient flow forward prediction model, including:

[0110] The Adam optimizer updates the parameters of the initial pipeline transient flow forward prediction model to minimize the first loss, thus obtaining the trained pipeline transient flow forward prediction model.

[0111] In this embodiment, the parameters of the initial pipeline transient flow forward prediction model are updated based on the Adam optimizer. This method revolves around the "statistical properties of gradients," with the core being the calculation of two key exponential moving averages (EMAs), followed by bias correction to obtain a reliable update direction and step size. The process is as follows:

[0112] The formula for calculating the first moment is as follows:

[0113]

[0114] in, Represents the first moment of the previous training round. Representing the In the first round of iterations, the first loss pairs the parameters The gradient. This represents the EMA decay coefficient. Since the gradient of the first loss may fluctuate frequently during iterations, it is directly used... Updating the parameters will cause the oscillation to converge more slowly. Therefore, By accumulating historical gradient directions, it is equivalent to adding inertia to parameter updates, making the update direction more stable and smooth.

[0115] The formula for calculating the second moment is as follows:

[0116]

[0117] in, This represents the second moment from the previous training iteration. By statistically calculating the square of the gradient, the second moment dynamically adjusts the step size in subsequent updates. This "adaptive step size" solves the problem of "uniform learning rate," allowing each parameter to converge to its optimal value at the "most suitable speed."

[0118] Deviation correction:

[0119] because and The initial values ​​are all 0, and , When the value is close to 1, the EMA estimate in the early stages of the iteration will have a systematic bias. To correct this bias, Adam introduces a bias correction term:

[0120]

[0121] wherein the corrected of can be closer to the true gradient direction and fluctuation amplitude at the beginning of iteration, avoiding convergence lag or oscillation caused by unreasonable initial step size.

[0122] Parameter update:

[0123]

[0124] wherein, is the learning rate, which is set to 0.001 in this example, and in order to prevent from being 0, a small number =10-8 is introduced.

[0125] The parameters of the initial pipe transient flow forward prediction model are updated by the Adam optimizer to minimize the value of the first loss, and a trained pipe transient flow forward prediction model is obtained.

[0126] In this application, the loss of the initial pipe transient flow forward prediction model is calculated according to the constraint model and boundary constraint condition for constraining the head and flow of the pipe, which can ensure that the model can learn the physical law implied by the real data and accurately predict the unknown node pipe head and flow in the case of missing pipe head and flow. According to the spatial coordinates and time coordinates of the pipe configuration points, the pipe head and flow are predicted based on the spatiotemporal sequence data, without the need for more detailed grid division of the data, thereby improving the prediction efficiency.

[0127] S204: Obtain real-time coordinates representing the position of the to-be-measured point on the to-be-predicted pipe, and real-time time representing the water flow from the entrance of the to-be-predicted pipe to the to-be-measured point. The real-time coordinates and the real-time time are input into the trained pipe transient flow forward prediction model to output the pipe transient flow forward prediction result representing the head and flow.

[0128] In step 204, the real-time coordinates and the real-time time are used to predict the head and flow at the to-be-measured point. The real-time coordinates and the real-time time are input into the trained pipe transient flow forward prediction model to output the pipe transient flow forward prediction result representing the head and flow.

[0129] In this embodiment, the real-time coordinates and real-time time are input into the trained pipe transient flow forward prediction model, and the pipe transient flow forward prediction results representing the water head and flow rate are output. If there are multiple to-be-measured points in the to-be-predicted pipe, the real-time coordinates and real-time time of each to-be-measured point are sequentially input into the trained pipe transient flow forward prediction model, and the pipe transient flow forward prediction results representing the water head and flow rate of each to-be-measured point are output. The pipe transient flow forward prediction results of each to-be-measured point are visualized, and a cross-sectional view or a three-dimensional curved surface view can be drawn, wherein the drawing tool used in this embodiment is matlab. The pipe transient flow forward prediction results of each to-be-measured point are visualized, so that the change process of the water head and flow rate in the to-be-predicted pipe transient flow can be accurately obtained, and a continuous solution in the space-time domain can be obtained. As shown in Figure 3 , referring to Figure 3 , it is a comparison chart of the prediction results based on the method of the present application and the reference values provided by an embodiment of the present application. Wherein h-pre is the prediction result based on the method of the present application, and h-ref is the reference value, i.e. the values of each to-be-measured point obtained in advance, wherein the horizontal coordinate is time, the unit is h, and the vertical coordinate is water head, the unit is m.

[0130] In this application, according to the constraint model and boundary constraint condition for constraining the water head and flow rate of the pipe, the loss of the initial pipe transient flow forward prediction model is calculated, which can ensure that the model can learn the physical law implied by the real data and accurately predict the unknown node pipe water head and flow rate in the case of missing pipe water head and flow rate. According to the spatial coordinates and time coordinates of the pipe configuration points, the water head and flow rate of the pipe are predicted, and the prediction is based on the space-time sequence data, without the need for more detailed grid division of the data, thereby improving the prediction efficiency.

[0131] Please refer to Figure 4 , Figure 4 is a structural schematic diagram of a pipe transient flow forward prediction device provided by an embodiment of the present application. The pipe transient flow forward prediction device corresponds to the pipe transient flow forward prediction method in the above embodiment. Please refer to the related description in the corresponding embodiment of Figure 2 and Figure 2 . For the sake of convenience, only the part related to this embodiment is shown. Referring to Figure 4 , the pipe transient flow forward prediction device 40 comprises a construction module 41, a first calculation module 42, a first training module 43, and an output module 44.

[0132] The construction module 41 is configured to construct an initial pipe transient flow forward prediction model and a training sample, input the training sample into the initial pipe transient flow forward prediction model, and output a sample predicted water head and a sample predicted flow rate, wherein the input of the initial pipe transient flow forward prediction model is a spatial coordinate and a time, the output is a water head and a flow rate, and the training sample is a sampling spatial coordinate and a sampling time of N sampling points determined from the pipe to be predicted, N being an integer greater than zero.

[0133] The first calculation module 42 is configured to obtain pipe parameters of the pipe to be predicted, simulate the pipe to be predicted according to the pipe parameters, obtain an initial pipe model, and calculate a first loss according to the initial pipe model, the sample predicted water head, and the sample predicted flow rate.

[0134] The first training module 43 is configured to train the initial pipe transient flow forward prediction model according to the first loss, and obtain a trained pipe transient flow forward prediction model.

[0135] The output module 44 is configured to obtain a real-time coordinate representing a position of a to-be-measured point on the pipe to be predicted and a real-time time representing a flow of water from an inlet of the pipe to be predicted to the to-be-measured point, input the real-time coordinate and the real-time time into the trained pipe transient flow forward prediction model, and output a pipe transient flow forward prediction result representing a water head and a flow rate.

[0136] Optionally, the pipe transient flow forward prediction device 40 further comprises:

[0137] The obtaining module is configured to obtain a boundary constraint condition of the pipe to be predicted, and calculate a second loss according to the boundary constraint condition and an output result of the initial pipe transient flow forward prediction model under the constraint condition;

[0138] The second calculation module is configured to calculate a target loss according to the first loss and the second loss;

[0139] The second training module is configured to train the initial pipe transient flow forward prediction model according to the target loss, and obtain a trained pipe transient flow forward prediction model.

[0140] Optionally, the first training module 43 comprises:

[0141] The training unit is configured to update parameters of the initial pipe transient flow forward prediction model according to an Adam optimizer, minimize a value of the first loss, and obtain the trained pipe transient flow forward prediction model.

[0142] It should be noted that the information interaction, execution process, and the like between the above units are based on the same concept as the method embodiments of the present application, and the specific functions and technical effects brought by them can be referred to the method embodiments part, which will not be described here.

[0143] Figure 5 is a structural schematic diagram of a computer device provided by an embodiment of the present application. As shown in the figure, the computer device of the embodiment comprises at least one processor (only one is shown in the figure), a memory, and a computer program stored in the memory and executable on the at least one processor, and the processor implements the steps in any of the above-mentioned pipe transient flow forward prediction method embodiments when executing the computer program. Figure 5 Figure 5

[0144] The computer device can comprise, but is not limited to, the processor, the memory. Those skilled in the art can understand that the computer device is only an example and does not constitute a limitation on the computer device, and the computer device can comprise more or fewer components than shown in the figure, or combine certain components, or different components, for example, it can also comprise a network interface, a display screen, an input device, etc. Figure 5

[0145] The processor can be a CPU, and the processor can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), ready programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0146] The memory comprises a readable storage medium, an internal memory, etc., wherein the internal memory can be the memory of the computer device, and the internal memory provides an environment for the operation of the operating system and the computer readable instructions in the readable storage medium. The readable storage medium can be the hard disk of the computer device, and in other embodiments, it can also be the external storage device of the computer device, for example, the plug-in hard disk, the smart media card (SMC), the secure digital (SD) card, the flash card, etc. provided on the computer device. Further, the memory can comprise both the internal storage unit of the computer device and the external storage device. The memory is used to store the operating system, the application program, the boot loader, the data, and other programs, such as the program code of the computer program, etc. The memory can also be used to temporarily store the data that has been output or will be output.

[0147] ​​​Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software functional unit. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the present application. The specific working process of the units and modules in the above device can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here. If the integrated unit is realized in the form of software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, all or part of the processes in the above embodiment methods can be completed by a computer program instructing related hardware. The computer program can be stored in a computer readable storage medium. When the processor executes the computer program, the steps of the above method embodiments can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable file or some intermediate form. The computer readable medium at least includes any entity or device that can carry computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, according to legislation and patent practice, computer readable medium cannot be electrical carrier signal and telecommunication signal.

[0148] The above embodiment methods can also be completed by a computer program product, which can be run on a computer device to make the computer device execute the steps of the above method embodiments.

[0149] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0150] Those skilled in the art can understand that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0151] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / computer device and method can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely schematic. The division of the modules or units is merely a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.

[0152] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.

[0153] The above embodiments are only used to illustrate the technical solutions of the present application, but not to limit it; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A method of forward prediction of transient flow in a pipe, characterized in that, The pipeline transient flow forward prediction method comprises: An initial pipeline transient flow forward prediction model and a training sample are constructed, the training sample is input into the initial pipeline transient flow forward prediction model, and sample predicted water head and sample predicted flow are output, wherein the input of the initial pipeline transient flow forward prediction model is spatial coordinates and time, and the output is water head and flow, and the training sample is sampling spatial coordinates and sampling time of N sampling points determined from a pipeline to be predicted, N being an integer greater than zero; Pipeline parameters of the pipeline to be predicted are acquired, the pipeline to be predicted is simulated according to the pipeline parameters, an initial pipeline model is obtained, and a first loss is calculated according to the initial pipeline model, the sample predicted water head and the sample predicted flow; The formula of the initial pipeline model is as follows: wherein, is the pipe cross-sectional area of the pipe to be predicted, is the sampling spatial coordinate of the sampling point, is the flow rate of the sampling point, is the gravitational acceleration, is the water head of the sampling point, is the friction coefficient, is the pipe , is the internal diameter of the pipe to be predicted, is the water hammer wave speed; The initial pipeline transient flow forward prediction model is trained according to the first loss, and a trained pipeline transient flow forward prediction model is obtained; The initial pipeline transient flow forward prediction model is trained, and a trained pipeline transient flow forward prediction model is obtained, which further comprises: A boundary constraint condition of a pipeline to be predicted is acquired, a second loss is calculated according to the boundary constraint condition and an output result of the initial pipeline transient flow forward prediction model under the boundary constraint condition; A target loss is calculated according to the first loss and the second loss; The initial pipeline transient flow forward prediction model is trained according to the target loss, and a trained pipeline transient flow forward prediction model is obtained; Real-time coordinates representing the position of a to-be-measured point on a pipeline to be predicted and real-time time representing the flow of water from an inlet of the pipeline to be predicted to the to-be-measured point are acquired, the real-time coordinates and the real-time time are input into the trained pipeline transient flow forward prediction model, and a pipeline transient flow forward prediction result representing water head and flow is output.

2. The method of claim 1, wherein, The formula for calculating the first loss according to the initial pipeline model, the sample predicted water head and the sample predicted flow is as follows: wherein, is a first loss, is a number of sampling points, is a sampling spatial coordinate and sampling time for each sampling point, is an output result of the initial pipe model under the initial pipe transient flow forward prediction model parameters .

3. The method of claim 1, wherein, The boundary constraint condition comprises a spatial constraint condition and a time constraint condition; The formula of the spatial constraint condition is as follows: wherein, is an upstream pressure boundary of the pipe to be predicted, is an upstream pressure boundary position, is a downstream flow boundary of the pipe to be predicted, is a downstream flow boundary position, is a downstream flow boundary value; The formula of the time constraint condition is as follows: wherein flow rate at start time, flow rate value at start time.

4. The method of claim 1, wherein, The initial pipeline transient flow forward prediction model is trained according to the first loss, and a trained pipeline transient flow forward prediction model is obtained, which comprises: The parameters of the initial pipeline transient flow forward prediction model are updated according to an Adam optimizer, so that the value of the first loss is minimized, and a trained pipeline transient flow forward prediction model is obtained.

5. A device for forward prediction of transient flow in a pipe, characterized in that The pipeline transient flow forward prediction device comprises: A construction module is configured to construct an initial pipeline transient flow forward prediction model and a training sample, input the training sample into the initial pipeline transient flow forward prediction model, and output sample predicted water head and sample predicted flow, wherein the input of the initial pipeline transient flow forward prediction model is spatial coordinates and time, and the output is water head and flow, and the training sample is sampling spatial coordinates and sampling time of N sampling points determined from a pipeline to be predicted, N being an integer greater than zero; The first calculation module is configured to obtain a pipeline parameter of the pipeline to be predicted, simulate the pipeline to be predicted according to the pipeline parameter, and obtain an initial pipeline model; and calculate a first loss according to the initial pipeline model, the sample predicted water head, and the sample predicted flow rate. The formula of the initial pipeline model is as follows: wherein, is the pipe cross-sectional area of the pipe to be predicted, is the sampling spatial coordinate of the sampling point, is the flow rate of the sampling point, is the gravitational acceleration, is the water head of the sampling point, is the friction coefficient, is pipe , is the internal diameter of the pipe to be predicted, is the water hammer wave speed; The first training module is configured to train the initial pipeline transient flow forward prediction model according to the first loss, and obtain a trained pipeline transient flow forward prediction model. The training of the initial pipeline transient flow forward prediction model to obtain the trained pipeline transient flow forward prediction model further includes: obtaining a boundary constraint condition of the pipeline to be predicted, and calculating a second loss according to the boundary constraint condition and an output result of the initial pipeline transient flow forward prediction model under the boundary constraint condition; calculating a target loss according to the first loss and the second loss; training the initial pipeline transient flow forward prediction model according to the target loss, and obtaining the trained pipeline transient flow forward prediction model; The output module is configured to obtain a real-time coordinate representing a position of a to-be-measured point on the pipeline to be predicted, and a real-time time representing a time of water flow from an inlet of the pipeline to be predicted to the to-be-measured point, input the real-time coordinate and the real-time time into the trained pipeline transient flow forward prediction model, and output a pipeline transient flow forward prediction result representing a water head and a flow rate.

6. A computer device, comprising: The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the pipeline transient flow forward prediction method according to any one of claims 1 to 4 when executing the computer program.

7. A computer-readable storage medium storing a computer program, wherein the computer program comprises the following steps of: The computer program is executed by the processor to implement the pipeline transient flow forward prediction method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Pipeline detection method and device, electronic equipment and storage medium

    CN118504409A

  • Pipeline flow field remodeling method based on LAAF-PINN

    CN120429988A