Hydrogen energy micro-service optimization method and system based on rule chain and graph neural network

By using a hydrogen energy microservice optimization method based on rule chains and graph neural networks, the shortcomings of traditional hydrogen energy systems in equipment coordination and fault diagnosis are addressed. This method improves the timeliness of equipment coordination response and the accuracy of fault diagnosis, reduces energy loss and resource waste, and provides a highly reliable and economical technical solution.

CN121457697APending Publication Date: 2026-02-03SHANDONG COMP SCI CENTNAT SUPERCOMP CENT IN JINAN
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511568612.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-30
Publication Date
2026-02-03

AI Technical Summary

Technical Problem

Traditional hydrogen energy system control architectures have shortcomings in equipment coordination, fault diagnosis, and resource optimization. In particular, they suffer from asymmetric time delays in equipment status feedback and limited information fusion capabilities, making it difficult to balance response speed and decision-making accuracy, resulting in insufficient reliability and economy.

Method used

A hydrogen energy microservice optimization method based on rule chains and graph neural networks is adopted. By constructing a dynamic microservice call graph, defining control logic and constraints by combining rule chains, encoding device interaction features by using multi-level graph neural networks, and generating optimization actions through reinforcement learning, intelligent unification of device collaboration, fault diagnosis and resource optimization is achieved.

Benefits of technology

It significantly improves the timeliness of equipment collaborative response, reduces energy efficiency loss, improves the location accuracy of fault diagnosis and resource utilization, meets stringent safety protection requirements, and achieves simultaneous optimization of the overall cost and safety risks of hydrogen production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121457697A_ABST
    Figure CN121457697A_ABST
Patent Text Reader

Abstract

The invention provides a hydrogen energy micro-service optimization method and system based on a rule chain and a graph neural network, and relates to the technical field of scheduling optimization. Constructing a dynamic micro-service calling graph based on hydrogen energy industry information, and defining a node state feature vector and an anomaly detection threshold based on a rule chain; when an anomaly alarm is triggered based on an anomaly detection threshold value, generating a global feature vector according to a calling dependency relationship between the node state feature vector and the nodes; coding nodes, paths and systems in the calling graph by adopting a multilevel graph neural network in combination with the global feature vectors to obtain relevant parameters of the rule chain; based on the relevant parameters of the rule chain, a reinforcement learning decision is executed under constraint conditions defined by the rule chain; based on the optimization action output by reinforcement learning and the rule chain related parameters generated in the encoding process, the micro-service dynamic deployment operation is executed, the equipment collaborative response speed is effectively improved, and the fault false alarm rate and the hydrogen production comprehensive cost are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of scheduling optimization technology, and in particular to a method and system for optimizing hydrogen energy microservices based on rule chains and graph neural networks. Background Technology

[0002] Hydrogen energy systems integrate multiple stages, including hydrogen production through electrolysis, gas storage and transportation, and fuel cell power generation. They exhibit dynamic coupling characteristics across equipment, levels, and scales, and their stable operation relies on the coordinated control and efficient maintenance of equipment in each stage. Microservice architecture, by breaking down control units into independent services, enables flexible scheduling and distributed management, becoming an important technological direction for addressing system complexity.

[0003] With the accelerated industrialization of hydrogen energy, system control faces multiple challenges, including high coupling, real-time response, and multi-objective optimization. Traditional centralized control architectures are gradually showing their shortcomings in areas such as equipment coordination, fault diagnosis, and resource optimization. In particular, in scenarios where there are asymmetric time delays in the feedback of different equipment statuses and limited information fusion capabilities, control strategies struggle to balance response speed and decision accuracy.

[0004] The shortcomings of existing technologies are mainly reflected in three aspects: First, the control logic is rigid, making it difficult to cope with the equipment linkage requirements under dynamic operating conditions; second, fault diagnosis relies on a single threshold judgment, resulting in weak ability to identify faults caused by multiple factors; and third, strategy optimization lacks a multi-objective collaborative mechanism, leading to poor performance in balancing cost, safety, and energy efficiency. These problems restrict the reliability and economy of hydrogen energy systems, necessitating the construction of a more intelligent control and optimization system. Summary of the Invention

