Artificial Intelligence-Based Intelligent Analysis and Control System and Method for the Entire Life Cycle of Gas Wells
By constructing a differentiable physical enhancement model and a safety rating strategy gradient algorithm, the adaptability and safety issues of gas well control methods under dynamic operating conditions were solved, realizing intelligent analysis and control of the entire life cycle of gas wells and improving production efficiency and safety.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SICHUAN CLOUD MILEAGE TECH DEV CO LTD
- Filing Date
- 2026-03-17
- Publication Date
- 2026-06-02
AI Technical Summary
Existing gas well control methods lack adaptability to dynamic changes in operating conditions throughout the entire life cycle of a gas well, resulting in control lag, inaccurate regulation, and difficulty in achieving stable and efficient production. Furthermore, existing data-driven methods do not incorporate physical laws, leading to safety hazards and poor optimization results.
An AI-based intelligent analysis method for the entire lifecycle of gas wells is adopted. By constructing a differentiable physical enhancement model and combining a safety rating function and a safety rating strategy gradient algorithm, the state prediction and strategy output are made in accordance with physical mechanisms, and safety constraints and closed-loop optimization are performed.
It improves the reliability and safety of gas well control, ensures the safety of the strategy optimization process, adapts to changes in operating conditions throughout the entire gas well life cycle, and achieves efficient and low-cost gas well production.
Smart Images

