A method and system for prioritized natural gas pipeline network anomaly handling recommendations
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-27
- Publication Date
- 2026-08-11
AI Technical Summary
[0006]针对现有技术方法难以直观展示模型在决策过程中对关键节点、关键管段及关键用户的关注程度的问题,本发明提供一种保供优先的天然气管网异常处置推荐方法与系统,以解决现有的问题
1、本发明方法通过构建天然气管网异常处置强化学习环境,采用基于Attention机制的DQN神经网络对可行动作进行价值评估,并结合面向天然气管网调度场景的奖励函数、动作约束条件和可解释分析方法,实现对异常状态下处置方案的智能推荐。该方法优先保障关键用户和重点区域供气,同时兼顾节点压力安全、设备运行边界、供气路径可达性和动作实施平稳性,从而提高天然气管网异常处置的响应效率、保供能力和调度可信度。
Smart Images

Figure CN122549903A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent control technology for natural gas pipeline networks, specifically to a recommended method and system for handling anomalies in natural gas pipeline networks with priority given to ensuring supply. Background Technology
[0002] Natural gas pipelines are the core infrastructure of the natural gas transmission, distribution, and supply system. Their operational safety and supply continuity directly affect the stable gas supply for industrial production, urban gas supply, and key residential users. With the increasing interconnectivity of long-distance trunk lines, provincial branch lines, city gate stations, gas storage facilities, and liquefied natural gas receiving terminals, natural gas pipelines are gradually exhibiting characteristics such as large network scale, complex topology, strong equipment coupling, and rapid dynamic changes in operating conditions. In the event of sudden events such as upstream gas supply interruptions, compressor failures, valve malfunctions, or monitoring instrument failures, local anomalies can easily spread into regional gas supply risks due to pressure propagation and gas redistribution, potentially affecting the gas supply to key industrial users, public facilities, and residential areas.
[0003] The current handling of natural gas pipeline anomalies mainly relies on dispatchers making manual judgments based on operational experience, contingency plans, and station operating procedures. Common measures include isolating faulty pipeline sections, adjusting compressor operating conditions, switching to backup gas sources, utilizing gas storage facilities, implementing tiered supply restrictions for users, and reconfiguring gas supply routes. While these methods have some engineering feasibility, the handling plans are heavily dependent on human experience, and different dispatchers may make different decisions under similar conditions, resulting in poor consistency in the plans. Furthermore, the existing handling processes primarily focus on quickly restoring localized operations, lacking a priority mechanism for ensuring supply to critical users and key areas, which can easily lead to situations where some critical loads are sacrificed to maintain overall balance.
[0004] In recent years, reinforcement learning methods have shown great potential in complex system control and sequential decision-making problems. However, directly applying general reinforcement learning methods to natural gas pipeline network anomaly handling scenarios still faces some limitations. The algorithm structures are often complex, hindering engineers' understanding and implementation. Natural gas pipeline network scheduling has strict safety boundaries and industry constraints; without action feasibility screening and risk shielding mechanisms, the model may output unexecutable solutions. Existing intelligent models often focus on maximizing overall benefits, insufficiently considering priority needs such as minimum gas supply guarantees for key users, node safety pressures, and equipment operating boundaries. Furthermore, existing interpretable methods struggle to intuitively demonstrate the model's attention to key nodes, key pipeline sections, and key users during the decision-making process.
[0005] Therefore, there is a need to provide a recommended method and system for handling natural gas pipeline network anomalies with a priority on ensuring supply in order to solve the above problems. Summary of the Invention
[0006] To address the problem that existing technologies struggle to intuitively demonstrate the level of attention models pay to key nodes, key pipeline sections, and key users during the decision-making process, this invention provides a method and system for recommending emergency response to natural gas pipeline network anomalies with a focus on ensuring supply, thus resolving the existing issues.
[0007] The first aspect of this invention provides a recommended method for handling abnormal situations in natural gas pipeline networks with priority given to ensuring supply, employing the following technical solution, including: Obtain abnormal status data of the natural gas pipeline network, and obtain the abnormal status vector of the pipeline network based on the abnormal status data; A set of candidate actions is generated based on a pre-set scheduling rule base, anomaly contingency plan base, and action executable conditions; constraints are defined, and candidate actions are pre-screened based on the natural gas pipeline network operation boundary to obtain a set of feasible actions that meet the constraints. Based on the importance score of the pipeline network anomaly, obtain the attention weight corresponding to each pipeline network anomaly. Based on the attention weight, obtain the corresponding weighted state of the pipeline network at the current time. Based on the corresponding weighted state of the pipeline network at the current time, obtain the action value of each actionable action. Construct a dataset based on the pipeline network anomaly vector and the action value of each actionable action. Set up user-tiered short supply reward items, user minimum gas supply default penalty items, node pressure deviation penalty items, coil and emergency gas source collaborative utilization reward items, action switching penalty items, and safety risk penalty items, and obtain reward values based on user-tiered short supply reward items, user minimum gas supply default penalty items, node pressure deviation penalty items, coil and emergency gas source collaborative utilization reward items, action switching penalty items, and safety risk penalty items. The target action value of each action at the current moment is obtained based on the maximum action value corresponding to the pipeline anomaly state vector at the next moment and the reward value at the current moment; the mean squared error loss function is constructed based on the target action value and action value of each action at the current moment. Construct an Attention-DQN neural network and train it using a dataset until the mean squared error loss function converges to obtain the trained target Attention-DQN neural network. The current pipeline anomaly state vector is input into the Attention-DQN neural network to obtain the action value of each action at the current moment, and the action corresponding to the maximum action value is used as the anomaly handling recommendation result.
[0008] A further technical solution of the present invention is that the pipeline abnormal state vector includes: node pressure data set, pipeline flow data set, coil status data set, equipment status data set, gas source and gas storage facility status data set, user gas supply status data set, and abnormal event status data set.
[0009] A further technical solution of the present invention is that the candidate actions include: isolation of the faulty pipeline section, switching of the backup bypass branch, starting or stopping of the compressor or adjustment of the operating gear, calling up the backup gas source, calling up the gas storage, replenishing liquefied natural gas, tiered supply restriction for users, reconfiguring the gas supply path, restoring gas supply, and maintaining the current control strategy unchanged.
[0010] A further technical solution of the present invention is subject to the following constraints: Minimum gas supply constraints for key users:
[0011] Node pressure constraints:
[0012] Pipeline output constraints:
[0013] Compressor operating boundary constraints:
[0014]
[0015] Gas supply path reachability constraints:
[0016] In the formula, express Candidate actions at any time Time user The actual gas supply; Indicates the minimum gas supply; express Candidate actions at any time Time node The pressure; Represents a node Minimum pressure; Represents a node The maximum pressure; express Candidate actions at any time Time Management Section The output quantity; Indicates pipe section Maximum output; express Candidate actions at any time Time The rotational speed of the compressor; Indicates the first The minimum speed of the compressor; Indicates the first The maximum speed of the compressor; express Candidate actions at any time Time The compression ratio of the compressor; Indicates the first The minimum compression ratio of the compressor; Indicates the first The maximum compression ratio of the compressor; Indicates in candidate actions Candidate gas supply path under action The remaining transport capacity; This indicates the distance from the available gas source to the user. The set of candidate gas supply paths; This represents the set of candidate gas supply paths from the available gas source to user u. In the process, there exists at least one candidate gas supply path p; Indicates user The minimum required quantity.
[0017] A further technical solution of the present invention is that the weighted state of the pipeline network at the current moment is:
[0018]
[0019] In the formula, express The corresponding weighted state of the pipeline network at that time, and ; Indicates the first The attention weights corresponding to the abnormal states of each pipeline network, and ; Indicates the first The network anomaly status features are encoded into a d-dimensional latent vector; d is the dimension of the latent representation output by the feature extraction layer, and ; Indicates the first Importance score value corresponding to each abnormal state feature of the pipeline network; Indicates the first Importance score value corresponding to each abnormal state feature of the pipeline network; This represents the total number of abnormal pipeline conditions involved in the decision-making process. This represents the total number of abnormal states in the pipeline network abnormal state vector.
[0020] A further technical solution of the present invention is to set up user-tiered short-supply reward items, user minimum gas supply default penalty items, node pressure deviation penalty items, coil and emergency gas source coordinated utilization reward items, action switching penalty items, and safety risk penalty items as follows:
[0021]
[0022]
[0023]
[0024]
[0025]
[0026] In the formula, This indicates the reward items corresponding to the user's tiered supply shortage. Indicates user The weighting coefficient of the corresponding tiered supply shortage when the user is a key user; Indicates user The weighting coefficients for the tiered supply shortages when the user is a key user; Indicates user The weighting coefficient of the tiered supply shortage corresponding to ordinary users; ; This indicates the total number of key users; This indicates the total number of important users; This represents the total number of regular users; Indicates user exist The current tiered supply shortage; This indicates the minimum penalty for defaulting on gas supply orders. This indicates the penalty for node pressure deviation; This indicates an award for the coordinated use of the cable and emergency gas source; Indicates the penalty for switching actions; This indicates a security risk penalty item; The weighting coefficient representing the user's minimum gas supply deviation; Weighting coefficients representing nodal pressure deviation; Weighting coefficients representing the effective packet release capability; Weighting coefficients representing emergency gas supply capacity; The weighting coefficients represent the cost of action switching; Weighting coefficients representing the number of risk events that violate security boundaries; Indicates user exist The actual gas supply at any given time; Indicates user The minimum guaranteed gas supply; Indicates the total number of nodes; Represents a node Importance weight; Indicates in Time node The pressure; Represents a node Reference safety pressure; Indicates in Effective packet release capability at any given time; Indicates in LNG emergency gas supply capability at all times; express Switching to available actions at any time The cost of switching actions at any given moment; Indicates in The number of risk events that violate the security boundary at any given time.
[0027] A further technical solution of the present invention is that the tiered supply shortage for users is:
[0028] In the formula, Indicates user exist The current tiered supply shortage; Indicates user exist Current demand; Indicates user exist The actual gas supply at any given time.
[0029] A further technical solution of the present invention is that the expression for the reward value is:
[0030] In the formula, Indicates in The reward value at that moment; This indicates the reward items corresponding to the user's tiered supply shortage. This indicates the minimum penalty for defaulting on gas supply orders. This indicates the penalty for node pressure deviation; This indicates an award for the coordinated use of the cable and emergency gas source; Indicates the penalty for switching actions; This indicates a security risk penalty item.
[0031] A further technical solution of the present invention is that the step of obtaining the target action value of each actionable action at the current moment based on the maximum action value corresponding to the pipeline anomaly state vector at the next moment and the reward value at the current moment is as follows:
[0032] In the formula, Indicates in The value of the target action that can be taken at any time; Indicates in Momentary reward value; Indicates the discount factor; Indicates in The action value of each actionable action at any given moment; Indicates in The set of actions that can be taken at any given moment; Indicates in Actions that can be taken at any time; This represents the network parameters of the Attention-DQN neural network.
[0033] A second aspect of the present invention provides a recommended approach to handling natural gas pipeline network anomalies with a focus on ensuring supply, comprising: The parameter acquisition module is used to acquire pipeline abnormal state data of the natural gas pipeline network and obtain the pipeline abnormal state vector based on the pipeline abnormal state data. The action setting module is used to generate a set of candidate actions based on a preset scheduling rule library, an exception contingency plan library, and action executable conditions; define constraints, and pre-screen candidate actions according to the natural gas pipeline network operation boundary to obtain a set of feasible actions that meet the constraints. The dataset construction module is used to obtain the attention weight corresponding to each pipeline abnormal state based on the importance score of the pipeline abnormal state, obtain the corresponding pipeline weighted state at the current time based on the attention weight, obtain the action value of each actionable action based on the corresponding pipeline weighted state at the current time, and construct the dataset based on the pipeline abnormal state vector and the action value of each actionable action. The loss function construction module is used to set user-tiered supply shortage reward items, user minimum gas supply default penalty items, node pressure deviation penalty items, coil and emergency gas source collaborative utilization reward items, action switching penalty items, and safety risk penalty items. It obtains reward values based on these items. It also obtains the target action value for each actionable action at the current moment based on the maximum action value corresponding to the pipeline anomaly state vector at the next moment and the reward value at the current moment. Finally, it constructs a mean squared error loss function based on the target action value and action value of each actionable action at the current moment. The neural network module is used to construct the Attention-DQN neural network and train the Attention-DQN neural network using the dataset until the mean squared error loss function converges to obtain the trained target Attention-DQN neural network. The result recommendation module is used to input the current pipeline abnormal state vector into the Attention-DQN neural network to obtain the action value of each action at the current time, and take the action corresponding to the maximum action value as the abnormal handling recommendation result.
[0034] The beneficial effects of this invention are: 1. The method of this invention constructs a reinforcement learning environment for handling natural gas pipeline anomalies, employs a DQN neural network based on an attention mechanism to evaluate the value of feasible actions, and combines a reward function, action constraints, and interpretable analysis methods tailored to natural gas pipeline scheduling scenarios to achieve intelligent recommendation of handling solutions under abnormal conditions. This method prioritizes ensuring gas supply to key users and key areas, while also considering node pressure safety, equipment operating boundaries, gas supply path accessibility, and the smoothness of action implementation, thereby improving the response efficiency, supply guarantee capacity, and scheduling reliability of natural gas pipeline anomaly handling.
[0035] 2. This invention introduces a minimum gas supply guarantee mechanism for key users into the reward function and action constraints, ensuring that the recommended results prioritize continuous gas supply to key users and key areas. It employs a DQN network based on the Attention mechanism, avoiding overly complex reinforcement learning algorithms and making it easier for oil and gas dispatching technicians to understand, deploy, and maintain. It incorporates key user minimum gas supply constraints, node pressure constraints, pipeline output constraints, compressor operating boundary constraints, and gas supply path reachability constraints—professional constraints of the natural gas pipeline network—into the action selection process, improving the executability of recommended actions. While ensuring gas supply, it also considers pressure stability, smooth action, and safety risk control, reducing the probability of secondary accidents. The Attention heatmap visually displays the nodes, pipelines, equipment, and users that the model focuses on during decision-making, facilitating understanding of the recommendation basis and manual review by dispatching personnel. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1This is a flowchart illustrating a recommended method for handling natural gas pipeline network anomalies prioritizing supply security, as per the present invention. Figure 2 This is a schematic diagram illustrating the screening action in an embodiment of the present invention; Figure 3 This is a schematic diagram of the Attention-DQN neural network in an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the interpretable analysis results of the Attention heatmap in an embodiment of the present invention. Detailed Implementation
[0038] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0039] This invention provides an embodiment of a natural gas pipeline network anomaly handling recommendation method prioritizing supply assurance. This embodiment addresses the problems of existing natural gas pipeline network anomaly handling recommendations relying on human experience, insufficient supply assurance priority, poor action executability, and weak interpretability. It constructs a natural gas pipeline network anomaly handling reinforcement learning environment, employs a DQN network based on an attention mechanism to evaluate the value of feasible actions, and combines reward functions, action constraints, and interpretability analysis methods for natural gas pipeline network scheduling scenarios to achieve intelligent recommendation of handling solutions under abnormal conditions. This method prioritizes gas supply to key users and key areas while considering node pressure safety, equipment operating boundaries, gas supply path accessibility, and action implementation stability, thereby improving the response efficiency, supply assurance capability, and scheduling reliability of natural gas pipeline network anomaly handling. Figure 1 As shown, this embodiment specifically includes: S1. Obtain the abnormal state vector of the pipeline network; Specifically, the abnormal state data of the natural gas pipeline network is obtained, and the abnormal state vector of the pipeline network is obtained based on the abnormal state data.
[0040] For example, in one specific embodiment, the pipeline network abnormal state vector includes: a node pressure data set, a pipeline segment flow data set, a coil status data set, an equipment status data set, a gas source and gas storage facility status data set, a user gas supply status data set, and an abnormal event status data set; the abnormal event status data set includes the location of the faulty pipeline segment, the faulty equipment number, and the gas source point of the sudden supply reduction. That is, in this embodiment, the expression of the pipeline network abnormal state vector is:
[0041] In the formula, Indicates in The abnormal state vector of the pipeline network at time 1; Indicates in The collection of node pressure data at any given time; Indicates in A collection of pipe flow data for the equipment at any given time; Indicates in The set of cable status data at any given time; Indicates in A collection of device status data at any given time; Indicates in A collection of real-time data on the status of gas sources and gas storage facilities; Indicates in A collection of user gas supply status data at any given time; Indicates in A collection of abnormal event status data at any given time.
[0042] S2. Set the candidate action set and filter out the action set that can be performed; Specifically, a set of candidate actions is generated based on a preset scheduling rule library, anomaly contingency plan library, and action executable conditions; constraints are defined, and candidate actions are pre-screened based on the natural gas pipeline network operation boundary to obtain a set of feasible actions that meet the constraints.
[0043] For example, in one specific embodiment, the candidate actions include: isolation of faulty pipeline sections, switching of backup bypass branches, compressor start / stop or adjustment of operating speed, call of backup gas source, call of gas storage, replenishment of liquefied natural gas, user-level supply restriction, gas supply path reconstruction, restoration of gas supply, and maintaining the current control strategy unchanged. The candidate action library is then represented as follows:
[0044]
[0045] In the formula, This indicates a preset candidate action library; Indicates in The set of candidate actions generated at any given time based on the current abnormal state, scheduling rule base, abnormal contingency plan base, and action execution conditions; Represents the first action in the candidate action set. One candidate action.
[0046] Furthermore, candidate actions can be expanded to include: closing the upstream valve of the faulty pipeline segment, closing the downstream valve of the faulty pipeline segment, activating the backup bypass pipeline segment, starting a compressor or increasing its operating level, decreasing the operating level of a compressor, calling for emergency gas replenishment from the gas storage facility, calling for gas replenishment from the liquefied natural gas receiving station, switching a specific gas supply path, lowering the gas supply level for ordinary users, lowering the gas supply level for important users, performing a gas supply restoration operation, and maintaining the current strategy unchanged. To control the scale of the action space, multiple underlying operations can be encapsulated into discrete strategy actions.
[0047] For example, in one specific embodiment, such as Figure 2 As shown, the steps for pre-screening candidate actions based on the natural gas pipeline network operation boundary to obtain the set of feasible actions that meet the constraints are as follows: The set of possible actions is defined as:
[0048] In the formula, Represents a set of possible actions; Indicates the first A constraint function; when the constraints are satisfied... =1, otherwise It is 0.
[0049] In this embodiment, the constraint functions include: minimum gas supply constraint for key users, node pressure constraint, pipeline output constraint, compressor operating boundary constraint, and gas supply path reachability constraint, namely: Minimum gas supply constraints for key users:
[0050] Node pressure constraints:
[0051] Pipeline output constraints:
[0052] Compressor operating boundary constraints:
[0053]
[0054] Gas supply path reachability constraints:
[0055] In the formula, express Candidate actions at any time Time user The actual gas supply; Indicates the minimum gas supply; express Candidate actions at any time Time node The pressure; Represents a node Minimum pressure; Represents a node The maximum pressure; express Candidate actions at any time Time Management Section The output quantity; Indicates pipe section Maximum output; express Candidate actions at any time Time The rotational speed of the compressor; Indicates the first The minimum speed of the compressor; Indicates the first The maximum speed of the compressor; express Candidate actions at any time Time The compression ratio of the compressor; Indicates the first The minimum compression ratio of the compressor; Indicates the first The maximum compression ratio of the compressor; Indicates in candidate actions Candidate gas supply path under action The remaining transport capacity; This indicates the distance from the available gas source to the user. The set of candidate gas supply paths; This represents the set of candidate gas supply paths from the available gas source to user u. In the process, there exists at least one candidate gas supply path p; Indicates user The minimum required quantity.
[0056] At this point, the set of possible actions that satisfy the constraints can be selected.
[0057] S3. Obtain the action value of actionable actions and build a dataset; Specifically, attention weights are obtained for each pipeline anomaly state based on its importance score. Based on these attention weights, the current weighted state of the pipeline is obtained. Based on the current weighted state of the pipeline, the action value of each action is obtained. Finally, the target action corresponding to the action with the highest action value in the set of actionable actions is selected.
[0058] For example, in one specific embodiment, the attention weights corresponding to each abnormal state of the pipeline network are:
[0059] In the formula, Indicates the first Attention weights corresponding to each network anomaly state; Indicates the first Importance score value corresponding to each abnormal state feature of the pipeline network; Indicates the first Importance score value corresponding to each abnormal state feature of the pipeline network.
[0060] The importance score is calculated using the Attention scoring function, where the intermediate layer of the Attention mechanism has a dimension of r, and the scoring function is a trainable mapping function.
[0061]
[0062] In the formula, This represents the weight vector in the Attention scoring function, used to further map the result of the nonlinear transformation into a scalar score; This represents the weight matrix in the Attention scoring function, used to weight the input feature vector. Mapped to the rating space; This represents the bias vector in the Attention scoring function, used to shift and adjust the linear mapping result; The current weighted state of the pipeline network is:
[0063] In the formula, express The corresponding weighted state of the pipeline network at that time, and ; Indicates the first The attention weights corresponding to the abnormal states of each pipeline network, and ; Indicates the first The d-dimensional latent vectors are encoded from the abnormal state features of the pipeline network; d is the dimension of the latent representation output by the feature extraction layer, and ; This indicates the total number of abnormal pipeline conditions involved in the decision-making process.
[0064] For example, in one specific embodiment, the expression for the action value of each action is:
[0065] In the formula, express Execute actionable actions under the abnormal state vector of the pipeline network at a given time. The value of the action; express Execute actionable actions under the abnormal state vector of the pipeline network at a given time. Action value mapping value, used to determine the weighted state Actions and network parameters Output the estimated value of this action in the current state; This represents the network parameters of the DQN network.
[0066] At this point, a dataset can be constructed based on the pipeline network anomaly state vector and the corresponding action value of each actionable action.
[0067] S4. Construct the loss function; Specifically, the system sets up user-tiered supply shortage reward items, user minimum gas supply default penalty items, node pressure deviation penalty items, coil and emergency gas source collaborative utilization reward items, action switching penalty items, and safety risk penalty items. Reward values are obtained based on these items. The target action value for each actionable action at the current moment is obtained based on the maximum action value corresponding to the pipeline anomaly state vector at the next moment and the reward value at the current moment. A mean squared error loss function is constructed based on the target action value and action value of each actionable action at the current moment.
[0068] For example, in one specific embodiment, S41, the following are set: User-tiered supply shortage reward item, user minimum gas supply default penalty item, node pressure deviation penalty item, coil and emergency gas source coordinated utilization reward item, action switching penalty item, and safety risk penalty item. S411, User-tiered supply shortage reward items are as follows: To reflect the technical objective of prioritizing gas supply, this invention constructs a reward function that combines tiered user gas shortage penalties with safe operation constraints. Users are divided into three categories: critical users, important users, and ordinary users, and each is assigned a different penalty weight. Critical users have the highest penalty weight for gas shortages, followed by important users, and ordinary users have the lowest. This allows the model to prioritize learning strategies for ensuring gas supply to critical users and key areas. Let the first... Individual users The demand at any time is The actual gas supply is The supply shortage is defined as follows:
[0069] Users are then divided into key user sets. Important user set and ordinary users The corresponding user-tiered supply shortage reward items are as follows:
[0070] In the formula, This indicates the reward items corresponding to the user's tiered supply shortage. Indicates user The weighting coefficient of the corresponding tiered supply shortage when the user is a key user; Indicates user The weighting coefficients for the tiered supply shortages when the user is a key user; Indicates user The weighting coefficient of the tiered supply shortage corresponding to ordinary users; ; This indicates the total number of key users; This indicates the total number of important users; This represents the total number of regular users; Indicates user exist The current level of supply shortage.
[0071] S412. Penalties for users who fail to meet minimum gas supply requirements: Because a high-weight penalty is applied when an action causes the gas supply to a critical user to fall below the minimum guaranteed value:
[0072] In the formula, This indicates the minimum penalty for defaulting on gas supply orders. The weighting coefficient representing the user's minimum gas supply deviation; Indicates user exist The actual gas supply at any given time; Indicates user The minimum guaranteed gas supply; S413, The penalty for nodal pressure deviation is: When the node pressure deviates from the safe reference pressure, a pressure deviation penalty is imposed:
[0073] In the formula, This indicates the penalty for nodal pressure deviation. Weighting coefficients representing nodal pressure deviation; Represents a node Importance weight; Indicates in Time node The pressure; Represents a node Reference safety pressure; S414, the reward for the coordinated use of line coil and emergency gas source is as follows: When the reservoir's regulation and storage capacity, gas storage facilities, and liquefied natural gas emergency replenishment capacity are used reasonably, corresponding rewards will be given, namely:
[0074] The effective packet release capability is as follows:
[0075] The emergency gas supply capacity is as follows:
[0076] In the formula, This indicates an award for the coordinated use of the cable and emergency gas source; Weighting coefficients representing the effective packet release capability; Weighting coefficients representing emergency gas supply capacity; Indicates in Effective packet release capability at any given time; Indicates in LNG emergency gas supply capability at all times; Indicates in Time of day The actual coil volume of the pipe section; Indicates the first The minimum number of safety coils that can be retained in a strip section; Indicates the total number of pipe sections; Indicates the first The actual replenishment gas flow that a gas storage facility can provide; express; Indicates the first One LNG emergency gas source; Indicates the first One gas storage facility; S415, The penalty for switching actions is: When actions frequently switch between adjacent time points, a penalty is applied to reduce the engineering difficulties caused by frequent compressor starts and stops and frequent valve switching. Specifically:
[0077] The action switching indicator function is as follows:
[0078] In the formula, Indicates the penalty for switching actions; express Switching to available actions at any time The cost of switching actions at any given moment; The weighting coefficients represent the cost of action switching; S416, Security Risk Penalty Items: When an action may result in overpressure, underpressure, overload, or dangerous operating conditions of the equipment, a safety risk penalty is imposed, namely:
[0079] In the formula, This indicates a security risk penalty item; Weighting coefficients representing the number of risk events that violate security boundaries; Indicates in The number of risk events that violate the security boundary at any given time.
[0080] For example, in one specific embodiment, step S42, obtaining the reward value based on user-tiered supply shortage reward items, user minimum gas supply default penalty items, node pressure deviation penalty items, coil and emergency gas source coordinated utilization reward items, action switching penalty items, and safety risk penalty items, is as follows:
[0081] In the formula, Indicates in The reward value at any given moment.
[0082] For example, in one specific embodiment, the step of obtaining the target action value of each actionable action at the current time based on the maximum action value corresponding to the pipeline anomaly state vector at the next time step and the reward value at the current time step is as follows: the system at time t pipeline anomaly state Select and execute the available actions Environment return Reward value at any moment And transition to the state of the next time step. Subsequently, in the next moment's state Below, the set of possible actions that satisfy the constraints. The motion value of each candidate motion is estimated, and the motion value with the highest value is selected; this is then combined with the reward value at the current moment. Construct the target action value at time t. The expression for the target action value is:
[0083] In the formula, Indicates in The target action value of the action that can be performed at any given moment, i.e., the time-series difference target value; Indicates that the system is in state of time Next action The reward value subsequently returned by the environment; Indicates the discount factor; Indicates in The action value of each actionable action at any given moment; Indicates in The set of actions that can be taken at any given moment; Indicates in Actions that can be taken at any time; This represents the network parameters of the Attention-DQN neural network.
[0084] For example, in one specific embodiment, a mean squared error loss function is constructed based on the target action value and action value of each actionable action at the current moment, that is, the mean squared error loss function is:
[0085] In the formula, This represents the mean squared error loss function; Indicates in Actions can be taken at any time The value of the target action; Indicates in Actions can be taken at any time The value of the action; This indicates that the average value is calculated over the training samples.
[0086] At this point, the mean squared error loss function can be constructed.
[0087] S5. Construct and train the Attention-DQN neural network; Specifically, we construct an Attention-DQN neural network and train it using a dataset until the mean squared error loss function converges to obtain the trained target Attention-DQN neural network. For example, in one specific embodiment, such as Figure 3 As shown, the Attention-DQN neural network includes an input layer, a feature extraction layer, an attention layer, and a Q-value output layer. The input layer is used to input the network's abnormal state vector; the feature extraction layer encodes the features in the network's abnormal state vector; the attention layer assigns different weights to different features, highlighting the features corresponding to key users, key nodes, and key equipment; and the Q-value output layer outputs the action value.
[0088] S6. Recommendations for handling abnormal situations; The current pipeline anomaly state vector is input into the Attention-DQN neural network to obtain the action value of each action at the current moment, and the action corresponding to the maximum action value is used as the anomaly handling recommendation result.
[0089] An embodiment of a natural gas pipeline network anomaly handling recommendation system prioritizing supply assurance includes: a parameter acquisition module, an action setting module, a dataset construction module, a loss function construction module, a neural network module, and a result recommendation module. The parameter acquisition module acquires pipeline network anomaly status data and obtains a pipeline network anomaly status vector based on the data. The action setting module generates a candidate action set based on a preset scheduling rule base, anomaly contingency plan base, and action executable conditions; defines constraints and pre-screens candidate actions according to the natural gas pipeline network operation boundary to obtain a set of feasible actions that meet the constraints. The dataset construction module obtains the attention weight corresponding to each pipeline network anomaly status based on its importance score, obtains the current weighted pipeline network status based on the attention weight, obtains the action value of each feasible action based on the current weighted pipeline network status, and constructs a dataset based on the pipeline network anomaly status vector and the action value of each feasible action. The loss function construction module sets user-tiered supply shortage reward items, user minimum gas supply default penalty items, and node pressure deviation. The system includes penalty items, reward items for the coordinated use of pipeline coils and emergency gas sources, penalty items for action switching, and penalty items for safety risks. Reward values are obtained based on user-tiered supply shortage reward items, user minimum gas supply default penalty items, node pressure deviation penalty items, reward items for the coordinated use of pipeline coils and emergency gas sources, penalty items for action switching, and penalty items for safety risks. The target action value for each actionable action at the current moment is obtained based on the maximum action value corresponding to the pipeline anomaly state vector at the next moment and the reward value at the current moment. A mean squared error loss function is constructed based on the target action value and action value of each actionable action at the current moment. A neural network module is used to construct an Attention-DQN neural network and train it using a dataset until the mean squared error loss function converges to obtain the trained target Attention-DQN neural network. A result recommendation module inputs the pipeline anomaly state vector at the current moment into the Attention-DQN neural network to obtain the action value of each actionable action at the current moment, and uses the action corresponding to the maximum action value as the anomaly handling recommendation result.
[0090] It should be noted that the "prioritizing gas supply to key users and key areas" in this embodiment is achieved through a mechanism combining "pre-screening of actions" and "soft guidance of reward function". First, in step S2, by constructing a hard boundary of "minimum gas supply constraint for key users", all candidate actions that cannot meet the minimum guaranteed gas supply for key users are directly eliminated, ensuring that the set of actions entering the value evaluation stage are all safe and feasible actions. Second, in step S4, in constructing the dataset and subsequent neural network training, the core "priority" strategy is reflected in the design of the "user-level supply shortage reward item". By dividing users into three levels: key, important, and ordinary, and assigning key users the highest supply shortage penalty weight coefficient (for example, in the total reward function, the supply shortage penalty for key users is much greater than that for ordinary users), the Attention-DQN neural network, driven by the goal of maximizing long-term cumulative reward, will spontaneously and preferentially learn and recommend scheduling strategies that can maximize the guarantee of gas supply for key users, thus demonstrating a clear supply priority feature in the overall scheduling decision.
[0091] The present invention will be described below with reference to specific data and accompanying drawings: During model training or online recommendation, the attention weights output by the Attention layer can be extracted and mapped onto the natural gas pipeline network topology to obtain an attention heatmap. The comprehensive importance weight corresponding to the v-th node, pipe segment, or device is: :
[0092] In the formula, This represents a set of state feature indices associated with a node, pipe segment, or device v. By comparing different... The size of the model can identify the key nodes, key pipelines, key equipment, and key users that the model focuses on in the current abnormal scenario, thereby helping dispatchers understand why the recommendation prioritizes a certain gas storage facility, switches a certain gas supply path, or reduces the load of a certain type of user.
[0093] Figure 4 This is a schematic diagram illustrating the interpretable analysis results based on the Attention heatmap of this invention. For example... Figure 4 As shown, the model maps the feature weights output by the Attention layer to natural gas pipeline network topology objects, and uses different colors to represent the degree of attention of each node, pipe segment, equipment, and user, where red represents high attention, yellow represents medium attention, and blue represents general attention. This heatmap can intuitively identify key industrial users, main valve chambers, compressor stations, and gas storage facilities that the model focuses on in the current abnormal scenario, thereby assisting dispatchers in understanding the basis for their recommended abnormal handling results.
[0094] Typical implementation scenarios Scenario 1: When a sudden reduction in gas supply occurs at an upstream gas supply point, the system acquires real-time gas shortage data for key downstream industrial users, residential gate stations, and general users. It then constructs a state vector based on the main pipeline's coil capacity, compressor operating conditions, and backup gas source capacity. After the model outputs multiple candidate actions, actions that would lead to insufficient gas supply to key industrial users are directly eliminated through action constraint filtering. Ultimately, the system prioritizes recommending either "calling on the gas storage facility to replenish gas and upgrading the relevant compressors" or "switching bypass branches and reducing the load on general users."
[0095] Scenario 2: When a compressor station fails and shuts down, the model focuses on the adjacent main pipeline sections, backup gas supply branches, key gate stations, and residential load nodes. If an action would cause the pressure of an adjacent node to drop below the safe lower limit, it would be blocked; the system would ultimately recommend switching to an alternative gas supply path, supplemented by an emergency gas replenishment plan.
[0096] Scenario 3: When a leak occurs in a local pipeline section, the system prioritizes isolating the faulty section and, provided that the gas supply to critical users is within the minimum required range, switches to a bypass branch or calls upon nearby gas storage facilities. The Attention heatmap shows that the model mainly focuses on the upstream and downstream valve chambers of the fault point, the affected critical user nodes, and alternative gas supply paths, thus demonstrating a clear supply-priority decision-making characteristic.
[0097] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for supply-priority natural gas pipeline network anomaly handling recommendation, characterized in that, include: Obtain abnormal status data of the natural gas pipeline network, and obtain the abnormal status vector of the pipeline network based on the abnormal status data; A set of candidate actions is generated based on a pre-set scheduling rule base, anomaly contingency plan base, and action executable conditions; constraints are defined, and candidate actions are pre-screened based on the natural gas pipeline network operation boundary to obtain a set of feasible actions that meet the constraints. Based on the importance score of the pipeline network anomaly, obtain the attention weight corresponding to each pipeline network anomaly. Based on the attention weight, obtain the corresponding weighted state of the pipeline network at the current time. Based on the corresponding weighted state of the pipeline network at the current time, obtain the action value of each actionable action. Construct a dataset based on the pipeline network anomaly vector and the action value of each actionable action. Set up user-tiered short supply reward items, user minimum gas supply default penalty items, node pressure deviation penalty items, coil and emergency gas source collaborative utilization reward items, action switching penalty items, and safety risk penalty items, and obtain reward values based on user-tiered short supply reward items, user minimum gas supply default penalty items, node pressure deviation penalty items, coil and emergency gas source collaborative utilization reward items, action switching penalty items, and safety risk penalty items. The target action value of each action at the current moment is obtained based on the maximum action value corresponding to the pipeline anomaly state vector at the next moment and the reward value at the current moment. Construct a mean squared error loss function based on the target action value and action value of each action that is possible at the current moment; Construct an Attention-DQN neural network and train it using a dataset until the mean squared error loss function converges to obtain the trained target Attention-DQN neural network. The current pipeline anomaly state vector is input into the Attention-DQN neural network to obtain the action value of each action at the current moment, and the action corresponding to the maximum action value is used as the anomaly handling recommendation result.
2. The method of claim 1, wherein the method further comprises: The pipeline abnormal status vector includes: node pressure data set, pipeline flow data set, coil status data set, equipment status data set, gas source and gas storage facility status data set, user gas supply status data set, and abnormal event status data set.
3. The method of claim 1, wherein the method further comprises: Candidate actions include: isolation of faulty pipeline section, switching of backup bypass branch, compressor start / stop or operation level adjustment, call of backup gas source, call of gas storage, replenishment of liquefied natural gas, user-level supply restriction, reconstruction of gas supply path, restoration of gas supply, and maintaining the current control strategy unchanged.
4. The method of claim 1, wherein, The constraints are: Minimum gas supply constraints for key users: Node pressure constraints: Pipeline output constraints: Compressor operating boundary constraints: Gas supply path reachability constraints: In the formula, express Candidate actions at any time Time user The actual gas supply; Indicates the minimum gas supply; express Candidate actions at any time Time node The pressure; Represents a node Minimum pressure; Represents a node The maximum pressure; express Candidate actions at any time Time Management Section The output quantity; Indicates pipe section Maximum output; express Candidate actions at any time Time The rotational speed of the compressor; Indicates the first The minimum speed of the compressor; Indicates the first The maximum speed of the compressor; express Candidate actions at any time Time The compression ratio of the compressor; Indicates the first The minimum compression ratio of the compressor; Indicates the first The maximum compression ratio of the compressor; Indicates in candidate actions Candidate gas supply path under action The remaining transport capacity; This indicates the distance from the available gas source to the user. The set of candidate gas supply paths; This represents the set of candidate gas supply paths from the available gas source to user u. In the process, there exists at least one candidate gas supply path p; Indicates user The minimum required quantity.
5. A recommended method for handling natural gas pipeline network anomalies with priority given to ensuring supply, as described in claim 1, is characterized in that... The current weighted state of the pipeline network is: In the formula, express The corresponding weighted state of the pipeline network at that time, and ; Indicates the first The attention weights corresponding to the abnormal states of each pipeline network, and ; Indicates the first The d-dimensional latent vectors are encoded from the abnormal state features of the pipeline network; d is the dimension of the latent representation output by the feature extraction layer, and ; Indicates the first Importance score value corresponding to each abnormal state feature of the pipeline network; Indicates the first Importance score value corresponding to each abnormal state feature of the pipeline network; This represents the total number of abnormal pipeline conditions involved in the decision-making process. This represents the total number of abnormal states in the pipeline network abnormal state vector.
6. The method of claim 1, wherein, The following penalties are set up: tiered reward system for insufficient gas supply, penalty system for users defaulting on minimum gas supply, penalty system for node pressure deviation, reward system for coordinated use of coil and emergency gas source, penalty system for action switching, and penalty system for safety risks. In the formula, This indicates the reward items corresponding to the user's tiered supply shortage. Indicates user The weighting coefficient of the corresponding tiered supply shortage when the user is a key user; Indicates user The weighting coefficients for the tiered supply shortages when the user is a key user; Indicates user The weighting coefficient of the tiered supply shortage corresponding to ordinary users; ; This indicates the total number of key users; This indicates the total number of important users; This represents the total number of regular users; Indicates user exist The current tiered supply shortage; This indicates the minimum penalty for defaulting on gas supply orders. This indicates the penalty for node pressure deviation; This indicates an award for the coordinated use of the cable and emergency gas source; Indicates the penalty for switching actions; This indicates a security risk penalty item; The weighting coefficient representing the user's minimum gas supply deviation; Weighting coefficients representing nodal pressure deviation; Weighting coefficients representing the effective packet release capability; Weighting coefficients representing emergency gas supply capacity; The weighting coefficients represent the cost of action switching; Weighting coefficients representing the number of risk events that violate security boundaries; Indicates user exist The actual gas supply at any given time; Indicates user The minimum guaranteed gas supply; Indicates the total number of nodes; Represents a node Importance weight; Indicates in Time node The pressure; Represents a node Reference safety pressure; Indicates in Effective packet release capability at any given time; Indicates in LNG emergency gas supply capability at all times; express Switching to available actions at any time actionable action switching cost at the time instant; representing the number of risk events that violate the safety boundary at the time instant. the number of risk events that violate the safety boundary at the time instant.
7. A method of supply-priority natural gas pipeline network anomaly handling recommendation according to claim 6, characterized in that, The tiered supply shortages for users are as follows: In the formula, Indicates user exist The current tiered supply shortage; Indicates user exist Current demand; Indicates user exist The actual gas supply at any given time.
8. The method of claim 1, wherein, The expression for the reward value is: In the formula, Indicates in The reward value at that moment; This indicates the reward items corresponding to the user's tiered supply shortage. This indicates the minimum penalty for defaulting on gas supply orders. This indicates the penalty for node pressure deviation; This indicates an award for the coordinated use of the cable and emergency gas source; Indicates the penalty for switching actions; This indicates a security risk penalty item.
9. The method of claim 1, wherein, The steps to obtain the target action value of each action at the current moment based on the maximum action value corresponding to the network anomaly state vector at the next moment and the reward value at the current moment are as follows: In the formula, Indicates in The value of the target action that can be taken at any time; Indicates in Momentary reward value; Indicates the discount factor; Indicates in The action value of each actionable action at any given moment; Indicates in The set of actions that can be taken at any given moment; Indicates in Actions that can be taken at any time; This represents the network parameters of the Attention-DQN neural network.
10. A criticality-preferred natural gas pipeline network anomaly handling recommendation system, characterized in that, include: The parameter acquisition module is used to acquire pipeline abnormal state data of the natural gas pipeline network and obtain the pipeline abnormal state vector based on the pipeline abnormal state data. The action setting module is used to generate a set of candidate actions based on a preset scheduling rule library, an exception contingency plan library, and action executable conditions; define constraints, and pre-screen candidate actions according to the natural gas pipeline network operation boundary to obtain a set of feasible actions that meet the constraints. The dataset construction module is used to obtain the attention weight corresponding to each pipeline abnormal state based on the importance score of the pipeline abnormal state, obtain the corresponding pipeline weighted state at the current time based on the attention weight, obtain the action value of each actionable action based on the corresponding pipeline weighted state at the current time, and construct the dataset based on the pipeline abnormal state vector and the action value of each actionable action. The loss function construction module is used to set user-tiered supply shortage reward items, user minimum gas supply default penalty items, node pressure deviation penalty items, coil and emergency gas source collaborative utilization reward items, action switching penalty items, and safety risk penalty items. It obtains reward values based on user-tiered supply shortage reward items, user minimum gas supply default penalty items, node pressure deviation penalty items, coil and emergency gas source collaborative utilization reward items, action switching penalty items, and safety risk penalty items. It obtains the target action value of each action that can be taken at the current time based on the maximum action value corresponding to the pipeline abnormal state vector at the next time step and the reward value at the current time step. Construct a mean squared error loss function based on the target action value and action value of each action that is possible at the current moment; The neural network module is used to construct the Attention-DQN neural network and train the Attention-DQN neural network using the dataset until the mean squared error loss function converges to obtain the trained target Attention-DQN neural network. The result recommendation module is used to input the current pipeline abnormal state vector into the Attention-DQN neural network to obtain the action value of each action at the current time, and take the action corresponding to the maximum action value as the abnormal handling recommendation result.