[0005] To address the aforementioned issues, this invention proposes a hydrogen energy microservice optimization method and system based on rule chains and graph neural networks. By combining the explicit logic control of rule chains with the implicit relationship modeling of graph neural networks and the dynamic decision-making of reinforcement learning, a microservice optimization system for the hydrogen energy industry chain is constructed. Rule chains define control logic and constraints, multi-level graph neural networks encode device interaction features, and reinforcement learning generates optimization actions under rule constraints. Finally, dynamic deployment of microservices implements the strategy, achieving intelligent unification of device collaboration, fault diagnosis, and resource optimization.

[0006] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a hydrogen energy microservice optimization method based on rule chains and graph neural networks, comprising: Based on hydrogen energy industry information, a dynamic microservice call graph is constructed, and node state feature vectors and anomaly detection thresholds are defined based on rule chains. When an anomaly alarm is triggered based on an anomaly detection threshold, a global feature vector is generated according to the node status feature vector and the call dependency relationship between nodes; A multi-level graph neural network is used to encode the nodes, paths and systems in the call graph by combining global feature vectors, so as to obtain the relevant parameters of the rule chain, including node embedding vectors, path feature vectors and global state vectors. Based on the relevant parameters of the rule chain, reinforcement learning decisions are executed under the constraints defined by the rule chain. Based on the optimized actions output by reinforcement learning and the rule chain-related parameters generated during the encoding process, microservice dynamic deployment operations are performed.

[0007] Secondly, the present invention provides a hydrogen energy microservice optimization system based on rule chains and graph neural networks, comprising: Call graph construction template is used to build a dynamic microservice call graph based on hydrogen energy industry information, and to define node state feature vectors and anomaly detection thresholds based on rule chains; The global feature generation module is used to generate a global feature vector based on the node status feature vector and the calling dependency relationship between nodes when an anomaly alarm is triggered based on the anomaly detection threshold. The multi-level graph encoding module is used to encode nodes, paths, and systems in the call graph using a multi-level graph neural network and combined with global feature vectors to obtain rule chain related parameters, including node embedding vectors, path feature vectors, and global state vectors. The reinforcement learning decision module is used to perform reinforcement learning decisions based on the relevant parameters of the rule chain and under the constraints defined by the rule chain. The dynamic deployment module is used to perform microservice-based dynamic deployment operations based on the optimization actions output by reinforcement learning and the rule chain-related parameters generated during the encoding process.

[0008] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the hydrogen energy microservice optimization method based on rule chains and graph neural networks described in the first aspect.

[0009] Fourthly, the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps in the hydrogen energy microservice optimization method based on rule chains and graph neural networks described in the first aspect.

[0010] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention achieves a systemic technological breakthrough in the field of hydrogen energy industrialization through a collaborative architecture of rule chain-driven, graph neural network modeling, and microservice-based reinforcement learning: Based on a dynamically constructed microservice call graph topology, it can characterize the multidimensional interaction relationship between the electrolyzer, storage tank, and fuel cell in real time. For example, the weight matrix covers core operating parameters such as pressure regulation, pressure drop, and operational reliability, which improves the timeliness of equipment collaborative response by orders of magnitude compared to traditional systems and significantly reduces energy efficiency loss.

[0011] This invention integrates a rule-chain anomaly detection framework with graph neural network feature extraction capabilities, achieving a significant reduction in false alarm rate and a breakthrough improvement in positioning accuracy in safety protection scenarios such as proton exchange membrane damage identification and leak location, fully meeting stringent explosion-proof standards. By decoupling strongly coupled parameter relationships through graph neural networks and combining a microservice-based hybrid action space optimization mechanism, it maintains the energy efficiency index in the industry-leading range under severe operating condition fluctuations, achieving simultaneous optimization of the overall cost of hydrogen production and the level of safety risks. The final constructed rule-chain dynamic deployment system supports millisecond-level hot update iteration of degradation compensation strategies, significantly improving equipment resource utilization and providing a full-stack technical solution with high reliability and economy for the large-scale application of green hydrogen.

[0012] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0013] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute a limitation thereof.

[0014] Figure 1 The main flowchart of a hydrogen energy microservice optimization method based on rule chains and graph neural networks provided in this embodiment of the invention; Figure 2 A system architecture diagram of a hydrogen energy microservice optimization method based on rule chains and graph neural networks provided in an embodiment of the present invention; Figure 3 A flowchart illustrating the coupling encoding of rule chains and GAT provided for embodiments of the present invention; Figure 4 A flowchart of the resource preemption strategy priority ranking algorithm provided in an embodiment of the present invention; Figure 5 The state transition diagram of the three-level melting mechanism of hydrogen energy equipment provided in the embodiments of the present invention. Detailed Implementation