Figure CN122131719A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of oil and gas field development technology, and in particular to an intelligent analysis and control system and method for the entire life cycle of gas wells based on artificial intelligence. Background Technology
[0002] Gas wells face complex dynamic operating conditions throughout their entire production lifecycle. Various issues arise during production, such as multiphase flow disturbances, formation pressure depletion, fluid accumulation, and sand production, leading to continuous changes in well conditions and hindering stable and efficient production. Traditional gas well control and analysis methods primarily rely on the experience of field engineers or employ simple PID control. These methods are poorly adaptable to changing conditions and cannot cope with dynamic fluctuations throughout the well's lifecycle, easily resulting in control lag and inaccurate adjustments, thus impacting gas well production efficiency.
[0003] In recent years, data-driven artificial intelligence methods have begun to be applied in the field of gas well control. Among them, reinforcement learning technology has become a research hotspot in intelligent gas well control due to its autonomous learning and adaptive adjustment capabilities. However, existing data-driven methods have two major drawbacks: First, pure data models do not incorporate the physical laws of gas wells and rely solely on data fitting for state prediction and strategy output, which can easily lead to control actions that violate physical mechanisms and pose safety hazards. Second, the action exploration process in reinforcement learning lacks safety constraints, which can easily lead to dangerous operations that threaten the safety of gas well production. At the same time, the strategy update direction lacks physical guidance, resulting in slow convergence speed and poor optimization effect.
[0004] Furthermore, existing gas well analysis and control methods struggle to achieve closed-loop optimization throughout the entire gas well lifecycle, failing to update models and strategies in real time based on dynamic changes in gas well operating conditions, and thus failing to balance the safety, efficiency, and economy of gas well production. Therefore, there is an urgent need for an intelligent analysis method and system for the entire gas well lifecycle that integrates physical knowledge and artificial intelligence technology, possessing safety constraints and closed-loop optimization capabilities, to address the shortcomings of existing technologies. Summary of the Invention
[0005] To address the aforementioned technical problems, this invention provides an intelligent analysis and control system and method for the entire lifecycle of gas wells based on artificial intelligence. The technical solution adopted is as follows: The AI-based intelligent analysis method for the entire lifecycle of gas wells includes the following steps: Step S1: Collect real-time production data from the gas well and preprocess the production data; Step S2: Construct a differentiable physical enhancement model. The differentiable physical enhancement model embeds the gas well physical equations as differentiable hierarchical neural networks, trains them using historical data, and constructs a digital twin model that conforms to physical laws and has data fitting capabilities. The digital twin model is end-to-end differentiable. Step S3: Design a security rating function based on the differentiable physical enhancement model, mapping each state-action pair to a continuous security score; Step S4: The control strategy is optimized using a security rating strategy gradient algorithm. The security rating strategy gradient algorithm introduces a security score as a reward weight in the strategy gradient update and uses a differentiable physics enhancement model to calculate the physical guidance gradient, so that the strategy update direction takes into account both security and physical optimality. Step S5: Deploy the optimized control strategy to the real-time control system, collect feedback data after the action is executed, update the differentiable physical enhancement model and the strategy network, and form a closed-loop continuous optimization.
[0006] Optionally, in step S1, the production data includes timestamps, casing pressure, oil pressure, gas production, water production, nozzle opening, and foaming agent injection amount. The preprocessing method is to use the 3σ principle to clean outliers in the production data, use linear interpolation to fill missing values, and normalize all preprocessed data to ensure that the data meets the requirements of model training and control.
[0007] Optionally, in step 2, the differentiable physics enhancement model consists of an input layer, a physics constraint layer, and a data-driven compensation layer connected in series, with each layer supporting differentiable operations. The input layer receives the current status parameters of the gas well and the next control action. The current status parameters include casing pressure, oil pressure, gas production, water production, nozzle opening and foaming agent injection amount. The control actions include the change in nozzle opening and the change in foaming agent injection amount. The physical constraint layer enables the differentiable calculation of the core physical equations of the gas well. The physical equations include the bottom hole flowing pressure calculation equation, the formation inflow dynamic equation, and the critical fluid carrying flow calculation equation. The undetermined parameters in the physical equations are set as trainable variables and are constrained by physical laws. The data-driven compensation layer uses a lightweight neural network to learn the residual between the output of the physical constraint layer and the actual measurement data of the gas well, and compensates for the simplification error of the physical model. The final output of the differentiable physical enhancement model is the predicted state parameters of the gas well at the next time step, including predicted casing pressure, predicted oil pressure, predicted gas production, and predicted water production.
[0008] Optionally, the physical equations in the physical constraint layer specifically include: the wellbore multiphase flow pressure drop calculation equation based on the Hagedorn-Brown correlation, the formation inflow dynamic equation under quasi-steady state, and the critical fluid carrying capacity calculation equation based on gas well operating parameters; the formation inflow dynamic equation under quasi-steady state is: ,in This is the gas extraction index. For formation pressure, The bottom hole flowing pressure; the physical equations are made differentiable using automatic differentiation technology, and the parameters to be determined include the gas production index. and formation pressure And the constraint is , .
[0009] Optionally, the training process of the differentiable physical enhancement model in step S2 specifically includes: setting a loss function, which includes data fitting loss and physical regularization term, wherein the data fitting loss uses mean square error to calculate the deviation between the model prediction value and the actual measurement value, and the physical regularization term is used to constrain the range of values of trainable physical parameters and the magnitude of residuals; using the Adam optimizer, the model parameters are trained in batches using historical production data, and after training, the online gradient descent method is used to fine-tune the model parameters using real-time feedback data from gas wells to adapt to dynamic changes in gas well operating conditions.
[0010] Optionally, the safety rating function in step S3 is calculated based on a weighted combination of multiple gas well physical safety indicators, specifically including pressure safety indicators. Liquid carrying safety indicators Safety indicators for opening change rate ; Pressure safety indicators Based on the hydraulic pressure safety threshold and the hydraulic pressure upper limit, when the hydraulic pressure exceeds the safety threshold, the safety score decreases linearly, and when the hydraulic pressure reaches the upper limit, the score is 0. Liquid carrying safety indicators Based on the ratio of actual gas production to critical fluid carrying capacity of a gas well, when the actual gas production is lower than the critical fluid carrying capacity, the safety score decreases as the ratio decreases. Safety index of opening change rate The safety score is calculated based on the ratio of the change in nozzle opening to the maximum allowable change. When the rate of change exceeds the maximum allowable value, the safety score decreases linearly. Overall safety score ;in The weighting coefficient is set based on the knowledge of gas well production experts and can be dynamically adjusted according to the operating conditions of the gas well.
[0011] Optionally, the security rating policy gradient algorithm in step S4 adopts the Actor-Critic reinforcement learning framework, which specifically includes the definition of the reinforcement learning framework, the construction of security-weighted rewards, the calculation of physical guided gradients, and the policy update. The state space defined by the reinforcement learning framework includes the well casing pressure, oil pressure, gas production, water production, the ratio of gas production to critical fluid carrying capacity, and trainable physical parameters in the differentiable physical reinforcement model; the action space consists of continuous actions, including changes in nozzle opening and foaming agent injection rate; the reward function combines the well's economic benefits, operating costs, and safety penalties, specifically: ;in , and These are the weighting coefficients. For gas production, To score safely, It is the cost of electricity consumed by various electrical equipment during gas well production and control. This refers to the cost of various chemical agents injected during gas well production to ensure normal production. Construct a safety-weighted reward by multiplying the original cumulative reward by the safety score to reduce the impact of unsafe trajectories on policy updates; Physics-guided gradient calculations utilize differentiable physics-enhanced models to calculate the partial derivatives of the next-moment state with respect to the current action. Combined with the value network, calculate the partial derivative of the value of the next state with respect to that state. The partial derivative of the next state value with respect to the current action is obtained by chain rule differentiation. , is added to the policy gradient as a physical guide gradient term; The policy is updated according to the following policy gradient formula: ; in It is the gradient of the objective function with respect to the policy parameters. It is the expectation operator. These are policy network parameters. It is the logarithmic gradient of the policy. For safety-weighted returns, It is the baseline function. For balance coefficient, These are the policy network parameters.
[0012] Optionally, during policy training, a differentiable physical augmentation model is used to generate virtual trajectories to accelerate policy learning and test policy safety; at the same time, the policy is periodically deployed to the real environment of the gas well to collect real interaction experience for optimizing the policy network and the differentiable physical augmentation model.
[0013] Optionally, the real-time control in step 5 specifically includes: before executing the control action output by the strategy network, calculating the safety score of the action through the safety rating function; if the safety score is lower than the preset threshold, performing safety correction on the action, projecting the action to the nearest neighbor action that meets the safety constraints, or directly refusing to execute the action and triggering the safety protection mode; after the action is executed, collecting the new state parameters of the gas well and the corresponding reward value in real time, storing them in the experience playback buffer for subsequent model and strategy updates.
[0014] The AI-based intelligent control system for the entire lifecycle of gas wells is used to realize AI-based intelligent analysis methods for the entire lifecycle of gas wells. The data acquisition and preprocessing module includes a differentiable physical enhancement modeling module, a safety rating calculation module, a strategy optimization module, and a real-time control and execution module. The data acquisition and preprocessing module is used to acquire gas well production data in real time and perform preprocessing operations such as outlier cleaning, missing value filling and data normalization to output standardized data that meets the requirements. The Differentiable Physical Enhancement Modeling Module is used to construct differentiable physical enhancement models, perform model training and online update operations, and output gas well state prediction results and trainable physical parameters. The safety rating calculation module is connected to the differentiable physics-enhanced modeling module, receives the current state parameters of the gas well and candidate control actions, and calculates and outputs the corresponding safety score through the safety rating function. The strategy optimization module connects the safety rating calculation module and the differentiable physical enhancement modeling module, deploys the safety rating strategy gradient algorithm, uses the safety score and physical guidance gradient to train and output the optimized gas well control strategy; The real-time control and execution module interfaces with the gas well SCADA system, receives the control strategies output by the strategy optimization module, executes control actions, and collects real-time feedback data from the gas well, sending it to the experience playback buffer.
[0015] In summary, the present invention has at least one of the following beneficial technical effects: This invention provides an AI-based intelligent analysis and control system and method for the entire lifecycle of gas wells. By constructing a differentiable physical enhancement model, it integrates the physical laws of gas wells with data-driven capabilities, ensuring that state prediction and strategy output conform to physical mechanisms, avoiding unauthorized operations, and improving control reliability. Through a safety rating function and a safety rating strategy gradient algorithm, it achieves safety constraints in the strategy optimization process, weakening the impact of unsafe actions and ensuring gas well production safety. It utilizes a physical-guided gradient to guide strategy updates, accelerating strategy convergence, improving strategy optimization effects, and achieving high-yield, low-cost gas well operation. A closed-loop optimization mechanism is constructed, capable of updating the model and strategy based on real-time feedback data from the gas well, adapting to changes in operating conditions throughout the gas well's lifecycle, and achieving continuous optimization. All modules work collaboratively to achieve integrated gas well production data acquisition, processing, modeling, optimization, and control, improving the intelligent management level of the entire gas well lifecycle. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating the intelligent analysis method for the entire life cycle of gas wells based on artificial intelligence, as described in this invention. Figure 2 This is a schematic diagram of the architecture of the intelligent analysis and control system for the entire life cycle of gas wells based on artificial intelligence, as described in this invention. Detailed Implementation
[0017] The present invention will be further described in detail below with reference to the accompanying drawings.
[0018] This invention discloses an intelligent analysis and control system and method for the entire life cycle of gas wells based on artificial intelligence.
[0019] Reference Figure 1 and Figure 2 Example 1, an intelligent analysis method for the entire life cycle of gas wells based on artificial intelligence, includes the following steps: Step S1: Collect real-time production data from the gas well and preprocess the production data; Step S2: Construct a differentiable physical enhancement model. The differentiable physical enhancement model embeds the gas well physical equations as differentiable hierarchical neural networks, trains them using historical data, and constructs a digital twin model that conforms to physical laws and has data fitting capabilities. The digital twin model is end-to-end differentiable. Step S3: Design a security rating function based on the differentiable physical enhancement model, mapping each state-action pair to a continuous security score; Step S4: The control strategy is optimized using a security rating strategy gradient algorithm. The security rating strategy gradient algorithm introduces a security score as a reward weight in the strategy gradient update and uses a differentiable physics enhancement model to calculate the physical guidance gradient, so that the strategy update direction takes into account both security and physical optimality. Step S5: Deploy the optimized control strategy to the real-time control system, collect feedback data after the action is executed, update the differentiable physical enhancement model and the strategy network, and form a closed-loop continuous optimization.
[0020] By adopting the above technical solutions, basic data support is built through data acquisition and preprocessing. By leveraging differentiable physics enhancement models to integrate physical laws and data fitting capabilities, an accurate digital twin of the gas well is constructed. Then, the safety of actions is quantified through a safety rating function. Combined with a safety rating strategy gradient algorithm, the strategy optimization achieves the optimal balance between safety and physics. Finally, through a closed-loop update mechanism, the model and strategy can adapt to changes in operating conditions throughout the entire life cycle of the gas well, achieving adaptive optimization and safety control of gas well production, forming a complete link from data input to strategy execution and feedback optimization.
[0021] In Example 2, step S1, the production data includes timestamps, casing pressure, oil pressure, gas production, water production, nozzle opening, and foaming agent injection amount. The preprocessing method is to use the 3σ principle to clean outliers in the production data, use linear interpolation to fill missing values, and normalize all preprocessed data to ensure that the data meets the requirements of model training and control.
[0022] By adopting the above technical solutions, the accuracy of gas well production data directly determines the effectiveness of subsequent model training and strategy optimization. Therefore, it is necessary to collect key parameters during the gas well production process to comprehensively reflect the gas well operating conditions. The 3σ principle can effectively identify and eliminate outliers in the data, preventing abnormal data from interfering with model training; linear interpolation can fill in missing data, ensuring data integrity; normalization processing can eliminate the dimensional differences of different parameters, bringing the data within a uniform range, ensuring stable model training, and meeting the needs of subsequent modeling and control.
[0023] Example 3: In step 2, the differentiable physics enhancement model consists of an input layer, a physics constraint layer, and a data-driven compensation layer connected in series, with each layer supporting differentiable operations. The input layer receives the current status parameters of the gas well and the next control action. The current status parameters include casing pressure, oil pressure, gas production, water production, nozzle opening and foaming agent injection amount. The control actions include the change in nozzle opening and the change in foaming agent injection amount. The physical constraint layer enables the differentiable calculation of the core physical equations of the gas well. The physical equations include the bottom hole flowing pressure calculation equation, the formation inflow dynamic equation, and the critical fluid carrying flow calculation equation. The undetermined parameters in the physical equations are set as trainable variables and are constrained by physical laws. The data-driven compensation layer uses a lightweight neural network to learn the residual between the output of the physical constraint layer and the actual measurement data of the gas well, and compensates for the simplification error of the physical model. The final output of the differentiable physical enhancement model is the predicted state parameters of the gas well at the next time step, including predicted casing pressure, predicted oil pressure, predicted gas production, and predicted water production.
[0024] By adopting the above technical solution, the physical model suffers from simplification errors, and a single data model lacks physical constraints. Therefore, a series structure of an input layer, a physical constraint layer, and a data-driven compensation layer is used to balance physical regularity and data fitting accuracy. The input layer receives the current state of the gas well and control actions, providing the input basis for the model; the physical constraint layer forces the model output to conform to physical laws by embedding the core physical equations of the gas well, avoiding illegal predictions; the data-driven compensation layer learns the simplification errors of the physical model through a lightweight neural network, improving the model's prediction accuracy; the three work together to achieve end-to-end differentiability, providing support for subsequent strategy gradient backpropagation.
[0025] Example 4, the physical equations in the physical constraint layer specifically include: the wellbore multiphase flow pressure drop calculation equation based on the Hagedorn-Brown correlation, the formation inflow dynamic equation under quasi-steady state, and the critical fluid-carrying flow rate calculation equation based on gas well operating parameters; the formation inflow dynamic equation under quasi-steady state is: ,in This is the gas extraction index. For formation pressure, The bottom hole flowing pressure; the physical equations are made differentiable using automatic differentiation technology, and the parameters to be determined include the gas production index. and formation pressure And the constraint is , .
[0026] By adopting the above technical solutions, the core physical equations of gas wells are key to reflecting the production laws of gas wells. Selecting correlations and equations that closely match actual production can improve the physical consistency of the model. The Hagedorn-Brown correlation can accurately calculate the pressure drop of multiphase flow in the wellbore, the formation inflow dynamic equation under quasi-steady state can reflect the gas production law of the formation, and the critical fluid-carrying flow rate calculation equation can judge the risk of fluid accumulation in the gas well. Automatic differentiation technology is used to realize the differentiability of the physical equations, ensuring that the model is end-to-end differentiable; physical constraints are set on undetermined parameters such as gas production index and formation pressure to ensure that the parameters conform to actual production laws, further improving the reliability of the model.
[0027] Example 5, the training process of the differentiable physical enhancement model in step S2 specifically includes: setting a loss function, which includes data fitting loss and physical regularization term, wherein the data fitting loss uses mean square error to calculate the deviation between the model prediction value and the actual measurement value, and the physical regularization term is used to constrain the range of values of trainable physical parameters and the magnitude of residuals; using the Adam optimizer, the model parameters are trained in batches using historical production data, and after training, the online gradient descent method is used to fine-tune the model parameters using real-time feedback data from gas wells to adapt to the dynamic changes in gas well operating conditions.
[0028] By adopting the above technical solutions, model training needs to balance data fitting accuracy and physical regularity. Therefore, a loss function is designed that includes data fitting loss and physical regularization term. The data fitting loss quantifies the deviation between the model's predicted values and the true values through mean squared error, ensuring that the model has accurate predictive capabilities. The physical regularization term constrains the range of physical parameters and the magnitude of residuals during training, preventing the model from deviating from physical laws. The Adam optimizer can efficiently optimize model parameters and improve training efficiency; the online gradient descent method can use real-time feedback data to fine-tune model parameters, enabling the model to adapt to dynamic changes in gas well conditions and maintain long-term prediction accuracy.
[0029] Example 6: The safety rating function in step S3 is calculated based on a weighted combination of multiple gas well physical safety indicators, specifically including pressure safety indicators. Liquid carrying safety indicators Safety indicators for opening change rate ; Pressure safety indicators Based on the hydraulic pressure safety threshold and the hydraulic pressure upper limit, when the hydraulic pressure exceeds the safety threshold, the safety score decreases linearly, and when the hydraulic pressure reaches the upper limit, the score is 0. Liquid carrying safety indicators Based on the ratio of actual gas production to critical fluid carrying capacity of a gas well, when the actual gas production is lower than the critical fluid carrying capacity, the safety score decreases as the ratio decreases. Safety index of opening change rate The safety score is calculated based on the ratio of the change in nozzle opening to the maximum allowable change. When the rate of change exceeds the maximum allowable value, the safety score decreases linearly. Overall safety score ;in The weighting coefficient is set based on the knowledge of gas well production experts and can be dynamically adjusted according to the operating conditions of the gas well.
[0030] By adopting the above technical solutions, pressure, fluid carrying capacity, and nozzle opening change rate are key indicators affecting production safety during gas well production. These require a weighted combination of multiple indicators to comprehensively quantify the safety of each state and action. The pressure safety indicator monitors whether the oil pressure is within a safe range, preventing excessive pressure from causing safety hazards; the fluid carrying safety indicator assesses the risk of fluid accumulation in the gas well, preventing it from affecting production; and the nozzle opening change rate safety indicator prevents sudden changes in nozzle opening, ensuring stable production. A comprehensive safety score is obtained through weighted combination, and the weights can be dynamically adjusted according to the gas well's operating conditions to ensure the safety rating aligns with actual production needs, providing a safety constraint basis for subsequent strategy optimization.
[0031] Example 7, the security rating policy gradient algorithm in step S4 adopts the Actor-Critic reinforcement learning framework, specifically including reinforcement learning framework definition, security weighted reward construction, physical guided gradient calculation and policy update; The state space defined by the reinforcement learning framework includes the well casing pressure, oil pressure, gas production, water production, the ratio of gas production to critical fluid carrying capacity, and trainable physical parameters in the differentiable physical reinforcement model; the action space consists of continuous actions, including changes in nozzle opening and foaming agent injection rate; the reward function combines the well's economic benefits, operating costs, and safety penalties, specifically: ;in , and These are the weighting coefficients. For gas production, To score safely, It is the cost of electricity consumed by various electrical equipment during gas well production and control. This refers to the cost of various chemical agents injected during gas well production to ensure normal production. Construct a safety-weighted reward by multiplying the original cumulative reward by the safety score to reduce the impact of unsafe trajectories on policy updates; Physics-guided gradient calculations utilize differentiable physics-enhanced models to calculate the partial derivatives of the next-moment state with respect to the current action. Combined with the value network, calculate the partial derivative of the value of the next state with respect to that state. The partial derivative of the next state value with respect to the current action is obtained by chain rule differentiation. , is added to the policy gradient as a physical guide gradient term; The policy is updated according to the following policy gradient formula: ; in It is the gradient of the objective function with respect to the policy parameters. It is the expectation operator. These are policy network parameters. It is the logarithmic gradient of the policy. For safety-weighted returns, It is the baseline function. For balance coefficient, These are the policy network parameters.
[0032] By adopting the above technical solutions, the Actor-Critic framework can balance policy learning and value estimation, improving the stability and efficiency of policy optimization. By defining the state space and action space, the input and output range of reinforcement learning is clearly defined; the reward function integrates economic gains, operating costs, and safety penalties, guiding the policy to achieve the goals of high productivity, low cost, and high safety. Safety-weighted rewards can mitigate the impact of unsafe trajectories on policy updates, preventing dangerous actions from being learned; physics-guided gradients utilize the differentiability of differentiable physics to enhance the model's differentiability, integrating physical laws into the policy update process, guiding the policy to converge towards the physical optimum, and achieving efficient policy parameter updates through the policy gradient formula, balancing safety and optimization effectiveness.
[0033] Example 8: During the policy training process, a differentiable physical augmentation model is used to generate virtual trajectories to accelerate policy learning and test policy security; at the same time, the policy is periodically deployed to the real environment of the gas well to collect real interaction experience for optimizing the policy network and the differentiable physical augmentation model.
[0034] By adopting the above technical solutions, purely realistic environment interactive training suffers from low efficiency and high safety risks, while purely simulated environment training is prone to the disconnect between strategies and real operating conditions. Utilizing differentiable physics-enhanced models to generate virtual trajectories can accelerate strategy learning in a safe environment while simultaneously testing the safety of the strategies and reducing dangerous exploration in real-world environments. Regularly deploying strategies to real-world environments and collecting real-world interaction experience can correct deviations between simulated and real-world environments, optimize models and strategies, ensure that strategies can adapt to real gas well operating conditions, and improve the practicality and reliability of the strategies.
[0035] Example 9, the real-time control in step 5 specifically includes: before executing the control action output by the strategy network, the safety score of the action is calculated by the safety rating function. If the safety score is lower than the preset threshold, the action is corrected for safety. The action is projected to the nearest neighbor action that meets the safety constraints, or the action is directly rejected and the safety protection mode is triggered. After the action is executed, the new state parameters of the gas well and the corresponding reward value are collected in real time and stored in the experience playback buffer for subsequent model and strategy updates.
[0036] By adopting the above technical solution, the actions output by the strategy must undergo safety verification to ensure the safety of gas well production. Before executing an action, a safety score is calculated using a safety rating function. Actions with low safety scores are corrected or rejected, avoiding dangerous operations, triggering safety protection modes, and ensuring the safety of gas well production. After the action is executed, new state parameters and reward values are collected and stored, providing real data support for subsequent model and strategy updates. This ensures that closed-loop optimization can continue, allowing the strategy and model to constantly adapt to changes in gas well operating conditions.
[0037] Example 10: Artificial intelligence-based intelligent control system for the entire life cycle of gas wells, used to realize an artificial intelligence-based intelligent analysis method for the entire life cycle of gas wells. Data acquisition and preprocessing module: The system includes a data acquisition and preprocessing module, a differentiable physical enhancement modeling module, a safety rating calculation module, a strategy optimization module, and a real-time control and execution module. The data acquisition and preprocessing module is used to acquire gas well production data in real time and perform preprocessing operations such as outlier cleaning, missing value filling and data normalization to output standardized data that meets the requirements. The Differentiable Physical Enhancement Modeling Module is used to construct differentiable physical enhancement models, perform model training and online update operations, and output gas well state prediction results and trainable physical parameters. The safety rating calculation module is connected to the differentiable physics-enhanced modeling module, receives the current state parameters of the gas well and candidate control actions, and calculates and outputs the corresponding safety score through the safety rating function. The strategy optimization module connects the safety rating calculation module and the differentiable physical enhancement modeling module, deploys the safety rating strategy gradient algorithm, uses the safety score and physical guidance gradient to train and output the optimized gas well control strategy; The real-time control and execution module interfaces with the gas well SCADA system, receives the control strategies output by the strategy optimization module, executes control actions, and collects real-time feedback data from the gas well, sending it to the experience playback buffer.
[0038] By adopting the above technical solutions, intelligent analysis of the entire gas well lifecycle requires the collaborative work of various modules to form an integrated intelligent control system. The data acquisition and preprocessing module provides standardized data for the entire system, laying the foundation for its operation; the differentiable physics-enhanced modeling module constructs an accurate digital twin, providing state prediction and physical gradient support; the safety rating calculation module quantifies the safety of actions, providing safety constraints for strategy optimization; the strategy optimization module outputs the optimal control strategy to guide gas well production; and the real-time control and execution module implements the strategy and provides data feedback. The collaborative cooperation of these modules ensures the efficient and safe operation of the entire system, achieving intelligent analysis and control of the entire gas well lifecycle.
[0039] The following specific embodiments illustrate the implementation principle of the present invention: Intelligent control of the entire lifecycle of a tight gas well is implemented to achieve adaptive optimization and safe operation from production to depletion. The specific implementation process is as follows: Data Acquisition and Preprocessing: First, execute step S1 to collect real-time production data of the tight gas well. The collected production data includes timestamp, casing pressure, oil pressure, gas production, water production, nozzle opening and foaming agent injection amount. The collection frequency is set to once per hour to ensure that the data can reflect the changes in the gas well's operating conditions in real time.
[0040] The collected production data is preprocessed as follows: outliers are identified and cleaned using the 3σ principle, and data that deviates from the normal range due to sensor failure or human error is removed; for missing values that occur during the collection process, linear interpolation is used to fill them in to ensure data integrity; all preprocessed data is normalized to map parameters of different dimensions to the range of 0 to 1, eliminating dimensional differences and ensuring that subsequent model training can proceed stably and meet the requirements of model training and control.
[0041] Construction and training of differentiable physics enhancement models: Step S2 is executed to construct a differentiable physical enhancement model. This model consists of an input layer, a physical constraint layer, and a data-driven compensation layer connected in series. Each layer supports differentiable operations, and the whole model achieves end-to-end differentiability. As a digital twin model of a gas well, it takes into account both physical laws and data fitting capabilities.
[0042] The input layer receives the current state parameters of the gas well and the next control action. The current state parameters include casing pressure, oil pressure, gas production, water production, nozzle opening and foaming agent injection amount. The control actions include the change in nozzle opening and the change in foaming agent injection amount, providing complete input data for the model.
[0043] The physical constraint layer enables the differentiable calculation of the core physical equations of the gas well. The selected physical equations include the wellbore multiphase flow pressure drop calculation equation based on the Hagedorn-Brown correlation, the formation inflow dynamic equation under quasi-steady-state conditions, and the critical fluid-carrying flow rate calculation equation based on gas well operating parameters. The formation inflow dynamic equation under quasi-steady-state conditions is as follows: ,in This is the gas extraction index. For formation pressure, The bottom hole flowing pressure; the gas production index and formation pressure, Set it as a trainable variable and set constraints. , This ensures that the parameters conform to the physical laws of gas well production. Automatic differentiation technology is used to achieve differentiability of all physical equations, guaranteeing end-to-end differentiability of the model.
[0044] The data-driven compensation layer employs a lightweight neural network containing two hidden layers. By learning the residuals between the output of the physical constraint layer and the actual measurement data of the gas well, it compensates for the simplification errors of the physical model, thereby improving the model's prediction accuracy. The final output of the differentiable physical enhancement model is the predicted state parameters of the gas well at the next time step, including predicted casing pressure, predicted oil pressure, predicted gas production, and predicted water production.
[0045] The model training process is as follows: A loss function is defined, which includes data fitting loss and a physical regularization term. The data fitting loss uses mean squared error to calculate the deviation between the model's predicted values and the actual measured values, ensuring the model has accurate predictive capabilities. The physical regularization term is used to constrain the range of trainable physical parameters and the magnitude of residuals, preventing the model from deviating from physical laws. The Adam optimizer is used, and the model parameters are trained in batches using historical production data from the gas well over the past three years. After training, online gradient descent is used to fine-tune the model parameters using real-time feedback data from the gas well, enabling the model to adapt to dynamic changes in gas well conditions and maintain long-term predictive accuracy.
[0046] Safety rating function design: Step S3 is executed, and a safety rating function is designed based on the constructed differentiable physical enhancement model. Each state-action pair is mapped to a continuous safety score in the range of 0 to 1, thereby comprehensively quantifying the safety of control actions.
[0047] The safety rating function is calculated based on a weighted combination of three physical safety indicators of gas wells, namely the pressure safety index. Liquid carrying safety indicators Safety indicators for opening change rate Among them, pressure safety indicators Based on the oil pressure safety threshold and upper limit, the safety score decreases linearly when the oil pressure exceeds the safety threshold, and reaches 0 when the upper limit is reached; liquid carrying safety index Based on the ratio of actual gas production to critical fluid carrying capacity, the safety score decreases as the ratio decreases when the actual gas production is lower than the critical fluid carrying capacity; the safety index of well opening change rate... The safety score is calculated based on the ratio of the change in nozzle opening to the maximum permissible change. When the rate of change exceeds the maximum permissible value, the safety score decreases linearly.
[0048] Overall safety score , The initial value is set based on the knowledge of gas well production experts, and can be dynamically adjusted according to the operating conditions of the gas well, so that the safety rating fits the actual production needs of the tight gas well, and provides a basis for safety constraints for subsequent strategy optimization.
[0049] Control strategy optimization: Step S4 is executed, and the control policy is optimized using the safety rating policy gradient algorithm. This algorithm adopts the Actor-Critic reinforcement learning framework, which specifically includes four parts: reinforcement learning framework definition, safety weighted reward construction, physical guidance gradient calculation, and policy update.
[0050] The reinforcement learning framework is defined as follows: the state space includes the gas well casing pressure, oil pressure, gas production, water production, the ratio of gas production to critical fluid carrying capacity, and trainable physical parameters in the differentiable physical reinforcement model; the action space consists of continuous actions, including changes in nozzle opening and foaming agent injection rate; the reward function combines the gas well's economic benefits, operating costs, and safety penalties, specifically... Where α, β, and γ are weighting coefficients. For gas production, For safety scoring, EC represents the cost of electrical energy consumed by various electrical equipment during gas well production and control, while DC represents the cost of various chemical agents added during gas well production to ensure normal production. The strategy aims to achieve high production, low cost, and high safety.
[0051] A safety-weighted reward is constructed by multiplying the original cumulative reward by the safety score, thus reducing the impact of unsafe trajectories on policy updates and preventing dangerous actions from being learned by the policy. Physics-guided gradient calculation utilizes a differentiable physics-enhanced model to calculate the partial derivative of the next-time state with respect to the current action. Combined with the value network, calculate the partial derivative of the value of the next state with respect to that state. The partial derivative of the next state value with respect to the current action is obtained by chain rule differentiation. This is added as a physical guiding gradient term to the policy gradient, guiding the policy to converge toward the physical optimum.
[0052] The policy is updated according to the following policy gradient formula: ,in It is the gradient of the objective function with respect to the policy parameters. It is the expectation operator. These are policy network parameters. It is the logarithmic gradient of the policy. For safety-weighted returns, It is the baseline function. For balance coefficient, These are the policy network parameters.
[0053] During strategy training, a differentiable physical augmentation model is used to generate virtual trajectories, accelerating strategy learning in a safe environment while testing the safety of the strategy and reducing dangerous exploration in the real environment. Every 7 days, the current optimized strategy is deployed to the real production environment of the tight gas well to collect real interaction experience, which is used to further optimize the strategy network and the differentiable physical augmentation model to ensure that the strategy can adapt to the real gas well operating conditions.
[0054] Real-time control and closed-loop optimization: Step S5 involves deploying the optimized control strategy to the gas well real-time control system to achieve real-time intelligent control of the gas well. Before executing the control action output by the strategy network, a safety score for the action is calculated using a safety rating function. If the safety score is lower than a preset threshold, the action is corrected for safety by projecting it onto the nearest neighbor action that meets the safety constraints. If the safety score of the action is extremely low, the action is directly rejected and a safety protection mode is triggered to ensure the safety of gas well production.
[0055] After the action is executed, the new state parameters and corresponding reward values of the gas well are collected in real time and stored in the experience playback buffer for subsequent model and strategy updates. Every 24 hours, the parameters of the differentiable physics enhancement model are fine-tuned using the online gradient descent method based on the feedback data in the experience playback buffer. At the same time, the policy network and value network are updated using samples in the buffer, forming a closed-loop continuous optimization, enabling the model and strategy to adapt to the changing operating conditions throughout the entire life cycle of the gas well, and achieving adaptive optimization and safety control of gas well production.
[0056] Deployment of intelligent control systems: To realize the above-mentioned AI-based intelligent analysis method for the entire life cycle of gas wells, a corresponding intelligent control system is deployed. This system includes a data acquisition and preprocessing module, a differentiable physical enhancement modeling module, a safety rating calculation module, a strategy optimization module, and a real-time control and execution module.
[0057] The data acquisition and preprocessing module collects gas well production data in real time and performs preprocessing operations such as outlier cleaning, missing value imputation, and data normalization, outputting standardized data that meets the requirements. The differentiable physical augmentation modeling module is used to construct a differentiable physical augmentation model, perform model training and online update operations, and output gas well state prediction results and trainable physical parameters. The safety rating calculation module connects to the differentiable physical augmentation modeling module, receives the current state parameters of the gas well and candidate control actions, calculates and outputs the corresponding safety score through the safety rating function. The strategy optimization module connects to the safety rating calculation module and the differentiable physical augmentation modeling module, deploys the safety rating strategy gradient algorithm, uses the safety score and physical-guided gradient to train and output the optimized gas well control strategy. The real-time control and execution module interfaces with the gas well SCADA system, receives the control strategy output by the strategy optimization module, executes control actions, and collects real-time feedback data from the gas well, sending it to the experience playback buffer.
[0058] The modules work together to form an integrated intelligent control system, ensuring that the entire system can operate efficiently and safely, realizing intelligent analysis and control of the tight gas well throughout its entire life cycle, improving gas well production efficiency and safety, and reducing operating costs.
[0059] The above are all preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape and principle of the present invention should be covered within the scope of protection of the present invention.
Claims
1. An intelligent analysis method for the entire life cycle of gas wells based on artificial intelligence, characterized in that, Includes the following steps: Step S1: Collect real-time production data from the gas well and preprocess the production data; Step S2: Construct a differentiable physical enhancement model. The differentiable physical enhancement model embeds the gas well physical equations as differentiable hierarchical neural networks, trains them using historical data, and constructs a digital twin model that conforms to physical laws and has data fitting capabilities. The digital twin model is end-to-end differentiable. Step S3: Design a security rating function based on the differentiable physical enhancement model, mapping each state-action pair to a continuous security score; Step S4: The control strategy is optimized using a security rating strategy gradient algorithm. The security rating strategy gradient algorithm introduces a security score as a reward weight in the strategy gradient update and uses a differentiable physics enhancement model to calculate the physical guidance gradient, so that the strategy update direction takes into account both security and physical optimality. Step S5: Deploy the optimized control strategy to the real-time control system, collect feedback data after the action is executed, update the differentiable physical enhancement model and the strategy network, and form a closed-loop continuous optimization.
2. The intelligent analysis method for the entire life cycle of gas wells based on artificial intelligence according to claim 1, characterized in that, In step S1, the production data includes timestamps, casing pressure, oil pressure, gas production, water production, nozzle opening, and foaming agent injection amount. The preprocessing method is to use the 3σ principle to clean outliers in the production data, use linear interpolation to fill missing values, and normalize all the preprocessed data to ensure that the data meets the requirements of model training and control.
3. The intelligent analysis method for the entire life cycle of gas wells based on artificial intelligence according to claim 2, characterized in that, In step 2, the differentiable physics enhancement model consists of an input layer, a physics constraint layer, and a data-driven compensation layer connected in series, with each layer supporting differentiable operations. The input layer receives the current status parameters of the gas well and the next control action. The current status parameters include casing pressure, oil pressure, gas production, water production, nozzle opening and foaming agent injection amount. The control actions include the change in nozzle opening and the change in foaming agent injection amount. The physical constraint layer enables the differentiable calculation of the core physical equations of the gas well. The physical equations include the bottom hole flowing pressure calculation equation, the formation inflow dynamic equation, and the critical fluid carrying flow calculation equation. The undetermined parameters in the physical equations are set as trainable variables and are constrained by physical laws. The data-driven compensation layer uses a lightweight neural network to learn the residual between the output of the physical constraint layer and the actual measurement data of the gas well, and compensates for the simplification error of the physical model. The final output of the differentiable physical enhancement model is the predicted state parameters of the gas well at the next time step, including predicted casing pressure, predicted oil pressure, predicted gas production, and predicted water production.
4. The intelligent analysis method for the entire life cycle of gas wells based on artificial intelligence according to claim 3, characterized in that, The physical equations in the physical constraint layer specifically include: the wellbore multiphase flow pressure drop calculation equation based on the Hagedorn-Brown correlation, the formation inflow dynamic equation under quasi-steady state, and the critical fluid carrying capacity calculation equation based on gas well operating parameters; the formation inflow dynamic equation under quasi-steady state is: ,in This is the gas extraction index. For formation pressure, The bottom hole flowing pressure; the physical equations are made differentiable using automatic differentiation technology, and the parameters to be determined include the gas production index. and formation pressure And the constraint is , .
5. The intelligent analysis method for the entire life cycle of gas wells based on artificial intelligence according to claim 4, characterized in that, The training process of the differentiable physical enhancement model in step S2 specifically includes: setting a loss function, which includes data fitting loss and physical regularization term. The data fitting loss uses mean square error to calculate the deviation between the model prediction value and the actual measurement value. The physical regularization term is used to constrain the range of values of trainable physical parameters and the magnitude of residuals. The Adam optimizer is used to train the model parameters in batches using historical production data. After training, the online gradient descent method is used to fine-tune the model parameters using real-time feedback data from gas wells to adapt to the dynamic changes in gas well operating conditions.
6. The intelligent analysis method for the entire life cycle of gas wells based on artificial intelligence according to claim 5, characterized in that, The safety rating function in step S3 is calculated based on a weighted combination of multiple gas well physical safety indicators, specifically including pressure safety indicators. Liquid carrying safety indicators Safety indicators for opening change rate ; Pressure safety indicators Based on the hydraulic pressure safety threshold and the hydraulic pressure upper limit, when the hydraulic pressure exceeds the safety threshold, the safety score decreases linearly, and when the hydraulic pressure reaches the upper limit, the score is 0. Liquid carrying safety indicators Based on the ratio of actual gas production to critical fluid carrying capacity of a gas well, when the actual gas production is lower than the critical fluid carrying capacity, the safety score decreases as the ratio decreases. Safety index of opening change rate The safety score is calculated based on the ratio of the change in nozzle opening to the maximum allowable change. When the rate of change exceeds the maximum allowable value, the safety score decreases linearly. Overall safety score ;in The weighting coefficient is set based on the knowledge of gas well production experts and can be dynamically adjusted according to the operating conditions of the gas well.
7. The intelligent analysis method for the entire life cycle of gas wells based on artificial intelligence according to claim 6, characterized in that, The security rating policy gradient algorithm in step S4 adopts the Actor-Critic reinforcement learning framework, which specifically includes the definition of the reinforcement learning framework, the construction of security-weighted rewards, the calculation of physical guided gradients, and the policy update. The state space defined by the reinforcement learning framework includes the well casing pressure, oil pressure, gas production, water production, the ratio of gas production to critical fluid carrying capacity, and trainable physical parameters in the differentiable physical reinforcement model; the action space consists of continuous actions, including changes in nozzle opening and foaming agent injection rate; the reward function combines the well's economic benefits, operating costs, and safety penalties, specifically: ;in , and These are the weighting coefficients. For gas production, To score safely, It is the cost of electricity consumed by various electrical equipment during gas well production and control. This refers to the cost of various chemical agents injected during gas well production to ensure normal production. Construct a safety-weighted reward by multiplying the original cumulative reward by the safety score to reduce the impact of unsafe trajectories on policy updates; Physics-guided gradient calculations utilize differentiable physics-enhanced models to calculate the partial derivatives of the next-moment state with respect to the current action. Combined with the value network, calculate the partial derivative of the value of the next state with respect to that state. The partial derivative of the next state value with respect to the current action is obtained by chain rule differentiation. , is added to the policy gradient as a physical guide gradient term; The policy is updated according to the following policy gradient formula: ; in It is the gradient of the objective function with respect to the policy parameters. It is the expectation operator. These are policy network parameters. It is the logarithmic gradient of the policy. For safety-weighted returns, It is the baseline function. For balance coefficient, These are the policy network parameters.
8. The intelligent analysis method for the entire life cycle of gas wells based on artificial intelligence according to claim 7, characterized in that, During policy training, a differentiable physical augmentation model is used to generate virtual trajectories, accelerating policy learning and testing policy safety. At the same time, the policy is periodically deployed to the real environment of gas wells to collect real interaction experience, which is used to optimize the policy network and the differentiable physical augmentation model.
9. The intelligent analysis method for the entire life cycle of gas wells based on artificial intelligence according to claim 8, characterized in that, The real-time control in step 5 specifically includes: before executing the control action output by the strategy network, calculating the safety score of the action through the safety rating function; if the safety score is lower than the preset threshold, the action is corrected for safety, projecting the action to the nearest neighbor action that meets the safety constraints, or directly refusing to execute the action and triggering the safety protection mode; after the action is executed, collecting the new state parameters of the gas well and the corresponding reward value in real time and storing them in the experience playback buffer for subsequent model and strategy updates.
10. An intelligent control system for the entire life cycle of gas wells based on artificial intelligence, characterized in that: To implement the AI-based intelligent analysis method for the entire life cycle of gas wells as described in claim 9, the data acquisition and preprocessing module includes: a differentiable physical enhancement modeling module, a safety rating calculation module, a strategy optimization module, and a real-time control and execution module. The data acquisition and preprocessing module is used to acquire gas well production data in real time and perform preprocessing operations such as outlier cleaning, missing value filling and data normalization to output standardized data that meets the requirements. The Differentiable Physical Enhancement Modeling Module is used to construct differentiable physical enhancement models, perform model training and online update operations, and output gas well state prediction results and trainable physical parameters. The safety rating calculation module is connected to the differentiable physics-enhanced modeling module, receives the current state parameters of the gas well and candidate control actions, and calculates and outputs the corresponding safety score through the safety rating function. The strategy optimization module connects the safety rating calculation module and the differentiable physical enhancement modeling module, deploys the safety rating strategy gradient algorithm, uses the safety score and physical guidance gradient to train and output the optimized gas well control strategy; The real-time control and execution module interfaces with the gas well SCADA system, receives the control strategies output by the strategy optimization module, executes control actions, and collects real-time feedback data from the gas well, sending it to the experience playback buffer.