Two-stage online operation optimization method for information-physical hydrogen-containing building energy system
Patent Information
- Application Number
- CN202611089933.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-22
- Publication Date
- 2026-10-23
AI Technical Summary
具体而言,基于模型的方法(如鲁棒优化和模型预测控制)依赖不确定参数(如多能负荷和可再生能源出力)的精确预测,而传统预测模型通常仅以最小化预测误差为目标进行训练,未考虑预测结果对下游控制决策的影响,缺乏决策聚焦的预测能力;基于数据驱动的方法(如深度强化学习)虽然无需预测不确定参数和任何系统模型的先验知识,但需要大量环境交互数据进行训练,因此训练成本高且实际部署困难
[0187](1)与现有基于模型的方法相比,本发明提供的基于决策聚焦神经网络辅助模型预测控制的集中式在线运行优化方法,以最小化决策遗憾为训练目标构建不确定参数预测模型,相比现有传统的以预测精度为训练目标的预测模型,可使预测直接面向优化决策,从而获得更高的决策质量,有效降低运行成本。
Smart Images

Figure CN122962950A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system, belonging to the interdisciplinary field of energy systems, cybersecurity, systems engineering, and artificial intelligence. Background Technology
[0002] To address the energy crisis and environmental problems caused by the overuse of fossil fuels, renewable energy sources such as photovoltaics and wind power have been widely deployed in energy systems to drive energy transition and promote the achievement of global carbon neutrality goals. However, their intermittency and volatility pose serious challenges to the reliability and stability of energy system operation. Against this backdrop, hydrogen-containing multi-energy systems have attracted widespread attention. In hydrogen-containing multi-energy systems, hydrogen energy storage systems possess advantages such as large-capacity storage, zero pollution, and black-start capability. When efficiently coordinated with other energy storage systems such as thermal energy storage, the economics, operational stability, and renewable energy absorption capacity of the energy system can be further improved. Therefore, research on the operational optimization of hydrogen-containing multi-energy systems is of great significance.
[0003] Numerous optimization methods for hydrogen-containing multi-energy systems have been proposed, including continuous subproblem solving, hierarchical model predictive control, multi-stage partial robust optimization, Lyapunov optimization, multi-agent deep reinforcement learning, and large language model-assisted reinforcement learning. These studies have made some progress in improving economic efficiency and reducing carbon emissions, and are increasingly focusing on supply and demand coordination. However, existing methods have the following shortcomings. Specifically, model-based methods (such as robust optimization and model predictive control) rely on accurate predictions of uncertain parameters (such as multi-energy loads and renewable energy output). Traditional prediction models are typically trained only to minimize prediction errors, without considering the impact of prediction results on downstream control decisions, thus lacking decision-focused prediction capabilities. Data-driven methods (such as deep reinforcement learning), while not requiring prediction of uncertain parameters or any prior knowledge of the system model, require a large amount of environmental interaction data for training, resulting in high training costs and difficulties in practical deployment. More critically, existing works all assume normal communication conditions during the operation of hydrogen-containing multi-energy systems, failing to consider the impact of cyberattacks on system performance. In practice, optimizing the operation of hydrogen-containing multi-energy systems requires collecting decision-making data and issuing control commands through communication links, which exposes network risks. For example, when a denial-of-service attack occurs, the blockage of critical communication links will lead to severe degradation of optimization performance and may even threaten the security of the physical system.
[0004] Based on the above research, the challenges in optimizing the operation of hydrogen-containing multi-energy systems can be summarized as follows: (1) there are multi-source uncertainties related to multi-energy loads and renewable energy output; (2) there are spatiotemporal coupling constraints related to the dynamics and energy balance of energy storage systems; and (3) there is information unavailability caused by critical communication link failures due to denial-of-service network attacks. To address these challenges, this invention proposes a two-stage online operation optimization method for cyber-physical hydrogen-containing building energy systems that combines decision-focused neural network-assisted model predictive control and alternating direction multiplier method. By switching between centralized and distributed strategies during the normal operation and denial-of-service attack phases, the method effectively resists performance degradation caused by denial-of-service attacks and achieves efficient and economical operation of the cyber-physical hydrogen-containing building energy system. Summary of the Invention
[0005] To address the shortcomings of existing research, this invention proposes a two-stage online operation optimization method for cyber-physical hydrogen-containing building energy systems. This method aims to prevent system performance degradation under denial-of-service network attacks, ensuring efficient and economical operation, and ultimately minimizing operating costs. To achieve the above objectives, this invention employs the following technical solution:
[0006] This invention provides a two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system, comprising the following steps:
[0007] Step 1: Establish an operational optimization problem for a cyber-physical hydrogen-containing building energy system under a denial-of-service (DoS) attack, and divide the operation process into a normal operation phase and a DoS attack phase based on the DoS attack status.
[0008] Step 2: For the normal operation phase, a centralized online operation optimization method based on decision-focusing neural network-assisted model predictive control is proposed;
[0009] Step 3: For the denial-of-service network attack phase, a distributed online operation optimization method based on the alternating direction multiplier method is proposed;
[0010] Step 4: Deploy the proposed two-stage online operation optimization method to the actual system and switch autonomously according to the denial-of-service network attack status.
[0011] Furthermore, the optimization problem of the operation of a cyber-physical hydrogen-containing building energy system under a denial-of-service network attack event established in step 1 includes constraints, decision variables, and objective function.
[0012] First, the constraints mainly include the physical layer model, the control and information layer model, the denial-of-service network attack model, the operating cost model, and the practical decision-making model. Among them, the physical layer model mainly includes the electrical energy subsystem model, the hydrogen energy subsystem model, the thermal energy subsystem model, and the energy balance model.
[0013] The electrical energy subsystem model is as follows:
[0014] (1)
[0015] (2)
[0016] in: and They represent Maximum power generation and actual utilization power of time-slot photovoltaic panels; , and These represent the power generation efficiency, solar radiation area, and [other parameters] of the photovoltaic panel, respectively. Time-slot illumination intensity. It is worth noting that, since the cyber-physical hydrogen-containing building energy system in this invention operates in off-grid mode, the cost of removing residual photovoltaic power generation is considered in the optimization objective.
[0017] The hydrogen energy subsystem model is as follows:
[0018] (3)
[0019] (4)
[0020] (5)
[0021] (6)
[0022] (7)
[0023] (8)
[0024] (9)
[0025] (10)
[0026] (11)
[0027] in: express Hydrogen storage capacity of the time-slot hydrogen storage tank; , and They represent The amount of hydrogen produced by the time-slot electrolyzer, the amount of hydrogen purchased from the hydrogen market, and the amount of hydrogen consumed by the fuel cell; and They represent Input power of the time-slot electrolyzer and output power of the fuel cell; Indicates the time slot length; and These represent the operating efficiency of the electrolyzer and the electro-hydrogen conversion efficiency of the fuel cell, respectively. This indicates the maximum storage capacity of the hydrogen storage tank; express The maximum amount of hydrogen that a time slot can purchase from the hydrogen market; and These represent the maximum input power of the electrolyzer and the maximum output power of the fuel cell, respectively. and These respectively represent the electrolyzer and fuel cell in The operation indicator of the time slot, express The electrolyzer in the time-slot hydrogen energy subsystem is in operation mode. express The time-slot fuel cell is in operation mode; express The heat generation of time-slot fuel cells; and These represent the heat recovery efficiency and electrothermal conversion efficiency of the fuel cell, respectively.
[0028] The thermal energy subsystem model is as follows:
[0029] (12)
[0030] (13)
[0031] (14)
[0032] (15)
[0033] (16)
[0034] (17)
[0035] (18)
[0036] (19)
[0037] (20)
[0038] (twenty one)
[0039] (twenty two)
[0040] (twenty three)
[0041] (twenty four)
[0042] (25)
[0043] (26)
[0044] (27)
[0045] in: and They represent The maximum heat generation and actual heat energy utilization of time-slot photovoltaic collectors; and These represent the heat generation efficiency and solar radiation area of the photovoltaic collector, respectively. express The heat storage capacity of time-slot geothermal wells; and They represent The heat generation of time-slot ground source heat pumps and the heat waste of fuel cells; This indicates the heat production efficiency of a ground source heat pump; This indicates the maximum heat storage capacity of a geothermal well. express Input power of time-slot ground source heat pump; This indicates the maximum input power of the ground source heat pump; This indicates the maximum heat output of the fuel cell; and These are indicators representing the operation of a ground-source heat pump and the waste heat from a fuel cell, respectively. express The time-slot geothermal well is releasing heat to drive the ground source heat pump. express Time-slot geothermal wells are injecting excess waste heat from fuel cells; express The heat output of a time-slot electric boiler; , and They represent Input power, heat production efficiency, and maximum input power of the time-slot electric boiler; express Thermal energy storage capacity of time-slot thermal storage tanks; and They represent The charging and discharging power of the time-slot thermal storage tank; and These represent the heat charging efficiency and heat release efficiency of the thermal storage tank, respectively. and These represent the maximum heat charging power and the maximum heat dissipation power of the thermal storage tank, respectively. and These indicate the operation of the thermal storage tank during heat charging and heat release, respectively. express The time-slot thermal storage tank is in charging mode. express The time-slot thermal storage tank is in heat release mode.
[0046] The energy balance model is as follows:
[0047] (28)
[0048] (29)
[0049] (30)
[0050] (31)
[0051] in: and They represent Time-slot electrical load and thermal load; and They represent Time slot electrical load reduction value and thermal load reduction value.
[0052] The control and information layer model is as follows:
[0053] Central controller of the control layer By receiving real-time operational status feedback from the physical layer and issuing control commands accordingly, the coordinated operation of the electrical, thermal, and hydrogen subsystems is achieved. The control commands and status feedback are transmitted via a communication layer, which employs a two-level hierarchical structure. Specifically, the control commands first travel through the backbone communication link from... Send to the corresponding subsystem router ,in: The router indexes correspond to the electrical, thermal, and hydrogen energy subsystems, respectively; subsequently, control commands are sent from the router. The data is forwarded via the subnet link to the switch that directly connects to the physical components, actuators, and sensors within the subsystem; conversely, the measured operational status information of each component is collected by the switch and transmitted back via the reverse path to... In summary, the controller and routers for each energy subsystem The backbone communication link is modeled as follows:
[0054] (32)
[0055] in: Indicated by the central controller Router connecting various subsystems The set of backbone communication links. All communication links, consisting of backbone communication links and sub-network communication links, are modeled as follows:
[0056] (33)
[0057] in: This represents the set of all communication links in a cyber-physical hydrogen-containing building energy system; This represents the set of subnet communication links between all routers and between routers and switches. Furthermore, since this invention focuses on the impact of communication availability on the operation of cyber-physical hydrogen-containing building energy systems, rather than asymmetric routing, bandwidth allocation, or packet-level dynamics, each communication link is treated as a bidirectional logical channel, and indicator variables are designed. A unified representation of the operational status of the uplink status feedback link and the downlink command issuance link; when the indicator variable At that time, the corresponding link is blocked due to a denial-of-service attack, and status information and control commands cannot be transmitted through the link. Furthermore, considering that the exposure risk of wide-area monitoring links in a layered cyber-physical architecture is higher than that of local edge networks, this invention focuses on denial-of-service attack events on backbone communication links. First, for each backbone link... Its availability is determined by a failure indicator variable caused by a denial-of-service attack, and is modeled as follows:
[0058] (34)
[0059] (35)
[0060] in: This is a Boolean variable representing the current time. link The state of being under a denial-of-service network attack. If At present link It suffered a denial-of-service cyberattack; if Then at the current moment link No denial-of-service cyberattack was suffered. This represents the set of communication links that are currently functioning correctly in the current time slot.
[0061] The denial-of-service network attack model is as follows:
[0062] (36)
[0063] in: Indicates the first The characteristic set of a denial-of-service attack event; An index representing denial-of-service attack events; and They represent the first The start time slot and duration of each denial-of-service attack event; Indicates the first The set of backbone links that were interrupted during the denial-of-service attack; This represents the set of denial-of-service attack events. Further, it is used to characterize the current moment. link The Boolean variable model for whether a network is under denial-of-service attack is as follows:
[0064] (37)
[0065] Furthermore, the duration and number of attacks in a denial-of-service network attack are modeled as follows:
[0066] (38)
[0067] (39)
[0068] (40)
[0069] (41)
[0070] in: and These represent the total runtime slots. Inner Link Total attack duration and total number of attack events; Represents all runtime slots A set; and These represent positive integers that limit the attack strength and frequency, respectively. This represents the strength coefficient.
[0071] The operating cost model is as follows:
[0072] (42)
[0073] (43)
[0074] (44)
[0075] (45)
[0076] (46)
[0077] in: express Operating costs of time-slotted information physical hydrogen-containing building energy systems; , , as well as These represent equipment operating costs, hydrogen purchase costs, renewable energy reduction costs, and load shedding costs, respectively. , , , , , as well as These represent the unit operating cost coefficients for photovoltaic panels, photovoltaic collectors, electrolyzers, fuel cells, thermal storage tanks, ground source heat pumps, and electric boilers, respectively. express Time-slot hydrogen price; and These represent the unit cost coefficients for renewable energy reduction; and These represent the unit cost coefficients for the reduction of electrical load and thermal load, respectively.
[0078] The actual decision-making model is as follows:
[0079] Because this invention considers each backbone link to be modeled as a bidirectional logical channel, therefore the link The availability indicator variables for status feedback uplink and control command downlink are modeled as follows:
[0080] (47)
[0081] in: and Representing backbone links Uplink and downlink availability indicators. In the event of a denial-of-service network attack, the central controller... The specific modeling of the available states and the actual decision-making of each energy subsystem in the physical layer is as follows:
[0082] (48)
[0083] (49)
[0084] in: Represents the actual physical layer energy subsystem The component's running status; Indicates when the control layer centralized controller is under denial-of-service attack For energy subsystems The estimated or most recently observed state; Indicates the centralized controller of the control layer. Observable energy subsystems The component's running status; Representing each energy subsystem The decision variables actually executed by the components; Indicates the centralized controller of the control layer. Based on its observed energy subsystem Component running status The output decision variables; Representing each energy subsystem Local decision variables based on local observation state output. Regarding the impact of the aforementioned denial-of-service network attack, the centralized controller... and routing of various energy subsystems The specific modeling for the decision is as follows:
[0085] (50)
[0086] (51)
[0087] (52)
[0088] (53)
[0089] in: For the control layer centralized controller The set of decision-making information that can be actually observed; Centralized controller Uncertain parameter prediction information; This is a centralized controller operation strategy; This represents the set of centralized operation strategies for the electrical, thermal, and hydrogen energy subsystems output by the centralized controller. For router A set of locally observable decision-making information; Indicates router The operating strategy; express The operational status of other energy subsystems that can be actually observed. Furthermore, the present invention takes into account a centralized controller. Centralized decision-making output It is a global decision, and its optimality depends crucially on the complete real-time states of the three subsystems. If the controller... Only a subset of these states is received, i.e., there exists Make Then its output This will degenerate into a suboptimal solution or even an infeasible solution. Therefore, this invention adopts a global switching strategy instead of switching one by one according to subsystems to maintain collaborative consistency. The specific decision modeling method is as follows:
[0090] (54)
[0091] (55)
[0092] (56)
[0093] (57)
[0094] (58)
[0095] (59)
[0096] in: Indicates a centralized operation indicator variable; Indicates the routes corresponding to the electric, thermal, and hydrogen energy subsystems. The set of local execution strategies output; This represents the set of actual execution strategies for the electric, thermal, and hydrogen energy subsystems.
[0097] The decision variables are the energy subsystems at the physical layer. The set of decisions actually implemented Among them, the power subsystem mainly includes the actual power utilized by the photovoltaic panels. and power reduction of electrical load The thermal energy subsystem mainly includes the actual thermal energy used by the photovoltaic collector. Ground source heat pump input power Electric boiler input power Excess waste heat from fuel cells Thermal storage tank charging power Heat storage tank heat release power Heat load reduction value Thermal storage tank charging indicator Heat storage tank heat release indicator Ground source heat pump operation indicator and fuel cell excess waste heat emission label The hydrogen energy subsystem mainly includes the amount of hydrogen purchased from the hydrogen market. Electrolytic cell input power Fuel cell output power Electrolytic cell operation indicator and fuel cell operation indicator .
[0098] The objective function is as follows:
[0099] (60)
[0100] in: Indicates the action on an uncertain parameter and random communication failure links caused by denial-of-service attacks The expectation operator.
[0101] Furthermore, the centralized online operation optimization method based on decision-focusing neural network-assisted model predictive control proposed in step 2 for the normal operation phase mainly includes the following three steps:
[0102] (2.1) First, under the model predictive control solution framework, a finite time domain rolling optimization operation cost minimization problem is established, which considers the prediction of electrical load, thermal load and light intensity.
[0103] (2.2) Secondly, an uncertain parameter prediction model based on a decision-focusing neural network is proposed, and it is trained offline using historical data;
[0104] (2.3) Finally, the trained prediction model is deployed in the model prediction control solver of the control layer to realize the output and distribution of centralized policies.
[0105] Furthermore, the problem of minimizing the running cost of finite-time rolling optimization under the model predictive control framework, considering the prediction of uncertain parameters, established in step (2.1) is as follows:
[0106] (61)
[0107] (62)
[0108] (63)
[0109] (64)
[0110] in: Indicates the time period A centralized decision-making sequence. Centralized controller Solve Available information at that time; , as well as These represent the observable component operating status information of the electrical, thermal, and hydrogen energy subsystems, respectively. This indicates a time period. The hydrogen price trajectory on the chart; The uncertain parameters representing the forecast include the predicted electrical load trajectory. Heat load prediction trajectory And solar radiation intensity prediction trajectory ; This represents a prediction model with uncertain parameters; and These represent the historical uncertain data set and the current time slot of the prediction model with input uncertain parameters, respectively. The set of uncertain parameters observed in the system;
[0111] Furthermore, the uncertain parameter prediction model based on the decision-focused neural network established in step (2.2) consists of two modules: a prediction module and an optimization module. Specifically, the prediction module comprises an uncertain parameter prediction model based on a decomposed linear layer, and the optimization module comprises an optimization problem-solving model based on a differentiable convex optimization layer. Further, the uncertain parameter prediction model based on the decomposed linear layer specifically includes: a sequence decomposition unit, used to decompose the input uncertain parameter time-series data into trend components and seasonal components, extract the trend through moving average, and use the remaining residual as the seasonal component; a trend linear mapping layer, which uses a fully connected linear layer to directly predict the future multiple steps of the decomposed trend component; a seasonal linear mapping layer, which uses a fully connected linear layer to directly predict the future multiple steps of the seasonal component; and a synthesis unit, which adds the trend prediction values and seasonal prediction values output by the trend linear mapping layer and the seasonal linear mapping layer point by point to generate the final predicted value of the uncertain parameter. The optimization problem-solving model based on a differentiable convex optimization layer specifically includes: a parameterized optimization problem construction unit, which receives the predicted value of uncertain parameters output by the prediction module and uses the predicted value as the problem parameter to automatically construct a convex optimization problem with the future control sequence as the decision variable, the total operating cost in the finite time domain as the objective function, and the constraint condition of a cyber-physical hydrogen-containing building energy system; and a differentiable convex optimization layer solution unit, which calls embedded convex optimization methods such as the simplex method to solve the parameterized optimization problem in the forward propagation and automatically calculates the gradient of the solution result relative to the predicted value of uncertain parameters using the implicit function theorem in the back propagation.
[0112] Furthermore, the training of the uncertain parameter prediction model based on the decision-focusing neural network established in step (2.2) mainly includes the following steps: First, let the training set of the uncertain parameter prediction model be... The maximum number of training segments is The training segment index is Secondly, let the initial training segment index be... The training will then proceed in the following loop.
[0113] 1) Random selection middle The training set samples are grouped, and the number of samples in each group is set to be [number]. This constitutes a training batch;
[0114] 2) The training samples in each training batch are input into the prediction module of the decision-focusing neural network. Each training sample contains a pre-defined set of training samples. and The prediction module decomposes the time-series data of the input training samples into trend and seasonal components based on a linear decomposition layer. These components are then modeled and predicted using a single-layer linear network, outputting predicted values for uncertain parameters. The predicted trajectories include electrical load, heat load, and solar irradiance.
[0115] 3) and Common input optimization module. The optimization module is based on the input. and The operational constraints and objective function of the cyber-physical hydrogen-containing building energy system are integrated into a differentiable convex optimization layer, and a linear programming problem is established and solved. To obtain the optimal decision variables and corresponding prediction running costs for the currently predicted uncertain parameters, where: linear programming problem The specific expression is as follows:
[0116] (65)
[0117] (66)
[0118] (67)
[0119] (68)
[0120] in: It is the set of operating modes in which the original Boolean indicator variable is relaxed; for each , This represents the corresponding decision variables that were originally constrained by Boolean indicator variables (i.e. , , , , and ); Indicates the upper bound corresponding to each decision; real variables and A real number variable that replaces the original Boolean indicator variable.
[0121] 4) Compare the predicted running cost obtained in 3) with the actual running cost of the corresponding samples in the training set. Comparisons were made, and a loss function was designed based on decision regret values. And calculate the loss value for the current training batch. The loss function based on decision regret is designed... Specifically defined as:
[0122] (69)
[0123] in: This refers to the sample index in the current training batch;
[0124] 5) Based on the loss value calculated in 4), calculate the loss function using the chain rule. gradient of the prediction module Its expression is:
[0125] (70)
[0126] in: The loss function is obtained directly from equation (69). Gradient of operating costs; The gradient of operating cost with respect to decision variables; It is represented as the gradient automatically given by the implicit differential of the differentiable convex optimization layer through the relaxation of the Caro-Kuhn-Tucker condition;
[0127] 6) The gradient calculated in 5) The network parameters of the prediction module are updated using the backpropagation algorithm;
[0128] 7) Determine if the current number of training segments meets the training termination condition. If If so, then jump to 1) to continue training; if If the training fails, the current prediction module network parameters are saved, and the trained decision-focusing neural network model is obtained.
[0129] Furthermore, the distributed online operation optimization method based on the alternating direction multiplier method proposed in step 3 for the denial-of-service network attack phase addresses the operation optimization problem of cyber-physical hydrogen-containing building energy systems. The problem is decomposed into local optimization problems of electrical, thermal, and hydrogen subsystems. Coupled decision variables between subsystems are designed, and the local decisions of each subsystem are solved by iterative updating of the alternating direction multiplier method, so as to realize the distributed collaborative operation of electrical, thermal, and hydrogen subsystems under denial-of-service attacks.
[0130] Furthermore, the local optimization problem of the electrical, thermal, and hydrogen subsystems is mainly modeled as follows. First, the local operation optimization problem of the electrical subsystem is:
[0131] (71)
[0132] (72)
[0133] (73)
[0134] (74)
[0135] (75)
[0136] in: The operating cost of the electrical subsystem; It is the set of decision variables. This indicates that the electrical energy subsystem transfers electrical power to the thermal energy subsystem. This represents the interaction power between the electrical energy subsystem and the hydrogen energy subsystem. Specifically, This indicates that the photovoltaic panels supply power to the electrolyzer to produce hydrogen. This indicates that the fuel cell supplies power to the electrical load. and These represent the current time slots. Power Subsystem Router The observable local state information set and the available state information set of other energy subsystems.
[0137] Secondly, the local operation optimization problem of the thermal subsystem is as follows:
[0138] (76)
[0139] (77)
[0140] (78)
[0141] (79)
[0142] (80)
[0143] (81)
[0144] (82)
[0145] in: For the operating cost of the thermal energy subsystem, It is the set of decision variables. and These represent the current time slots. The thermal energy subsystem obtains electrical power from the electrical energy subsystem and the hydrogen energy subsystem. Indicates the current time slot The thermal energy transferred from the hydrogen energy subsystem to the thermal energy subsystem. and These represent the current time slots. Thermal subsystem router The observable local state information set and the available state information set of other energy subsystems.
[0146] Furthermore, the local operation optimization problem of the hydrogen energy subsystem is as follows:
[0147] (83)
[0148] (84)
[0149] (85)
[0150] (86)
[0151] (87)
[0152] (88)
[0153] in: For the operating cost of the hydrogen energy subsystem, It is the set of decision variables. Indicates the current time slot The interaction power between the hydrogen energy subsystem and the electrical energy subsystem. Specifically, This indicates that the fuel cell supplies power to the electrical load, while This indicates that the photovoltaic panel supplies power to the electrolytic cell. and These represent the current time slots. The electrical power and thermal energy supplied by the hydrogen energy subsystem to the thermal energy subsystem. , These represent the current time slots. Hydrogen Energy Subsystem Router The observable local state information set and the available state information set of other energy subsystems.
[0154] Finally, the constraints on the coupled decision variables in the local optimization problem of the electric, thermal, and hydrogen energy subsystems are as follows:
[0155] (89)
[0156] (90)
[0157] (91)
[0158] (92)
[0159] Furthermore, the distributed online operation optimization method based on the alternating direction multiplier method first introduces Lagrange multipliers. By constructing an augmented Lagrange function, the local operation optimization problems of the electricity, heat, and hydrogen subsystems are remodeled into mutually coupled collaborative optimization subproblems. Specifically, the reconstructed collaborative optimization subproblem of the electricity subsystem is as follows:
[0160] (93)
[0161] (94)
[0162] in: and These represent the Lagrange multipliers that couple the electrical energy subsystem with the thermal energy subsystem and the hydrogen energy subsystem, respectively. and These represent the penalty factors for coupling the electrical subsystem with the thermal subsystem and the hydrogen subsystem, respectively.
[0163] The reconstructed thermal energy subsystem cooperative optimization subproblem is as follows:
[0164] (95)
[0165] (96)
[0166] in: and These represent the Lagrange multipliers that represent the electrical and thermal energy coupling of the thermal energy subsystem and the hydrogen energy subsystem, respectively. and These represent the penalty factors for the electrical and thermal coupling of the thermal energy subsystem and the hydrogen energy subsystem, respectively.
[0167] The reconstructed hydrogen energy subsystem collaborative optimization subproblem is as follows:
[0168] (97)
[0169] (98)
[0170] Furthermore, the iterative update steps based on the alternating direction multiplier method are as follows: First, let the maximum number of steps in the iterative update be... Secondly, let the current iteration index be... This will enter the following loop:
[0171] 1) Each router Initialize the coupled decision variables of its corresponding energy subsystem, i.e.: initialization and ; initialization , and ; initialization , and And initialize the Lagrange dual parameters. and selection of penalty factor parameters ,in: ;
[0172] 2) Each router Swap the initial coupled decision variables, i.e.: Will and Send to respectively and ; Will Send to general and Send to ; Will Send to general and Send to ;
[0173] 3) Routers corresponding to the power subsystem Based on the received coupled decision variables , and its own coupled decision variables and To augment the Lagrange function To optimize the objective and solve the problem using convex optimization methods such as the simplex method. ,get and And sent to and .
[0174] 4) Router corresponding to the thermal energy subsystem Based on the received coupled decision variables , , and its own coupled decision variables , and To augment the Lagrange function To optimize the objective and solve the problem using non-convex optimization methods such as Benders decomposition. ,get , as well as And sent to and ;
[0175] 5) Router corresponding to the hydrogen energy subsystem Based on the received coupled decision variables , as well as and its own coupled decision variables , and To augment the Lagrange function To optimize the objective and solve the subproblems using non-convex optimization methods such as Benders decomposition. ,get , as well as And sent to and ;
[0176] 6) Each router The Lagrange multipliers are updated based on the following update formulas:
[0177] (99)
[0178] (100)
[0179] (101)
[0180] (102)
[0181] 7) Hydrogen Energy Subsystem Router Calculate the original residuals and dual residuals ,Right now:
[0182] (103)
[0183] (104)
[0184] 8) Hydrogen Energy Subsystem Router Determine the current original residual and dual residuals Does it meet the convergence condition, that is: if and Then convergence is achieved. Towards and Send a convergence signal. Each router distributes its final decision variables to its physical subsystem, at which point the iteration process of the time slot ends; otherwise, Proceed to the next judgment condition;
[0185] 9) If , Towards and Send a termination signal. Each router distributes its current decision variables to its subsystems, at which point the slot iteration update process ends; otherwise, Towards and Send a signal to continue iteration, making And jump to step 1).
[0186] Beneficial Effects: A two-stage online operation optimization method for cyber-physical hydrogen-containing building energy systems. This invention combines model predictive control assisted by decision-focusing neural networks with the alternating direction multiplier method. By employing a centralized strategy during normal operation and switching to a distributed strategy during denial-of-service attacks, it effectively resists performance degradation caused by attacks, achieving efficient and economical operation of the cyber-physical hydrogen-containing building energy system. Compared with existing research, this invention's method mainly achieves the following three beneficial effects:
[0187] (1) Compared with existing model-based methods, the centralized online operation optimization method based on decision-focusing neural network-assisted model predictive control provided by the present invention constructs an uncertain parameter prediction model with the goal of minimizing decision regret. Compared with existing traditional prediction models with prediction accuracy as the training goal, it can make prediction directly oriented towards optimization decision, thereby obtaining higher decision quality and effectively reducing operating costs.
[0188] (2) Compared with existing learning-based methods, the decision-focused neural network prediction model in the method proposed in this invention only needs to be trained offline using historical data, which overcomes the shortcomings of existing learning methods that rely on a large amount of environmental interaction data, and reduces training costs and actual deployment difficulties.
[0189] (3) Compared with existing research on the operation optimization of hydrogen-containing multi-energy systems, the two-stage online operation optimization method proposed in this invention can effectively resist the performance degradation caused by denial-of-service attacks by switching between a centralized strategy during normal operation and a distributed strategy when subjected to denial-of-service attacks, ensuring that the cyber-physical hydrogen-containing building energy system can achieve efficient and economical operation under various working conditions. Attached Figure Description
[0190] Figure 1 This is a flowchart of a two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system proposed in this invention.
[0191] Figure 2 This is a comparison chart of the operating costs of the present invention and the comparative scheme without considering denial-of-service attacks.
[0192] Figure 3 This is a comparison chart of the operating costs of the present invention and the comparative scheme under the consideration of denial-of-service attack events.
[0193] Figure 4 This is a detailed diagram of hydrogen purchase under the assumption of a denial-of-service attack, comparing the present invention and the comparative scheme.
[0194] Figure 5 This is a detailed diagram of the load shedding of the present invention and the comparative scheme under the consideration of denial-of-service attack events. Detailed Implementation
[0195] The present invention will now be described in further detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for illustrating the technical solutions of the present invention more clearly, and should not be construed as limiting the scope of protection of the present invention.
[0196] Example:
[0197] This paper analyzes an embodiment of a hydrogen-containing building energy system in cyber-physical systems, implemented using a PyCharm and Matlab co-simulation platform. Specifically, the PyCharm platform constructs the uncertain parameter prediction model of the proposed decision-focusing neural network and performs offline training using historical operating data. The Matlab platform reads the predicted values output by the PyCharm platform online, using them as input to the model's predictive control strategy during normal operation, and outputs centralized decision commands. Furthermore, upon detecting a denial-of-service attack, it autonomously switches to a distributed operation strategy based on the alternating direction multiplier method, depending on the availability of the backbone communication link. This achieves the complete deployment and simulation verification of the proposed two-stage online operation optimization method.
[0198] like Figure 1 As shown, the specific implementation process of this embodiment is as follows:
[0199] First, an operational optimization problem for a cyber-physical hydrogen-containing building energy system is established, considering a denial-of-service (DoS) attack. The operational process is divided into a normal operation phase and a DoS attack phase based on the DoS attack state. The established operational optimization problem aims to minimize the system operating cost under a DoS attack, comprehensively considering the operational constraints of the physical layer's electrical, thermal, and hydrogen energy subsystems, control and information layer communication constraints, DoS attack constraints, and actual execution decision constraints under the attack event.
[0200] Secondly, for the normal operation phase, a centralized online operation optimization method based on decision-focused neural network-assisted model predictive control is proposed. This method first constructs an uncertain parameter prediction model based on a decision-focused neural network, which consists of a prediction module based on a decomposed linear layer and an optimization module based on a differentiable convex optimization layer. During the training phase, the prediction module performs multi-step predictions of electrical load, thermal load, and solar radiation intensity based on historical data; the optimization module constructs a convex optimization problem using the predicted values as parameters, solves the optimal decision in forward propagation, and calculates the gradient towards decision regret using the implicit function theorem in backpropagation, thereby updating the network parameters of the decomposed linear layer in the prediction module. After training, the decision-focused neural network is deployed in the model predictive control framework. In each normal operation time slot, the model predictive control framework calls this network to perform multi-step predictions and solves the finite-time rolling optimization problem using mixed-integer linear programming methods such as Benders decomposition, issuing and executing the centralized control command for the current time slot.
[0201] Furthermore, for the denial-of-service (DoS) attack phase, a distributed online operational optimization method based on the alternating direction multiplier method is proposed. This method first decomposes the operational optimization problem into local optimization problems for three subsystems: electricity, heat, and hydrogen, defining the decision variables and objective functions within each subsystem. Second, it designs the coupling decision variables between subsystems, including electricity-heat interaction power, electricity-hydrogen interaction power, and hydrogen-heat interaction power, and establishes consistency constraint equations. Then, it introduces Lagrange multipliers to construct augmented Lagrange functions, reconstructing each local optimization problem into a collaborative optimization subproblem. Finally, iterative updates using the alternating direction multiplier method are performed. Each router sequentially solves its local collaborative subproblem, exchanges coupling variables, updates the Lagrange multipliers, calculates the original residuals and dual residuals to determine convergence, and continues until convergence or the maximum number of iterations is reached, at which point the local decision is issued.
[0202] Finally, the proposed two-stage online operation optimization method was deployed in a cyber-physical hydrogen-containing building energy system, autonomously switching based on the denial-of-service (DoS) attack status. At the beginning of each time slot, the centralized controller determines the system's communication availability based on the status feedback of each backbone link: if all backbone links are available, the centralized policy output in step 2 is triggered and distributed; if any backbone link is unavailable, the distributed policy output in step 3 is triggered and distributed. Each subsystem receives and executes the corresponding decision, updates the system status, and enters the next time slot, realizing the autonomous switching and online optimization of the two-stage policy based on the DoS attack event.
[0203] To verify the effectiveness of the method of this invention in optimizing the online operation of cyber-physical hydrogen-containing building energy systems under denial-of-service network attacks, seven comparative schemes were introduced. Each comparative scheme was compared under the same cyber-physical hydrogen-containing building energy system structure, the same operational constraints, the same load and renewable energy output data, and the same performance indicators. The performance indicators were the average total operating cost under multiple random seed conditions (i.e., seeds of 42, 123, 456, 789, and 101112).
[0204] In contrast, Option 1 adopts a rule-based centralized online operation strategy, which determines control decisions sequentially based on the relationship between renewable energy output and multi-energy loads.
[0205] In contrast, Scheme 2 employs a centralized online operation strategy using a greedy algorithm, which determines control decisions solely based on the current time slot state information by calling non-convex optimization methods such as Benders decomposition.
[0206] In contrast, Scheme 3 employs a centralized online execution strategy using the particle swarm optimization algorithm, solving the optimization problem in each time slot to determine control decisions.
[0207] In contrast, Scheme 4 adopts an online operation strategy based on a near-end policy optimization algorithm. To meet energy balance constraints and decision-making feasibility, this scheme deploys a rule-based component sequence decision-making mechanism and uses historical data and environmental interaction for training before generating centralized control decisions online.
[0208] In contrast, Scheme 5 adopts a centralized operation strategy of model predictive control based on the prediction of uncertain parameters assisted by the decomposition of linear layers.
[0209] Compared with Scheme 6, which uses the proposed decision-focused neural network-assisted model predictive control algorithm to output a centralized online operation optimization strategy during the normal operation phase, the rule-based method outputs a distributed online operation strategy during the denial-of-service attack phase.
[0210] In contrast, Scheme 7 employs an alternating direction multiplier method to output a distributed online operation strategy during both the normal operation phase and the denial-of-service attack phase.
[0211] like Figure 2 The figure shown is a comparison of the operating costs of the method of the present invention with comparative schemes 1, 2, 3, 4, and 5, without considering denial-of-service attacks. From... Figure 2As can be seen, the method of the present invention achieves the lowest average total operating cost without considering denial-of-service attacks. Specifically, compared with comparative schemes 1, 2, 3, 4, and 5, the average total operating cost of the method of the present invention is reduced by 62.04%, 11.12%, 14.18%, 4.28%, and 3.21%, respectively. These results demonstrate that the method of the present invention efficiently predicts uncertain parameters based on a decision-focused neural network and uses a rolling optimization framework for solving the problem, thereby achieving better economic efficiency under the condition of no denial-of-service attacks.
[0212] like Figure 3 The figure shown is a comparison of the operating costs of the method of the present invention with comparative schemes six and seven, considering a denial-of-service attack. From... Figure 3 As can be seen, the method of the present invention achieves the lowest average total operating cost under the consideration of denial-of-service attacks. Specifically, compared with comparative schemes six and seven, the average total operating cost of the method of the present invention is reduced by 16.18% and 9.31%, respectively. This economic advantage stems from two factors: the more flexible hydrogen procurement strategy and the lower multi-energy load reduction of the method of the present invention under denial-of-service attacks, as described above. Figure 4 and Figure 5 As shown. Figure 4 These are detailed diagrams illustrating the hydrogen purchase process under a denial-of-service attack, comparing the method of this invention with comparative schemes six and seven. Figure 4 As can be seen, the method of the present invention purchases and stores hydrogen when the price of hydrogen is low for use during periods of high price. In contrast, comparative schemes six and seven make short-sighted decisions based only on the current time slot, thus lacking the flexibility to purchase hydrogen and resulting in higher hydrogen purchase costs. Figure 5 These are detailed diagrams illustrating the load shedding of the method of this invention and comparative schemes six and seven under a denial-of-service attack. From... Figure 5 As can be seen, under denial-of-service attacks, the method of this invention maintains a lower reduction level compared to comparative scheme six; under normal circumstances, it is also superior to comparative scheme seven. By deploying a centralized strategy under normal circumstances and switching to a distributed strategy during denial-of-service network attacks, the method of this invention combines the advantages of both strategies, ensuring both economic efficiency during normal operation and robustness against denial-of-service network attacks, thereby consistently achieving lower multi-energy load shedding and lower average total operating cost.
[0213] comprehensive Figures 2 to 5 The comparison results show that the method of the present invention outperforms the comparative scheme in both the absence of denial-of-service attacks and the consideration of denial-of-service attacks, achieving the lowest average total operating cost. This demonstrates that the method of the present invention can effectively resist performance degradation caused by denial-of-service attacks and can achieve efficient and economical operation of cyber-physical hydrogen-containing building energy systems.
[0214] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any other way. Any modifications or equivalent changes made based on the technical essence of the present invention shall still fall within the scope of protection claimed by the present invention.
Claims
1. A two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system, characterized in that, Includes the following steps: Step 1: Establish an operational optimization problem for a cyber-physical hydrogen-containing building energy system under a denial-of-service (DoS) attack, and divide the operation process into a normal operation phase and a DoS attack phase based on the DoS attack status. Step 2: For the normal operation phase, a centralized online operation optimization method based on decision-focusing neural network-assisted model predictive control is proposed; Step 3: For the denial-of-service network attack phase, a distributed online operation optimization method based on the alternating direction multiplier method is proposed; Step 4: Deploy the proposed two-stage online operation optimization method to the actual system and switch autonomously according to the denial-of-service network attack status.
2. The two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system according to claim 1, characterized in that, The problem established in step 1 regarding the operational optimization of cyber-physical hydrogen-containing building energy systems under denial-of-service network attacks is described. This includes constraints, decision variables, and the objective function; First, the constraints include the physical layer model, the control and information layer model, the denial-of-service network attack model, the operating cost model, and the execution decision model; Specifically, the physical layer model includes an electrical energy subsystem model, a hydrogen energy subsystem model, a thermal energy subsystem model, and an energy balance model; The electrical energy subsystem model is as follows: (1) (2) in: and They represent Maximum power generation and actual utilization power of time-slot photovoltaic panels; , and These represent the power generation efficiency, solar radiation area, and [other parameters] of the photovoltaic panel, respectively. Time-slot illumination intensity; The hydrogen energy subsystem model is as follows: (3) (4) (5) (6) (7) (8) (9) (10) (11) in: express Hydrogen storage capacity of the time-slot hydrogen storage tank; , and They represent The amount of hydrogen produced by the time-slot electrolyzer, the amount of hydrogen purchased from the hydrogen market, and the amount of hydrogen consumed by the fuel cell; and They represent Input power of the time-slot electrolyzer and output power of the fuel cell; Indicates the time slot length; and These represent the operating efficiency of the electrolyzer and the electro-hydrogen conversion efficiency of the fuel cell, respectively. This indicates the maximum storage capacity of the hydrogen storage tank; express The maximum amount of hydrogen that a time slot can purchase from the hydrogen market; and These represent the maximum input power of the electrolyzer and the maximum output power of the fuel cell, respectively. and These are two Boolean variables, representing the electrolyzer and fuel cell, respectively. A flag indicating whether a time slot is in operation; express The heat generation of time-slot fuel cells; and These represent the heat recovery efficiency and electrothermal conversion efficiency of the fuel cell, respectively. The thermal subsystem model is as follows: (12) (13) (14) (15) (16) (17) (18) (19) (20) (21) (22) (23) (24) (25) (26) (27) in: and They represent The maximum heat generation and actual heat energy utilization of time-slot photovoltaic collectors; and These represent the heat generation efficiency and solar radiation area of the photovoltaic collector, respectively. express The heat storage capacity of time-slot geothermal wells; and They represent The heat generation of time-slot ground source heat pumps and the excess waste heat of fuel cells; This indicates the heat production efficiency of a ground source heat pump; This indicates the maximum heat storage capacity of a geothermal well. express Input power of time-slot ground source heat pump; This indicates the maximum input power of the ground source heat pump; This indicates the maximum heat output of the fuel cell; and These are two Boolean variables, representing the indicators of ground source heat pump operation and fuel cell heat rejection, respectively. express The heat output of a time-slot electric boiler; , and They represent Input power, heat production efficiency, and maximum input power of the time-slot electric boiler; express Thermal energy storage capacity of time-slot thermal storage tanks; and They represent The heat charging power and heat dissipation power of the time-slot thermal storage tank; and These represent the heat charging efficiency and heat release efficiency of the thermal storage tank, respectively. and These represent the maximum heat charging power and the maximum heat dissipation power of the thermal storage tank, respectively. and These are two Boolean variables, representing the operating flags of the thermal storage tank during heat charging and heat release, respectively. The energy balance model is as follows: (28) (29) (30) (31) in: and They represent Time-slot electrical load and thermal load; and They represent Time-slot electrical load reduction and thermal load reduction; The control and information layer model is as follows: (32) (33) (34) (35) in: This represents the centralized controller in the control layer; This refers to the routers corresponding to the electrical, hydrogen, and thermal energy subsystems in the information layer. Routers corresponding to the electric, thermal, and hydrogen energy subsystems The index; Indicates that it is controlled by a centralized controller. Router connecting various subsystems The set of backbone communication links; Represents the set of all links in a cyber-physical hydrogen-containing building energy system; This represents the set of communication links between all routers, as well as between routers and switches. This is a Boolean variable representing the current time. backbone communication link Is it under denial-of-service cyberattack? This is a Boolean variable representing the current time. link The communication status; Indicates the current time slot A set of communication links that are functioning normally; The denial-of-service network attack model is as follows: (36) (37) (38) (39) (40) (41) in: Indicates the first The set of characteristics of a denial-of-service attack; An index representing denial-of-service attack events; and They represent the first The start time slot and duration of each denial-of-service attack event; Indicates the first The set of backbone links that were interrupted during the denial-of-service attack; This represents a set of denial-of-service attack events; This indicates the total number of time slots in the system operation. and Representing links respectively Total attack duration and total number of attack events; Represents all runtime slots A set; and These represent positive integers that limit the attack strength and frequency, respectively. Indicates the strength coefficient; The operating cost model is as follows: (42) (43) (44) (45) (46) in: express Operating costs of time-slotted information physical hydrogen-containing building energy systems; , , as well as These represent equipment operating costs, hydrogen purchase costs, renewable energy reduction costs, and load shedding costs, respectively. , , , , , as well as These represent the unit operating cost coefficients for photovoltaic panels, photovoltaic collectors, electrolyzers, fuel cells, thermal storage tanks, ground source heat pumps, and electric boilers, respectively. express Time-slot hydrogen price; and These represent the unit cost coefficients for renewable energy reduction; and These represent the unit cost coefficients for electrical load and heat load reduction, respectively. The actual decision-making model is as follows: (47) (48) (49) (50) (51) (52) (53) (54) (55) (56) (57) (58) in: and These represent the backbone links. Availability metrics for status feedback uplink and control command downlink; Represents the actual physical layer energy subsystem The component's running status; Indicates when the control layer centralized controller is under denial-of-service attack For energy subsystems The estimated or most recently observed state; Indicates the centralized controller of the control layer. Physical layer energy subsystems that can be actually observed The component's running status; Central controller The set of information that can be actually observed; Indicates centralized controller Uncertain parameter prediction information; This is a centralized controller operation strategy; For router The set of locally observable information; express The operational status of other energy subsystems that can be actually observed; Indicates router Local operation strategy; Represents energy subsystem Local decision-making; Indicates a centralized operation indicator variable; and These represent the centralized operation strategy and the local operation strategy set for the electric, thermal, and hydrogen energy subsystems, respectively. This represents the set of actual execution strategies for the electric, thermal, and hydrogen energy subsystems. The decision variables are the energy subsystems at the physical layer. The set of decisions actually implemented Among them, the actual execution decision of the power subsystem includes the actual power utilized by the photovoltaic panels. and power reduction of electrical load The actual execution decisions of the thermal energy subsystem include the actual utilization of thermal energy by the photovoltaic collector. Ground source heat pump input power Electric boiler input power Excess waste heat from fuel cells Thermal storage tank charging power Heat storage tank heat release power Heat load reduction value Thermal storage tank charging indicator Heat storage tank heat release indicator Ground source heat pump operation indicator and fuel cell excess waste heat emission label The actual implementation decisions of the hydrogen energy subsystem include the amount of hydrogen purchased from the hydrogen market. Electrolytic cell input power Fuel cell output power Electrolytic cell operation indicator and fuel cell operation indicator ; The objective function is as follows: (59) in: Indicates the action on an uncertain parameter and random communication failure links caused by denial-of-service attacks The expectation operator.
3. The two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system according to claim 1, characterized in that, The centralized online operation optimization method based on decision-focused neural network-assisted model predictive control proposed in step 2 for the normal operation phase includes the following three steps. (3.1) First, under the model predictive control solution framework, a finite-time rolling optimization operation cost minimization problem is established, considering the prediction of electrical load, heat load, and light intensity. ; (3.2) Secondly, an uncertain parameter prediction model based on a decision-focusing neural network is proposed, and it is trained offline using historical data; (3.3) Finally, the trained prediction model is deployed in the model predictive control solver of the control layer for solving during normal operation. This enables the centralized output and distribution of strategies.
4. The two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system according to claim 3, characterized in that, The problem of minimizing the running cost of finite-time rolling optimization under the model predictive control framework, considering the prediction of uncertain parameters, established in step (3.1) is as follows: (60) (61) (62) (63) in: Indicates the time period Centralized decision-making sequence; Indicates centralized controller Solve The set of available information at that time; , as well as These represent the observable component operating status information of the electrical, thermal, and hydrogen energy subsystems, respectively. This indicates a time period. The hydrogen price trajectory on the chart; The uncertain parameters representing the forecast include the predicted electrical load trajectory. Heat load prediction trajectory And solar radiation intensity prediction trajectory ; This represents a prediction model with uncertain parameters; and These represent the historical uncertain data set and the current time slot of the prediction model with input uncertain parameters, respectively. The set of uncertain parameters observed in the system.
5. The two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system according to claim 3, characterized in that, The uncertain parameter prediction model based on a decision-focused neural network established in step (3.2) consists of two modules: a prediction module and an optimization module. The prediction module comprises an uncertain parameter prediction model based on a decomposed linear layer, and the optimization module comprises an optimization problem-solving model based on a differentiable convex optimization layer. Further, the uncertain parameter prediction model based on a decomposed linear layer specifically includes: a sequence decomposition unit, used to decompose the input uncertain parameter time-series data into trend and seasonal components, extract the trend through moving average, and use the remaining residual as the seasonal component; a trend linear mapping layer, which uses a fully connected linear layer to directly predict the future multi-step trend components; a seasonal linear mapping layer, which uses a fully connected linear layer to directly predict the future multi-step seasonal components; and a synthesis unit. The trend prediction values and seasonal prediction values output by the trend linear mapping layer and the seasonal linear mapping layer are added point by point to generate the final predicted value of the uncertain parameters. The optimization problem solving model based on the differentiable convex optimization layer specifically includes: a parameterized optimization problem construction unit, which receives the uncertain parameter prediction value output by the prediction module and uses the prediction value as the problem parameter to automatically construct a convex optimization problem with the future control sequence as the decision variable, the minimization of the total operating cost in the finite time domain as the objective function, and the constraint condition of the cyber-physical hydrogen-containing building energy system; and a differentiable convex optimization layer solving unit, which calls the embedded simplex method to solve the parameterized optimization problem in the forward propagation and automatically calculates the gradient of the solution result relative to the uncertain parameter prediction value using the implicit function theorem in the backpropagation.
6. The two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system according to claim 3, characterized in that, The training of the uncertain parameter prediction model based on the decision-focusing neural network established in step (3.2) includes the following steps: First, let the training set of the uncertain parameter prediction model be... The maximum number of training segments is The training segment index is Secondly, let the initial training segment index be... The training will then proceed in the following loop. (6.1) Random sampling middle The training set samples are grouped, and the number of samples in each group is set to be [number]. This constitutes a training batch; (6.2) The training samples in each training batch are input into the prediction module of the decision-focusing neural network. Each training sample contains a preset... and The prediction module decomposes the time series data of the input training samples into trend and seasonal components based on a linear decomposition layer, and then models and predicts them separately through a single-layer linear network, outputting predicted values of uncertain parameters. The predicted trajectories include electrical load, heat load, and solar irradiance. (6.3) will and Common input optimization module; the optimization module is based on input. and The operational constraints and objective function of the cyber-physical hydrogen-containing building energy system are integrated into a differentiable convex optimization layer, and a linear programming problem is established and solved. To obtain the optimal decision variables and corresponding total operating costs based on the current uncertain parameter predictions, where: linear programming problem The specific expression is as follows: (64) (65) (66) (67) in: It is the set of operating modes in which the original Boolean indicator variable is relaxed; for each , This represents the corresponding decision variable that was originally constrained by the Boolean indicator variable, i.e. , , , , and ; This indicates that each decision corresponds to an upper bound; positive real variable. and A real number variable to replace the original Boolean indicator variable; (6.4) Compare the predicted running cost obtained in (6.3) with the actual running cost of the corresponding samples in the training set. Comparison, designing a loss function based on decision regret value. Loss function designed based on decision regret value The specific expression is as follows: (68) in: This refers to the sample index in the current training batch; (6.5) Based on the loss value calculated in (6.4), the loss function is calculated using the chain rule. gradient of the prediction module Its expression is: (69) in: The loss function is obtained directly from equation (68). Gradient of operating costs; The gradient of operating cost with respect to decision variables; It is represented as the gradient automatically given by the implicit differential of the differentiable convex optimization layer through the relaxation of the Caro-Kuhn-Tucker condition; (6.6) Based on the gradient calculated in (6.5) The network parameters of the prediction module are updated using the backpropagation algorithm; (6.7) Determine whether the current number of training segments meets the training termination condition; if If so, proceed to (6.1) to continue training; if If the training fails, the current prediction module network parameters are saved, and the trained decision-focusing neural network model is obtained.
7. The two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system according to claim 1, characterized in that, The distributed online operation optimization method based on the alternating direction multiplier method proposed in step 3 for the denial-of-service network attack phase addresses the operation optimization problem of cyber-physical hydrogen-containing building energy systems. The problem is decomposed into local optimization problems of electrical, thermal, and hydrogen subsystems. Coupled decision variables between subsystems are designed, and the local decisions of each subsystem are solved by iterative updating of the alternating direction multiplier method, so as to realize the distributed collaborative operation of electrical, thermal, and hydrogen subsystems under denial-of-service attacks.
8. The two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system according to claim 7, characterized in that, The local optimization problem of the electrical, thermal, and hydrogen subsystems is modeled as follows; firstly, the local operation optimization problem of the electrical subsystem is... (70) (71) (72) (73) (74) in: The operating cost of the electrical subsystem; Its set of decision variables; This indicates that the electrical energy subsystem transfers electrical power to the thermal energy subsystem. This represents the interaction power between the electrical energy subsystem and the hydrogen energy subsystem; specifically, This indicates that the photovoltaic panels supply power to the electrolyzer to produce hydrogen. This indicates that the fuel cell supplies power to the electrical load; and These represent the current time slots. Power subsystem corresponding router The observable set of local state information and the limited set of state information of other energy subsystems that are available; Secondly, the local operation optimization problem of the thermal subsystem is... (75) (76) (77) (78) (79) (80) (81) in: For the operating cost of the thermal energy subsystem, Its set of decision variables; and These represent the current time slots. The electrical power obtained by the thermal energy subsystem from the electrical energy subsystem and the hydrogen energy subsystem; Indicates the current time slot The thermal energy transferred from the hydrogen energy subsystem to the thermal energy subsystem; and These represent the current time slots. Thermal subsystem router The observable set of local state information and the limited set of state information of other energy subsystems that are available; Furthermore, the local operation optimization problem of the hydrogen energy subsystem is... (82) (83) (84) (85) (86) (87) in: For the operating cost of the hydrogen energy subsystem, Its set of decision variables; Indicates the current time slot The interaction power between the hydrogen energy subsystem and the electrical energy subsystem; specifically... This indicates that the fuel cell supplies power to the electrical load, while This indicates that the photovoltaic panels supply power to the electrolytic cell; and These represent the current time slots. The electrical power and thermal energy supplied by the hydrogen energy subsystem to the thermal energy subsystem; and These represent the current time slots. Hydrogen Energy Subsystem Router The observable set of local state information and the available set of state information for other energy subsystems; Finally, the constraints on the coupled decision variables in the local optimization problem of the electric, thermal, and hydrogen energy subsystems are as follows: (88) (89) (90) (91)。 9. A two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system according to claim 8, characterized in that, The distributed online operation optimization method based on the alternating direction multiplier method first introduces Lagrange multipliers. By constructing an augmented Lagrange function, the local operation optimization problems of the electricity, heat, and hydrogen subsystems are remodeled into mutually coupled collaborative optimization subproblems. Specifically, the reconstructed collaborative optimization subproblem of the electricity subsystem is as follows: (92) (93) in: and These represent the Lagrange multipliers that couple the electrical energy subsystem with the thermal energy subsystem and the hydrogen energy subsystem, respectively. and These represent the penalty factors for coupling the electrical subsystem with the thermal subsystem and the hydrogen subsystem, respectively. The reconstructed thermal energy subsystem cooperative optimization subproblem is as follows: (94) (95) in: and These represent the Lagrange multipliers that represent the electrical and thermal energy coupling of the thermal energy subsystem and the hydrogen energy subsystem, respectively. and These represent the penalty factors for the electrical and thermal coupling of the thermal energy subsystem and the hydrogen energy subsystem, respectively. The reconstructed hydrogen energy subsystem collaborative optimization subproblem is as follows: (96) (97)。 10. A two-stage online operation optimization method for a cyber-physical hydrogen-containing building energy system according to claim 7, characterized in that, The iterative update steps based on the alternating direction multiplier method are as follows: First, let the maximum number of steps in the iterative update be... Secondly, let the current iteration index be... This will enter the following loop: (10.1) Each router Initialize the coupled decision variables of its corresponding energy subsystem, i.e.: initialization and ; initialization , and ; initialization , and ; And initialize the Lagrange dual parameters. and selection of penalty factor parameters ,in: Indicates the index value of the coupled decision variable; (10.2) Each router Swap the initial coupled decision variables, i.e.: Will and Send to respectively and ; Will Send to general and Send to ; Will Send to general and Send to ; (10.3) Router corresponding to the power subsystem Based on the received coupled decision variables , and its own coupled decision variables and To augment the Lagrange function Minimize the problem as the optimization objective and solve it using convex optimization methods such as the simplex method. ,get and And sent to and ; (10.4) Router corresponding to the thermal energy subsystem Based on the received coupled decision variables , , and its own coupled decision variables , and To augment the Lagrange function Minimize the target value and solve the problem using non-convex optimization methods such as Benders decomposition. ,get , as well as And sent to and ; (10.5) Router corresponding to the hydrogen energy subsystem Based on the received coupled decision variables , as well as and its own coupled decision variables , and To augment the Lagrange function Minimize the subproblem as the optimization objective and solve the subproblem using nonconvex optimization methods such as Benders decomposition. ,get , as well as And sent to and ; (10.6) Each router The Lagrange multipliers are updated based on the following update formulas: (98) (99) (100) (101) (10.7) Hydrogen Energy Subsystem Router Calculate the original residuals and dual residual ,Right now: (102) (103) (10.8) Hydrogen Energy Subsystem Router Determine the current original residual and dual residual Does it meet the convergence condition, that is: if and Then convergence is achieved; at this point... Towards and Send a convergence signal; Each router distributes the final decision variables to its physical subsystem, at which point the iteration process of the time slot ends; otherwise, Proceed to the next judgment condition; (10.9) If , Towards and Send a termination signal; each router distributes its current decision variables to its subsystems, at which point the slot iteration update process ends; otherwise... Towards and Send a signal to continue iteration, making Then proceed to step (10.1).