[0015] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0016] Explanation of technical terms: 1. Microservice Call Graph: A weighted directed graph constructed from distributed tracing data.

[0017] 2. Node State Vector: A multi-dimensional feature vector that describes the operating state of a device.

[0018] 3. Rule Chain: A sequence of control logic consisting of initial rules. 4. Attention Network Encoding (GAT Encoding): A graph neural network encoding method based on multi-head attention mechanism.

[0019] 5. Hybrid Action Space: The set of actions for reinforcement learning, A=[a1,a2,a3].

[0020] 6. Dynamic Policy Deployment: A policy hot update mechanism implemented through Kubernetes Operator.

[0021] Example 1 like Figure 1 As shown, this embodiment discloses a hydrogen energy microservice optimization method based on rule chains and graph neural networks, including the following steps: S1: Based on hydrogen energy industry information, construct a dynamic microservice call graph, and define node state feature vectors and anomaly detection thresholds based on rule chains; S2: When an anomaly alarm is triggered based on the anomaly detection threshold, a global feature vector is generated according to the node status feature vector and the calling dependency relationship between nodes; S3: Employs a multi-level graph neural network, combining global feature vectors to encode nodes, paths, and systems in the call graph, obtaining rule chain-related parameters, including node embedding vectors, path feature vectors, and global state vectors; S4: Based on the relevant parameters of the rule chain, perform reinforcement learning decisions under the constraints defined by the rule chain; S5: Based on the optimized actions output by reinforcement learning and the rule chain-related parameters generated during the encoding process, perform microservice dynamic deployment operations.

[0022] Next, combined Figure 2 This embodiment provides a detailed description of a hydrogen energy microservice optimization method based on rule chains and graph neural networks.

[0023] In S1, a dynamic call graph driven by rule chains is constructed.

[0024] By deploying the microservice tracing agent (OpenTelemetry Collector) as a Kubernetes DaemonSet, distributed tracing data collection is achieved, and a microservice call graph with time windows is constructed. .

[0025] in, The microservice call graph with time window represents the topology of the call relationships between microservices in the hydrogen energy system at a certain time t, and is dynamically updated with the time window. Let t be the set of nodes at time t, representing the independent units that constitute the hydrogen energy microservice system, with each node corresponding to a specific microservice; Let be the set of edges at time t, representing the call relationships between nodes (microservices). If service A needs to call service B to obtain data (e.g., power regulation service calls stress monitoring service), then there exists an edge t. .

[0026] Here is the weight matrix at time t, used for quantization. The importance and health of each side's calls, matrix dimensions and The number of nodes must be the same (if there are n nodes, (For an n×n matrix), the matrix elements are :

[0027] in, .

[0028] in, Let be the weight value from node i to node j, and let be the frequency of calls from microservice i to microservice j within the time window. The call frequency threshold is the current latency, which is the average response latency of microservice i calling microservice j within the time window. This is the response latency threshold. This represents the historical average call frequency. The standard deviation of historical call frequency. It is a historical lag exponential moving average. This is the buffer coefficient for the rule chain.

[0029] The weight matrix proposed in this embodiment By combining call frequency and response latency, the value of the call chain is quantified from two dimensions. Furthermore, by dynamically adjusting thresholds based on historical data and rule chains, it better adapts to the characteristics of hydrogen energy microservices. It accurately identifies core collaborative links, ensuring reliable linkage between equipment such as electrolyzers, storage tanks, and fuel cells, and avoiding misjudgments of core link priorities. It dynamically adapts to fluctuations in operating conditions, avoiding one-size-fits-all misjudgments through variable thresholds, such as allowing moderate delays under high load. It provides quantitative basis for subsequent anomaly detection and reinforcement learning decisions, such as locating low-weight abnormal links and prioritizing resource allocation to high-weight links. Adapting to the dynamic characteristics of microservices, weights are updated in real time with the addition and deletion of nodes, requiring no manual intervention, and adapting to the dynamic control logic of the rule chain.

[0030] Furthermore, we define the node state feature vector.

[0031]

[0032] in, , Let be the state feature vector of node i, and T be the statistical time window. Let be the CPU utilization at time t. For the memory pressure of node i, For the health of the rule chain of node i, This represents the weight coefficient of the rule chain.

[0033] Based on the above call graph and node state feature vectors, an initial rule chain is generated. , Includes frequency threshold and delay threshold .in Indicates the initial rule chain. A single rule represents the basic unit in the rule chain, corresponding to "from microservice nodes". To the node The constraints that the "call chain" must follow. Indicates the microservice call relationship. For a single rule, the threshold set, For frequency threshold, This indicates the delay threshold.

[0034] This embodiment abstracts key equipment in a hydrogen energy system, such as electrolyzers, hydrogen storage tanks, gas compressors, and fuel cells, into microservice nodes with state awareness and control capabilities. A rule chain mechanism is used to achieve unified scheduling and dynamic linkage of control logic among these devices. The rule chain consists of a series of conditional triggering logics, possessing event awareness, process tracking, and response management capabilities, and can trigger corresponding control strategies based on real-time equipment operating data.

[0035] For example, when the internal pressure of the hydrogen storage tank exceeds the safety threshold, the rule chain system can automatically identify this state and, according to preset rules, activate the pressure relief module, adjust the hydrogen production rate of the electrolyzer, or switch to a backup storage tank. This dynamic rule configuration supports on-demand modification and is suitable for complex and ever-changing industrial operating scenarios.

[0036] The rule chain system also supports priority queue mechanism and node condition management, which can dynamically adjust the policy scheduling order according to the importance of the policy and the health status of the equipment, so as to achieve more flexible operation optimization control and solve the problems of rigid response and complex configuration of traditional control systems.

[0037] In S2, anomaly detection and feature fusion are performed.

[0038] Implementing a sliding time window based on Flink CEP The abnormal path detection is triggered by the following conditions:

[0039] Where P is the set of call paths within the sliding window. The average response delay for path p. Let P be the number of paths in the path set. This represents the path latency threshold, while service coupling refers to the tightness of dependencies in the call chain. This is the service coupling compliance threshold.

[0040] Build the call dependency matrix , of which elements Extract global feature vectors:

[0041] Where D is the call dependency matrix. This represents the element in the i-th row and j-th column of matrix D. This represents the link weight from node i to node j. Let F be the sum of the weights of all outgoing edges from node i. Let F be the global feature vector. | represents the total number of microservice nodes. is the average CPU utilization of all nodes, max (latency) is the average CPU utilization of all nodes, and the rule chain system health is the overall compliance indicator of the system.

[0042] The scheduling dependency matrix is ​​obtained through elements. The strength of dependencies between nodes is quantified, such as the dependency degree of the core hydrogen energy link "electrolyzer → storage tank". In case of anomalies, highly dependent upstream nodes are prioritized for investigation, shortening the fault tracing time of hydrogen energy equipment. Simultaneously, the dispersed node dependencies are integrated into a structured matrix, combined with global feature vectors, such as the average CPU and maximum latency of all nodes, to provide global topology data for the subsequent system-level encoding of multi-level graph neural networks, avoiding the bias of local indicators. Furthermore, real-time updates are based on a sliding time window. This allows for better coordination of equipment under fluctuating loads in hydrogen energy systems, preventing malfunctions caused by rigid dependencies.

[0043] In S3, such as Figure 3 As shown, the multi-level graph neural network encoding encodes the nodes, paths, and systems in the call graph, generating node embedding vectors, path feature vectors, and global state vectors, respectively.

[0044] To enhance the fault detection capability of hydrogen energy systems under complex operating conditions, this embodiment designs a diagnostic system that integrates a rule-chain logic structure with a graph neural network. By constructing a data flow and physical coupling graph between devices, the system operating state is modeled as graph-structured data, and the graph neural network is used for implicit relationship modeling and anomaly pattern recognition. Specifically: 1. Node-level encoding: Node embeddings are calculated using a 3-layer GAT network, with each layer including a multi-head attention mechanism. The calculation formula is as follows:

[0045] in The feature vector representing a node. This represents the learnable linear projection matrix, where 'a' is the attention vector used to calculate the single-head attention coefficients. || denotes the vector concatenation operation. The priority weighting coefficient of the rule chain indicates that node i is more critical in the business logic, and its neighbor information is amplified. This represents the normalized attention weights, which are used to weight and aggregate neighbor features to form the next layer of node embeddings. The GAT network encoding includes: a) The number of heads n in the multi-head attention mechanism is dynamically determined by the service topology complexity defined by the rule chain; b) Residual join method injection of rule chain stability constraints: ; in, This represents the embedding matrix of nodes in the (l+1)th layer. Let N be the embedding matrix of the nodes in the l-th layer (N is the number of nodes). The current layer's multi-head graph attention aggregation function, The representation layer is normalized to maintain gradient stability; , representing the rule chain stability gating coefficient; c) The final node is embedded as a weighted concatenation of the outputs from each layer:

[0046] ;

[0047] in, The node embedding matrix output by the l-th layer GAT. The layer importance weights are calculated using MLP+Softmax and satisfy ∑ = 1, where a larger weight indicates a greater contribution of that layer to the final embedding. MLP stands for Multilayer Perceptron. The final node embedding matrix contains both shallow local features and deep global features. This represents the coefficient obtained by normalizing the "layer importance weights" predefined by the rule chain using softmax. This represents the final embedding of node i, used for subsequent path encoding and global state aggregation.

[0048] 2. Path-level encoding: Use bidirectional LSTM to process the path sequence, output feature vectors and inject rule chain temporal constraints;

[0049] in, The hidden state of the bidirectional LSTM at time t contains the concatenation of forward and backward information, serving as the path representation for that step. Embed the node in the current step t. It is a bidirectional long short-term memory network; The path reliability coefficient generated for the rule chain is generated through the following process: (1) Data acquisition: Record the target path p within a sliding window of the past 10 minutes: : Number of successful calls Total number of calls (2) Basic reliability:

[0050] (3) Rule chain correction: Introduce the path level given by the rule chain. and buffer coefficient : σ( + · ) Where σ(·) is the Sigmoid function, and its output is limited to the interval (0,1), yielding the final path reliability coefficient. .

[0051] 3. System-level coding: Generate global state through attention pooling:

[0052] in, Let q be the global state vector, and q be the dimension of the trainable query vector. This is the weight matrix. , The feature vector (Node Embedding) of node i is derived from the GAT encoding output of step 3.1. The path reliability coefficient generated for the rule chain.

[0053] In this embodiment, node-level coding utilizes GAT and rule chain priority to explicitly inject and embed the relationships between nodes and the importance of each node, enabling subsequent algorithms to prioritize critical equipment and reduce noise from irrelevant nodes; path-level coding employs bidirectional LSTM and path reliability coefficients. By capturing historical-future context bidirectionally along the call chain, the fault propagation path is fully modeled, significantly improving the localization accuracy of coupled faults such as leaks and blockages; system-level coding compresses node-path features into a single global vector through attention pooling. This approach preserves the macroscopic operational status while also serving as direct input for reinforcement learning, enabling unified decision-making from local to global perspectives and avoiding information loss caused by modular splicing. Therefore, the three-layer encoding in this embodiment can sequentially complete the progressive abstraction of local correlation, temporal propagation, and global status, allowing the graph neural network to balance accuracy, interpretability, and computational efficiency in strongly coupled, multi-scale hydrogen energy scenarios.

[0054] In S4, reinforcement learning decision-making is based on rule chain constraints.

[0055] First, define the hybrid action space: Version repository, node selection probability vector} in, This is a continuous operation used for online fine-tuning of anomaly detection thresholds. For discrete actions, the value space is a rule chain version library, which determines which set of control rules to load in the next moment; the method for generating the node selection probability is as follows: a) The node selection scoring model is:

[0056] in To generate trainable projection vectors, node embeddings are mapped to scalar scores. For the final embedding of node i, SLA levels are divided into five grades, from P0 to P4. The node business criticality score is pre-defined by the rule chain. The current CPU utilization of the node is used to determine the score. The lower the utilization, the higher the score, thus achieving "light load priority".

[0057] b) Using the softmax generation probability with temperature coefficient T:

[0058] c) Hard constraints include: or Forced ; Furthermore, the PPO algorithm is adopted as the update strategy, and the composite reward function is:

[0059] Weight For dynamic weights, This represents the set of actions allowed by the rule chain:

[0060] in, A real-time score (0–1) is used, with scores closer to 1 indicating a higher degree of match between the sub-objective (resources, compliance, availability) and the current working conditions. Further optimization of the PPO algorithm includes: a) The experience playback buffer uses priority sampling, with a sampling probability of:

[0061] in, For time-series difference error, the larger the absolute value, the greater the correction of the experience to the value network, and the more likely it will be replayed.

[0062] b) Adaptive entropy regularization coefficient:

[0063] c) Gradient clipping threshold ∈ [0.1, 1.0], KL divergence constraint is used during policy update; Furthermore, the policy gradient is calculated based on Generalized Advantage and Estimation (GAE):

[0064] in As a discount factor, For GAE smoothing coefficients, Output for the value network.

[0065] In S5, microservice-based rule chains are dynamically deployed.

[0066] First, the canary release strategy uses a rule-chain-driven weight allocation, and the health score is calculated as follows:

[0067]

[0068] Where σ represents the Sigmoid function, For the health score of the old version of the rule chain during the gray release within the same time window, and... Together, they are used to calculate the traffic weight of the new and old versions and determine the gray-scale ratio.

[0069] The dynamic deployment includes: a) Version control mechanism maintains a set of rule chain versions. Retain the most recent N historical versions; b) such as Figure 4 As shown, the resource preemption strategy reserves a certain percentage of resources for P0-level services, and the preemption trigger condition is:

[0070] in .

[0071] For resource utilization, The instantaneous utilization rate of the current physical node (CPU / memory) is the measured value. The SLA violation probability is represented by the number of timeouts in the P0 service in the last 1 minute / the total number of calls.

[0072] c) The threshold for the number of times the center jump detection of the node isolation strategy is ∈ [3-10] times, and the isolation time is ∈ [30s, 300s].

[0073] In dynamic deployment operations, to address sudden safety risks in hydrogen energy systems (such as gas leaks in electrolyzers and abnormal pressure in fuel cells), a three-level circuit breaker mechanism needs to be implemented based on rule chain triggering conditions and real-time equipment status, such as... Figure 5 As shown, risk tiered management is implemented, and the specific process and state transition logic are as follows: I. Circuit Breaker Triggering Conditions and State Definitions The three-tiered circuit breaker mechanism is triggered based on core safety indicators of the hydrogen energy system (such as hydrogen concentration, equipment operating temperature, and pressure). The circuit breaker conditions at each level are dynamically configured through a rule chain and are linked to the health of nodes and the reliability coefficient of paths in the microservice call graph. The specific definitions are as follows: 1. Normal state: The operating parameters of all equipment in the system (hydrogen concentration < safety threshold, temperature / pressure within the rated range) are within the normal range, the microservice call success rate is ≥99.5%, the rule chain health score is >0.9, and no abnormal alarms are triggered. At this time, the dynamic deployment module maintains the normal resource allocation strategy.

[0074] 2. Warning Status: A warning status is activated when any of the following conditions are met: (1) The hydrogen concentration in key equipment (such as storage tanks and gas pipelines) continues to rise to 80% of the safety threshold and does not show a downward trend within 5 minutes (gradient anomaly). (2) The microservice call delay exceeds the threshold set by the rule chain for three consecutive time windows (each window is 1 minute), and the service coupling degree is >0.7 (the core link weight in the call dependency matrix fluctuates by >20%). (3) The CPU utilization rate in the node state feature vector is >85% or the memory pressure is >90%, and the rule chain health score drops to the range of 0.7-0.9.

[0075] Once the warning state is entered, the system automatically starts abnormal path marking (based on Flink CEP to trace high-latency call links) and sends a warning signal to the reinforcement learning decision module, prioritizing the allocation of resources for abnormal node monitoring.

[0076] 3. Level 1 Circuit Breaker: Executed when the warning status continues to time out (default 10 minutes) or when the following hard conditions are triggered: (1) The hydrogen concentration is greater than or equal to the relay threshold (90% of the safety threshold), and the gas detection sensor exceeds the standard in three consecutive sampling data. (2) The success rate of microservice calls drops below 95%, and the core link (such as electrolyzer control service → tank monitoring service) fails to call more than twice; (3) The rule chain triggers a first-level risk event (such as a minor leak in the proton exchange membrane or an excessive local temperature in the equipment).

[0077] The Level 1 circuit breaker operation includes: suspending resource allocation for non-core microservices (such as data statistics service and log analysis service) and prioritizing the allocation of released resources to the security monitoring service; adjusting the number of replicas of core services through Kubernetes Operator to improve call fault tolerance; pushing risk warnings to the operations and maintenance terminal in real time, and if the risk is mitigated within 30 minutes (the concentration drops below the safety threshold and the call success rate recovers to above 98%), it will return to normal; if the risk continues to escalate, the Level 2 circuit breaker will be automatically triggered.

[0078] 4. Level 2 circuit breaker: Triggered when one of the following conditions is met: (1) The hydrogen concentration is greater than or equal to the safety threshold, and the gas diffusion rate is greater than the upper limit set by the rule chain; (2) The core microservice (such as fuel cell power regulation service, emergency shut-off valve control service) experiences 5 consecutive timeouts, or the rule chain health score in the node status feature vector is <0.5; (3) The risk is not mitigated after the first-level circuit breaker is triggered, and two or more related nodes are abnormal (such as the gas pipeline control service alarm triggered by the abnormal tank monitoring service).

[0079] Level 2 circuit breaker operations include: forcibly terminating all non-security-related microservices, retaining only security monitoring and emergency control services; initiating emergency protection measures for equipment (such as shutting off gas valves and reducing the operating power of the electrolysis cell); locking the dynamic deployment permissions of microservices through the circuit breaker actuator to prevent new services from going online; and automatically triggering Level 3 circuit breaker if the risk is still not under control within 15 minutes.

[0080] 5. Level 3 Circuit Breaker: Triggered only when the Level 2 circuit breaker fails and a "fatal risk" occurs, such as hydrogen concentration > 1.2 times the safety threshold, equipment emitting an open flame / explosion warning, or core safety services (such as emergency shut-off valve control services) becoming completely unavailable. In this case, the system immediately performs a shutdown maintenance operation: disconnecting the main power and gas supply to the hydrogen energy system, shutting down all equipment; blocking external call requests through the microservice gateway to prevent the fault from spreading; generating a detailed risk report (including abnormal node call paths, circuit breaker trigger sequence, and equipment parameter change curves), and forcibly waiting for manual safety confirmation. After on-site risk investigation and fault repair by maintenance personnel, a "safety confirmation command" must be entered through the management terminal before the system can perform a reset operation, gradually restoring microservice deployment and equipment operation, ultimately returning to normal status.

[0081] In this embodiment, the three-level circuit breaker mechanism is deeply coupled with the rule chain and the dynamic deployment module to achieve a closed loop of risk detection, decision execution and state recovery.

[0082] This specific embodiment addresses the shortcomings of traditional control architectures in hydrogen energy systems regarding equipment coordination, fault diagnosis, and resource optimization. It achieves a systemic breakthrough by integrating rule-chain-driven dynamic control logic, feature encoding from multi-level graph neural networks, and reinforcement learning decision-making. It improves the timeliness of collaborative response by dynamically representing equipment interaction relationships in a real-time microservice call graph; enhances fault diagnosis capabilities and reduces false alarm rates by integrating rule chains and graph neural networks; optimizes multi-objective balance through reinforcement learning constrained by rule chains, reducing costs while ensuring safety; and enables rapid strategy iteration through microservice-based dynamic deployment, significantly improving resource utilization and providing an efficient and reliable technical solution for the industrialization of hydrogen energy.

[0083] Example 2 This embodiment provides a hydrogen energy microservice optimization system based on rule chains and graph neural networks, including: Call graph construction template is used to build a dynamic microservice call graph based on hydrogen energy industry information, and to define node state feature vectors and anomaly detection thresholds based on rule chains; The global feature generation module is used to generate a global feature vector based on the node status feature vector and the calling dependency relationship between nodes when an anomaly alarm is triggered based on the anomaly detection threshold. The multi-level graph encoding module is used to encode nodes, paths, and systems in the call graph using a multi-level graph neural network and combined with global feature vectors to obtain rule chain related parameters, including node embedding vectors, path feature vectors, and global state vectors. The reinforcement learning decision module is used to perform reinforcement learning decisions based on the relevant parameters of the rule chain and under the constraints defined by the rule chain. The dynamic deployment module is used to perform microservice-based dynamic deployment operations based on the optimization actions output by reinforcement learning and the rule chain-related parameters generated during the encoding process.

[0084] Example 3 This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in the hydrogen energy microservice optimization method based on rule chains and graph neural networks as described in Embodiment 1 above.

[0085] Example 4 This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the hydrogen energy microservice optimization method based on rule chains and graph neural networks as described in Embodiment 1 above.

[0086] The steps or modules involved in Embodiments 2 to 4 above correspond to those in Embodiment 1. For specific implementation details, please refer to the relevant description section of Embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood as including any medium capable of storing, encoding, or carrying an instruction set for execution by a processor and enabling the processor to perform any of the methods in this invention.

[0087] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A rule chain and graph neural network based hydrogen energy microservice optimization method, characterized in that, The method comprises the following steps: Based on the hydrogen energy industry information, a dynamic micro-service call graph is constructed, and a node state feature vector and an abnormal detection threshold are defined based on a rule chain; When an abnormal alarm is triggered based on the abnormal detection threshold, a global feature vector is generated based on the node state feature vector and the call dependency relationship between nodes; A multi-level graph neural network is used to encode the nodes, paths and systems in the call graph in combination with the global feature vector to obtain rule chain related parameters, including node embedding vectors, path feature vectors and global state vectors; Based on the rule chain related parameters, reinforcement learning decision is executed under the constraint conditions defined by the rule chain; Based on the optimization actions output by the reinforcement learning and the rule chain related parameters generated in the encoding process, micro-service dynamic deployment operations are performed.

2. The rule chain and graph neural network-based hydrogen energy microservice optimization method of claim 1, wherein, The construction of the dynamic micro-service call graph collects time series data of hydrogen energy equipment operation through a distributed tracking agent, updates the weights of nodes and edges in the graph according to time windows, and the weights are used to reflect the correlation between service call frequency and response performance.

3. The rule chain and graph neural network-based hydrogen energy microservice optimization method of claim 1, wherein, The abnormal detection analyzes the service call path through a sliding time window, triggers an alarm when the average delay exceeds the threshold and the service coupling degree exceeds the standard, and the call dependency relationship is calculated based on the service call weight and the rule chain priority.

4. The rule chain and graph neural network-based hydrogen energy microservice optimization method of claim 1, wherein, The node state feature vector contains the CPU utilization, memory pressure, response delay, request queue length and call success rate of the device, and the rule chain dynamically adjusts the abnormal detection threshold of each feature based on the device operation history data.

5. The rule chain and graph neural network-based hydrogen energy microservice optimization method of claim 1, wherein, In the multi-level graph neural network encoding, the node-level encoding uses a multi-head attention mechanism with rule chain priority weight, the path-level encoding incorporates rule chain timing constraints, and the system-level encoding aggregates node and path features through attention pooling.

6. The rule chain and graph neural network-based hydrogen energy microservice optimization method of claim 1, wherein, The action space of the reinforcement learning decision includes threshold adjustment, rule chain version switching and node selection, the reward function integrates resource utilization efficiency, rule compliance and service interruption frequency, and the weights dynamically change with the rule chain confidence.

7. The rule chain and graph neural network-based hydrogen energy microservice optimization method of claim 1, wherein, The micro-service dynamic deployment adopts a gray release strategy, allocates traffic weights based on the health degree and risk coefficient of new and old version rule chains, and the health degree is calculated from the request success rate and failure rate.

8. A rule chain and graph neural network based hydrogen energy microservice optimization system, characterized in that, The method comprises the following steps: A call graph construction template is used to construct a dynamic micro-service call graph based on hydrogen energy industry information, and a node state feature vector and an abnormal detection threshold are defined based on a rule chain; A global feature generation module is used to generate a global feature vector based on the node state feature vector and the call dependency relationship between nodes when an abnormal alarm is triggered based on the abnormal detection threshold; A multi-level graph encoding module is used to encode the nodes, paths and systems in the call graph in combination with the global feature vector using a multi-level graph neural network to obtain rule chain related parameters, including node embedding vectors, path feature vectors and global state vectors; A reinforcement learning decision module is used to execute reinforcement learning decision based on the rule chain related parameters under the constraint conditions defined by the rule chain; A dynamic deployment operation module is used to perform micro-service dynamic deployment operations based on the optimization actions output by the reinforcement learning and the rule chain related parameters generated in the encoding process.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the steps in the rule chain and graph neural network-based hydrogen microservice optimization method according to any one of claims 1-7.

10. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the steps in the rule chain and graph neural network-based hydrogen microservice optimization method according to any one of claims 1-7.